2 Aug 2004 20:51
Re: Help with [] for defined types
Andy Adler <adler <at> site.uottawa.ca>
2004-08-02 18:51:59 GMT
2004-08-02 18:51:59 GMT
David,
Thanks for your help with this stuff. I still have some questions.
On Wed, 28 Jul 2004, David Bateman wrote:
> To get a reasonable speed the concatenation function precalcuates the
> size of the return type and then dimensions the return value before
> inserting the data into it. As the functions in pt-mat.cc
> (tree_matrix::rvalue) and data.cc (do_cat) know nothing of the types
> its concatenations (it hands that role off to do_catop), it uses a
> resize of the octave_value itself. For this reason you have to define
> in make_sparse.h something like
>
> #ifdef HAVE_OCTAVE_CONCAT
> octave_value
> octave_sparse::resize (const dim_vector& dv) const
> {
> if (dv.length() > 2)
> {
> error ("Can not resize sparse matrix to NDArray");
> return octave_value ();
> }
> SuperMatrix retval (*this);
>
> // Do the magic needed to change the number of rows and columns while
> // leaving the elements of retval alone //
>
> return new octave_sparse (retval);
> }
(Continue reading)
].
As I don't understand all that needs to be done for private functions
yet, I thought I'd attack the question of inline functions and see
what I could do. There is already a reasonable implementation within
octave-forge, but it has the disadvantage that it defines as many user
defined functions in the symbol table as there are inline functions,
and can implement the argnames and vectorize functions in a matlab
compatiable manner.
I re-implemented the same ideas in version in octave-forge as an
octave_value class. However, to get the function I extract its
RSS Feed