Jump to content
  • Advertisement
Sign in to follow this  
Boldt

Sparse Matrix Implementation

This topic is 4758 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

Hi Guys How does one best implement a class to represent sparse matrices. Common operations like multiplication with matrices and vectors should also be implemented. I guess you must have some kind of datastructure like (r,c,value) where (r,c) are an entry into the matrix and value are the value of that entry. But should you have some kind of sorting on the datastructure, or maybe multiple ways to iterate through this, depending of the type of multiplication you are doing? Niels

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by Boldt
How does one best implement a class to represent sparse matrices. Common operations like multiplication with matrices and vectors should also be implemented.

Any particular reason you are writing your own when there are so many already-written and debugged libraries out there?

A Google search for "sparse matrix class" pulls up things like the Boost library implementation (if you program in C++, you should know about Boost) and SparseLib++ from NIST. Both of those are widely used.

Other results include an implementation using only the C++ STL, implementations in python and C#, and that's just the first page of the search results. There are several other non-free implementations, like the Intel Performance Primatives library.

Assuming you want to roll your own (I don't see why you would) you can search for "sparce matrix algorithms" and again find all the information you are looking for.

frob.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!