- or download this
Task 2: Submatrix Sum
Submitted by: Jorg Sommrey
...
[30, 34, 38]
]
- or download this
sub sms_WxH_Perl_4loops( $m, $w, $h ) {
my ( $W, $H ) = ( scalar $m-> [0]-> @*, scalar @$m );
...
| 140 | 0.284 | 0.022 |
+-----+-------+-------+
- or download this
sub sms_2x2_PDL ( $m ) {
$m-> slice( '0:-2', '0:-2' ) +
...
$m-> slice( '1:-1', '1:-1' )
}
- or download this
sub sms_WxH_PDL_naive ( $m, $w, $h ) {
my $ret = 0;
...
}
return $ret
}
- or download this
use Inline Pdlpp => <<'EOPP';
...
EOPP
- or download this
sub sms_WxH_PDL_lags ( $m, $w, $h ) {
my ( $W, $H ) = $m-> dims;
...
[ 5 6 7 8]
[ 9 10 11 12]
]
- or download this
+
Time (s) vs. N (NxN submatrix, PDL: Double D [1500,1500] matrix)
...
| 1400 | | | 0.291 | 0.272 |
+------+-------+-------+-------+-------+
- or download this
sub _do_dimension ( $m, $w ) {
$m -> slice([ 0, $w - 1 ], [])
...
| 1400 | 0.275 | 0.003 |
+------+-------+-------+
- or download this
use PDL::Apply 'apply_rolling';
...
3.20836806297302
1.28170394897461