help-octave
[Top][All Lists]
Advanced

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

Re: a difficult homework


From: Nicholas Jankowski
Subject: Re: a difficult homework
Date: Tue, 27 Aug 2019 10:48:06 -0400

On Tue, Aug 27, 2019 at 8:24 AM shivax via Help list for GNU Octave <address@hidden> wrote:
sorry .. I made a mistake in writing the code
The correct version is:
(I recreated an exercise with the number of numbers of my work..this is a
test to show you that I can't run it for memory)


B=5000;
a1=fix(rand(B).*100);
 a=a1(:);
 b=1:(B*B-1);
 c=((1:(B*B-1)))+1;
size(b)
size(c)
 cc=uint16(a.*ones(1,numel(b)));

  %d=cc(b:end)
 g=uint16((1:rows(cc))'.*ones(1,numel(b)));
  g1=g>=b&g<=c;

 e=min(~g1.*max(cc).+g1.*cc)
error: out of memory or dimension too large for Octave's index type
error: called from
    prova2 at line 8 column 4

i used unint16..but the result is the same..:(

if i try this code with B=50 it runny perfectly



ok, since it runs for  B=50 and you've avoided looping, it seems you've managed to solve the problem as you first presented it.  there are numerous computer algorithms that will work perfectly well for certain data sizes but require completely different approaches for 'big data'. 

Perhaps you could share the actual problem you're trying to solve.  I feel like we could keep proposing an infinite number of suggestions that would lead you in the wrong direction if we don't understand what it is that the homework is trying to teach you. Is the goal to work on code vectorization, to manage large dataset problems, etc.  While we don't want to solve the actual problem for you, we should be able to provide more useful guidance. 

reply via email to

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