PDL::Primitive 2.4.3
Sponsored Links
PDL::Primitive 2.4.3 Ranking & Summary
File size:
2.1 MB
Platform:
Any Platform
License:
Perl Artistic License
Price:
Downloads:
848
Date added:
2007-06-28
Publisher:
Tuomas J. Lukka
PDL::Primitive 2.4.3 description
PDL::Primitive Perl module contains primitive operations for pdl.
This module provides some primitive and useful functions defined using PDL::PP and able to use the new indexing tricks.
See PDL::Indexing for how to use indices creatively. For explanation of the signature format, see PDL::PP.
Inner product over one dimension
c = sum_i a_i * b_i
, BadDoc => If a() * b() contains only bad data, c() is set bad. Otherwise c() will have its bad flag cleared, as it will not contain any bad values., ); # pp_def( inner )
pp_def( outer, HandleBad => 1, Pars => a(n); b(m); [o]c(n,m);, Code => loop(n,m) %{ $c() = $a() * $b(); %}, BadCode => loop(n,m) %{ if ( $ISBAD(a()) || $ISBAD(b()) ) { $SETBAD(c()); } else { $c() = $a() * $b(); } %}, Doc => =for ref
outer product over one dimension
Naturally, it is possible to achieve the effects of outer product simply by threading over the "*" operator but this function is provided for convenience.
); # pp_def( outer )
pp_addpm(<<EOD); =head2 x
Signature: (a(i,x), b(z,i),[o]c(x,z))
Matrix multiplication
PDL overloads the x operator (normally the repeat operator) for matrix multiplication. The number of columns (size of the 0 dimension) in the left-hand argument must normally equal the number of rows (size of the 1 dimension) in the right-hand argument.
Row vectors are represented as (N x 1) two-dimensional PDLs, or you may be sloppy and use a one-dimensional PDL. Column vectors are represented as (1 x N) two-dimensional PDLs.
Threading occurs in the usual way, but as both the 0 and 1 dimension (if present) are included in the operation, you must be sure that you dont try to thread over either of those dims.
EXAMPLES:
Here are some simple ways to define vectors and matrices:
perldl> $r = pdl(1,2); # A row vector
perldl> $c = pdl([[3],[4]]); # A column vector
perldl> $c = pdl(3,4)->(*1); # A column vector, using NiceSlice
perldl> $m = pdl([[1,2],[3,4]]); # A 2x2 matrix
Now that we have a few objects prepared, here is how to matrix-multiply them:
perldl> print $r x $m # row x matrix = row
[
[ 7 10]
]
perldl> print $m x $r # matrix x row = ERROR
PDL: Dim mismatch in matmult of [2x2] x [2x1]: 2 != 1
perldl> print $m x $c # matrix x column = column
[
[ 5]
[11]
]
perldl> print $m x 2 # Trivial case: scalar mult.
[
[2 4]
[6 8]
]
perldl> print $r x $c # row x column = scalar
[
[11]
]
perldl> print $c x $r # column x row = matrix
[
[3 6]
[4 8]
]
This module provides some primitive and useful functions defined using PDL::PP and able to use the new indexing tricks.
See PDL::Indexing for how to use indices creatively. For explanation of the signature format, see PDL::PP.
Inner product over one dimension
c = sum_i a_i * b_i
, BadDoc => If a() * b() contains only bad data, c() is set bad. Otherwise c() will have its bad flag cleared, as it will not contain any bad values., ); # pp_def( inner )
pp_def( outer, HandleBad => 1, Pars => a(n); b(m); [o]c(n,m);, Code => loop(n,m) %{ $c() = $a() * $b(); %}, BadCode => loop(n,m) %{ if ( $ISBAD(a()) || $ISBAD(b()) ) { $SETBAD(c()); } else { $c() = $a() * $b(); } %}, Doc => =for ref
outer product over one dimension
Naturally, it is possible to achieve the effects of outer product simply by threading over the "*" operator but this function is provided for convenience.
); # pp_def( outer )
pp_addpm(<<EOD); =head2 x
Signature: (a(i,x), b(z,i),[o]c(x,z))
Matrix multiplication
PDL overloads the x operator (normally the repeat operator) for matrix multiplication. The number of columns (size of the 0 dimension) in the left-hand argument must normally equal the number of rows (size of the 1 dimension) in the right-hand argument.
Row vectors are represented as (N x 1) two-dimensional PDLs, or you may be sloppy and use a one-dimensional PDL. Column vectors are represented as (1 x N) two-dimensional PDLs.
Threading occurs in the usual way, but as both the 0 and 1 dimension (if present) are included in the operation, you must be sure that you dont try to thread over either of those dims.
EXAMPLES:
Here are some simple ways to define vectors and matrices:
perldl> $r = pdl(1,2); # A row vector
perldl> $c = pdl([[3],[4]]); # A column vector
perldl> $c = pdl(3,4)->(*1); # A column vector, using NiceSlice
perldl> $m = pdl([[1,2],[3,4]]); # A 2x2 matrix
Now that we have a few objects prepared, here is how to matrix-multiply them:
perldl> print $r x $m # row x matrix = row
[
[ 7 10]
]
perldl> print $m x $r # matrix x row = ERROR
PDL: Dim mismatch in matmult of [2x2] x [2x1]: 2 != 1
perldl> print $m x $c # matrix x column = column
[
[ 5]
[11]
]
perldl> print $m x 2 # Trivial case: scalar mult.
[
[2 4]
[6 8]
]
perldl> print $r x $c # row x column = scalar
[
[11]
]
perldl> print $c x $r # column x row = matrix
[
[3 6]
[4 8]
]
PDL::Primitive 2.4.3 Screenshot
PDL::Primitive 2.4.3 Keywords
PDL
Primitive Perl
Primitive 2.4.3
Perl module
X
c
PerlDL
m
column
print
PDL::Primitive
PDLPrimitive
PDL::Primitive 2.4.3
Libraries
Programming
Bookmark PDL::Primitive 2.4.3
PDL::Primitive 2.4.3 Copyright
WareSeeker periodically updates pricing and software information of PDL::Primitive 2.4.3 full version from the publisher, so some information may be slightly out-of-date. You should confirm all information before relying on it. Software piracy is theft, Using crack, password, serial numbers, registration codes, key generators is illegal and prevent future development of PDL::Primitive 2.4.3 Edition. Download links are directly from our publisher sites, torrent files or links from rapidshare.com, yousendit.com or megaupload.com are not allowed
Featured Software
Want to place your software product here?
Please contact us for consideration.
Contact WareSeeker.com
Related Information
Related Software
PDL::Impatient is a PDL for the impatient. Free Download
PDL::API is a Perl module for making piddles from Perl and C/XS code. Free Download
PDL::Tips is a Perl module with small tidbits of useful arcana. Free Download
PDL::Image2D is a Perl module that contains miscellaneous 2D image processing functions. Free Download
PDL::IO::Misc is a Perl module with misc IO routines for PDL. Free Download
PDL::IO::FITS Perl module offers a simple FITS support for PDL. Free Download
PDL::NiceSlice Perl module contains a nicer slicing syntax for PDL. Free Download
PDL::Internals is a Perl module that contains a description of some aspects of the current internals. Free Download
Latest Software
Popular Software
Favourite Software