View previous topic :: View next topic |
Author |
Message |
baxissimo
Joined: 23 Oct 2006 Posts: 241 Location: Tokyo, Japan
|
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
Don Clugston
Joined: 05 Oct 2005 Posts: 91 Location: Germany (expat Australian)
|
Posted: Fri Nov 02, 2007 5:17 am Post subject: |
|
|
Quote: |
I haven't run across a C++ library geared towards general N-dimensional arrays.
|
How about Blitz++ ? |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
sandford
Joined: 16 Jan 2007 Posts: 3
|
Posted: Sat Jun 07, 2008 11:51 am Post subject: Re: Some libraries to steal ideas from |
|
|
baxissimo wrote: |
I haven't run across a C++ library geared towards general N-dimensional arrays. |
There's also cisstVector: http://www.cisst.org/resources/software/ |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
baxissimo
Joined: 23 Oct 2006 Posts: 241 Location: Tokyo, Japan
|
Posted: Sun Jun 08, 2008 3:40 am Post subject: Re: Some libraries to steal ideas from |
|
|
Thanks. Fawzi is working on a new N-dim array type ... maybe it will be good info for him. Would you recommend the design of cisstVector or are you just saying that it exists? |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
fawzi
Joined: 19 Feb 2008 Posts: 9 Location: Berlin, Germany
|
Posted: Tue Jul 22, 2008 7:46 am Post subject: |
|
|
I gave a look at all the libraries.
Indeed the cisstVector seems nice for a user that needs all of that, but it is not what I want to do.
I working on a class/template for uniformly spaced (normally dense) multidimensional arrays with a dimension that although constant for each object once created it is not known at compile time.
The rank of the object on the other hand must be known at compile time.
Having multidimensional arrays with constant sizes (and very often you want only one or two dimensions constant) immediately increases the the complexity very much, and makes a clean design and uniform handling much less difficult (it is easy to have holes in the implementation of given corner cases).
This won't be the right class for 3D vectors, but for array of 3D vectors it might well be.
time will tell ![Smile](images/smiles/icon_smile.gif) |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
Don Clugston
Joined: 05 Oct 2005 Posts: 91 Location: Germany (expat Australian)
|
Posted: Thu Jul 24, 2008 4:58 am Post subject: |
|
|
It's worth knowing that the next DMD2 release (probably in a couple of days -- I have a pre-release already) contains array operations.
So you can write stuff like:
double [] a;
double [] b;
a += b[3..$-8]*3.5;
and have it converted into a DAXPY call.
Which will mean we'll pretty much have BLAS1 built into the language.
The implications for a matrix library are quite interesting... |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
baxissimo
Joined: 23 Oct 2006 Posts: 241 Location: Tokyo, Japan
|
Posted: Thu Jul 24, 2008 12:18 pm Post subject: |
|
|
Don Clugston wrote: | It's worth knowing that the next DMD2 release (probably in a couple of days -- I have a pre-release already) contains array operations.
So you can write stuff like:
double [] a;
double [] b;
a += b[3..$-8]*3.5;
and have it converted into a DAXPY call.
Which will mean we'll pretty much have BLAS1 built into the language.
The implications for a matrix library are quite interesting... |
You mean it gets converted to something that's like a DAXPY call? It doesn't actually call a BLAS DAXPY does it? Is it configurable? Can you make it call your own routines? Or is it yet another of these "works for builtins, but not for you" things like returning lvalues from arrays.
Anyway, I won't be doing much about D2 till Tango and DWT are ported. |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
Don Clugston
Joined: 05 Oct 2005 Posts: 91 Location: Germany (expat Australian)
|
Posted: Mon Jul 28, 2008 1:46 am Post subject: |
|
|
Quote: | You mean it gets converted to something that's like a DAXPY call? It doesn't actually call a BLAS DAXPY does it? Is it configurable? Can you make it call your own routines? Or is it yet another of these "works for builtins, but not for you" things like returning lvalues from arrays.
|
It's like a DAXPY call. It calls a new routine in the runtime (which could be forwarded to a BLAS routine if desired). Only works for built-ins. It's the first situation in which DMD will use SSE operations.
Essentially, it's just syntax sugar for BLAS1 operations: you can use an array instead of a vector class. |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
fawzi
Joined: 19 Feb 2008 Posts: 9 Location: Berlin, Germany
|
Posted: Fri Sep 05, 2008 9:32 am Post subject: NArray |
|
|
Well my multidimensional array library is now basically ready for primetime.
You can give it a look at
http://github.com/fawzi/narray/tree/master/INSTALL.txt
I think that the design is quite sound (3. iteration) and the performance reasonable.
There is still to do, but it has already a meaningful functionality, and performance.
Unfortunately the direct indexing of 3D arrays (that have larger overhead than 1D/2D) has a rather large overhead over the optimal strategy (10-15x) because the compiler is not smart enough to optimize it fully, but it is easy to avoid direct indexing, and as reference implementation direct indexing is still acceptable.
You can use it like this:
import frm.narray.NArray;
auto a=zeros!(float)([5,5]);
auto b=zeros!(float)(5);
auto c=dot(a,b);
diag(a)=arange(5);
a[0,0]=12.5f;
auto ev=eigh(a); |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
|