Prev Next a_fun_property_xam.m Headings

@(@\newcommand{\B}[1]{ {\bf #1} } \newcommand{\R}[1]{ {\rm #1} }@)@
Octave: a_fun Properties: Example and Test
function ok = a_fun_property_xam()
     %
     % load the Cppad Swig library
     m_cppad
     %
     % initialize return variable
     ok = true;
     % -----------------------------------------------------------------------
     n_ind = 1; % number of independent variables
     n_dep = 2; % number of dependent variables
     n_var = 1; % phantom variable at address 0
     n_op = 1;  % special operator at beginning
     %
     % dimension some vectors
     x = m_cppad.vec_double(n_ind);
     ay = m_cppad.vec_a_double(n_dep);
     %
     % independent variables
     x(0) = 1.0;
     ax = m_cppad.independent(x);
     n_var = n_var + n_ind; % one for each indpendent
     n_op = n_op + n_ind;
     %
     % first dependent variable
     ay(0) = ax(0) + ax(0);
     n_var = n_var + 1; % one variable and operator
     n_op = n_op + 1;
     %
     % second dependent variable
     ax0 = ax(0);
     ay(1) = ax0.sin();
     n_var = n_var + 2; % two varialbes, one operator
     n_op = n_op + 1;
     %
     % define f(x) = y
     af = m_cppad.a_fun(ax, ay);
     n_op = n_op + 1; % speical operator at end
     %
     % check af properties
     ok = ok && af.size_ind() == n_ind;
     ok = ok && af.size_dep() == n_dep;
     ok = ok && af.size_var() == n_var;
     ok = ok && af.size_op() == n_op;
     %
     return;
end

Input File: build/lib/example/octave/a_fun_property_xam.m