Prev: Detectind the Periodin and aperiodic componenet in speech
Next: plotting highest point in filled contour
From: James Tursa on 1 Aug 2010 17:54 "regujr regujr" <kiregujr(a)yahoo.it> wrote in message <i34ebl$91r$1(a)fred.mathworks.com>... > I have 3 array: > - row > - column > - value > These are very long array (about 1 milion). > Now my code return these 3 arrays that are necessary to create sparse matrix (in matlab). > I want return only sparse matrix because matlab has some limitation in memory management. > In other word I want that my code return only sparse matrix, not 3 vectors that can create sparse matrix. 1 million is large but not huge. That's only about 8MB per row, column, and value vector. MATLAB can easily handle this and there should be no memory problem. For these sizes, my advice is to just pass them back to MATLAB and use the sparse command to build your sparse matrix on the MATLAB side. You could also do this inside the mex routine but it won't really save you much, if anything. James Tursa
From: regujr regujr on 1 Aug 2010 18:29 > 1 million is large but not huge. That's only about 8MB per row, column, and value vector. MATLAB can easily handle this and there should be no memory problem. For these sizes, my advice is to just pass them back to MATLAB and use the sparse command to build your sparse matrix on the MATLAB side. You could also do this inside the mex routine but it won't really save you much, if anything. > > James Tursa Your observation is right but I can have 10 mld of elements in a vector ^_^. I must work with image and sometimes I can have HD images ^^. Otherwise I'm not here to ask help ^^. I try to understand how matlab implement the function "Sparse" but I don't find nothing. I need only that part of code, in fact I convert all the rest of the program, but I can not reproduce the method that put data in sparse matrix starting from row, col and vals vectors ^^ If you can tell me where I can find, or how I can reimplement code (without using sort algoritm to re-organizate vectors) I will appreciate. Thk in advance
From: Bruno Luong on 2 Aug 2010 03:00 "regujr regujr" <kiregujr(a)yahoo.it> wrote in message <i34sfj$9c6$1(a)fred.mathworks.com>... > > If you can tell me where I can find, or how I can reimplement code (without using sort algoritm to re-organizate vectors) I will appreciate. > It is not possible, the non-zero data of sparse matrix are organized by index, so sorting step is needed. It can't miraculously become sorted when the work is not properly done. I wish I can eat my meal everyday without moving the finger to cook it. There are few short examples in the doc that illustrate the internal structure of sparse. Otherwise you can hack my code spvalmex.c here: http://www.mathworks.com/matlabcentral/fileexchange/23488-sparse-sub-access Bruno
From: regujr regujr on 2 Aug 2010 04:42 > There are few short examples in the doc that illustrate the internal structure of sparse. Otherwise you can hack my code spvalmex.c here: > http://www.mathworks.com/matlabcentral/fileexchange/23488-sparse-sub-access > > Bruno Thx, as I told before I want only replicate performance of instruction 'sparse'. I try to do a sort algorithm on a vector (bubble sort) without obtaint good result (100 times more slow than sparse)
From: James Tursa on 2 Aug 2010 12:52 "regujr regujr" <kiregujr(a)yahoo.it> wrote in message <i360cu$p6n$1(a)fred.mathworks.com>... > > There are few short examples in the doc that illustrate the internal structure of sparse. Otherwise you can hack my code spvalmex.c here: > > http://www.mathworks.com/matlabcentral/fileexchange/23488-sparse-sub-access > > > > Bruno > > Thx, as I told before I want only replicate performance of instruction 'sparse'. I try to do a sort algorithm on a vector (bubble sort) without obtaint good result (100 times more slow than sparse) Wow! 100 times slower??!! Are you sure? That's amazing ... I would have expected a bubble sort to run at least 1000 times slower ... James Tursa
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 Prev: Detectind the Periodin and aperiodic componenet in speech Next: plotting highest point in filled contour |