Angharad has asked for the wisdom of the Perl Monks concerning the following question:
4 2 9 7 21 2 5 4 4 11.5 6 3 5 3 15.5 8 4 6 6 22
my $dmat = pdl [ [4, 2, 9, 7], [2, 5, 5, 4], [6, 3, 5, 3], [8, 4, 6, 6], ]; my $damat = pdl [ [21, 2, 9, 7], [11.5, 5, 5, 4], [15.5, 3, 5, 3], [22, 4, 6, 6], ]; my $dbmat = pdl [ [4, 21, 9, 7], [2, 11.5, 5, 4], [6, 15.5, 5, 3], [8, 22, 6, 6], ]; my $dcmat = pdl [ [4, 2, 21, 7], [2, 5, 11.5, 4], [6, 3, 15.5, 3], [8, 4, 22, 6], ]; my $ddmat = pdl [ [4, 2, 9, 21], [2, 5, 5, 11.5], [6, 3, 5, 15.5], [8, 4, 6, 22], ];
#!/usr/bin/perl -w use PDL; $matrixfile = $ARGV[0]; open(MATRIX, "$matrixfile") || die "Error: Can't open $matrixfile file + for reading: $!\n"; @matrix = <MATRIX>; for(my $i = 0; $i < @matrix; $i ++) { $a = substr($matrix[$i], 0, 5); $b = substr($matrix[$i], 6, 5); $c = substr($matrix[$i], 12, 5); $d = substr($matrix[$i], 18, 5); $cd = substr($matrix[$i], 24, 5); my $dmat = pdl [ [ $a, $b, $c, $d], } ];
READMORE tags added by Arunbear
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: creating matrices for PDL module
by monarch (Priest) on Jul 01, 2005 at 12:28 UTC | |
|
Re: creating matrices for PDL module
by gam3 (Curate) on Jul 01, 2005 at 12:39 UTC | |
|
Re: creating matrices for PDL module
by tlm (Prior) on Jul 01, 2005 at 12:49 UTC | |
|
Re: creating matrices for PDL module
by polettix (Vicar) on Jul 01, 2005 at 13:03 UTC | |
|
Re: creating matrices for PDL module
by bart (Canon) on Jul 01, 2005 at 13:31 UTC | |
|
Re: creating matrices for PDL module
by Angharad (Pilgrim) on Jul 01, 2005 at 12:23 UTC | |
|
Re: creating matrices for PDL module
by Angharad (Pilgrim) on Jul 01, 2005 at 12:43 UTC | |
by sapnac (Beadle) on Jul 01, 2005 at 14:13 UTC | |
by Angharad (Pilgrim) on Jul 01, 2005 at 12:46 UTC | |
by monarch (Priest) on Jul 03, 2005 at 01:41 UTC |