SPVM::Complex_2d(3)
๐ NAME ๐
okay so bestie, this is the page for SPVM::Complex_2d โ the double Complex Type. Itโs giving โI do math and I look cute doing itโ energy. ๐งฎโจ
๐ธ USAGE ๐ธ
use Complex_2d;
my $z : Complex_2d;
# Set
$z->{re} = 1.5;
$z->{im} = 2.5;
# Get
my $re = $z->{re};
my $im = $z->{im};
๐ฆ DESCRIPTION ๐ฆ
SPVM::Complex_2d is a multi-numeric type used to represent a double complex number. periodt. ๐
For the full lore on multi-numeric types, go look at SPVM::Document::Language::Types. ๐
๐ FIELDS ๐
re ๐
has re : double;
The real-number part. literally the re girlie. ๐
im ๐ฆ
has im : double;
The imaginary-number part. no cap, itโs the im icon. โจ
โจ CLASS METHODS โจ
๐ new
static method new : Complex_2d ($re : double = 0, $im : double = 0);
Creates a new Complex_2d multi-numeric value from the real number $re and the imaginary number $im, and returns it. The defaults are 0 and 0, bestie. ๐ซถ
๐ new_array_from_pairs
static method new_array_from_pairs : Complex_2d[] ($pairs : double[]);
Creates a new Complex_2d array from $pairs โ the pairs of a real number and an imaginary number โ and returns that new array. ๐ซ
Examples of Input:
# Input Data
[1, 2, 3, 4]
# Data of a new array
[{re => 1, im => 2}, {re => 3, im => 4}]
๐ new_array_from_re_array
static method new_array_from_re_array : Complex_2d[] ($re_array : double[]);
Creates a new Complex_2d array from the real numbers in $re_array, and returns the new array. ๐
๐ new_array_from_im_array
static method new_array_from_im_array : Complex_2d[] ($im_array : double[]);
Creates a new Complex_2d array from the imaginary numbers in $im_array, and returns the new array. ๐ฆ
๐ to_re_array
static method to_re_array : double[] ($array : Complex_2d[]);
Converts the Complex_2d array $array into an array of real numbers, and returns it. ๐
๐ to_im_array
static method to_im_array : double[] ($array : Complex_2d[]);
Converts the Complex_2d array $array into an array of imaginary numbers, and returns it. โจ
๐ to_pairs
static method to_pairs : double[] ($array : Complex_2d[]);
Converts the Complex_2d array $array into pairs of a real number and an imaginary number, and returns it. ๐
Examples of Output:
# Input Data
[{re => 1, im => 2}, {re => 3, im => 4}]
# Output
[1, 2, 3, 4]
๐ to_string
static method to_string : string ($z : Complex_2d);
Converts the Complex_2d multi-numeric value into a string, such as "1+2i". slay. ๐
Implementation:
my $string = (string)undef;
if ($z->{im} < 0) {
$string = "$z->{re}$z->{im}i";
}
else {
$string = "$z->{re}+$z->{im}i";
}
๐ SEE ALSO ๐
Complex_2fSPVM::Document::Language::Types
๐ COPYRIGHT & LICENSE ๐
Copyright (c) 2023 Yuki Kimoto
MIT License
with love and zero cap ๐
, this was the SPVM::Complex_2d(3) page from perl v5.42.2, dated 2026-02-03. bye bestie! ๐ซถ
๐ฆ where this page comes from
- alpine 3.24: spvm-doc 0.990125-r0 ยท MIT
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms