[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
matrix append
From: |
John W. Eaton |
Subject: |
matrix append |
Date: |
Fri, 13 Jun 2003 14:26:38 -0500 |
On 13-Jun-2003, Matthew Wollenweber <address@hidden> wrote:
| here is a snippit of C code, but i get the following error when running
| fatal: row dimension mismatch for append
|
| i don't understand what's wrong... any ideas?
|
| ---code---
|
| RowVector A = RowVector(8,8);
| ColumnVector B = ColumnVector(8,8);
|
| int r = A.length();
| int c = B.length();
|
| Matrix X = Matrix(r,c);
| Matrix Y = Matrix(r,c);
|
| X.append(A);
Append works left to right, so you are trying to do the equivalent of
X = zeros (8, 8);
A = zeros (1, 8);
[X, A]
If you want to do
[X; A]
use the "stack" method instead:
X.stack (A);
BTW, the append and stack and append are const methods, so what you
really want is probably
X = X.stack (A);
In any case, I suppose these names are not good. Maybe we should
introduce vcat and hcat or similar instead and deprecate the stack and
append names.
Comments?
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
-------------------------------------------------------------
- matrix append, Matthew Wollenweber, 2003/06/13
- matrix append,
John W. Eaton <=