object oriented or not?

object oriented or not?

Post by dem » Tue, 23 Sep 2003 20:37:42



Hi

We have a large package of matlab software developed during the last
years. It is a tool for simulation of navigation sensors and
Kalmanfiltering.

It is now time to upgrade the tool because of many new requirements.
It is very likely that the whole thing will be reprogrammed.

My first impresison, due to the notation of oop in matlab
(bar=foo(bar,'data',value)), was that this was not oop after all, and
must be slow because of all the copying instead of passing by
reference. But as I read the documentation it seems that matlab is
more object oriented than it appears, and even though passing by
reference is not done, copies aren't always made? Am I on the right
track?

So if you have experience with oop in matlab:
Should we consider oop in matlab?
What are the pros and cons for oop in matlab?
Does a oop coded program run slower?
Is the oop in matlab R13 likely to be compatible with future matlab
oop?

Kristian

 
 
 

object oriented or not?

Post by Davi » Fri, 26 Sep 2003 05:02:54



> But as I read the documentation it seems that matlab is
> more object oriented than it appears, and even though passing by
> reference is not done, copies aren't always made? Am I on the right
> track?

Yes. Only those class members are copied which are altered in the
function.

Quote:> So if you have experience with oop in matlab:
> Should we consider oop in matlab?
> What are the pros and cons for oop in matlab?
> Does a oop coded program run slower?

The OOP features from Matlab are very basic, especially the
inheritance implementation is kind of clumsy. From my experience,
access to class/structure fields can be very slow compared to
conventional arrays. If you're using Matlab R13, remember that the JIT
accelerator cannot speed up loops which access structures or classes.
However, you can always copy class members to local variables, which
takes almost no time unless they are altered.

But in the end it all depends on the kind of algorithms you're going
to implement. For a big project you should really program some simple
test classes which more or less reflect the typical usage you need in
your algorithms and use the profiler.

hth,
David

 
 
 

object oriented or not?

Post by AJ \ » Fri, 26 Sep 2003 22:04:04



Quote:> Hi

> We have a large package of matlab software developed during the last
> years. It is a tool for simulation of navigation sensors and
> Kalmanfiltering.

> It is now time to upgrade the tool because of many new requirements.
> It is very likely that the whole thing will be reprogrammed.

> My first impresison, due to the notation of oop in matlab
> (bar=foo(bar,'data',value)), was that this was not oop after all, and
> must be slow because of all the copying instead of passing by
> reference. But as I read the documentation it seems that matlab is
> more object oriented than it appears, and even though passing by
> reference is not done, copies aren't always made? Am I on the right
> track?

> So if you have experience with oop in matlab:
> Should we consider oop in matlab?
> What are the pros and cons for oop in matlab?
> Does a oop coded program run slower?
> Is the oop in matlab R13 likely to be compatible with future matlab
> oop?

> Kristian

A few years ago (Matlab version 5 I think) I took a moderate complexity
application and converted it to OOP model. The encapsulation was nice, and
the application itself (excluding the object definitions themselves) became
quite short and readable. However its execution speed as *much* slower. (3x?
5x?) Much of that slowdown may have since been mitigated through Mathworks
enhanced compiler technology (JIT). Perhaps other can speak to their
experiences with Version 6.1 and higher.

Cheers,
Aj

 
 
 

object oriented or not?

Post by dem » Sat, 27 Sep 2003 15:28:54





> > Hi

> > We have a large package of matlab software developed during the last
> > years. It is a tool for simulation of navigation sensors and
> > Kalmanfiltering.

> > It is now time to upgrade the tool because of many new requirements.
> > It is very likely that the whole thing will be reprogrammed.

> > My first impresison, due to the notation of oop in matlab
> > (bar=foo(bar,'data',value)), was that this was not oop after all, and
> > must be slow because of all the copying instead of passing by
> > reference. But as I read the documentation it seems that matlab is
> > more object oriented than it appears, and even though passing by
> > reference is not done, copies aren't always made? Am I on the right
> > track?

> > So if you have experience with oop in matlab:
> > Should we consider oop in matlab?
> > What are the pros and cons for oop in matlab?
> > Does a oop coded program run slower?
> > Is the oop in matlab R13 likely to be compatible with future matlab
> > oop?

> > Kristian

> A few years ago (Matlab version 5 I think) I took a moderate complexity
> application and converted it to OOP model. The encapsulation was nice, and
> the application itself (excluding the object definitions themselves) became
> quite short and readable. However its execution speed as *much* slower. (3x?
> 5x?) Much of that slowdown may have since been mitigated through Mathworks
> enhanced compiler technology (JIT). Perhaps other can speak to their
> experiences with Version 6.1 and higher.

> Cheers,
> Aj

Thanks for the info.

The shortness and readability is one of the attractions for us.

BUT, execution speed much lower than today's is very not wanted. Does
anyone have experience with the JIT in this context?

Kristian

 
 
 

1. Object Oriented: reference to object

Hi!,

I have a problem working with Object.
Suppouse that we have three object A, B, C of the same class, and we
have one object Z, which is part of A,B and C.
For instance A, B and C could be three different firms and Z could be
a bank.

Now suppouse that I change a value in Z, of course I want the three
other object knowing that the value in Z changed.
For instance suppouse that the bank change the rate of interest, so
when the firms ask the rate of interest to the bank they have to see
alway the same rate of interest.

Basically this could be possible to be solved if A, B and C have a
reference of Z. However, in matlab I just can make that A, B and C
have a copy of Z. So when I change a value in Z, it does not affect
A, B and C.

2. CVS permissions

3. compile object oriented code work arounds?

4. ??'s for a potential CEO?

5. compiler problem: how to compile object-oriented functions

6. Blue screen Hell for 3 months and running

7. Compiling object-oriented methods

8. BEWARE OF HACKS?

9. literature, object oriented programming

10. Object Oriented Programming w/ Wavelet Toolbox

11. Why is there no object-oriented programming in matlab?

12. Material about object oriented programming in Matlab

13. object oriented matlab