"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "Basic/Complex/complex.pd" between
PDL-2.074.tar.gz and PDL-2.075.tar.gz

About: PDL (Perl Data Language) aims to turn perl into an efficient numerical language for scientific computing (similar to IDL and MatLab).

complex.pd  (PDL-2.074):complex.pd  (PDL-2.075)
skipping to change at line 97 skipping to change at line 97
quickly and conveniently write complex constants like this: C<4+3*i>. quickly and conveniently write complex constants like this: C<4+3*i>.
B<NB> This will override the PDL::Core function of the same name, which B<NB> This will override the PDL::Core function of the same name, which
returns a native complex value. returns a native complex value.
=item * =item *
Use C<r2C(real-values)> to convert from real to complex, as in C<$r Use C<r2C(real-values)> to convert from real to complex, as in C<$r
= Cpow $cplx, r2C 2>. The overloaded operators automatically do that for = Cpow $cplx, r2C 2>. The overloaded operators automatically do that for
you, all the other functions, do not. So C<Croots 1, 5> will return all you, all the other functions, do not. So C<Croots 1, 5> will return all
the fifths roots of 1+1*i (due to threading). the fifths roots of 1+1*i (due to broadcasting).
=item * =item *
use C<cplx(real-valued-ndarray)> to cast from normal ndarrays into the use C<cplx(real-valued-ndarray)> to cast from normal ndarrays into the
complex datatype. Use C<real(complex-valued-ndarray)> to cast back. This complex datatype. Use C<real(complex-valued-ndarray)> to cast back. This
requires a copy, though. requires a copy, though.
=item * =item *
This module has received some testing by Vanuxem Grégory This module has received some testing by Vanuxem Grégory
skipping to change at line 1104 skipping to change at line 1104
*$op = \&$func if $op =~ /\w+/; # create an alias *$op = \&$func if $op =~ /\w+/; # create an alias
($op, eval 'sub { '.$func.' $_[0] }'); ($op, eval 'sub { '.$func.' $_[0] }');
} }
sub initialize { sub initialize {
# Bless a null PDL into the supplied 1st arg package # Bless a null PDL into the supplied 1st arg package
# If 1st arg is a ref, get the package from it # If 1st arg is a ref, get the package from it
bless PDL->null, ref($_[0]) || $_[0]; bless PDL->null, ref($_[0]) || $_[0];
} }
# so threading doesn't also assign the real value into the imaginary # so broadcasting doesn't also assign the real value into the imaginary
sub Cassgn { sub Cassgn {
my @args = !$_[2] ? @_[1,0] : @_[0,1]; my @args = !$_[2] ? @_[1,0] : @_[0,1];
$args[1] = r2C($args[1]) if ref $args[1] ne __PACKAGE__; $args[1] = r2C($args[1]) if ref $args[1] ne __PACKAGE__;
PDL::Ops::assgn(@args); PDL::Ops::assgn(@args);
$args[1]; $args[1];
} }
use overload use overload
(map _gen_biop($_), qw(++Cadd --Csub *+Cmul /-Cdiv **-Cpow atan2-Catan2 ==+Ce q .=-Cassgn)), (map _gen_biop($_), qw(++Cadd --Csub *+Cmul /-Cdiv **-Cpow atan2-Catan2 ==+Ce q .=-Cassgn)),
(map _gen_unop($_), qw(sin@Csin cos@Ccos exp@Cexp abs@Cabs log@Clog sqrt@Csqr t)), (map _gen_unop($_), qw(sin@Csin cos@Ccos exp@Cexp abs@Cabs log@Clog sqrt@Csqr t)),
 End of changes. 2 change blocks. 
2 lines changed or deleted 2 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)