- or download this
use Math::Cephes::Matrix qw(mat);
$a = mat [[1, 2], [3, 4]];
...
print "@{$a->mul($b)}";
# print "3 7"
- or download this
use Math::MatrixReal;
$a = Math::MatrixReal->new_from_rows( [[1, 2], [3, 4]] );
...
# print "[ 3.000000000000E+000 ]
# [ 7.000000000000E+000 ]"
- or download this
use PDL;
$a = pdl [[1, 2],[3, 4]];
...
# [7]
# ]"
- or download this
>> a = [1, 2; 3, 4];
>> b = [1; 1];
...
3
7
- or download this
> a = matrix(c(1,2,3,4), ncol=2, byrow=T)
> b = matrix(c(1,1), ncol=1)
...
[1,] 3
[2,] 7
- or download this
use Math::Cephes::Matrix qw(mat);
$mat = mat [[1, 2, 3], [4, 5, 6], [7, 8, 9]];
...
# print "5 6
# 8 9"
- or download this
use Math::MatrixReal;
$mat = Math::MatrixReal->new_from_rows(
...
# print "5 6
# 8 9"
- or download this
use PDL;
$mat = pdl [[1, 2, 3], [4, 5, 6], [7, 8, 9]];
...
# [8 9]
# ]"
- or download this
mat = [1,2,3; 4,5,6; 7,8,9];
mat(2:3, 2:3)
...
5 6
8 9
- or download this
> mat = matrix(1:9, ncol=3, byrow=T)
> mat[2:3, 2:3]
...
[1,] 5 6
[2,] 8 9
- or download this
> vec = 1:10
> vec
...
[1] 1 3 5 7 9
> vec[vec %% 2 == 1] + 1
[1] 2 4 6 8 10
- or download this
#! /usr/local/bin/perl -w
use strict;
...
ciphered: 18431 6512 5843 7236
deciphered: 80 101 114 108
decoded: Perl
- or download this
#! /usr/local/bin/perl -w
use strict ;
...
$Rscript =~ s/<-/=/gm ; # \r or <- will break "echo"
return `echo $Rscript | $Rcmd` ;
}
- or download this
my $dir = 'D:\\tmp\\prog\\math\\lp32';
my $lp_solve = "d:\\mydir\\lp_solve.exe";
...
print $lp;
print $output;
system("del $lpfile");
- or download this
use strict;
use warnings;
...
matrixreal 5.28/s -- -94% -99%
cephes 83.3/s 1479% -- -87%
pdl 625/s 11744% 650% --