help-octave
[Top][All Lists]
Advanced

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

Re: Dot product (nx1).*(nxm)


From: Mike Miller
Subject: Re: Dot product (nx1).*(nxm)
Date: Mon, 6 Dec 1999 11:27:26 -0600 (CST)

On Mon, 6 Dec 1999, Joao Cardoso wrote:

> ah, yes, now I understand it. But your explanation skips an important step:
> you was speaking of matrix A, and suddenly starts speaking of column vector p
> :-)
> My problem was (is!) that the notation p(:,[1 1 1]) is applied to matrices,
> and if p is a column vector, how can one specify its columns?


Column vector p is a 1xn matrix.  So the logic is exactly the same as for
mxn matrix A, except that m=1.  If size(A) = [10 3], and I specify 
A(:,[2 5]), I will get an error message because there are not 5 columns in
A.  The same holds for p(:,[1 2 3]) because there is only one column in p,
and there is no column 2 and no column 3.  So, for column vectors, one
must not specify a column value greater than one.  Things of this form are
fine:  p(:,ones(1,m)) where m is any positive integer.


> > Does that clarify the meaning of line 5 above?
> 
> yes, thanks. But the notation is not self-evident, as I said.

But it is sensible, don't you think?  I can't think of a better way.


> > So far so good, but in MATLAB you can get those elements out of the matrix
> > and into a column vector using this command:
> >
> > A(find(A<.5))
> >
> > That doesn't work in Octave.  Is there some other way that Octave can
> > extract those numbers from the matrix?  Is it as efficient?
> 
> As John Eaton said, use do_fortran_indexing=1 for this case.


Yes.  I was a little embarrassed that I forgot that one.  I'm much more
experienced with MATLAB than I am with Octave and I sometimes forget the
Octave-specific features.

Thanks, Joao, for all of your contributions to Octave and to this list!

Regards,

Mike

-- 
Michael B. Miller
University of Missouri--Columbia
http://taxa.psyc.missouri.edu/~mbmiller/



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

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



reply via email to

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