octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Changeset] Re: Faster Array transpose


From: David Bateman
Subject: Re: [Changeset] Re: Faster Array transpose
Date: Tue, 06 May 2008 23:24:39 +0200
User-agent: Thunderbird 2.0.0.12 (X11/20080306)

dbateman wrote:
> 
> 
> John W. Eaton wrote:
>> Is there a ChangeLog entry for this?  With that, I'd apply the change
>> (but skipping the diffs for the float matrix files I don't have yet).
>>
> 
> Humm, I was sure I wrote one, but it seems not. I;ll send another changeset
> with one later.
> 
> All the float stuff is on my respository at hg.dbateman.org, starting at
> changeset 8002.

The changeset is attached, however, I'm not sure how to handle the split
between the patch of this code you'll take and the single precision code
that you won't. So perhaps if you'd take the single precision code
before this stuff it might be easier. Could you examine further the
changesets

8002
8003
8004
8006
8015
8017
8019
8056

from http://hg.dbateman.org/octave and see what further you'd like to be
added to the single precision code before accepting it into 3.1.. I'll
work on the single precision type further in any case, including

* single precision version of quad
* perhaps the same for daspk, glpk, etc, but less sure of that
* Move more methods from teh derived classes to the Array classes to
clean up the code.

Regards
David
# HG changeset patch
# User David Bateman <address@hidden>
# Date 1210108550 -7200
# Node ID e87f87f45d7a149ca5d02849494670b55b0b046b
# Parent  b385f05462735470b01ecee8da054d986494909b
Add tests for tranpose/hermitian and ChangeLog entry for new transpose code

diff --git a/liboctave/Array.cc b/liboctave/Array.cc
--- a/liboctave/Array.cc
+++ b/liboctave/Array.cc
@@ -1322,6 +1322,41 @@ Array<T>::hermitian (T (*fcn) (const T&)
       return result;
     }
 }
+
+/*
+
+%% Tranpose tests for matrices of the tile size and plus or minus a row
+%% and with four tiles.
+
+%!shared m7, mt7, m8, mt8, m9, mt9
+%! m7 = reshape (1 : 7*8, 8, 7);
+%! mt7 = [1:7; 1:7, 1:7, 1:7, 1:7; 1:7, 1:7, 1:7];
+%! m8 = reshape (1 : 8*8, 8, 8);
+%! mt8 = [1:8; 1:8, 1:8, 1:8, 1:8; 1:8, 1:8, 1:8];
+%! m9 = reshape (1 : 9*8, 8, 9);
+%! mt9 = [1:9; 1:9, 1:9, 1:9, 1:9; 1:9, 1:9, 1:9];
+
+%!assert (m7', mt7)
+%!assert ((1i*m7).', 1i * mt7)
+%!assert ((1i*m7)', conj (1i * mt7))
+%!assert (m8', mt8)
+%!assert ((1i*m8).', 1i * mt8)
+%!assert ((1i*m8)', conj (1i * mt8))
+%!assert (m9', mt9)
+%!assert ((1i*m9).', 1i * mt9)
+%!assert ((1i*m9)', conj (1i * mt9))
+
+%!assert ([m7, m7; m8, m8]', [mt7, mt8; mt7, mt8])
+%!assert ((1i*[m7, m7; m8, m8]).', 1i * [mt7, mt8; mt7, mt8])
+%!assert ((1i*[m7, m7; m8, m8])', conj (1i * [mt7, mt8; mt7, mt8]))
+%!assert ([m8, m8; m8, m8]', [mt8, mt8; mt8, mt8])
+%!assert ((1i*[m8, m8; m8, m8]).', 1i * [mt8, mt8; mt8, mt8])
+%!assert ((1i*[m8, m8; m8, m8])', conj (1i * [mt8, mt8; mt8, mt8]))
+%!assert ([m9, m9; m8, m8]', [mt9, mt8; mt9, mt8])
+%!assert ((1i*[m9, m9; m8, m8]).', 1i * [mt9, mt8; mt9, mt8])
+%!assert ((1i*[m9, m9; m8, m8])', conj (1i * [mt9, mt8; mt9, mt8]))
+
+*/
 
 template <class T>
 T *
diff --git a/liboctave/ChangeLog b/liboctave/ChangeLog
--- a/liboctave/ChangeLog
+++ b/liboctave/ChangeLog
@@ -1,3 +1,48 @@ 2008-05-05  John W. Eaton  <address@hidden
+2008-05-06  David Bateman  <address@hidden>
+
+       * Array.cc (Array<T> Array<T>::transpose () const): Modify for tiled
+       transpose to limit the number of cache misses.
+       (Array<T> Array<T>::hermitian (T (*)(const&)) const): New method
+       for matrix conjugate transpose.
+       * Array.h (Array<T> hermitian (T (*)(const&)) const): Declare it.
+
+       * DiagArray2.cc (DiagArray2<T> DiagArray2<T>::transpose () const):
+       Specialization for diagonal arrays.
+       (DiagArray2<T> DiagArray2<T>::transpose (T (*) (const&)) const):
+       Ditto.
+       
+       * MArray.h (MArray<T> hermitian <T (*) (const&)) const): New method.
+       (MArray<T> transpose () const): Ditto.
+       * MArray2.h (MArray2<T> hermitian <T (*) (const&)) const): Ditto.
+       * Array2.h (Array2<T> hermitian <T (*) (const&)) const): Ditto.
+       * ArrayN.h (ArrayN<T> hermitian <T (*) (const&)) const): Ditto.
+       * MDiagArray2.h (MDiagArray2<T> transpose () const): Ditto.
+       (MDiagArray<T> hermitian <T (*) (const&)) const): Ditto.
+
+       * CColVector.cc (transpose, hermitian): Define in terms of base class.
+       * CRowVector.cc (transpose, hermitian): Ditto.
+       * dColVector.cc (transpose): Ditto.
+       * dRowVector.cc (transpose): Ditto.
+       * CDiagMatrix.h (transpose, hermitian): Ditto.
+       * dDiagMatrix.h (transpose): Ditto.
+
+       * fCColVector.cc (transpose, hermitian): Define in terms of base class.
+       * fCRowVector.cc (transpose, hermitian): Ditto.
+       * fColVector.cc (transpose): Ditto.
+       * fRowVector.cc (transpose): Ditto.
+       * fCDiagMatrix.h (transpose, hermitian): Ditto.
+       * fDiagMatrix.h (transpose): Ditto.
+
+       * CDiagMatrix.cc (ComplexDiagMatrix::transpose,
+       ComplexDiagMatrix::hermitian): Delete.
+       * dDiagMatrix.cc (DiagMatrix::transpose): Ditto.
+       * CMatrix.cc (ComplexMatrix::hermitian): Ditto.
+
+       * fCDiagMatrix.cc (FloatComplexDiagMatrix::transpose,
+       FloatComplexDiagMatrix::hermitian): Delete.
+       * fDiagMatrix.cc (FloatDiagMatrix::transpose): Ditto.
+       * fCMatrix.cc (FloatComplexMatrix::hermitian): Ditto.
+
 2008-05-05  John W. Eaton  <address@hidden>
 
        * cmd-edit.cc (command_editor::re_read_init_file,

reply via email to

[Prev in Thread] Current Thread [Next in Thread]