forum.alglib.net

ALGLIB forum
It is currently Sun Dec 22, 2024 11:19 pm

All times are UTC


Forum rules


1. This forum can be used for discussion of both ALGLIB-related and general numerical analysis questions
2. This forum is English-only - postings in other languages will be removed.



Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Memory usage of rmatrixsolvels
PostPosted: Wed Jul 24, 2013 7:17 pm 
Offline

Joined: Fri Feb 08, 2013 5:42 pm
Posts: 4
Hello Sergey,
I am trying to use rmatrixsolvels to solve a system of linear equation. I can get it to work fine, but sometimes I need to input matrixes with thousand of elements.
For exemple, a typical call would be (using C#):
rmatrixsolvels(a, 2, 9000, b, 0.0, out info, out rep, out x);
with "b" a vector of length 2 and "a" a matrix of dimension[2,9000];

Such call use a lot of memory (over 1.3 go). Is there any way to limit memory usage? Or is there another similar function I could use to do the same job?

thank you


Top
 Profile  
 
 Post subject: Re: Memory usage of rmatrixsolvels
PostPosted: Mon Jul 29, 2013 1:29 pm 
Offline
Site Admin

Joined: Fri May 07, 2010 7:06 am
Posts: 927
Hello!

The reason behind such large memory consumption is that ALGLIB allocates 9000x9000 array for Rep.CX field, where nullspace(A) is stored.

Memory impact is insignificant when function is used in most traditional way (more rows than variables), so this field is always allocated. However, your use case is unusual because you have much more variables than rows. If you want, you may try to solve this issue as follows:
* comment out all rows in rmatrixsolvels() which initialize Rep.CX
* replace rmatrixsvd(a, nrows, ncols, 1, 2, 2, sv, u, vt) in rmatrixsolvels() by rmatrixsvd(a, nrows, ncols, 1, 1, 1, sv, u, vt)

I have not tested these modifications, but they should work. In case I forgot something, your program should crash with violation of array bounds, so you won't miss it :)

P.S. I added notice to implement compact version of SolveLS(), but it will be done in 3.9.0, because 3.8.0 is in the feature freeze mode (will be released within days from now).


Top
 Profile  
 
 Post subject: Re: Memory usage of rmatrixsolvels
PostPosted: Mon Jul 29, 2013 1:41 pm 
Offline

Joined: Fri Feb 08, 2013 5:42 pm
Posts: 4
Thank you very much for your support!


Top
 Profile  
 
 Post subject: Re: Memory usage of rmatrixsolvels
PostPosted: Thu Aug 15, 2013 10:41 am 
Offline

Joined: Thu Sep 02, 2010 10:43 am
Posts: 9
But the 9000x9000 matrix is always present, or am i wrong ?

if i use it traditional with 9000 points in 2 dimensions, the left singular matrix u should be 9000x9000 if calculated wholly and for 2 points in 9000 dimensions the right singular matrix v is of that size.

With uneeded and vtneeded = 1, the output matrices should be rectangular


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 34 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group