help-octave
[Top][All Lists]
Advanced

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

Re: out of memory or dimension too large for Octave's index type


From: Jiang, Yanda [E CPE]
Subject: Re: out of memory or dimension too large for Octave's index type
Date: Wed, 26 Oct 2022 15:03:41 +0000

H(:, noslack) = sparse(Bf(:, noref)) / sparse(Bbus(noslack, noref));


still gave me the error message as following:

debug> H(:, noslack) = sparse(Bf(:, noref)) / sparse(Bbus(noslack, noref));
error: out of memory or dimension too large for Octave's index type
error: called from
    makePTDF at line 76 column 15


Does that mean the problem is not related to index type?


Best,
Yanda

From: Jiang, Yanda [E CPE] <yandaj@iastate.edu>
Sent: Wednesday, October 26, 2022 10:02 AM
To: Markus Mützel <markus.muetzel@gmx.de>
Cc: help@octave.org <help@octave.org>
Subject: Re: out of memory or dimension too large for Octave's index type
 
Thanks, Markus.

If the sentence below


From: Markus Mützel <markus.muetzel@gmx.de>
Sent: Wednesday, October 26, 2022 9:46 AM
To: Jiang, Yanda [E CPE] <yandaj@iastate.edu>
Cc: help@octave.org <help@octave.org>
Subject: Re: out of memory or dimension too large for Octave's index type
 
Am 26. Oktober 2022 um 16:32 Uhr schrieb "Jiang, Yanda [E CPE]":
> Hi Markus,


> Thanks for your reply.
> That issue has been resolved.

Which of the two proposed changes did you test? Or did both of them work? I'd like to fix this in Octave so others won't run into the same issue in the future.

> Then how about this below one? (nbr and nb are very large). I encountered the same problem as before.
> H = sparse(zeros(nbr, nb));

This creates a *full* matrix with those dimensions by calling the `zero` function. (Or at least it tries to do so.) After that, it would convert that full matrix to a sparse matrix.
Try to directly create a sparse matrix with those dimensions instead:

H = sparse(nbr, nb);

See also the documentation for `sparse` that also mentions other constructors. You can open the documentation with this command:
doc sparse

Markus
 
------------------------------------------------------------

From: Markus Mützel <markus.muetzel@gmx.de>
Sent: Wednesday, October 26, 2022 4:37 AM
To: Jiang, Yanda [E CPE] <yandaj@iastate.edu>
Cc: help@octave.org <help@octave.org>
Subject: Re: out of memory or dimension too large for Octave's index type
 

Am 26. Oktober 2022 um 07:06 Uhr schrieb "Jiang, Yanda [E CPE]":
> Dear Sir/Madam,


> I am a phd student who is using octave for my research work.
> While running my code, I got this error message. 
>

> After hours of investigation, I believe the reason is one matrix is 232100*71368.
> Do you have any method to solve this problem?


For the future: Please don't use images of text. Paste the text directly instead.


I'm guessing your input to `glpk` is sparse. Line 507 of `glpk.m` uses:
  if (any (! isfinite (A(:))))
    error ("glpk: The values in A must be finite");
  endif

`isfinite (A(:))` creates a sparse Boolean matrix. However, it is likely not sparsely populated which might be the cause for the memory issue.

Does it work if you edit that file and change the above lines to the following?
  if (any (isinf (A(:))) || any (isnan(A(:))))
    error ("glpk: The values in A must be finite");
  endif


Alternatively, try:
  if (any (any (! isfinite (A))))
    error ("glpk: The values in A must be finite");
  endif


Markus

reply via email to

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