Hi there
I'm currently trying to get to grips with the PDL module .. i'm wanting to calculate the determinant for a 4x4 matrix. This is the code I've managed to create so far
#!/usr/bin/perl -w
use strict;
use PDL::MatrixOps;
my $mat = pdl [
[3.4603, 1.7529, 1.6990,2.1181],
[ 2.5459,2.5615,2.2525,2.3606],
[ 2.3606, 2.2515, 2.5628,2.5459],
[ 2.1181,1.6982,1.7537,3.4603],
];
my $det = determinant($mat);
print "$det\n";
But it comes up with a syntax error
syntax error at ./test.pl line 7, near "pdl ["
Execution of ./test.pl aborted due to compilation errors.
Any help much appreciated
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.