FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Some libraries to steal ideas from

 
Post new topic   Reply to topic     Forum Index -> MultiArray
View previous topic :: View next topic  
Author Message
baxissimo



Joined: 23 Oct 2006
Posts: 241
Location: Tokyo, Japan

PostPosted: Thu Nov 01, 2007 2:37 am    Post subject: Some libraries to steal ideas from Reply with quote

These are all linear algebra-oriented matrix libraries:

An alpha of MTL 4 was just released recently.
http://www.osl.iu.edu/research/mtl/mtl4/

Boost ublas:
http://www.boost.org/libs/numeric/ublas/doc/index.htm

Boost multi_array:
http://www.boost.org/libs/multi_array/doc/user.html

Schani recommended FLENS:
http://flens.sourceforge.net/

I haven't run across a C++ library geared towards general N-dimensional arrays. Oh wait -- Don points out below that Blitz++ is such a beast.

Blitz++
http://www.oonumerics.org/blitz/

And on the NumPy mailing list someone suggested the computer vision / image library "Vigra":
http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/

Which reminds me of the other generic image package that you hear about these days -- Adobe's GIL (Generic Image Library), which also support arbitrary N-dimensional storage:
http://opensource.adobe.com/gil/

The GNU Scientific Library (GSL) apparently has an N-dim array thing. (It's in C so it's not a 'class' per se):
http://www.gnu.org/software/gsl/manual/html_node/index.html

For Python of course there's NumPy.

Lush:
http://lush.sourceforge.net/lush-manual/index.html


Last edited by baxissimo on Tue Nov 20, 2007 6:54 pm; edited 4 times in total
Back to top
View user's profile Send private message
Don Clugston



Joined: 05 Oct 2005
Posts: 91
Location: Germany (expat Australian)

PostPosted: Fri Nov 02, 2007 5:17 am    Post subject: Reply with quote

Quote:

I haven't run across a C++ library geared towards general N-dimensional arrays.


How about Blitz++ ?
Back to top
View user's profile Send private message
sandford



Joined: 16 Jan 2007
Posts: 3

PostPosted: Sat Jun 07, 2008 11:51 am    Post subject: Re: Some libraries to steal ideas from Reply with quote

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
View user's profile Send private message
baxissimo



Joined: 23 Oct 2006
Posts: 241
Location: Tokyo, Japan

PostPosted: Sun Jun 08, 2008 3:40 am    Post subject: Re: Some libraries to steal ideas from Reply with quote

sandford wrote:
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/


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
View user's profile Send private message
fawzi



Joined: 19 Feb 2008
Posts: 9
Location: Berlin, Germany

PostPosted: Tue Jul 22, 2008 7:46 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
Don Clugston



Joined: 05 Oct 2005
Posts: 91
Location: Germany (expat Australian)

PostPosted: Thu Jul 24, 2008 4:58 am    Post subject: Reply with quote

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
View user's profile Send private message
baxissimo



Joined: 23 Oct 2006
Posts: 241
Location: Tokyo, Japan

PostPosted: Thu Jul 24, 2008 12:18 pm    Post subject: Reply with quote

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
View user's profile Send private message
Don Clugston



Joined: 05 Oct 2005
Posts: 91
Location: Germany (expat Australian)

PostPosted: Mon Jul 28, 2008 1:46 am    Post subject: Reply with quote

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
View user's profile Send private message
fawzi



Joined: 19 Feb 2008
Posts: 9
Location: Berlin, Germany

PostPosted: Fri Sep 05, 2008 9:32 am    Post subject: NArray Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> MultiArray All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group