Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
allocating sparse matrix, memory problem

Subject: allocating sparse matrix, memory problem

From: m4 Chrennikov

Date: 17 Jan, 2011 12:26:04

Message: 1 of 1

Hi All.
I have a precomputed RxM matrix of velocity decrements. Now I have a vector of distancies on which I need to know decrement, so the result is NxM matrix, where each row contains the decrements at a certain distance.
                    Vtmp = spalloc( nR, nM, sum(sum(nums)) );
                    V = decrs( round(R+1), : );
                    Vtmp(nums) = sparse( V(nums) );
nums is the NxM logical matrix, it has only 1-2 nonzero elements per each row. The bottleneck is V matrix(memiry expensive), because I don't need all decrs values, but only values according to nums matrix.
How can I allocate V matrix from decrs matrix according to R and nums matricies?

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us