[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: AD matrix operations
From: |
John W. Eaton |
Subject: |
Re: AD matrix operations |
Date: |
Thu, 26 Jan 2017 09:39:39 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.4.0 |
On 01/26/2017 09:30 AM, Brad Bell wrote:
The type a_double in Octave (and other languages)
http://www.seanet.com/~bradbell/cppad_swig/a_double_ctor.htm
is a scalar type that will record floating point operations with the
purpose of creating a corresponding function object
http://www.seanet.com/~bradbell/cppad_swig/a_fun_ctor.htm
In python, you can create a numpy matrix of type a_double and perform
operations, like matrix addition, multiplication, etc on the objects.
The actual matrix loops are done in C (not in python). Can one do a
similar thing in Octave ?
If you are already creating a custom object that wraps a matrix, then
you can just do something like this
@a_double/mtimes.m
function r = mtimes (x, y)
## compute the normal numeric result using Octave's builtin
## function for matrix multiplication.
## assumes "data" is the data member that contains
## the matrix that a_dobule wraps.
numeric_result = builtin ('mtimes', x.data, y.data);
... do the other stuff that your a_double type needs to do ...
## package the result in an a_double object:
r = a_double (...);
endfunction
The above is the old-style class syntax, but you should also be able to
do this with a classdef object and methods. If there are problems,
report the bugs.
jwe
- Re: Algorithmic Differentiation in Octave, (continued)
- Re: Algorithmic Differentiation in Octave, Richard Crozier, 2017/01/24
- Re: Algorithmic Differentiation in Octave, Brad Bell, 2017/01/24
- Re: Algorithmic Differentiation in Octave, Olaf Till, 2017/01/25
- Re: Algorithmic Differentiation in Octave, Brad Bell, 2017/01/25
- AD matrix operations, Brad Bell, 2017/01/26
- Re: AD matrix operations, John W. Eaton, 2017/01/26
- Re: AD matrix operations, Brad Bell, 2017/01/26
- Re: AD matrix operations,
John W. Eaton <=
- Re: Algorithmic Differentiation in Octave, Brad Bell, 2017/01/27
- Re: Algorithmic Differentiation in Octave, Olaf Till, 2017/01/27
- Re: Algorithmic Differentiation in Octave, Brad Bell, 2017/01/27
- Re: Algorithmic Differentiation in Octave, Olaf Till, 2017/01/27
- Re: Algorithmic Differentiation in Octave, Brad Bell, 2017/01/27
- Re: Algorithmic Differentiation in Octave, Olaf Till, 2017/01/28