[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Automatic Type Conversion
From: |
John W. Eaton |
Subject: |
Automatic Type Conversion |
Date: |
Fri, 17 Jul 2009 12:33:48 -0400 |
On 16-Jul-2009, r-j-k wrote:
| I have a special matrix type, my_matrix, defined in an oct file. I want my
| my_matrix to be automatically converted to an octave matrix when a function
| is called expecting an octave matrix. Is this possible? I have implemented
| the matrix_value() and is_real_matrix() methods. Currently, I get the
| following when I attempt to use such functions:
|
| octave:6> x = my_matrix(1);
| octave:7> log(x);
| error: mapper: wrong type argument `my_matrix'
| octave:7> eig(x);
| error: eig: wrong type argument `matrix'
|
| Any tips?
Look at the octave_base_value::numeric_conversion_function method.
There are examples in several of the classes that are part of Octave.
jwe