help-octave
[Top][All Lists]
Advanced

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

Re: Help-octave Digest, Vol 37, Issue 6


From: David Doria
Subject: Re: Help-octave Digest, Vol 37, Issue 6
Date: Fri, 3 Apr 2009 12:44:54 -0400

Has anyone else seen the problem with scatter() that I was talking about?

Thanks,

David


On Fri, Apr 3, 2009 at 12:38 PM, <address@hidden> wrote:
Send Help-octave mailing list submissions to
       address@hidden

To subscribe or unsubscribe via the World Wide Web, visit
       https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
or, via email, send a message with subject or body 'help' to
       address@hidden

You can reach the person managing the list at
       address@hidden

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Help-octave digest..."


Today's Topics:

  1. Re: How to derive from 'octave_base_value' ? (John W. Eaton)
  2. Re: Performance optimization (allocation inside a for loop)
     (John W. Eaton)
  3. Re: Performance optimization (allocation inside a for loop) (r)
  4. Re: Performance optimization (allocation inside a for loop)
     (Jaroslav Hajek)
  5. phase space (Johannes Wolfgang Woger)
  6. octave plot function (Maxwell Blair)
  7. undefined symbol: _glp_lib_fault_hook (Rishi Amrit)
  8. Re: phase space (Carlo de Falco)
  9. Re: phase space (Johannes Wolfgang Woger)
 10. Octave to serial on Mac OS-X (Gondwana)
 11. Re: octave plot function (David Bateman)


----------------------------------------------------------------------

Message: 1
Date: Thu, 2 Apr 2009 16:04:44 -0400
From: "John W. Eaton" <address@hidden>
Subject: Re: How to derive from 'octave_base_value' ?
To: S?ren Hauberg <address@hidden>
Cc: address@hidden
Message-ID: <address@hidden>
Content-Type: text/plain; charset=iso-8859-1

On  2-Apr-2009, S?ren Hauberg wrote:

| s?n, 29 03 2009 kl. 19:03 -0400, skrev John W. Eaton:
| > On 22-Mar-2009, S?ren Hauberg wrote:
| >
| > | s?n, 22 03 2009 kl. 20:53 +0100, skrev Jaroslav Hajek:
| > | > I think your derived class must override octave_base_value::is_defined.
| > |
| > | Thanks, that was the missing part.
| >
| > and earlier you wrote:
| >
| > | I'd like to create a new type in Octave that simply holds a pointer to
| > | some object in an external library. The attached code implements a very
| > | simple type in Octave that just holds a string. This was the simplest
| > | possible type I could think of. I compile the code with
| >
| > Does this solution (using octave_value) give you the copying semantics
| > that you want?
|
| This sounds like a trick question :-) I think it does what I want, but
| my current code is quite poorly tested, so I'm not sure. Is there
| anything I should be looking out for?

I was just wondering if the default copy-on-write semantics of the
octave_valeu class caused trouble for you.  Or maybe it doesn't matter
if you just have a scalar object?  I'm not sure.  I just remember
running into trouble when trying to wrap pointers for COMEDI objects
because I really needed reference/pointer/handle semantics for that.

jwe



------------------------------

Message: 2
Date: Thu, 2 Apr 2009 16:06:23 -0400
From: "John W. Eaton" <address@hidden>
Subject: Re: Performance optimization (allocation inside a for loop)
To: r <address@hidden>
Cc: address@hidden
Message-ID: <address@hidden>
Content-Type: text/plain; charset=us-ascii

On  2-Apr-2009, r wrote:

| I think chunks of ~5% of the structure size (perhaps more for smaller
| arrays) would be affordable by anyone and would effectively fix these
| allocation issues in practical applications. Whether it is worth the
| effort is a different question.

If you think this is important, how about submitting a patch?

jwe



------------------------------

Message: 3
Date: Thu, 2 Apr 2009 22:06:46 +0100
From: r <address@hidden>
Subject: Re: Performance optimization (allocation inside a for loop)
To: address@hidden
Message-ID:
       <address@hidden>
Content-Type: text/plain; charset=ISO-8859-1

On Thu, Apr 2, 2009 at 9:06 PM, John W. Eaton <address@hidden> wrote:
>
> If you think this is important, how about submitting a patch?

Sorry, I didn't mean to push anyone. Feel free to do whatever you like
with my suggestions. As for the patch, I'm not capable of preparing
one, really.

Cheers,
-r.


------------------------------

Message: 4
Date: Fri, 3 Apr 2009 07:11:55 +0200
From: Jaroslav Hajek <address@hidden>
Subject: Re: Performance optimization (allocation inside a for loop)
To: r <address@hidden>
Cc: address@hidden
Message-ID:
       <address@hidden>
Content-Type: text/plain; charset=ISO-8859-1

On Thu, Apr 2, 2009 at 9:53 PM, r <address@hidden> wrote:
> On Thu, Apr 2, 2009 at 9:59 AM, Francesco Potorti` <address@hidden> wrote:
>>> ?for n = [1:n]
>> ?A prefereable way is to write
>>
>> for ii = 1:n
>
> Sure, my mistake.
>
>> In the cases when you really need a for loop because your code cannot be
>> vectorised, the efficient way is to either preallocate the vector, as
>> you did, or to start writing from the end using
>> ?for ii = n:-1:1
>
> That's a good idea. Perhaps it would be enough to document these
> solutions (e.g. in "help for") so that newcomers didn't had to
> rediscover them on their own.
>
>>>So the complexity is O(n^2).
>>
>> Well, given two points, it could be anything :)
>
> plot([10 20 30 40 50 60 70 80 90 100 120 150]*1000, [0.88 2.11 3.9
> 6.48 10.7 19.9 28.3 39.8 58.2 82.1 123 215])
>
>> Hm. ?Maybe growing in fixed-size chunks would be a good idea, in fact it
>> would significantly alleviate the problem you observe. ?Maybe also
>> growing in variable-size chunks would be a good idea. ?In fact, others
>> have observed that this would be dangerous for really big arrays, but
>> growing a big array is anyway bad practice and very slow, so those
>> conciously working at the limits of available memory will use the
>> currently recommended techniques, while the others could benefit from
>> improved performance and not be too disturbed by the occasional
>> out-of-memory error.
>
> I think chunks of ~5% of the structure size (perhaps more for smaller
> arrays) would be affordable by anyone

based on what...?

> and would effectively fix these
> allocation issues in practical applications. Whether it is worth the
> effort is a different question. It certainly doesn't help Octave when
> somebody executes the same code in Matlab and Octave and the latter is
> hundreds times slower.
>
> Regards,
>
> -r.
>

I don't think things work differently in Matlab. At least with Matlab
2007, I see the same behaviour.
A lot of code runs faster in Matlab because it's better optimized,
especially given the JIT accelerator. But there's also code that runs
faster in Octave. We don't take always the same path as Matlab. I, for
instance, don't think that a JIT compiler is really such a great idea.
What doesn't help Octave would probably fill a long list. What does
help Octave includes donations, patches, bug reports, etc.

--
RNDr. Jaroslav Hajek
computing expert & GNU Octave developer
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz



------------------------------

Message: 5
Date: Fri, 03 Apr 2009 14:55:32 +0200
From: Johannes Wolfgang Woger <address@hidden>
Subject: phase space
To: address@hidden
Message-ID: <address@hidden>
Content-Type: text/plain; charset=ISO-8859-15; format=flowed

Hi,
I am an newby.

How can I obtain a plot of the phase portrait
of Lotka-Volterra:

octave:92> function xdot = f(x,t)
 >  a = 4;
 >  b = 4;
 >  c = 4;
 >  d = 8;
 >  E = 1;
 >  K = 1;
 >  xdot = zeros(2,1);
 >  xdot(1) = x(1)*(a-b*x(2)-E*x(1));
 >  xdot(2) = x(2)*(d*x(1)-c-K*x(2));
 >  endfunction
octave:93>
octave:93> t = linspace(0,50,100);
octave:94> x = lsode("f", [2,1],t);
octave:95> plot(t,x);


Thanks


------------------------------

Message: 6
Date: Thu, 02 Apr 2009 22:51:34 -0400
From: Maxwell Blair <address@hidden>
Subject: octave plot function
To: address@hidden
Message-ID: <address@hidden>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

I just started to explore octave as alternative to matlab.
The documentation for octave function 'plot' is not very satisfying.
Does someone have a list of examples of plot that I can test?
Thanks for anything
Max


------------------------------

Message: 7
Date: Thu, 2 Apr 2009 22:10:31 -0500
From: Rishi Amrit <address@hidden>
Subject: undefined symbol: _glp_lib_fault_hook
To: help-octave <address@hidden>
Message-ID:
       <address@hidden>
Content-Type: text/plain; charset="iso-8859-1"

Hi,

  I built octave (stable ver 3.0.3) a few days back. One of sqp calls in my
code spits out the following error terminating octave.

octave: symbol lookup error:
/usr/local/octave/version/libexec/octave/3.0.3/oct/x86_64-unknown-linux-gnu/__glpk__.oct:
undefined symbol: _glp_lib_fault_hook

I think its got to do with the octave build. I need to install something and
build octave again. Any ideas ?

Thanks,

Rishi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://www-old.cae.wisc.edu/pipermail/help-octave/attachments/20090402/ab38a071/attachment-0001.html

------------------------------

Message: 8
Date: Fri, 3 Apr 2009 15:26:39 +0200
From: Carlo de Falco <address@hidden>
Subject: Re: phase space
To: Johannes Wolfgang Woger <address@hidden>
Cc: address@hidden
Message-ID: <address@hidden>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes


On 3 Apr 2009, at 14:55, Johannes Wolfgang Woger wrote:

> Hi,
> I am an newby.
>
> How can I obtain a plot of the phase portrait
> of Lotka-Volterra:
>
> octave:92> function xdot = f(x,t)
>> a = 4;
>> b = 4;
>> c = 4;
>> d = 8;
>> E = 1;
>> K = 1;
>> xdot = zeros(2,1);
>> xdot(1) = x(1)*(a-b*x(2)-E*x(1));
>> xdot(2) = x(2)*(d*x(1)-c-K*x(2));
>> endfunction
> octave:93>
> octave:93> t = linspace(0,50,100);
> octave:94> x = lsode("f", [2,1],t);
> octave:95> plot(t,x);
>

plot(x(:,1), x(:,2));
xlabel("x_1");
ylabel("x_2");

but I would suggest using a few more time steps if you want a nice
looking spiral...

> Thanks

HTH,
c.



------------------------------

Message: 9
Date: Fri, 03 Apr 2009 15:47:37 +0200
From: Johannes Wolfgang Woger <address@hidden>
Subject: Re: phase space
To: address@hidden
Message-ID: <address@hidden>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Carlo de Falco schrieb:
>
> On 3 Apr 2009, at 14:55, Johannes Wolfgang Woger wrote:
>
>> Hi,
>> I am an newby.
>>
>> How can I obtain a plot of the phase portrait
>> of Lotka-Volterra:
>>
>> octave:92> function xdot = f(x,t)
>>> a = 4;
>>> b = 4;
>>> c = 4;
>>> d = 8;
>>> E = 1;
>>> K = 1;
>>> xdot = zeros(2,1);
>>> xdot(1) = x(1)*(a-b*x(2)-E*x(1));
>>> xdot(2) = x(2)*(d*x(1)-c-K*x(2));
>>> endfunction
>> octave:93>
>> octave:93> t = linspace(0,50,100);
>> octave:94> x = lsode("f", [2,1],t);
>> octave:95> plot(t,x);
>>
>
> plot(x(:,1), x(:,2));
> xlabel("x_1");
> ylabel("x_2");
>
> but I would suggest using a few more time steps if you want a nice
> looking spiral...
>
Thanks, works great. Is there a tutorial addressing phase space?

>> Thanks
>
> HTH,
> c.
>
>



------------------------------

Message: 10
Date: Fri, 3 Apr 2009 07:47:07 -0700 (PDT)
From: Gondwana <address@hidden>
Subject: Octave to serial on Mac OS-X
To: address@hidden
Message-ID: <address@hidden>
Content-Type: text/plain; charset=us-ascii


Hi
In the context of the Kids of Nature Initiative (www.kidsofnature.org), I am
in charge of producing a series of time lapse movies on the last nature
sanctuaries on earth, starting with Africa.  For the realization of this
project, our non-profit organization has teamed-up with several sponsors,
including Festo who is building up the motion controlled device for the time
lapse photographic project.

In order to download instructions to the motion control device's PLC, I will
have to use a software such as MatLab (or Octave) to create the set of
values for the different movements (linear, pan & azimut) via the serial
port.

I am using an Apple Mac Book Pro with OS-X 10.5.6 and the PLC is attached to
the USB port via a serial RS232 - USB adator from Sunix.

I normally program in PHP.  Although we have successfully tested PHP writing
to a Festo intelligent motor via USB-Serial, PHP is unable to open the
serial port as soon as the PLC is attached.  The PHP fopen() functions.  So
far this problem could not be solved as not too many people seems to use PHP
serial on Mac.

We have tested MatLab on Windows and it is working fine.  However, the
programme must work on OS-X.  Will MatLab/Octave Mac version do the same
job?

The principle is simple :
- calculate an array of 10000 values (positions) through different math
functions
- open serial port
- send each value, one by one and test the returned value for verification
- close serial port

I have tried to download the Mac package for Octave (octave-3.1.55-i386.dmg)
but it failed twice.
--
View this message in context: http://www.nabble.com/Octave-to-serial-on-Mac-OS-X-tp22869916p22869916.html
Sent from the Octave - General mailing list archive at Nabble.com.



------------------------------

Message: 11
Date: Fri, 03 Apr 2009 18:38:49 +0200
From: David Bateman <address@hidden>
Subject: Re: octave plot function
To: Maxwell Blair <address@hidden>
Cc: address@hidden
Message-ID: <address@hidden>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Maxwell Blair wrote:
> I just started to explore octave as alternative to matlab.
> The documentation for octave function 'plot' is not very satisfying.
> Does someone have a list of examples of plot that I can test?
> Thanks for anything
> Max
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
>
>
The help of the functions are not suppose to stand on their own, but are
rather an aid if you know more or less what you want to do. Read the
manual in conjunction with the plot function and things will be clearer.
I'll sent a pdf offline of the manual

D.


--
David Bateman                                address@hidden
35 rue Gambetta                              +33 1 46 04 02 18 (Home)
92100 Boulogne-Billancourt FRANCE            +33 6 72 01 06 33 (Mob)



------------------------------

_______________________________________________
Help-octave mailing list
address@hidden
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave


End of Help-octave Digest, Vol 37, Issue 6
******************************************


reply via email to

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