[Changeset] Re: Faster Array transpose

David Bateman adb014 at gmail.com
Sun May 4 17:36:02 CDT 2008


David Bateman wrote:
> I think the code below is a good compromise for this function. Sorry I
> can't easily create a changeset as thare are other uncomitted changes in
> Array.cc in by repository at the moment
> 
> D.

It wasn't correct.. I've written this up in my attempt to clean up the
Array class for the integration of the single precision type.. The
Changeset is attached, but I suspect it might not apply without the rest
of the single precision changes (which I consider pretty much complete
in themselves). With this changes the transpose and hermitian methods go
into the Array class, with only a one specialization for the DiagArray2
class. With this change "make check" passes correctly and the speed
difference with the bench mark

N = [128, 129, 1024, 1025, 2048, 2049, 4096, 4097];
nruns = 10;

t = zeros (1, length (N));
for i = 1: length (N)
  A = 1i*randn (N(i), N(i));

  for j = 1: nruns
    t0 = cputime ();
    B = A';
    t(i) = t(i) + cputime() - t0;
  endfor
  t (i) = t (i) ./ nruns;

  printf("N = %4d, time = %g sec\n", N(i), t(i));
  fflush (stdout);
endfor

I got previous without the patch

N =  128, time = 0.0016666 sec
N =  129, time = 0.0003333 sec
N = 1024, time = 0.0439971 sec
N = 1025, time = 0.0336645 sec
N = 2048, time = 0.276649 sec
N = 2049, time = 0.172656 sec
N = 4096, time = 1.19492 sec
N = 4097, time = 0.700954 sec

and with it

N =  128, time = 0 sec
N =  129, time = 0 sec
N = 1024, time = 0.0319979 sec
N = 1025, time = 0.0243318 sec
N = 2048, time = 0.170655 sec
N = 2049, time = 0.117326 sec
N = 4096, time = 0.745285 sec
N = 4097, time = 0.558964 sec

and similar improvements for the hermitian operator.

D.




-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch8019
Url: https://www.cae.wisc.edu/pipermail/octave-maintainers/attachments/20080505/7b623333/attachment.ksh 


More information about the Octave-maintainers mailing list