Quantcast

Matlab vs. Octave speed of computation

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Matlab vs. Octave speed of computation

lorenzosan
Hello,
I am used to work with Matlab, but for economical reason I am switching to Octave.
I tried ''as it is'' my matlab code in octave and it works!
Now, on a test set of variables, Matlab needs 0.91 s while Octave 15 s.

My question is: is it normal? Or maybe, even if it works, it is better to change the code (for instance ''end'' in Matlab to ''endfor'' or ''endif'')?
What are your experience?

Thank you very much!
Lorenzo.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Matlab vs. Octave speed of computation

lorenzosan
Sorry,
maybe, considering the previous messages, it is needed to say that I am using some for loops. I tryied to vectorialize as much as possible, but I am working with a piecewise potential so I do not see any way to avoid some of them.

Any hints?

Thank you!
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Matlab vs. Octave speed of computation

Jaroslav Hajek-2
On Thu, Apr 16, 2009 at 7:16 AM, lorenzosan <[hidden email]> wrote:
>
> Sorry,
> maybe, considering the previous messages, it is needed to say that I am
> using some for loops. I tryied to vectorialize as much as possible, but I am
> working with a piecewise potential so I do not see any way to avoid some of
> them.
>
> Any hints?
>

Post the code. Maybe someone else will see a vectorized way.
Also, loopy code can be quite easily handled in writing a DLD function
in C++ to be called from Octave.



--
RNDr. Jaroslav Hajek
computing expert & GNU Octave developer
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz
_______________________________________________
Help-octave mailing list
[hidden email]
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Matlab vs. Octave speed of computation

lorenzosan
Thanks to all,
unfortunately I am not the only person who has written the code and I can not post it here!
In the meanwhile I have avoided another loop with a series of floor and rem, may be not optimized but I have seen a slight improvement in Matlab but a good one in Octave. Now it is ''only'' twice slower.


I think I will try C++, at the end...

Thanks!

Jaroslav Hajek-2 wrote
On Thu, Apr 16, 2009 at 7:16 AM, lorenzosan <ferraroto@gmail.com> wrote:
>
> Sorry,
> maybe, considering the previous messages, it is needed to say that I am
> using some for loops. I tryied to vectorialize as much as possible, but I am
> working with a piecewise potential so I do not see any way to avoid some of
> them.
>
> Any hints?
>

Post the code. Maybe someone else will see a vectorized way.
Also, loopy code can be quite easily handled in writing a DLD function
in C++ to be called from Octave.



--
RNDr. Jaroslav Hajek
computing expert & GNU Octave developer
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz
_______________________________________________
Help-octave mailing list
Help-octave@octave.org
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Matlab vs. Octave speed of computation

Jaroslav Hajek-2
On Fri, Apr 17, 2009 at 8:02 AM, lorenzosan <[hidden email]> wrote:
>
> Thanks to all,
> unfortunately I am not the only person who has written the code and I can
> not post it here!

Maybe you can isolate just the bottlenecks and post them, or post an
equivalent code to avoid violating copyright.


> In the meanwhile I have avoided another loop with a series of floor and rem,
> may be not optimized but I have seen a slight improvement in Matlab but a
> good one in Octave. Now it is ''only'' twice slower.
>
>
> I think I will try C++, at the end...
>
> Thanks!
>

that's up to you, of course, but maybe that's not needed. in any case
without more information you can't get more help.

--
RNDr. Jaroslav Hajek
computing expert & GNU Octave developer
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz
_______________________________________________
Help-octave mailing list
[hidden email]
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Matlab vs. Octave speed of computation

c.-2
In reply to this post by lorenzosan

On 17 Apr 2009, at 08:02, lorenzosan wrote:

>
> Thanks to all,
> unfortunately I am not the only person who has written the code and  
> I can
> not post it here!
> In the meanwhile I have avoided another loop with a series of floor  
> and rem,
> may be not optimized but I have seen a slight improvement in Matlab  
> but a
> good one in Octave. Now it is ''only'' twice slower.
>
>
> I think I will try C++, at the end...

Lorenzo,
 From your previous emails I deduced that

1) As you are not allowed to share the code of your prgram it probably  
is not free software
2) As you mentioned "end users", I believe your program is being  
distributed.

if these assumptions are correct then consider that:
"Code written using Octave's native plug-in interface (also known as  
a .oct file) necessarily links with Octave internals and is considered  
a derivative work of Octave and therefore must be released under terms  
that are compatible with the GPL." [1]

so if you distribute your code as .oct files you might be required to  
share the source.

If my assumptions were incorrect then sorry for the noise.

> Thanks!

c.


[1] http://www.nabble.com/proposed-FAQ-entries-about-licensing-td22685608.html#a22685608
_______________________________________________
Help-octave mailing list
[hidden email]
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
Loading...