[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: horzcat and vertcat in C++
From: |
Jordi Gutiérrez Hermoso |
Subject: |
Re: horzcat and vertcat in C++ |
Date: |
Mon, 25 Nov 2013 16:45:39 -0500 |
On Mon, 2013-11-25 at 14:30 +0100, Lukas Reichlin wrote:
> Which C++ methods do I have to provide such that horizontal and
> vertical matrix concatenation work for a given class entirely
> implemented in C++?
Look at Octave's concat function:
http://hg.savannah.gnu.org/hgweb/octave/file/79653c5b6147/libinterp/corefcn/data.cc#l1668
Octave only knows how to concatenate its own types and user-defined
Octave classes (defined from m-files). For the latter, it calls
do_class_concat, and the first thing it does is look up in the symbol
table a concatenation function:
http://hg.savannah.gnu.org/hgweb/octave/file/79653c5b6147/libinterp/corefcn/data.cc#l1596
So it seems to me that what you should do is ensure that Octave thinks
that your new type is a user-defined class and to register in the
symbol table a concatenation method for it.
Admittedly, perhaps we should patch Octave itself so it's more
flexible for user-defined types, since the fixed package has to work
around this by defining its own concat function in an m-file.
- Jordi G. H.