diff --git a/Basic/Core/Basic.pm b/Basic/Core/Basic.pm index 9ff681393..4dc1cd179 100644 --- a/Basic/Core/Basic.pm +++ b/Basic/Core/Basic.pm @@ -354,14 +354,13 @@ sub PDL::ndcoords { unshift(@d,$type) if defined($type); my $out = PDL->zeroes(@d); for my $d(0..$#dims) { - my $w = $out->index($d)->mv($d,0); + my $w = $out->index($d); + $w = $w->mv($d,0) if $d != 0; $w .= xvals($w); } $out; } -*ndcoords = \&PDL::ndcoords; -*allaxisvals = \&PDL::ndcoords; -*PDL::allaxisvals = \&PDL::ndcoords; +*ndcoords = *allaxisvals = *PDL::allaxisvals = \&PDL::ndcoords; =head2 hist diff --git a/Libtmp/FFT/fft.pd b/Libtmp/FFT/fft.pd index df9f8fe6f..10b60a9b7 100644 --- a/Libtmp/FFT/fft.pd +++ b/Libtmp/FFT/fft.pd @@ -289,8 +289,8 @@ sub PDL::fftnd { $i = $i->copy; foreach (0..$n) { fft($r,$i); - $r = $r->mv(0,$n); - $i = $i->mv(0,$n); + $r = $r->mv(0,$n) if 0 != $n; + $i = $i->mv(0,$n) if 0 != $n; } if (!$_[0]->type->real) { $_[0]= czip($r, $i); @@ -332,8 +332,8 @@ sub PDL::ifftnd { $n--; foreach (0..$n) { ifft($r,$i); - $r = $r->mv(0,$n); - $i = $i->mv(0,$n); + $r = $r->mv(0,$n) if 0 != $n; + $i = $i->mv(0,$n) if 0 != $n; } if (!$_[0]->type->real) { $_[0]= czip($r, $i); diff --git a/Libtmp/ImageND/imagend.pd b/Libtmp/ImageND/imagend.pd index 7afad1c2b..ed9542f98 100644 --- a/Libtmp/ImageND/imagend.pd +++ b/Libtmp/ImageND/imagend.pd @@ -317,10 +317,10 @@ sub PDL::rebin { } elsif ($odims[$i] != $idims[$i]) { # If something changes if (!($odims[$i] % $idims[$i])) { # Cells map 1 -> n my ($r) = $odims[$i]/$idims[$i]; - $y = $x->mv($i,0)->dupN($r); + $y = ($i==0 ? $x : $x->mv($i,0))->dupN($r); } elsif (!($idims[$i] % $odims[$i])) { # Cells map n -> 1 my ($r) = $idims[$i]/$odims[$i]; - $x = $x->mv($i,0); + $x = $x->mv($i,0) if $i != 0; # -> copy so won\'t corrupt input PDL $y = $x->slice("0:-1:$r")->copy; foreach (1..$r-1) { @@ -328,7 +328,7 @@ sub PDL::rebin { } $y /= $r; } else { # Cells map n -> m - &PDL::_rebin_int($x->mv($i,0), $y = null, $odims[$i]); + &PDL::_rebin_int(($i==0 ? $x : $x->mv($i,0)), $y = null, $odims[$i]); } $x = $y->mv(0,$i); }