In python, numpy will provide matrix
operations for overloaded types. This worked for AD matrix
operations; see
http://www.seanet.com/~bradbell/pycppad/pycppad.htm
Is there a package, similar to numpy, that works for Octave ?
On 01/25/2017 06:04 AM, Brad Bell wrote:
On 01/25/2017 01:59 AM, Olaf Till wrote:
After a look at the source, it seems to me
that the interface to cppad
only overloads scalar operations, not matrix multiplication and
not
element-wise matrix operations (like e.g. 'matrix1 ./ matrix2'
in
Octave). This would be a rather severe limitation for
application in
Octave...
Olaf
There are lots of ways to proceed here. This simplest thing to do
would be to define the matrix operations in octave and have them
just be element
by element operators. (I assume this is possible in the Octave
language). Recording the function would be slow, but once it is
recorded, playback would be fast.
Perhaps a better approach, in the long run, might be to include
Cppad atomic operations in the Cppad Swig interface. It is not
obvious (to me) how to do this. For example, see the atomic matrix
multiply at
https://www.coin-or.org/CppAD/Doc/atomic_mat_mul.cpp.xml
For a paper on matrix AD calculations; see
https://people.maths.ox.ac.uk/gilesm/files/NA-08-01.pdf
Note that, one only need to define the parts of the atomic
operation they are using. For example, if you do not compute the
sparsity patterns for Hessians, you do not need to include it. If
you do not use forward mode for derivative of order higher than 3,
you do not need to include them.
Brad
|