complex.pd (PDL-2.077) | : | complex.pd (PDL-2.078) | ||
---|---|---|---|---|
skipping to change at line 26 | skipping to change at line 26 | |||
pp_addpm {At => 'Top'}, <<'EOD'; | pp_addpm {At => 'Top'}, <<'EOD'; | |||
use strict; | use strict; | |||
use warnings; | use warnings; | |||
use Carp; | use Carp; | |||
our $VERSION = '2.009'; | our $VERSION = '2.009'; | |||
use PDL::Slices; | use PDL::Slices; | |||
use PDL::Types; | use PDL::Types; | |||
use PDL::Bad; | use PDL::Bad; | |||
use vars qw($sep $sep2); | ||||
EOD | ||||
pp_addpm {At => 'Top'}, <<'EOD'; | ||||
=encoding iso-8859-1 | =encoding iso-8859-1 | |||
=head1 NAME | =head1 NAME | |||
PDL::Complex - handle complex numbers (DEPRECATED - use native complex) | PDL::Complex - handle complex numbers (DEPRECATED - use native complex) | |||
=head1 SYNOPSIS | =head1 SYNOPSIS | |||
use PDL; | use PDL; | |||
use PDL::Complex; | use PDL::Complex; | |||
skipping to change at line 105 | skipping to change at line 100 | |||
= 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 broadcasting). | 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 * | ||||
This module has received some testing by Vanuxem Grégory | ||||
(g.vanuxem at wanadoo dot fr). Please report any other errors you | ||||
come across! | ||||
=back | =back | |||
=head1 EXAMPLE WALK-THROUGH | =head1 EXAMPLE WALK-THROUGH | |||
The complex constant five is equal to C<pdl(1,0)>: | The complex constant five is equal to C<pdl(1,0)>: | |||
pdl> p $x = r2C 5 | pdl> p $x = r2C 5 | |||
5 +0i | 5 +0i | |||
Now calculate the three cubic roots of five: | Now calculate the three cubic roots of five: | |||
skipping to change at line 243 | skipping to change at line 232 | |||
Comparing complex numbers other than for equality is a fatal error. | Comparing complex numbers other than for equality is a fatal error. | |||
=cut | =cut | |||
my $i; | my $i; | |||
BEGIN { $i = bless pdl 0,1 } | BEGIN { $i = bless pdl 0,1 } | |||
{ | { | |||
no warnings 'redefine'; | no warnings 'redefine'; | |||
sub i { $i->copy + (@_ ? $_[0] : 0) }; | sub i { $i->copy + (@_ ? $_[0] : 0) }; | |||
} | } | |||
# sensible aliases from PDL::LinearAlgebra | ||||
*r2p = \&Cr2p; | ||||
*p2r = \&Cp2r; | ||||
*conj = \&Cconj; | ||||
*abs = \&Cabs; | ||||
*abs2 = \&Cabs2; | ||||
*arg = \&Carg; | ||||
*tan = \&Ctan; | ||||
*proj = \&Cproj; | ||||
*asin = \&Casin; | ||||
*acos = \&Cacos; | ||||
*atan = \&Catan; | ||||
*sinh = \&Csinh; | ||||
*cosh = \&Ccosh; | ||||
*tanh = \&Ctanh; | ||||
*asinh = \&Casinh; | ||||
*acosh = \&Cacosh; | ||||
*atanh = \&Catanh; | ||||
EOD | EOD | |||
for (qw(Ctan Catan re im i cplx real)) { | for (qw(Ctan Catan re im i cplx real)) { | |||
pp_add_exported '', $_; | pp_add_exported '', $_; | |||
} | } | |||
pp_addhdr <<'EOH'; | pp_addhdr <<'EOH'; | |||
#include <math.h> | #include <math.h> | |||
End of changes. 3 change blocks. | ||||
11 lines changed or deleted | 19 lines changed or added |