Codebase list libmath-matrixreal-perl / 4e37dab
Import upstream version 2.13+git20200522.1.f42a4de Debian Janitor 2 years ago
63 changed file(s) with 81 addition(s) and 83 deletion(s). Raw diff Collapse all Expand all
99 funcs.pl
1010 GOALS
1111 Kleene.pod
12 lib/Math/.MatrixReal.pm.swo
1312 lib/Math/MatrixReal.pm
13 Makefile.PL
1414 MANIFEST This list of files
15 META.json
16 META.yml
1517 OLD_README
1618 README.mkd
17 t/.list.t.swo
1819 t/00-load.t
1920 t/adjoint.t
2021 t/arith.t
7576 t/vecnorm.t
7677 t/yacas.t
7778 TODO
78 Makefile.PL
79 META.yml
80 META.json
33 "Jonathan Leto <jonathan@leto.net>"
44 ],
55 "dynamic_config" : 1,
6 "generated_by" : "Module::Build version 0.4003, CPAN::Meta::Converter version 2.133380",
6 "generated_by" : "Module::Build version 0.4231",
77 "license" : [
88 "perl_5"
99 ],
1010 "meta-spec" : {
1111 "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
12 "version" : "2"
12 "version" : 2
1313 },
1414 "name" : "Math-MatrixReal",
1515 "prereqs" : {
4040 "url" : "http://github.com/leto/math--matrixreal/tree/master"
4141 }
4242 },
43 "version" : "2.13"
43 "version" : "2.13",
44 "x_serialization_backend" : "JSON::PP version 4.04"
4445 }
22 author:
33 - 'Jonathan Leto <jonathan@leto.net>'
44 build_requires:
5 File::Spec: 0
6 Test::Most: 0
5 File::Spec: '0'
6 Test::Most: '0'
77 configure_requires:
8 Module::Build: 0.38
8 Module::Build: '0.38'
99 dynamic_config: 1
10 generated_by: 'Module::Build version 0.4003, CPAN::Meta::Converter version 2.133380'
10 generated_by: 'Module::Build version 0.4231, CPAN::Meta::Converter version 2.150010'
1111 license: perl
1212 meta-spec:
1313 url: http://module-build.sourceforge.net/META-spec-v1.4.html
14 version: 1.4
14 version: '1.4'
1515 name: Math-MatrixReal
1616 provides:
1717 Math::MatrixReal:
1818 file: lib/Math/MatrixReal.pm
19 version: 2.13
19 version: '2.13'
2020 resources:
2121 license: http://dev.perl.org/licenses/
2222 repository: http://github.com/leto/math--matrixreal/tree/master
23 version: 2.13
23 version: '2.13'
24 x_serialization_backend: 'CPAN::Meta::YAML version 0.018'
0 # Note: this file was auto-generated by Module::Build::Compat version 0.4003
0 # Note: this file was auto-generated by Module::Build::Compat version 0.4231
11 use ExtUtils::MakeMaker;
22 WriteMakefile
33 (
4 'NAME' => 'Math::MatrixReal',
5 'VERSION_FROM' => 'lib/Math/MatrixReal.pm',
64 'PREREQ_PM' => {
75 'File::Spec' => 0,
86 'Test::Most' => 0
97 },
10 'INSTALLDIRS' => 'site',
8 'PL_FILES' => {},
119 'EXE_FILES' => [],
12 'PL_FILES' => {}
10 'VERSION_FROM' => 'lib/Math/MatrixReal.pm',
11 'NAME' => 'Math::MatrixReal',
12 'INSTALLDIRS' => 'site'
1313 )
1414 ;
lib/Math/.MatrixReal.pm.swo less more
Binary diff not shown
40264026 The adjoint is just the transpose of the cofactor matrix. This method is
40274027 just an alias for C< ~($matrix-E<gt>cofactor)>.
40284028
4029 =back
4030
40314029 =item *
40324030
40334031 C<$part_of_matrix = $matrix-E<gt>submatrix(x1,y1,x2,Y2);>
40344032
4035 Submatrix permit to select only part of existing matrix in order to produce a new one.
4033 Submatrix permits one to select only part of existing matrix in order to produce a new one.
40364034 This method take four arguments to define a selection area:
40374035
40384036 =over 6
43434341 B<x> is of course that: B<M> * B<x> = I<l> * B<x>.
43444342
43454343 The method uses a Householder reduction to tridiagonal form
4346 followed by a QL algoritm with implicit shifts on this
4344 followed by a QL algorithm with implicit shifts on this
43474345 tridiagonal. (The tridiagonal matrix is kept internally
43484346 in a compact form in this routine to save memory.)
43494347 In fact, this routine wraps the householder() and
43634361 in $matrix to tridiagonal form.
43644362 On output, B<T> is a symmetric tridiagonal matrix (only
43654363 diagonal and off-diagonal elements are non-zero) and B<Q>
4366 is an I<orthogonal> matrix performing the tranformation
4364 is an I<orthogonal> matrix performing the transformation
43674365 between B<M> and B<T> (C<$M == $Q * $T * ~$Q>).
43684366
43694367 =item *
53495347
53505348 Boolean test
53515349
5352 Tests wether there is at least one non-zero element in the matrix.
5350 Tests whether there is at least one non-zero element in the matrix.
53535351
53545352 Example:
53555353
53595357
53605358 Negated boolean test
53615359
5362 Tests wether the matrix contains only zero's.
5360 Tests whether the matrix contains only zero's.
53635361
53645362 Examples:
53655363
t/.list.t.swo less more
Binary diff not shown
44
55 my $DEBUG = 0;
66
7 do 'funcs.pl';
7 do './funcs.pl';
88
99 $matrix = Math::MatrixReal->new_diag( [ 1, 2, 3 ] );
1010 $cofactor = Math::MatrixReal->new_from_string(<<MATRIX);
22 use lib File::Spec->catfile("..","lib");
33 use Math::MatrixReal;
44
5 do 'funcs.pl';
5 do './funcs.pl';
66
77 $matrix = Math::MatrixReal->new_random(20);
88 $matrix2 = $matrix->shadow();
22 use lib File::Spec->catfile("..","lib");
33 use Math::MatrixReal;
44
5 do 'funcs.pl';
5 do './funcs.pl';
66
77 $matrix = Math::MatrixReal->new_from_string(<<MATRIX);
88 [ 1 0 -1 0 3 ]
22 use lib File::Spec->catfile("..","lib");
33 use Math::MatrixReal;
44
5 do 'funcs.pl';
5 do './funcs.pl';
66
77 my $BENCH = 0; # Some basic benchmarks on operations
88 my $DEBUG2 = 0;
22 use lib File::Spec->catfile("..","lib");
33 use Math::MatrixReal;
44
5 do 'funcs.pl';
5 do './funcs.pl';
66
77 ### First, some preparation
88
11 use File::Spec;
22 use lib File::Spec->catfile("..","lib");
33 use Math::MatrixReal;
4 do 'funcs.pl';
4 do './funcs.pl';
55
66 my $DEBUG2 = 0;
77 # Set this one if you want the REAL benchmarking to be done!
22 use lib File::Spec->catfile("..","lib");
33 use Math::MatrixReal;
44
5 do 'funcs.pl';
5 do './funcs.pl';
66
77 $matrix = Math::MatrixReal->new_from_string(<<"MATRIX");
88 [ 1 0 0 0 1 ]
22 use lib File::Spec->catfile("..","lib");
33 use Math::MatrixReal;
44
5 do 'funcs.pl';
5 do './funcs.pl';
66
77 $matrix = Math::MatrixReal->new_from_string(<<"MATRIX");
88 [ 1 0 0 0 1 ]
11 use File::Spec;
22 use lib File::Spec->catfile("..","lib");
33 use Math::MatrixReal;
4 do 'funcs.pl';
4 do './funcs.pl';
55
66 $matrix = Math::MatrixReal->new_diag( [ 1, 2, 3 ] );
77 $cofactor = Math::MatrixReal->new_from_string(<<MATRIX);
22 use lib File::Spec->catfile("..","lib");
33 use Math::MatrixReal;
44
5 do 'funcs.pl';
5 do './funcs.pl';
66
77 $matrix = new Math::MatrixReal (10,10);
88 $matrix->one();
44 use Math::MatrixReal;
55 use Data::Dumper;
66
7 do 'funcs.pl';
7 do './funcs.pl';
88
99 {
1010 my $a = Math::MatrixReal->new_from_rows([ [ 2 ] ] );
11 use File::Spec;
22 use lib File::Spec->catfile("..","lib");
33 use Math::MatrixReal;
4 do 'funcs.pl';
4 do './funcs.pl';
55 my $eps ||= 1e-8;
66
77 $matrix = Math::MatrixReal->new_from_string(<<"MATRIX");
22 use File::Spec;
33 use lib File::Spec->catfile("..","lib");
44
5 do 'funcs.pl';
5 do './funcs.pl';
66
77 ##########################
88 ## test to see if is_diagonal works
11 use File::Spec;
22 use lib File::Spec->catfile("..","lib");
33 use Math::MatrixReal;
4 do 'funcs.pl';
4 do './funcs.pl';
55
66 my $matrix = Math::MatrixReal->new_diag([1,2,3,4]);
77 $matrix->display_precision(5);
11 use File::Spec;
22 use lib File::Spec->catfile("..","lib");
33 use Math::MatrixReal;
4 do 'funcs.pl';
4 do './funcs.pl';
55
66 ###############################
77 $matrix = Math::MatrixReal->new_from_string(<<"MATRIX");
22 use lib File::Spec->catfile("..","lib");
33 use Math::MatrixReal;
44
5 do 'funcs.pl';
5 do './funcs.pl';
66
77 my $DEBUG2 = 0;
88
11 use File::Spec;
22 use lib File::Spec->catfile("..","lib");
33 use Math::MatrixReal;
4 do 'funcs.pl';
4 do './funcs.pl';
55
66 my $DEBUG2 = 0;
77
22 use lib File::Spec->catfile("..","lib");
33 use Math::MatrixReal;
44
5 do 'funcs.pl';
5 do './funcs.pl';
66
77 my $DEBUG2 = 0;
88 my $bigsize = 30; # Size of big matrix tests (be careful: n^3!)
33 use Math::MatrixReal;
44
55
6 do 'funcs.pl';
6 do './funcs.pl';
77
88 my $matrix = Math::MatrixReal->new_from_string(<<'MATRIX');
99 [ 1 7 2 6 9 0 1 1 ]
11 use File::Spec;
22 use lib File::Spec->catfile("..","lib");
33 use Math::MatrixReal;
4 do 'funcs.pl';
4 do './funcs.pl';
55
66 ###############################
77 ## compute A^2 , compare to A*A
00 use File::Spec;
11 use lib File::Spec->catfile("..","lib");
22 use Math::MatrixReal;
3 do 'funcs.pl';
3 do './funcs.pl';
44
55 print "1..21\n";
66 print "ok 1\n";
11 use File::Spec;
22 use lib File::Spec->catfile("..","lib");
33 use Math::MatrixReal;
4 do 'funcs.pl';
4 do './funcs.pl';
55
66 $matrix = Math::MatrixReal->new_from_string(<<"MATRIX");
77 [ 1 0 0 0 0 ]
22 use lib File::Spec->catfile("..","lib");
33 use Math::MatrixReal;
44
5 do 'funcs.pl';
5 do './funcs.pl';
66 $eps = 1e-6;
77 my $A = Math::MatrixReal->new_from_string(<<"MATRIX");
88 [ 1 2 3 ]
22 use lib File::Spec->catfile("..","lib");
33 use Math::MatrixReal;
44
5 do 'funcs.pl';
5 do './funcs.pl';
66
77 my $matrix = Math::MatrixReal->new_from_string(<<'MATRIX');
88 [ 1 7 2 6 9 0 1 1 ]
11 use File::Spec;
22 use lib File::Spec->catfile("..","lib");
33 use Math::MatrixReal;
4 do 'funcs.pl';
4 do './funcs.pl';
55
66 {
77 ## compute a 2x2 inverse
22 use lib File::Spec->catfile("..","lib");
33 use Math::MatrixReal;
44
5 do 'funcs.pl';
5 do './funcs.pl';
66
77 my $matrix = Math::MatrixReal->new_from_string(<<MATRIX);
88 [ 1 2 3 ]
11 use File::Spec;
22 use lib File::Spec->catfile("..","lib");
33 use Math::MatrixReal;
4 do 'funcs.pl';
4 do './funcs.pl';
55
66 $matrix1 = Math::MatrixReal->new_from_string(<<"MATRIX");
77 [ 1 0 0 0 ]
33 use File::Spec;
44 use lib File::Spec->catfile("..","lib");
55 use Math::MatrixReal;
6 do 'funcs.pl';
6 do './funcs.pl';
77
88 {
99 my $latex1=<<'LATEX';
22 use lib File::Spec->catfile("..","lib");
33 use Math::MatrixReal;
44
5 do 'funcs.pl';
5 do './funcs.pl';
66
77 my $vec = Math::MatrixReal->new_from_rows([ [ 1, 2, 3 ] ]);
88 my $len = (~$vec)->length;
22 use lib File::Spec->catfile("..","lib");
33 use Math::MatrixReal;
44
5 do 'funcs.pl';
5 do './funcs.pl';
66
77 my $matrix = Math::MatrixReal->new_from_rows([ [1, 2], [3, 4] ]);
88 my @list = $matrix->as_list;
11 use File::Spec;
22 use lib File::Spec->catfile("..","lib");
33 use Math::MatrixReal;
4 do 'funcs.pl';
4 do './funcs.pl';
55
66 my ($a,$b);
77 $a = Math::MatrixReal->new_from_cols([[ 1.41E-05, 6.82E-06, 3.18E-06 ],[1,3,4]]);
22 use lib File::Spec->catfile("..","lib");
33 use Math::MatrixReal;
44
5 do 'funcs.pl';
5 do './funcs.pl';
66
77 $matrix = Math::MatrixReal->new_from_string(<<MATRIX);
88
44 use strict;
55 use warnings;
66
7 do 'funcs.pl';
7 do './funcs.pl';
88
99 my ($x,$y) = (7,42);
1010
11 use File::Spec;
22 use lib File::Spec->catfile("..","lib");
33 use Math::MatrixReal;
4 do 'funcs.pl';
4 do './funcs.pl';
55
66 $matrix = Math::MatrixReal->new_diag( [ 1, 2, 3 ] );
77 $minor11 = Math::MatrixReal->new_from_rows ( [ [2,0],[0,3] ] );
22 use lib File::Spec->catfile("..","lib");
33 use Math::MatrixReal;
44
5 do 'funcs.pl';
5 do './funcs.pl';
66 my $eps ||= 1e-8;
77
88 $matrix = Math::MatrixReal->new_from_string(<<"MATRIX");
22 use lib File::Spec->catfile("..","lib");
33 use Math::MatrixReal;
44
5 do 'funcs.pl';
5 do './funcs.pl';
66
77 my $a = Math::MatrixReal->new_from_rows([ [1, 2], [-2, 1] ] );
88 my $b = Math::MatrixReal->new_from_rows([ [1, 2], [3, 1] ] );
11 use File::Spec;
22 use lib File::Spec->catfile("..","lib");
33 use Math::MatrixReal;
4 do 'funcs.pl';
4 do './funcs.pl';
55 $eps ||= 1e-8;
66
77 $matrix = Math::MatrixReal->new_from_string(<<"MATRIX");
11 use File::Spec;
22 use lib File::Spec->catfile("..","lib");
33 use Math::MatrixReal;
4 do 'funcs.pl';
4 do './funcs.pl';
55
66 my $matrix = new Math::MatrixReal (10,10);
77 $matrix->one;
22 use lib File::Spec->catfile("..","lib");
33 use Math::MatrixReal qw/:all/;
44
5 do 'funcs.pl';
5 do './funcs.pl';
66
77 my $a = Math::MatrixReal->new_diag( [ 1, 2, -3 ] );
88 ok( ! $a->is_positive_definite, 'positive_definite' );
11 use File::Spec;
22 use lib File::Spec->catfile("..","lib");
33 use Math::MatrixReal;
4 do 'funcs.pl';
4 do './funcs.pl';
55 my $eps = 1e-8;
66
77 $vec1 = Math::MatrixReal->new_from_string(<<MAT);
11 use File::Spec;
22 use lib File::Spec->catfile("..","lib");
33 use Math::MatrixReal;
4 do 'funcs.pl';
4 do './funcs.pl';
55
66 $matrix = Math::MatrixReal->new_from_string(<<"MATRIX");
77 [ 1 0 0 0 1 ]
44 my ($e,$res) = (0,0);
55 my $eps = 1e-8;
66
7 do 'funcs.pl';
7 do './funcs.pl';
88
99 {
1010 my $matrix = Math::MatrixReal->new_random( 10,10, { integer => 1 } );
22 use lib File::Spec->catfile("..","lib");
33 use Math::MatrixReal;
44
5 do 'funcs.pl';
5 do './funcs.pl';
66
77 $matrix = Math::MatrixReal->new_from_string(<<"MATRIX");
88 [ 1 0 0 0 1 ]
11 use File::Spec;
22 use lib File::Spec->catfile("..","lib");
33 use Math::MatrixReal;
4 do 'funcs.pl';
4 do './funcs.pl';
55
66 my ($a,$b);
77 eval { $a = Math::MatrixReal->new_from_cols([[ 1.41e-05, 6.82E-06, 3.18e-06 ]]) };
44 use strict;
55 use warnings;
66
7 do 'funcs.pl';
7 do './funcs.pl';
88
99 my ($x,$y,$z) = (42, 42.0001,42.0000001);
1010
22 use lib File::Spec->catfile("..","lib");
33 use Math::MatrixReal;
44
5 do 'funcs.pl';
5 do './funcs.pl';
66
77 $matrix = Math::MatrixReal->new_from_string(<<"MATRIX");
88 [ 1 0 0 0 1 ]
11 use File::Spec;
22 use lib File::Spec->catfile("..","lib");
33 use Math::MatrixReal;
4 do 'funcs.pl';
4 do './funcs.pl';
55
66 # Determine number of digits in exponents beyond the libc 'standard' of two
77 # and pad out the expected result.
33 use Math::MatrixReal;
44 use strict;
55
6 do 'funcs.pl';
6 do './funcs.pl';
77 my $eps ||= 1e-8;
88
99 my $matrix = Math::MatrixReal->new_from_string(<<"MATRIX");
22 use lib File::Spec->catfile("..","lib");
33 use Math::MatrixReal;
44
5 do 'funcs.pl';
5 do './funcs.pl';
66
77 $matrix = Math::MatrixReal->new_from_string(<<"MATRIX");
88 [ 1 0 0 0 ]
22 use lib File::Spec->catfile("..","lib");
33 use Math::MatrixReal;
44
5 do 'funcs.pl';
5 do './funcs.pl';
66
77 $matrix = Math::MatrixReal->new_from_string(<<"MATRIX");
88 [ 1 0 0 0 1 ]
22 use lib File::Spec->catfile("..","lib");
33 use Math::MatrixReal;
44
5 do 'funcs.pl';
5 do './funcs.pl';
66
77 ###############################
88 ## 2x2 inverse
22 use lib File::Spec->catfile("..","lib");
33 use Math::MatrixReal;
44
5 do 'funcs.pl';
5 do './funcs.pl';
66
77 $matrix = Math::MatrixReal->new_diag( [ 1, 2, 3 ] );
88 $matrix2 = Math::MatrixReal->new_random(10);
33 use Math::MatrixReal;
44 my $DEBUG = 0;
55
6 do 'funcs.pl';
6 do './funcs.pl';
77
88 $matrix = Math::MatrixReal->new_from_string(<<"MATRIX");
99 [ 1 0 0 0 1 ]
22 use lib File::Spec->catfile("..","lib");
33 use Math::MatrixReal;
44 use strict;
5 do 'funcs.pl';
5 do './funcs.pl';
66
77 my $zero = sprintf '%E', 0;
88 my ($pad) = $zero =~ /E00(\d+)$/;
11 use File::Spec;
22 use lib File::Spec->catfile("..","lib");
33 use Math::MatrixReal;
4 do 'funcs.pl';
4 do './funcs.pl';
55
66 my ($a,$b);
77 my $eps = 1e-6;
22 use lib File::Spec->catfile("..","lib");
33 use Math::MatrixReal;
44 use strict;
5 do 'funcs.pl';
5 do './funcs.pl';
66
77 my ($a,$b);
88 $a = Math::MatrixReal->new_from_cols([[ 1.41E-05, 6.82E-06, 3.18E-06 ],[1,3,4]]);