Thread: Help via references please!

  1. #1
    Not bad at Crack Attack!
    Join Date
    Aug 2003
    Posts
    45

    Help via references please!

    Basically I need to program large (10000 square) sparse symmetric matrices in C efficiently. Can someone point me towards some literature on this?

    Could someone also provide a sample bit of code that takes an integer n and malloc's an n x n matrix? It's midday and I still haven't woken up properly!

    Thanks in advance,
    Matt


  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    The FAQ will have some stuff to get you going.

    gg

  3. #3
    Not bad at Crack Attack!
    Join Date
    Aug 2003
    Posts
    45
    I had a meander through the examples section and the FAQ but nothing struck me as particularly relevant. However, I have managed to find out that sparse matrices are usually dealt with by storing the co-ordinates of the non-zero entries. This is pretty cool and also rather obvious. But my second request still stands.


  4. #4
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    I agree that the FAQ really doesn't have much relevant to sparse matrices. Your best bet is to go get an advanced algorithms/data structures book and search google. As for someone giving you code, don't hold your breath. Those of us that are willing and able to write code for such a complex data structure don't want to do it unless absolutely necessary, I know I don't. The last time I wrote code to build and maintain a sparse matrix, I think I vowed never to do it again without exhausting all other alternatives first. Besides, even simple sparse matrix code is too long and complex for these forums.
    My best code is written with the delete key.

  5. #5
    Not bad at Crack Attack!
    Join Date
    Aug 2003
    Posts
    45
    Originally posted by Prelude
    I agree that the FAQ really doesn't have much relevant to sparse matrices. Your best bet is to go get an advanced algorithms/data structures book and search google. As for someone giving you code, don't hold your breath. Those of us that are willing and able to write code for such a complex data structure don't want to do it unless absolutely necessary, I know I don't. The last time I wrote code to build and maintain a sparse matrix, I think I vowed never to do it again without exhausting all other alternatives first. Besides, even simple sparse matrix code is too long and complex for these forums.
    My code request was just for a little (tiny!) function that takes an integer n and generates an all zero n X n matrix. (ie a tool for going the "long way round")

  6. #6
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Originally posted by Matt13
    My code request was just for a little (tiny!) function that takes an integer n and generates an all zero n X n matrix. (ie a tool for going the "long way round")
    Take a look here, paying attention to the threads on multi-dimensional arrays.

    Quzah.
    Hope is the first step on the road to disappointment.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compiler settings, references etc...
    By ejohns85 in forum C++ Programming
    Replies: 0
    Last Post: 05-14-2009, 04:53 AM
  2. VC++ 2005 Express: missing references page
    By psychopath in forum Tech Board
    Replies: 1
    Last Post: 08-21-2006, 04:55 PM
  3. Vector of references
    By roktsyntst in forum C++ Programming
    Replies: 5
    Last Post: 04-15-2003, 06:40 PM
  4. declare references to references works!
    By ManuelH in forum C++ Programming
    Replies: 4
    Last Post: 01-20-2003, 08:14 AM
  5. Pointers and references...
    By SushiFugu in forum C++ Programming
    Replies: 6
    Last Post: 12-08-2001, 04:21 PM