help-octave
[Top][All Lists]
Advanced

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

Re: C++ template


From: Fredrik Bulow
Subject: Re: C++ template
Date: Mon, 4 Oct 2004 07:43:59 -0500

That's weird. If I run the same sequence as you just did I get:

octave:1> a=ones(5,5)
a =
 
  1  1  1  1  1
  1  1  1  1  1
  1  1  1  1  1
  1  1  1  1  1
  1  1  1  1  1
 
octave:2> a(6)==a(1,2)
error: single index only valid for row or column vector
error: evaluating binary operator `==' near line 2, column 5
octave:2>

I run octave version 2.1.50. Do I have a too old version perhaps?

If things were working the way you described them below, I would be
totally happy.

Your friend
Fredrik


On Mon, 2004-10-04 at 14:12, Stefan van der Walt wrote:
> I am not sure what you mean, since all the examples listed under "Linear
> Indexing" in the document below works as stated.
> 
> octave:1> a = ones(5,5)
> a =
> 
>   1  1  1  1  1
>   1  1  1  1  1
>   1  1  1  1  1
>   1  1  1  1  1
>   1  1  1  1  1
> 
> octave:2> a(6)==a(1,2)
> ans = 1
> 
> Which compares the 6th element of 'a' to the second in the first row.
> If you want to compare a(6) to the first two elements, you have to do
> 
> octave:6> a(6)==a(1:2)
> 
> or 
> 
> octave:7> a(6)==a([1 2])
> 
> Regards
> Stefan
> 
> On Mon, Oct 04, 2004 at 04:46:22AM -0500, Fredrik Bulow wrote:
> > hmm....
> > 
> > Linear indexing (i.e. a(6)==a(1,2) for a 5x5 matrix) does not seem to be
> > implemented yet. Or can it be turned on in some way? (Linear indexing is
> > described in the below link.)
> > 
> > The "find" function seems to be built on the idea that linear indexing
> > is available since find(eye(5)) does return [1 7 13 19 25]'.
> > 
> > /Fredrik
> > 
> > On Mon, 2004-10-04 at 07:19, Paul Thomas wrote:
> > > Fredrik Bulow wrote:
> > > 
> > > >Thank you!
> > > >  
> > > >
> > > You are more than welcome.
> > > 
> > > >  
> > > >
> > > Most octave programmes can be vectorised, although it is not always 
> > > obvious how.  All that applies to Matlab, in this area, applies to 
> > > octave as well.  The following technical note is therefore very useful 
> > > and should be read by all octave/Matlab/Scilab/... users, regardless of 
> > > which they use:
> > > 
> > > http://www.mathworks.com/support/tech-notes/1100/1109.html
> > > 
> > > The speedup that can be obtained is often more than that from writing a 
> > > dynamically linked function - especially if the development time of the 
> > > latter is taken into account.
> > > 
> > > Best regards
> > > 
> > > Paul T
> > > 
> > 
> > 
> > 
> > -------------------------------------------------------------
> > Octave is freely available under the terms of the GNU GPL.
> > 
> > Octave's home on the web:  http://www.octave.org
> > How to fund new projects:  http://www.octave.org/funding.html
> > Subscription information:  http://www.octave.org/archive.html
> > -------------------------------------------------------------
> > 
> 



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

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