help-octave
[Top][All Lists]
Advanced

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

RE: requested size too large for range of Octave's index type


From: Tim Rueth
Subject: RE: requested size too large for range of Octave's index type
Date: Mon, 16 Aug 2010 15:31:38 -0700

> -----Original Message-----
> From: Martin Helm [mailto:address@hidden 
> Sent: Sunday, August 15, 2010 8:35 PM
> To: address@hidden; address@hidden
> Subject: Re: requested size too large for range of Octave's index type
> 
> Am Montag, 16. August 2010, 05:19:30 schrieb Tim Rueth:
> > I am running a simulation that uses a 6-dimensional ndgrid. 
>  The total 
> > number of elements in this matrix is 3,670,016.  Some of 
> the elements 
> > are integers, and some are floats, but I don't actually specify 
> > whether they're integer or float other than saying 10, or 10.0, for 
> > example, when putting numbers in them.  When I try to run this 
> > simulation, I get the following
> > error:
> > 
> > "error: memory exhausted or requested size too large for range of 
> > Octave's index type -- trying to return to prompt"
> > 
> > I'm running Vista with 4GB of RAM.  Can someone tell me what the 
> > "range of Octave's index type" is?  Should I be type-casting these 
> > elements somehow so I don't waste memory?  Even for the floats, I 
> > never need more than 1 decimal place of accuracy.
> > 
> > Thanks,
> > 
> > --Tim
> 
> The size of a double is 8 bytes so given your number of 
> elements there should not be any problem (less than 30 MB), 
> the 32 bit build of octave can (provided enough ram) handle 
> 2e9 elements (which is 16 GB of RAM even for 32 bit).
> 
> So I guess something else is wrong in what you try to do.
> Can you post the part of the code which allocates this array?
> 
> Btw: 10 is always a double if you use a . or not.
> 
> - mh
> 

As you requested, here's the part of my code that allocates the ndgrid:

# set threshold min, max, and step-size parameters
cthd_min    =  -3.0;     cthd_max    =   -6.0;     cthd_st    = -0.2;
rthd_min    =   0.6;     rthd_max    =    2.0;     rthd_st    =  0.2;
bthd_min    =  -0.5;     bthd_max    =   -2.4;     bthd_st    = -0.2;
p4thd_min   =   2.0;     p4thd_max   =    5.0;     p4thd_st   =  0.2;
v1thd_min   =    20;     v1thd_max   =     48;     v1thd_st   =    2;
v2thd_min   =    20;     v2thd_max   =     42;     v2thd_st   =    2;

# Create an ndgrid for cthd, rthd, bthd, p4thd, v1thd, and v2thd
[cthd, rthd, bthd, p4thd, v1thd, v2thd] = ndgrid(
     [cthd_min  : cthd_st  : cthd_max], ...
     [rthd_min  : rthd_st  : rthd_max], ...
     [bthd_min  : bthd_st  : bthd_max], ...
     [p4thd_min : p4thd_st : p4thd_max], ...
     [v1thd_min : v1thd_st : v1thd_max], ...
     [v2thd_min : v2thd_st : v2thd_max]);

Indeed, I found that it's not the ndgrid itself that caused the memory/index
error.  Looks like I need to go through my code and find out exactly
when/where I get this error.  Simply reducing the size of the ndgrid (I made
larger step sizes) made the problem go away, but I need to investigate
further, since that's not really solving the problem.

Thanks,

--Tim



reply via email to

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