Oh wisest perl monks,
I'm trying to do some oh-so-simple matrix calculations with Math::Matrix, but the usage of the major functions (cross_product, dot_product, etc) are poorly documented on CPAN, so I'm not sure if I'm even calling them properly.
http://search.cpan.org/~ulpfr/Math-Matrix-0.5/Matrix.pm
Most other functions work, such as print, transpose, etc, but none of the more useful algorithms return anything.
Does anyone have any experience with this? Am I even asking in the right forum?
Here's what I've tried so far:
#! /usr/bin/perl
use Math::Matrix;
$a = new Math::Matrix ([1], [2], [3]);
$x = new Math::Matrix ([4], [5], [6]);
$a->print("A\n");
$x->print("X\n");
$f = $a->cross_product( $x );
print "output of a->cross_product( x ) is: '$f'\n\n";
if( defined( $f ) ) { $f->print( "Cross product is \n" ) };
$f = $a->cross_product( $a, $x );
print "output of a->cross_product( a, x ) is: '$f'\n\n";
if( defined( $f ) ) { $f->print( "Cross product is \n" ) };
Script outputs:
$ mathtest.pl
A
1.00000
2.00000
3.00000
X
4.00000
5.00000
6.00000
output of a->cross_product( x ) is: ''
output of a->cross_product( a, x ) is: ''
Any help would be much appreciated. Thanks!!
Ryan
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.