help-octave
[Top][All Lists]
Advanced

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

Re: GSoC: Student blogs


From: c.
Subject: Re: GSoC: Student blogs
Date: Thu, 24 May 2012 13:41:33 +0200

Richard,

Please keep the list in CC

On 23 May 2012, at 19:44, richard wrote:

> On Wed, May 23, 2012 at 11:10:28AM +0200, c. wrote:
> 
>> If I understand correctly your code is something like:
>> 
>> for outer_loop_index = 1:10
>>  for inner_loop_index = 1:1e5
>>    result(outer_loop_index, inner_loop_index) = inner_loop_function 
>> (outer_loop_index, inner_loop_index);
>>  endfor
>> endfor
>> 
>> is that what you mean?
>> c.
> Hi c. 
> 
> I'm nor sure where your question is going.

Your code, as you described it, sounded like a good candidate for a 
"vectorization quiz". Search the mailing list archives for previous examples, 
in some sense, 
"vectorization quizzes" are a sort of "game" we some times like to play among 
Octave programmers to test our abilities.

Code vectorization can some times improve execution speed by orders of magnitude
and, even when it does not lead to dramatic optimization, many Octave 
programmers
find vectorized code easier to read and more "elegant".

> I would need to ask 
> about permissions before I can post a complete example for 
> the model: and there are several variations; it's a work in 
> progress. 

no need to show the full code, a stripped down example is often good enough
to try and check how much improvement you can get from vectorization.

> The parts of the code defining the loops are as follows: 
> for j= 1 : 10
> Variable = 12.0/(j+2)
> #set up initial conditions here 
> X= ones(120002,16); # just one line as an example 
>  for i= 2:120001
> # algebra calculations here : for simplicity, say g=variable; 
> # step calculations here typically  X(i,7)= X(h,7)*g ;
>  endfor 
> endfor
> # print and plot commands to output results 

this particular example looks like it can probably be reduced to a one-liner 
I'll give it a try later,
but it would be more interesting if you could propose something closer to the 
"real thing".

> Putting that more briefly - a qualified yes. 
> 
> My reason for posting was to show that the code improvements are
> likely to be of immediate use.

Of course the JIT is a great improvement, which has been in great demand for 
quite a long time
among Octave users, I also am looking forward with great excitement at the 
outcome of this project.

> Perhaps I should have added that 
> there is value in manipulating the model manually - it helps 
> my understanding of the processes. 

I don't see your point here, what do you mean by "manipulating manually"?

> HTH
> Richard A Lough
c.




reply via email to

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