[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Problems translating .m to .oct
From: |
John W. Eaton |
Subject: |
Problems translating .m to .oct |
Date: |
Fri, 5 Mar 2004 13:37:20 -0600 |
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
-------------------------------------------------------------
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
-------------------------------------------------------------