Sign in to follow this  

Linear Algebra library

This topic is 4399 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I was wondering, is there a standard C++ library for vectors classes and such ? One that is fairly standard ? And no, I don't mean the stl vector container class kind but the linear algebra type.

Share this post


Link to post
Share on other sites
PGC, what exactly do you plan to do with this library?

I, for one, use Intel's MKL. It's very versatile, extremely fast and it even has a support for sparse BLAS and solvers.

Share this post


Link to post
Share on other sites
I had read about Boost (uBLAS) before, but wondered how standard that is.

ury > I want to use it for a 3d visualization. Several linear algebraic methods are performed . I can implement those myself, however, instead of creating my own vector class and such I wondered if there were any standard and (most important) commonly used libraries.

Share this post


Link to post
Share on other sites
I see, so I guess that all you need are 4x4 or 3x3 matrices. In this case you don't really need heavy guns like BLAS or LAPACK.

People usually implement such libraries by themselves or use the one supplied by DirectX (or OpenGL).

I am sure that there are great open source libraries out there; maybe someone else can point them out?

Share this post


Link to post
Share on other sites
ury > as I said, I want to avoid implementing it myself. I believe there to be a 1001 implementations by now, all by people who decided to 'implement it themselves'. I do not want to reinvent the wheel for the 1002nd time. Yes, I only need 3 and 4 dimensional operations. From what I've seen thusfar, Boost::uBlas seems like a decent library. The MKL however is Intel specific. My code might have to run on non-intel systems so now and then...

And a heavy gun might actually be required since I'm working on a visualizer for particle simulations, thus involving lots of particles...

Share this post


Link to post
Share on other sites
PGC, what I really mean by big guns is a general purpose matrix library that can handle a matrix of any given size.

A library with specific implementations of 4 and 3 dimensional matrices is generally faster and more lightweight.
Good examples are: DirectX and Doom3 SDK.

As far as I can see all of the previously proposed libraries were implementations of BLAS.

Googling for this, could prove to be useful.

One more thing. Usually, data like particles can benefit from parallel processing. A good idea would be to use a library that can work with arrays of data instead of separately processing each piece of data.
In other words, use SSE :)

Share this post


Link to post
Share on other sites
That (SSE and such) would be very handy of course and I might add that later on. For now however I'll concentrate on the la (linear algebra) library.

Although uBLAS might be a bit more extended than would be necessary, it is, as far as I can tell the most accepted library. I am a bit surprised of the lack of a really standard library for 3/4 dimensional la when you consider the amount of 3d programs/games nowadays. Maybe directx has a standard class for vectors, however openGl (which I'm using) doesn't. So do 99% of the 3d application creators implement their own vector/la class(es) ?

I'm not a game programmer nor do I consider myself anything of an experienced programmer, but I am very surprised about this...

Share this post


Link to post
Share on other sites
Quote:
Original post by PGC
... Maybe directx has a standard class for vectors, however openGl (which I'm using) doesn't. So do 99% of the 3d application creators implement their own vector/la class(es) ?

I'm not a game programmer nor do I consider myself anything of an experienced programmer, but I am very surprised about this...


OpenGl doesn't have a lot of things ^_^. Well, it won't hurt you to implement them yourself. Personally I use the vector classes which come with the lwjgl library, which is a java binding for opengl. However, vectors and matrices are rather simple - if/once you understand the math behind them, coding some shouldn't take any signifficant amount of time.

Share this post


Link to post
Share on other sites
Quote:
Original post by lightbringer
Quote:
Original post by PGC
... Maybe directx has a standard class for vectors, however openGl (which I'm using) doesn't. So do 99% of the 3d application creators implement their own vector/la class(es) ?

I'm not a game programmer nor do I consider myself anything of an experienced programmer, but I am very surprised about this...


OpenGl doesn't have a lot of things ^_^. Well, it won't hurt you to implement them yourself. Personally I use the vector classes which come with the lwjgl library, which is a java binding for opengl. However, vectors and matrices are rather simple - if/once you understand the math behind them, coding some shouldn't take any signifficant amount of time.


As I said before, I can implement them myself, it's just that I do not wish to be the 1002nd person to reinvent the damn wheel. I know my linear algebra, don't worry.

Share this post


Link to post
Share on other sites
Quote:
Original post by nmi
Did someone already mention Blitz++ ?

http://sal.jyu.fi/B/0/BLITZ++.html


A listing of available libraries can be found here:
http://www.oonumerics.org/oon/#libraries


The copyrights indicated on the bottom of the site indicate 2001. Did they stop development ? I can't reach oonumerics.org for some reason by the way...

Share this post


Link to post
Share on other sites
Quote:
Original post by PGC
Quote:
Original post by nmi
Did someone already mention Blitz++ ?

http://sal.jyu.fi/B/0/BLITZ++.html


A listing of available libraries can be found here:
http://www.oonumerics.org/oon/#libraries


The copyrights indicated on the bottom of the site indicate 2001. Did they stop development ? I can't reach oonumerics.org for some reason by the way...


As indicated by sourceforge the latest release is from October 14, 2005.
http://sourceforge.net/project/showfiles.php?group_id=63961

Strange thing that you cannot reach oonumerics. For me it works fine. Maybe you should try again another day.

Share this post


Link to post
Share on other sites
Quote:
Original post by nmi
Quote:
Original post by PGC
Quote:
Original post by nmi
Did someone already mention Blitz++ ?

http://sal.jyu.fi/B/0/BLITZ++.html


A listing of available libraries can be found here:
http://www.oonumerics.org/oon/#libraries


The copyrights indicated on the bottom of the site indicate 2001. Did they stop development ? I can't reach oonumerics.org for some reason by the way...


As indicated by sourceforge the latest release is from October 14, 2005.
http://sourceforge.net/project/showfiles.php?group_id=63961

Strange thing that you cannot reach oonumerics. For me it works fine. Maybe you should try again another day.



I don't know why either. Looks interesting, 'blitz++'. I'll check it out.

Share this post


Link to post
Share on other sites
Quote:
Original post by PGC
As I said before, I can implement them myself, it's just that I do not wish to be the 1002nd person to reinvent the damn wheel. I know my linear algebra, don't worry.


Right. Now that that's out of the way ^_^, here's another thought: Maybe you'll be using some other third party libraries, for collision or physics, in your project. If you plan to, look at those libraries and see whether they use their own custom classes for these tasks. You probably don't want to convert between your own and and their classes ten thousand times per frame, so there might be some advantage to be gained there.

Share this post


Link to post
Share on other sites
Someone suggested this to me :
http://plib.sourceforge.net/sg/

It looks like all I'm searching for ...

anyone any experience in using this ?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Quote:
[i]
Right. Now that that's out of the way ^_^, here's another thought: Maybe you'll be using some other third party libraries, for collision or physics, in your project. If you plan to, look at those libraries and see whether they use their own custom classes for these tasks. You probably don't want to convert between your own and and their classes ten thousand times per frame, so there might be some advantage to be gained there.

That would be a big mistake. It is good software practice keeping data dependency separate.
Say for example that after you done some work you find that you need to replace the third party collision engine because for example is not good enough at what it is suppose to do, or maybe you lost the license, or something as simple as a new update change the math library interface. You would be stuck in a big mess if you have a large project sitting on the math part of a library that was not suppose to be a math library on the first place.

Share this post


Link to post
Share on other sites
Well, all those libraries have a strong dependency of BLAS and LAPACK, whose have been writen in Fortran.
The problem is how to deal with Fortran?, I just cannot use those libraries on my DevC++ with mingw. The same thing with Visual C++ 6.0 ; installing them is so tricky. How do you deal with?

In the web there are many instalation guides for installing Boost and libraries like BLAS and LAPACK ( with Cygwin of course), but still I'm stuck!! Sorry!, I don't drive linux very well, and using Cygwin is a trully hell!

Share this post


Link to post
Share on other sites
Quote:
Original post by Anonymous Poster
Quote:
[i]
Right. Now that that's out of the way ^_^, here's another thought: Maybe you'll be using some other third party libraries, for collision or physics, in your project. If you plan to, look at those libraries and see whether they use their own custom classes for these tasks. You probably don't want to convert between your own and and their classes ten thousand times per frame, so there might be some advantage to be gained there.

That would be a big mistake. It is good software practice keeping data dependency separate.
Say for example that after you done some work you find that you need to replace the third party collision engine because for example is not good enough at what it is suppose to do, or maybe you lost the license, or something as simple as a new update change the math library interface. You would be stuck in a big mess if you have a large project sitting on the math part of a library that was not suppose to be a math library on the first place.


I can definitely see where you're coming from (but rather than data dependency, it's really third-party library dependency), but imho Vector class interfaces should be/are sufficiently consistent that you can apply automatic refactoring with minimal fuss. I'll agree on the count of it being a "bad software practice" though.

Share this post


Link to post
Share on other sites

This topic is 4399 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this