[LON-CAPA-users] looking for linear algebra library
Guy Albertelli II
lon-capa-users@mail.lon-capa.org
Mon, 19 Nov 2007 16:30:22 -0500
Hi Jay,
> Does anyone have a linear algebra perl library they would mind sharing?
The is one integrated into lon-capa directly.
Math::Cephes::Matrix is available
http://search.cpan.org/~rkobes/Math-Cephes-0.45/lib/Math/Cephes/Matrix.pm
(You won't be able to use the Math::Cephes::Matrix->new($arr_ref);
syntax but you will be able to use &mat()
<script type="loncapa/perl">
$M= &mat([[1,2],[2,1]]);
$a = $M->add($M);
$b = $a->add($M);
$b = $b->coef();
foreach my $row (@{$b}) {
$str.='<tr><td>'.join('</td><td>',@{$row}).'</td></tr>';
}
$str = '<table>'.$str.'</table>';
</script>
<startouttext />My matrix is $str<endouttext />
> I'm looking for basic matrix functionality: matrix add, subtract,
> multiply, determinant, inverse
As you can see it has all of that.
--
guy@albertelli.com 0-7-0-6-27,137