[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
DLF - returning transposed vector
From: |
Wonkoo Kim |
Subject: |
DLF - returning transposed vector |
Date: |
Wed, 24 Jun 98 00:25:59 -0400 |
I want to return a row or column vector depending on the vector
type of an argument to my DLF (dynamically linked function).
I declared "ColumnVector y ..." and then computed for y values.
When returning y to the caller, I wanted to transpose if an input
argument was a row vector. But the following always returned a column
vector. I confirmed that 'if' branched correctly according to the
input vector type, but either returned the same column vector.
What was wrong?
ColumnVector x = args(0).vector_value();
ColumnVector y (Ny, 0.0);
...
...
if (args(0).matrix_value().cols() > 1) {
return octave_value (y.transpose());
} else {
return octave_value (y);
}
Since this DLF code will be called quite a lot, I need a fast code and
so I didn't want to copy to a RowVector. (Perhaps, is x[] style
access recommended over x() (or x.elem()) access as well?)
Thanks.
//--------------------------------------------------------------------
// Wonkoo Kim (address@hidden)
- DLF - returning transposed vector,
Wonkoo Kim <=