help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: R: help on Octave


From: Martin Helm
Subject: Re: R: help on Octave
Date: Tue, 26 Jun 2012 16:35:33 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120601 Thunderbird/13.0

Am 26.06.2012 16:13, schrieb Pierpaolo:
> Sure...
>
> A small part of code is:
>
> #####################################
> dimxtot = 49;  #numero nodi in x*) 
> dimytot = 49; #numero nodi in y*) 
> dy = 1/(dimytot - 1);   #rpasso in y*)
> dd = dimxtot*dimytot; #scrittura sintetica*)
> r = dx/dy;  #rapporto fra i passi*)
> cicli=10;
> t0 = clock ();
> w=zeros(3*dimxtot*dimytot,3*dimxtot*dimytot);
>
> for j = 3:(dimytot-1 -1)
>       for i = 3:(dimxtot-1 -1) 
>    w((j-1)*dimxtot+(i),(j-1)*dimxtot+(i)) = 6 + 6*r^4 + 8*(r^2);
>    w((j-1)*dimxtot+(i),(j-1)*dimxtot+(i-2))= 1;   
>    w((j-1)*dimxtot+(i),(j-1)*dimxtot+(i-1))=-4-4*(r^2);    
>    w((j-1)*dimxtot+(i),(j-1)*dimxtot+(i+1))=-4-4*(r^2);   
>    w((j-1)*dimxtot+(i),(j-1)*dimxtot+(i+2))=1;   
>    w((j-1)*dimxtot+(i),(j-1-1)*dimxtot+(i-1))=2*r^2;     
>    w((j-1)*dimxtot+(i),(j-1-1)*dimxtot+(i))=-4*r^4 -4*r^2;     
>    w((j-1)*dimxtot+(i),(j-1-1)*dimxtot+(i+1))=2*r^2;   
>    w((j-1)*dimxtot+(i),(j-1+1)*dimxtot+(i-1))=2*r^2;
>    w((j-1)*dimxtot+(i),(j-1+1)*dimxtot+(i))=-4*r^4-4*r^2;
>    w((j-1)*dimxtot+(i),(j-1+1)*dimxtot+(i+1))=2*(r^2);
>    w((j-1)*dimxtot+(i),(j-1-2)*dimxtot+(i))=1*(r^4);  
>    w((j-1)*dimxtot+(i),(j-1+2)*dimxtot+(i))=1*(r^4);
>       endfor
> endfor
> ###################################
>
> With 3*dimxtot*dimytot about 6200 I've memory error.
>
> a=rand(6200) does not give any error
> a=rand(8700) generates memory error
>
> -----Messaggio originale-----
> Da: Martin Helm [mailto:address@hidden 
> Inviato: martedì 26 giugno 2012 15:56
> A: Jordi Gutiérrez Hermoso
> Cc: address@hidden; Pierpaolo
> Oggetto: Re: help on Octave
>
> Am 26.06.2012 15:52, schrieb Jordi Gutiérrez Hermoso:
>> Oops, I made the wrong computation. I blame memroy fragmentation now.
>> - Jordi G. H. 
> ;) happened to me often enough (wrong calculations)
>
> I have some doubts, even if memory is fragmented it will just allocate
> that memory in the windows paging file.
>
> @Pierpaolo:
> Can you show us a short code snippet which leads to that problem?
> Does something as simple as
>
> a = rand(6200)
>
> show the same problem?
>
While I cannot test now why it fails on windows, I quickly tested
(setting dx to 1 because its undefined) with dimxtot=dimytot=10000 on
linux which allocates a 3e4*3e4 matrix without problems (this is a
standard build without enable64 on a 64bit GNU/Linux machine).
I can check in a few hours on a Win7.

But beside that your matrix is almost empty = sparse so I do not see the
benefit to allocate it as full matrix.
You mentioned you have to invert it. Really? I almost cannot think of a
case where you really have to explicitly invert such a matrix.

Reformulate your problem at hand to use sparse matrices and avoid the
inversion.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]