Mercurial > octave-nkf
view examples/code/structdemo.cc @ 20596:87b557ee8e5d
clean up and vectorize code for dense output in ode45
* scripts/ode/private/ode_rk_interpolate.m: new file
* scripts/ode/private/ode_rk_interpolate.m(hermite_quartic_interpolation):
move to internal function, use vectorization and broadcasting.
* scripts/ode/private/hermite_quartic_interpolation.m: remove file
* scripts/ode/module.mk: list added and removed files
* scripts/ode/private/integrate_adaptive.m: use new interpolation code.
author | Carlo de Falco <carlo.defalco@polimi.it> |
---|---|
date | Tue, 06 Oct 2015 19:28:59 +0200 |
parents | 2f8500ca91d3 |
children |
line wrap: on
line source
#include <octave/oct.h> #include <octave/ov-struct.h> DEFUN_DLD (structdemo, args, , "Struct Demo") { if (args.length () != 2) print_usage (); if (! args(0).is_map ()) error ("structdemo: ARG1 must be a struct"); octave_scalar_map arg0 = args(0).scalar_map_value (); //octave_map arg0 = args(0).map_value (); if (! args(1).is_string ()) error ("structdemo: ARG2 must be a character string"); std::string arg1 = args(1).string_value (); octave_value tmp = arg0.contents (arg1); //octave_value tmp = arg0.contents (arg1)(0); if (! tmp.is_defined ()) error ("structdemo: struct does not have a field named '%s'\n", arg1.c_str ()); octave_scalar_map st; st.assign ("selected", tmp); return octave_value (st); }