From help-octave-request at bevo dot che dot wisc dot edu Fri Mar 5 14:23:47 2004 Subject: Re: Problems translating .m to .oct From: Al Niessner To: "John W. Eaton" Cc: Octave Help 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 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 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 -------------------------------------------------------------