help-octave
[Top][All Lists]
Advanced

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

Re: Problems translating .m to .oct


From: Al Niessner
Subject: Re: Problems translating .m to .oct
Date: Fri, 05 Mar 2004 12:14:18 -0800

Thank you. That is what I have been looking for.

On Fri, 2004-03-05 at 11:37, John W. Eaton wrote:
> On  5-Mar-2004, Al Niessner <address@hidden> wrote:
> 
> | I am translating a working 'm' file into a compiled version and cannot
> | figure out how to multiply two ColumnVectors element wise. Here is an
> | example of the octave syntax (m file) and reduced C++ code:
> | 
> |  m-file                              C++
> |  ------                              ---
> | a = someMatrix(:,1);        ColumnVector a(someMatrix.column(0));
> | b = someMatrix(:,2);        ColumnVector b(someMatrix.column(1));
> | c = someMatrix(:,3);        ColumnVector c(someMatrix.column(2));
> |                             ColumnVector d;
> | d = a .* (b + c);           d = a * (b + c);
> | 
> | I then get the ambiguous operator "*" error where it can find
> | RowVector, ColumnVector -> double
> | ColumnVector, RowVector -> Matrix
> | octave_value, octave_value -> octave_value
> | 
> | So, what is the correct C++ syntax for this operation? Should I be using
> | the last and then extracting the column vector from it?
> 
> I think you want
> 
>   ColumnVector d = product (a, b+c);
> 
> jwe
-- 
Al Niessner <address@hidden>
Jet Propulsion Laboratory

All opinions stated above are mine and do not necessarily reflect 
those of JPL or NASA.

 ----
| dS | >= 0
 ----



-------------------------------------------------------------
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]