comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: adding sparse arrays
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: adding sparse arrays [message #54300 is a reply to message #54296] Thu, 07 June 2007 08:23 Go to previous messageGo to previous message
Vince Hradil is currently offline  Vince Hradil
Messages: 574
Registered: December 1999
Senior Member
On Jun 7, 9:32 am, nivedita.raghun...@gmail.com wrote:
> Hi all,
>
> Thanks for the suggestions.
>
> The arrays that I'm working with are really huge so there's no option
> of A+B. I cannot convert to full matrix form using fulstr and have to
> work only with the sparse arrays A and B to get another sparse array (A
> +B). The non-zero elements of the two arrays are in different index
> positions (ija), so the sa vectors cannot be added directly.
>
> Under these constraints, whats the best (and the fastest) way to add
> them?
>
> -Nivedita
>
> On Jun 7, 4:36 am, Paolo Grigis <pgri...@astro.phys.ethz.ch> wrote:
>
>> nivedita.raghun...@gmail.com wrote:
>>> Hello all,
>
>>> How do I add two sparse arrays? The fact that a sparse function to add
>>> doesn't exist makes me think its pretty simple, but I just can't get
>>> it. I do not want to use any loops.
>
>> Well, it depends where the non-zero, non-diagonal elements of the two
>> arrays are. If they are located in the same positions, you just need
>> to add the sa vectors while keeping the ija vectors fixed.
>
>> Ciao,
>> Paolo
>
>>> Thanks in advance.
>
>>> -Nivedita- Hide quoted text -
>
>> - Show quoted text -

I don't use sprsin, but can you try c = sprsin(fulstr(a)+fulstr(b))?
or maybe c = sprsin(fulstr(temporary(a))+fulstr(temporary(b))) to
delete a and b from memory?
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Executable files
Next Topic: scaling idlGrAxis ticks?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 07:27:34 PDT 2025

Total time taken to generate the page: 0.88401 seconds