in reply to Re: Sparse Matrix Multiplication Problem
in thread Sparse Matrix Multiplication Problem
Not sure why it doesn't give this desired result:use Data::Dumper; my @realval = ( 0.994704478, 0.989459074, 0.994717023, 1.000000000, 1.000000000, 0.002647761, 0.005282977, 0.000882587, 0.005270463, 0.000882587, 0.002635231, 0.000882587, 0.002635231,); my @row_index = qw( 1 2 3 4 5 1 3 1 2 1 2 1 2); my @col_index = qw(1 2 3 4 5 5 3 2 1 3 3 4 4); my @mat_dim = (5,5); # M always equal to N my @trans_r = (0) x scalar(@p); for my $j (0..$#row_index) { $trans_r[$col_index[$i]-1] += $realval[$i] * $p[$row_index[$i]-1] ; } print Dumper \@trans_r;
Truly need your expert advice on this. Thanks and hope to hear from you again.@result = (0.3989359, 0.1982448, 0.2008801, 0.2008801, 0.2010591);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Sparse Matrix Multiplication Problem
by gone2015 (Deacon) on Jan 30, 2009 at 09:50 UTC |