From: regujr regujr on
Hi,
I need help to resolve a problem. I do a code in C that I use as mex and I want create a sparse matrix and this is must return in matlab.
I have 3 vectors:
- row vector
- column vector
- value vector
Now I return this 3 vectors and in matlab I use command "sparse" to create the matrix. But as you can understand, if I return 3 vectors sometimes I have problem of "Out of memory".
I try to use mxCreateSparse, but I understand that I can not pass these 3 vectors and only solution is do an order of these array but this is too long!

I see that matlab when I use "sparse" take about 10 seconds and I want only reproduce this performance in C - mex code.

thk in advance

bye bye
From: James Tursa on
"regujr regujr" <kiregujr(a)yahoo.it> wrote in message <i33696$ihp$1(a)fred.mathworks.com>...
> Hi,
> I need help to resolve a problem. I do a code in C that I use as mex and I want create a sparse matrix and this is must return in matlab.
> I have 3 vectors:
> - row vector
> - column vector
> - value vector
> Now I return this 3 vectors and in matlab I use command "sparse" to create the matrix. But as you can understand, if I return 3 vectors sometimes I have problem of "Out of memory".
> I try to use mxCreateSparse, but I understand that I can not pass these 3 vectors and only solution is do an order of these array but this is too long!
>
> I see that matlab when I use "sparse" take about 10 seconds and I want only reproduce this performance in C - mex code.

Have you considered using mexCallMATLAB?

James Tursa
From: regujr regujr on
> Have you considered using mexCallMATLAB?
>
> James Tursa

Now I try it, other solutions ?
From: James Tursa on
"regujr regujr" <kiregujr(a)yahoo.it> wrote in message <i3409l$6jc$1(a)fred.mathworks.com>...
> > Have you considered using mexCallMATLAB?
> >
> > James Tursa
>
> Now I try it, other solutions ?

It is still unclear to me what exactly you are trying to do, and what you have tried so far and why it is not working for you. Can you provide a short example of what works for you in m-code, and then what exactly you want to do in C code?

James Tursa
From: regujr regujr on
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.