Re: sparse matrix newbie

From: Dan Tex1 (dantex1_at_aol.com)
Date: 11/28/03


Date: 28 Nov 2003 00:51:39 GMT


>From: Fernan Bolando fernanbolando@mailc.net
>Date: 11/26/03 4:57 PM Pacific Standard Time
>Message-id: <571987b260e99de5110a3b03355d618f@news.teranews.com>
>
>In article <20031123204144.18969.00000848@mb-m18.aol.com>, Dan Tex1 wrote:
>>>From: Fernan Bolando fernanbolando@mailc.net
>>>
>>>In article <20031122155423.03434.00000745@mb-m29.aol.com>, Dan Tex1 wrote:
>>>>>From: Fernan Bolando fernanbolando@mailc.net
>
>>>>>I am looking for a sparse matrix library for linux gcc compiler.
>>>>
>>>> Do you really "need" a sparse solver? The complexity of such a solver is
>>>much
>>>> higher than just a simple solver algorithm. Why not just write the
>>>"solver"
>>>> code yourself?
>>>
>>>I am also considering writing it myself, But it seems a sparse program
>>>is very problem specific and indeed very complex. I am condering using
>>>gsl as the matrix solver initially and update it to sparse matrix as the
>>>need come up. Do you think this is an effective approach considering I
>>>am new at this? So far I have tested my initial code using gsl dense
>>>matrix code.
>>
>> That sounds like an effective and logical approach to me. Sparse codes
>are
>> great when you need them. They're just too complex for when you don't need
>> them ( and aren't already set up to use them ). If a group of problems
>aren't
>> large enough, the effort required to set up sparse solvers just won't pay
>off.
>>
>I am wondering which is faster? calculating a large matrix in dense
>matrix algorithm or processing the matrix in sparse mat. Do you think it
>is advantagous to initially analyze the matrix then decide whether to
>solve it in dense or sparse? You see am thinking of putting both dense and
>sparse matrix into my program and then write a simple code to
>pre-analyse the problem and then decide whether to use sparse or dense
>matrix.
>
>I am thinking that if a matrix does not have enough zero's then the
>advantages of using sparse matrix disappears plus I would be wasting so
>much cpu time processing the data into sparse.
>
>,Fernan

I'd say you're thinking along the "right" lines. Keep in mind that it always
depends on what types of systems you are doing the solving for. However,
with a sparse solver... you'll need to arrange your input data in such a way
as to facilitate your sparse solver. Thus... using a sparse solver will take
more time even to prep your data to send to the solver. As a result... it may
not be all that easy for you to set up your algorithm to work with both a
sparse solver and a more elementary solver.

If I were in your shoes... ( keep in mind I don't know what type of problems
you are solving or how large they truly are 0... I'd write the algorithm to
use a simpler solver. However... while writing it... I'd be aware of the
fact that I might want to implement a sparse solver later. In other words...
I'd attempt to write the code so that it can be easily altered later without
causing too many headaches. An advantage to this way is that you will learn
things along the way that you can make better ( ie. redo ) when you add
sparse solver capabilites.

Dan :-)



Relevant Pages

  • Re: sparse matrix newbie
    ... calculating a large matrix in dense ... >>matrix algorithm or processing the matrix in sparse mat. ... > depends on what types of systems you are doing the solving for. ... > as to facilitate your sparse solver. ...
    (comp.programming)
  • Re: Solving a large sparse system with a single dense row/column?
    ... *and* a dense row. ... Renumbering deals ... you can renumber your system to take advantage of sparse solver. ...
    (sci.math.num-analysis)