29#define SWIGLAL_MODULE_RENAME_VARIABLES
32%include <octcomplex.swg>
37#include <octave/ov-cell.h>
38#include <octave/ov-int-traits.h>
39#include <octave/ov-flt-re-mat.h>
40#include <octave/ov-re-mat.h>
41#include <octave/ov-flt-cx-mat.h>
42#include <octave/ov-cx-mat.h>
43#include <octave/Array-util.h>
49#define swiglal_not_empty(v) (!(v).is_empty())
54#define swiglal_self() (args.length() > 0 ? args(0) : octave_value())
55#define swiglal_no_self() (octave_value())
60#define swiglal_1starg() (args.length() > 0 ? args(0) : octave_value())
65#define swiglal_get_reference(v) (v)
71#define swiglal_maybe_return_int() \
72 if (_out.length() > 1) _out = _out.slice(1, _out.length() - 1)
77#define swiglal_null_ptr(v) (!(v).is_string() && (v).is_matrix_type() && (v).rows() == 0 && (v).columns() == 0)
82SWIGINTERN
int swiglal_output_stdouterr(
void) {
85 fflush(swiglal_tmp_stdout);
86 rewind(swiglal_tmp_stdout);
87 fflush(swiglal_tmp_stderr);
88 rewind(swiglal_tmp_stderr);
92 octave_value_list
args = feval(
"stdout", octave_value_list(), 1);
93 if (
args.length() < 1) {
97 args(1) = octave_value(std::string(
"%s"));
99 while (fgets(buf,
sizeof(buf), swiglal_tmp_stdout) != NULL) {
100 args(2) = octave_value(std::string(buf));
101 feval(
"fprintf",
args, 0);
107 octave_value_list
args = feval(
"stderr", octave_value_list(), 1);
108 if (
args.length() < 1) {
112 args(1) = octave_value(std::string(
"%s"));
114 while (fgets(buf,
sizeof(buf), swiglal_tmp_stderr) != NULL) {
115 args(2) = octave_value(std::string(buf));
116 feval(
"fprintf",
args, 0);
121 fclose(swiglal_tmp_stdout);
122 fclose(swiglal_tmp_stderr);
134%define %swiglal_oct_urn_op(NAME, OCTNAME)
135%rename(__##OCTNAME##__) *::__##NAME##__;
136%newobject *::__##NAME##__;
138%swiglal_oct_urn_op(abs, abs);
139%swiglal_oct_urn_op(neg, uminus);
140%swiglal_oct_urn_op(pos, uplus);
143%define %swiglal_oct_bin_op(NAME)
144%newobject *::__##NAME##__;
145%newobject *::__r##NAME##__;
147%swiglal_oct_bin_op(add);
148%swiglal_oct_bin_op(and);
149%swiglal_oct_bin_op(div);
150%swiglal_oct_bin_op(lshift);
151%swiglal_oct_bin_op(mod);
152%swiglal_oct_bin_op(mul);
153%swiglal_oct_bin_op(or);
154%swiglal_oct_bin_op(pow);
155%swiglal_oct_bin_op(rshift);
156%swiglal_oct_bin_op(sub);
157%swiglal_oct_bin_op(xor);
160%typemap(in, numinputs=0) void* SWIGLAL_OP_POW_3RDARG "";
163%typemap(in, numinputs=0, noblock=1)
int SWIGLAL_CMP_OP_RETN_HACK "";
170%define %swiglal_struct_extend_specific(TAGNAME, OPAQUE, DTORFUNC)
179%swig_cplxflt_convn(gsl_complex_float, gsl_complex_float_rect, GSL_REAL, GSL_IMAG);
180%swig_cplxdbl_convn(gsl_complex, gsl_complex_rect, GSL_REAL, GSL_IMAG);
181%typemaps_primitive(%checkcode(CPLXFLT), gsl_complex_float);
182%typemaps_primitive(%checkcode(CPLXDBL), gsl_complex);
187%typemaps_primitive(%checkcode(CPLXFLT),
COMPLEX8);
188%typemaps_primitive(%checkcode(CPLXDBL),
COMPLEX16);
191%typemap(in, fragment=SWIG_AsVal_frag(
double)) struct tm* (struct tm temptm) {
194 octave_value_list datenum_args;
195 if ($input.is_string()) {
196 datenum_args.append($input);
198 dim_vector dims = $input.dims();
199 if (dims.length() == 2 && dims.num_ones() == 1 && 3 <= dims.numel() && dims.numel() <= 6) {
200 RowVector datevec = $input.row_vector_value();
201 for (
int i = 0; i < datevec.numel(); ++i) {
202 datenum_args.append(octave_value(datevec(i)));
206 octave_value_list retn;
207 if (datenum_args.length() > 0) {
208 retn = feval(
"datenum", datenum_args, 1);
210 if (retn.length() == 0) {
211 %argument_fail(SWIG_ValueError,
"$type", $symname, $argnum);
214 int res = SWIG_AsVal(
double)(retn(0), &datenum);
215 if (!SWIG_IsOK(res)) {
216 %argument_fail(res,
"$type", $symname, $argnum);
222 time_t t = (time_t) llround((datenum - 719529) * 86400);
225 memset(&temptm, 0,
sizeof(temptm));
226 if (
gmtime_r(&t, &temptm) == NULL) {
227 %argument_fail(SWIG_RuntimeError,
"$type", $symname, $argnum);
233%typemap(freearg)
struct tm*
"";
234%typemap(out)
struct tm* {
237 RowVector datevec(6);
240 datevec(0) = $1->tm_year + 1900;
241 datevec(1) = $1->tm_mon + 1;
242 datevec(2) = $1->tm_mday;
243 datevec(3) = $1->tm_hour;
244 datevec(4) = $1->tm_min;
245 datevec(5) = $1->tm_sec;
247 $result = octave_value(datevec);
263typedef std::pair<octave_value, int> swiglal_oct_parent;
264typedef std::pair<void*, swiglal_oct_parent> swiglal_oct_parent_pair;
265typedef std::map<void*, swiglal_oct_parent> swiglal_oct_parent_map;
266static swiglal_oct_parent_map* parent_map = 0;
270SWIGINTERN
void swiglal_store_parent(
void* ptr, octave_value parent) {
272 assert(parent.is_defined());
273 swiglal_oct_parent_map::iterator i = parent_map->find(ptr);
274 if (i == parent_map->end()) {
275 parent_map->insert(swiglal_oct_parent_pair(ptr, swiglal_oct_parent(parent, 1)));
286SWIGINTERN
bool swiglal_release_parent(
void *ptr) {
289 swiglal_oct_parent_map::iterator i = parent_map->find(ptr);
290 if (i != parent_map->end()) {
292 if (--i->second.second == 0) {
293 parent_map->erase(i);
307 const char*
const parent_map_name =
"__SWIGLAL_parent_map__";
308 octave_value ov = SWIG_Octave_GetGlobalValue(parent_map_name);
309 int res = SWIG_ConvertPacked(ov, &parent_map,
sizeof(parent_map), 0);
310 if (!SWIG_IsOK(res)) {
311 parent_map =
new swiglal_oct_parent_map();
312 ov = SWIG_NewPackedObj(&parent_map,
sizeof(parent_map), 0);
313 SWIG_Octave_SetGlobalValue(parent_map_name, ov);
328#define %swiglal_oct_array_view_class(ACFTYPE) swiglal_oct_array_view_##ACFTYPE
331#define %swiglal_oct_array_view_helper_class(ACFTYPE) swiglal_oct_array_view_helper_##ACFTYPE
334#define %swiglal_oct_array_view_tmpl(ACFTYPE) swiglal_oct_array_view<%swiglal_oct_array_view_helper_class(ACFTYPE) >
337#define %swiglal_oct_array_view_ovtype(ACFTYPE) "swiglal_oct_array_view_" %str(ACFTYPE)
340#define %swiglal_oct_array_view_frag(ACFTYPE) "swiglal_oct_array_view_" %str(ACFTYPE)
344#define %swiglal_oct_array_view_init_frag(ACFTYPE) "swiglal_oct_array_view_init_" %str(ACFTYPE)
349%fragment(
"swiglal_oct_array_view",
"header") {
353 template<
class HELPER>
354 class swiglal_oct_array_view :
public octave_base_value {
360 const typename HELPER::OVClass sloav_class;
364 const octave_value sloav_parent;
367 void *
const sloav_ptr;
368 const size_t sloav_esize;
369 const size_t sloav_ndims;
370 const dim_vector sloav_dims;
371 const dim_vector sloav_strides;
372 const bool sloav_isptr;
373 swig_type_info *
const sloav_tinfo;
374 const int sloav_tflags;
377 static dim_vector sloav_make_dim_vector(
const size_t n,
const size_t v[]) {
379 for (
size_t i = 0; i < n; ++i) {
386 static octave_base_value* sloav_numeric_conversion_function(
const octave_base_value& v) {
387 const swiglal_oct_array_view& oav =
dynamic_cast<const swiglal_oct_array_view&
>(v);
388 octave_value ov = oav.sloav_array_out();
389 return new typename HELPER::OVClass(HELPER::ovvalue(ov));
393 void* sloav_get_element_ptr(Array<octave_idx_type>& idx)
const {
395 for (
size_t j = 0; j < sloav_ndims; ++j) {
396 elemidx += idx(j) * sloav_strides(j);
398 return reinterpret_cast<void*
>(
reinterpret_cast<char*
>(sloav_ptr) + elemidx*sloav_esize);
402 void sloav_increment_idx(Array<octave_idx_type>& idx)
const {
403 for (
int j = sloav_ndims-1; j >= 0; --j) {
404 if (++idx(j) < sloav_dims(j)) {
413 virtual ~swiglal_oct_array_view()
416 swiglal_oct_array_view()
417 : octave_base_value(), sloav_class(typename HELPER::OVClass()),
418 sloav_parent(), sloav_ptr(0), sloav_esize(0), sloav_ndims(0),
419 sloav_dims(), sloav_strides(),
420 sloav_isptr(false), sloav_tinfo(0), sloav_tflags(0)
423 swiglal_oct_array_view(
const octave_value& parent,
428 const size_t strides[],
430 swig_type_info* tinfo,
432 : octave_base_value(), sloav_class(typename HELPER::OVClass()),
433 sloav_parent(parent), sloav_ptr(ptr), sloav_esize(esize), sloav_ndims(ndims),
434 sloav_dims(sloav_make_dim_vector(ndims, dims)),
435 sloav_strides(sloav_make_dim_vector(ndims, strides)),
436 sloav_isptr(isptr), sloav_tinfo(tinfo), sloav_tflags(tflags)
440 int sloav_array_in(octave_value& obj,
int *pelemalloc,
const int tflags) {
444 return SWIG_MemoryError;
450 dim_vector objdims = obj.dims();
451 if (sloav_ndims == 1) {
452 if (objdims.length() > 2 || objdims.num_ones() == 0 || objdims.numel() != sloav_dims(0)) {
453 return SWIG_ValueError;
456 else if (objdims != sloav_dims) {
457 return SWIG_ValueError;
461 Array<octave_idx_type> idx(dim_vector(1, sloav_ndims), 0);
462 std::list<octave_value_list> objidx(1);
463 for (
int i = 0; i < objdims.numel(); ++i) {
466 objidx.front()(0) = get_scalar_idx(idx, objdims) + 1;
467 octave_value objelem = obj.subsref(obj.is_cell() ?
"{" :
"(", objidx);
470 int res = HELPER::incall(sloav_parent, objelem, sloav_get_element_ptr(idx), pelemalloc, sloav_esize, sloav_isptr, sloav_tinfo, sloav_tflags | tflags);
471 if (!SWIG_IsOK(res)) {
476 sloav_increment_idx(idx);
485 octave_value sloav_array_out(
const bool copyobj =
false)
const {
489 return octave_value();
493 dim_vector objdims = sloav_dims;
494 typename HELPER::OVType objval(objdims);
495 octave_value obj(objval);
498 Array<octave_idx_type> idx(dim_vector(1, sloav_ndims), 0);
499 std::list<octave_value_list> objidx(1);
500 for (
int i = 0; i < objdims.numel(); ++i) {
503 objidx.front()(0) = get_scalar_idx(idx, objdims) + 1;
506 octave_value objelem = HELPER::outcall(sloav_parent, copyobj, sloav_get_element_ptr(idx), sloav_esize, sloav_isptr, sloav_tinfo, sloav_tflags);
507 obj = obj.subsasgn(obj.is_cell() ?
"{" :
"(", objidx, objelem);
510 sloav_increment_idx(idx);
521 dim_vector dims()
const {
526 octave_value full_value()
const {
527 return sloav_array_out();
531 octave_base_value* empty_clone()
const {
532 return sloav_array_out().empty_clone();
536 octave_base_value::type_conv_info numeric_conversion_function()
const {
537 return octave_base_value::type_conv_info(sloav_numeric_conversion_function, sloav_class.type_id());
541 octave_value do_index_op(
const octave_value_list& idx,
bool resize_ok) {
542 return sloav_array_out().do_index_op(idx,
false);
544 octave_value_list do_multi_index_op(
int nargout,
const octave_value_list& idx) {
545 return sloav_array_out().do_multi_index_op(nargout, idx);
549 octave_value subsref(
const std::string& type,
const std::list<octave_value_list>& idx) {
550 return sloav_array_out().subsref(type, idx);
552 octave_value_list subsref(
const std::string& type,
const std::list<octave_value_list>& idx,
int nargout) {
553 return sloav_array_out().subsref(type, idx, nargout);
557 octave_value subsasgn(
const std::string& type,
const std::list<octave_value_list>& idx,
const octave_value& rhs) {
558 octave_value obj = sloav_array_out().subsasgn(type, idx, rhs);
568 int res = sloav_array_in(obj, &elemalloc, sloav_isptr ? SWIG_POINTER_DISOWN : 0);
569 if (!SWIG_IsOK(res)) {
570 std::string n = type_name();
571 std::string e = SWIG_ErrorType(res).string_value();
572 error(
"failed to perform indexed assignment for %s type: %s", n.c_str(), e.c_str());
573 return octave_value();
576 return octave_value(
this);
580 bool save_ascii (std::ostream& os) {
581 return sloav_array_out().save_ascii(os);
583 bool load_ascii(std::istream& is) {
584 octave_value obj = sloav_array_out();
586 return obj.load_ascii(is) && SWIG_IsOK(sloav_array_in(obj, &elemalloc, 0));
590 bool save_binary(std::ostream& os,
bool& save_as_floats) {
591 return sloav_array_out().save_binary(os, save_as_floats);
593 bool load_binary(std::istream& is,
bool swap, oct_mach_info::float_format fmt) {
594 octave_value obj = sloav_array_out();
596 return obj.load_binary(is, swap, fmt) && SWIG_IsOK(sloav_array_in(obj, &elemalloc, 0));
601%#
if SWIG_OCTAVE_PREREQ(4,0,0)
602 bool save_hdf5(octave_hdf5_id loc_id, const
char *
name,
bool save_as_floats) {
603 return sloav_array_out().save_hdf5(loc_id,
name, save_as_floats);
606 bool save_hdf5(hid_t loc_id,
const char *
name,
bool save_as_floats) {
607 return sloav_array_out().save_hdf5(loc_id,
name, save_as_floats);
610%#
if SWIG_OCTAVE_PREREQ(4,0,0)
611 bool load_hdf5(octave_hdf5_id loc_id, const
char *
name) {
612 octave_value obj = sloav_array_out();
614 return obj.load_hdf5(loc_id,
name) && SWIG_IsOK(sloav_array_in(obj, &elemalloc, 0));
616%#elif SWIG_OCTAVE_PREREQ(3,3,52)
617 bool load_hdf5(hid_t loc_id, const
char *
name) {
618 octave_value obj = sloav_array_out();
620 return obj.load_hdf5(loc_id,
name) && SWIG_IsOK(sloav_array_in(obj, &elemalloc, 0));
623 bool load_hdf5(hid_t loc_id,
const char *
name,
bool have_h5giterate_bug) {
624 octave_value obj = sloav_array_out();
626 return obj.load_hdf5(loc_id,
name, have_h5giterate_bug) && SWIG_IsOK(sloav_array_in(obj, &elemalloc, 0));
632%#
if SWIG_OCTAVE_PREREQ(4,0,0)
633 void print(std::ostream &os,
bool pr_as_read_syntax = false)
635 void print(std::ostream &os,
bool pr_as_read_syntax =
false) const
638 return sloav_array_out().print(os, pr_as_read_syntax);
645#define SLOAV_OBV_METH_FROM_CLASS_0(N, R) R N() const { return sloav_class.N(); }
646 SLOAV_OBV_METH_FROM_CLASS_0(is_all_va_args,
bool);
647 SLOAV_OBV_METH_FROM_CLASS_0(is_bool_matrix,
bool);
648 SLOAV_OBV_METH_FROM_CLASS_0(is_bool_scalar,
bool);
649 SLOAV_OBV_METH_FROM_CLASS_0(is_bool_type,
bool);
650 SLOAV_OBV_METH_FROM_CLASS_0(is_builtin_function,
bool);
651%#
if SWIG_OCTAVE_PREREQ(4,4,0)
652 SLOAV_OBV_METH_FROM_CLASS_0(iscell,
bool);
653 SLOAV_OBV_METH_FROM_CLASS_0(iscellstr,
bool);
655 SLOAV_OBV_METH_FROM_CLASS_0(is_cell,
bool);
656 SLOAV_OBV_METH_FROM_CLASS_0(is_cellstr,
bool);
658 SLOAV_OBV_METH_FROM_CLASS_0(is_char_matrix,
bool);
659 SLOAV_OBV_METH_FROM_CLASS_0(is_classdef_meta,
bool);
660 SLOAV_OBV_METH_FROM_CLASS_0(is_classdef_object,
bool);
661 SLOAV_OBV_METH_FROM_CLASS_0(is_classdef_superclass_ref,
bool);
662 SLOAV_OBV_METH_FROM_CLASS_0(is_complex_matrix,
bool);
663 SLOAV_OBV_METH_FROM_CLASS_0(is_complex_scalar,
bool);
664 SLOAV_OBV_METH_FROM_CLASS_0(is_complex_type,
bool);
665 SLOAV_OBV_METH_FROM_CLASS_0(is_constant,
bool);
666 SLOAV_OBV_METH_FROM_CLASS_0(is_cs_list,
bool);
667 SLOAV_OBV_METH_FROM_CLASS_0(is_defined,
bool);
668 SLOAV_OBV_METH_FROM_CLASS_0(is_diag_matrix,
bool);
669 SLOAV_OBV_METH_FROM_CLASS_0(is_dld_function,
bool);
670 SLOAV_OBV_METH_FROM_CLASS_0(is_double_type,
bool);
671 SLOAV_OBV_METH_FROM_CLASS_0(is_float_type,
bool);
672 SLOAV_OBV_METH_FROM_CLASS_0(is_function,
bool);
673 SLOAV_OBV_METH_FROM_CLASS_0(is_function_handle,
bool);
674 SLOAV_OBV_METH_FROM_CLASS_0(is_inline_function,
bool);
675 SLOAV_OBV_METH_FROM_CLASS_0(is_int16_type,
bool);
676 SLOAV_OBV_METH_FROM_CLASS_0(is_int32_type,
bool);
677 SLOAV_OBV_METH_FROM_CLASS_0(is_int64_type,
bool);
678 SLOAV_OBV_METH_FROM_CLASS_0(is_int8_type,
bool);
679 SLOAV_OBV_METH_FROM_CLASS_0(is_integer_type,
bool);
680 SLOAV_OBV_METH_FROM_CLASS_0(is_list,
bool);
681 SLOAV_OBV_METH_FROM_CLASS_0(is_magic_colon,
bool);
682 SLOAV_OBV_METH_FROM_CLASS_0(is_map,
bool);
683 SLOAV_OBV_METH_FROM_CLASS_0(is_matrix_type,
bool);
684 SLOAV_OBV_METH_FROM_CLASS_0(is_mex_function,
bool);
685 SLOAV_OBV_METH_FROM_CLASS_0(is_null_value,
bool);
686 SLOAV_OBV_METH_FROM_CLASS_0(is_numeric_type,
bool);
687 SLOAV_OBV_METH_FROM_CLASS_0(is_object,
bool);
688 SLOAV_OBV_METH_FROM_CLASS_0(is_perm_matrix,
bool);
689 SLOAV_OBV_METH_FROM_CLASS_0(is_range,
bool);
690 SLOAV_OBV_METH_FROM_CLASS_0(is_real_matrix,
bool);
691 SLOAV_OBV_METH_FROM_CLASS_0(is_real_nd_array,
bool);
692 SLOAV_OBV_METH_FROM_CLASS_0(is_real_scalar,
bool);
693 SLOAV_OBV_METH_FROM_CLASS_0(is_real_type,
bool);
694 SLOAV_OBV_METH_FROM_CLASS_0(is_scalar_type,
bool);
695 SLOAV_OBV_METH_FROM_CLASS_0(is_single_type,
bool);
696 SLOAV_OBV_METH_FROM_CLASS_0(is_sparse_type,
bool);
697 SLOAV_OBV_METH_FROM_CLASS_0(is_sq_string,
bool);
698 SLOAV_OBV_METH_FROM_CLASS_0(is_string,
bool);
699 SLOAV_OBV_METH_FROM_CLASS_0(is_true,
bool);
700 SLOAV_OBV_METH_FROM_CLASS_0(is_uint16_type,
bool);
701 SLOAV_OBV_METH_FROM_CLASS_0(is_uint32_type,
bool);
702 SLOAV_OBV_METH_FROM_CLASS_0(is_uint64_type,
bool);
703 SLOAV_OBV_METH_FROM_CLASS_0(is_uint8_type,
bool);
704 SLOAV_OBV_METH_FROM_CLASS_0(is_user_code,
bool);
705 SLOAV_OBV_METH_FROM_CLASS_0(is_user_function,
bool);
706 SLOAV_OBV_METH_FROM_CLASS_0(is_user_script,
bool);
707 SLOAV_OBV_METH_FROM_CLASS_0(isjava,
bool);
708 SLOAV_OBV_METH_FROM_CLASS_0(isobject,
bool);
709 SLOAV_OBV_METH_FROM_CLASS_0(isstruct,
bool);
710#undef SLOAV_OBV_METH_FROM_CLASS_0
715#define SLOAV_OBV_METH_FROM_ARRAY_0(N, R) R N() const { return sloav_array_out().N(); }
716#define SLOAV_OBV_METH_FROM_ARRAY_1(N, R, A) R N(A a) const { return sloav_array_out().N(a); }
717#define SLOAV_OBV_METH_FROM_ARRAY_2(N, R, A, B) R N(A a, B b) const { return sloav_array_out().N(a, b); }
718#define SLOAV_OBV_METH_FROM_ARRAY_3(N, R, A, B, C) R N(A a, B b, C c) const { return sloav_array_out().N(a, b, c); }
719#define SLOAV_OBV_METH_FROM_ARRAY_4(N, R, A, B, C, D) R N(A a, B b, C c, D d) const { return sloav_array_out().N(a, b, c, d); }
720#define SLOAV_OBV_METH_FROM_ARRAY_5(N, R, A, B, C, D, E) R N(A a, B b, C c, D d, E e) const { return sloav_array_out().N(a, b, c, d, e); }
721%#
if SWIG_OCTAVE_PREREQ(4,2,0)
722 SLOAV_OBV_METH_FROM_ARRAY_0(as_double, octave_value);
723 SLOAV_OBV_METH_FROM_ARRAY_0(as_single, octave_value);
725%#
if SWIG_OCTAVE_PREREQ(3,3,52)
726 SLOAV_OBV_METH_FROM_ARRAY_0(map_value, octave_map);
728 SLOAV_OBV_METH_FROM_ARRAY_0(map_value, Octave_map);
730 SLOAV_OBV_METH_FROM_ARRAY_0(abs, octave_value);
731 SLOAV_OBV_METH_FROM_ARRAY_0(acos, octave_value);
732 SLOAV_OBV_METH_FROM_ARRAY_0(
acosh, octave_value);
733 SLOAV_OBV_METH_FROM_ARRAY_0(angle, octave_value);
734 SLOAV_OBV_METH_FROM_ARRAY_0(arg, octave_value);
735 SLOAV_OBV_METH_FROM_ARRAY_0(asin, octave_value);
736 SLOAV_OBV_METH_FROM_ARRAY_0(asinh, octave_value);
737 SLOAV_OBV_METH_FROM_ARRAY_0(atan, octave_value);
738 SLOAV_OBV_METH_FROM_ARRAY_0(atanh, octave_value);
739 SLOAV_OBV_METH_FROM_ARRAY_0(byte_size,
size_t);
740 SLOAV_OBV_METH_FROM_ARRAY_0(ceil, octave_value);
741 SLOAV_OBV_METH_FROM_ARRAY_0(cell_value, Cell);
742 SLOAV_OBV_METH_FROM_ARRAY_0(cellstr_value, Array<std::string>);
743 SLOAV_OBV_METH_FROM_ARRAY_0(conj, octave_value);
744 SLOAV_OBV_METH_FROM_ARRAY_0(cos, octave_value);
745 SLOAV_OBV_METH_FROM_ARRAY_0(
cosh, octave_value);
746 SLOAV_OBV_METH_FROM_ARRAY_0(erf, octave_value);
747 SLOAV_OBV_METH_FROM_ARRAY_0(erfc, octave_value);
748 SLOAV_OBV_METH_FROM_ARRAY_0(exp, octave_value);
749 SLOAV_OBV_METH_FROM_ARRAY_0(expm1, octave_value);
750 SLOAV_OBV_METH_FROM_ARRAY_0(finite, octave_value);
751 SLOAV_OBV_METH_FROM_ARRAY_0(fix, octave_value);
752 SLOAV_OBV_METH_FROM_ARRAY_0(floor, octave_value);
753 SLOAV_OBV_METH_FROM_ARRAY_0(gamma, octave_value);
754 SLOAV_OBV_METH_FROM_ARRAY_0(imag, octave_value);
755 SLOAV_OBV_METH_FROM_ARRAY_0(index_vector, idx_vector);
756 SLOAV_OBV_METH_FROM_ARRAY_0(int16_array_value, int16NDArray);
757 SLOAV_OBV_METH_FROM_ARRAY_0(int16_scalar_value, octave_int16);
758 SLOAV_OBV_METH_FROM_ARRAY_0(int32_array_value, int32NDArray);
759 SLOAV_OBV_METH_FROM_ARRAY_0(int32_scalar_value, octave_int32);
760 SLOAV_OBV_METH_FROM_ARRAY_0(int64_array_value, int64NDArray);
761 SLOAV_OBV_METH_FROM_ARRAY_0(int64_scalar_value, octave_int64);
762 SLOAV_OBV_METH_FROM_ARRAY_0(int8_array_value, int8NDArray);
763 SLOAV_OBV_METH_FROM_ARRAY_0(int8_scalar_value, octave_int8);
764 SLOAV_OBV_METH_FROM_ARRAY_0(isinf, octave_value);
765 SLOAV_OBV_METH_FROM_ARRAY_0(isna, octave_value);
766 SLOAV_OBV_METH_FROM_ARRAY_0(isnan, octave_value);
767 SLOAV_OBV_METH_FROM_ARRAY_0(lgamma, octave_value);
768 SLOAV_OBV_METH_FROM_ARRAY_0(log, octave_value);
769 SLOAV_OBV_METH_FROM_ARRAY_0(log10, octave_value);
770 SLOAV_OBV_METH_FROM_ARRAY_0(log1p, octave_value);
771 SLOAV_OBV_METH_FROM_ARRAY_0(log2, octave_value);
772 SLOAV_OBV_METH_FROM_ARRAY_0(matrix_type, MatrixType);
773 SLOAV_OBV_METH_FROM_ARRAY_0(nnz, octave_idx_type);
774 SLOAV_OBV_METH_FROM_ARRAY_0(nzmax, octave_idx_type);
775 SLOAV_OBV_METH_FROM_ARRAY_0(perm_matrix_value, PermMatrix);
776 SLOAV_OBV_METH_FROM_ARRAY_0(range_value, Range);
777 SLOAV_OBV_METH_FROM_ARRAY_0(real, octave_value);
778 SLOAV_OBV_METH_FROM_ARRAY_0(round, octave_value);
779 SLOAV_OBV_METH_FROM_ARRAY_0(roundb, octave_value);
780 SLOAV_OBV_METH_FROM_ARRAY_0(signum, octave_value);
781 SLOAV_OBV_METH_FROM_ARRAY_0(sin, octave_value);
782 SLOAV_OBV_METH_FROM_ARRAY_0(sinh, octave_value);
783 SLOAV_OBV_METH_FROM_ARRAY_0(sqrt, octave_value);
784 SLOAV_OBV_METH_FROM_ARRAY_0(tan, octave_value);
785 SLOAV_OBV_METH_FROM_ARRAY_0(tanh, octave_value);
786 SLOAV_OBV_METH_FROM_ARRAY_0(uint16_array_value, uint16NDArray);
787 SLOAV_OBV_METH_FROM_ARRAY_0(uint16_scalar_value, octave_uint16);
788 SLOAV_OBV_METH_FROM_ARRAY_0(uint32_array_value, uint32NDArray);
789 SLOAV_OBV_METH_FROM_ARRAY_0(uint32_scalar_value, octave_uint32);
790 SLOAV_OBV_METH_FROM_ARRAY_0(uint64_array_value, uint64NDArray);
791 SLOAV_OBV_METH_FROM_ARRAY_0(uint64_scalar_value, octave_uint64);
792 SLOAV_OBV_METH_FROM_ARRAY_0(uint8_array_value, uint8NDArray);
793 SLOAV_OBV_METH_FROM_ARRAY_0(uint8_scalar_value, octave_uint8);
794 SLOAV_OBV_METH_FROM_ARRAY_0(xisalnum, octave_value);
795 SLOAV_OBV_METH_FROM_ARRAY_0(xisalpha, octave_value);
796 SLOAV_OBV_METH_FROM_ARRAY_0(xisascii, octave_value);
797 SLOAV_OBV_METH_FROM_ARRAY_0(xiscntrl, octave_value);
798 SLOAV_OBV_METH_FROM_ARRAY_0(xisdigit, octave_value);
799 SLOAV_OBV_METH_FROM_ARRAY_0(xisgraph, octave_value);
800 SLOAV_OBV_METH_FROM_ARRAY_0(xislower, octave_value);
801 SLOAV_OBV_METH_FROM_ARRAY_0(xisprint, octave_value);
802 SLOAV_OBV_METH_FROM_ARRAY_0(xispunct, octave_value);
803 SLOAV_OBV_METH_FROM_ARRAY_0(xisspace, octave_value);
804 SLOAV_OBV_METH_FROM_ARRAY_0(xisupper, octave_value);
805 SLOAV_OBV_METH_FROM_ARRAY_0(xisxdigit, octave_value);
806 SLOAV_OBV_METH_FROM_ARRAY_0(xtoascii, octave_value);
807 SLOAV_OBV_METH_FROM_ARRAY_0(xtolower, octave_value);
808 SLOAV_OBV_METH_FROM_ARRAY_0(xtoupper, octave_value);
809 SLOAV_OBV_METH_FROM_ARRAY_1(all, octave_value,
int);
810 SLOAV_OBV_METH_FROM_ARRAY_1(all_strings, string_vector,
bool);
811 SLOAV_OBV_METH_FROM_ARRAY_1(any, octave_value,
int);
812 SLOAV_OBV_METH_FROM_ARRAY_1(array_value, NDArray,
bool);
813 SLOAV_OBV_METH_FROM_ARRAY_1(bool_array_value, boolNDArray,
bool);
814 SLOAV_OBV_METH_FROM_ARRAY_1(bool_matrix_value, boolMatrix,
bool);
815 SLOAV_OBV_METH_FROM_ARRAY_1(bool_value,
bool,
bool);
816 SLOAV_OBV_METH_FROM_ARRAY_1(char_array_value, charNDArray,
bool);
817 SLOAV_OBV_METH_FROM_ARRAY_1(char_matrix_value, charMatrix,
bool);
818 SLOAV_OBV_METH_FROM_ARRAY_1(complex_array_value, ComplexNDArray,
bool);
819 SLOAV_OBV_METH_FROM_ARRAY_1(complex_diag_matrix_value, ComplexDiagMatrix,
bool);
820 SLOAV_OBV_METH_FROM_ARRAY_1(complex_matrix_value, ComplexMatrix,
bool);
821 SLOAV_OBV_METH_FROM_ARRAY_1(complex_value, Complex,
bool);
822 SLOAV_OBV_METH_FROM_ARRAY_1(diag, octave_value, octave_idx_type);
823 SLOAV_OBV_METH_FROM_ARRAY_1(diag_matrix_value, DiagMatrix,
bool);
824 SLOAV_OBV_METH_FROM_ARRAY_1(double_value,
double,
bool);
825 SLOAV_OBV_METH_FROM_ARRAY_1(float_array_value, FloatNDArray,
bool);
826 SLOAV_OBV_METH_FROM_ARRAY_1(float_complex_array_value, FloatComplexNDArray,
bool);
827 SLOAV_OBV_METH_FROM_ARRAY_1(float_complex_diag_matrix_value, FloatComplexDiagMatrix,
bool);
828 SLOAV_OBV_METH_FROM_ARRAY_1(float_complex_matrix_value, FloatComplexMatrix,
bool);
829 SLOAV_OBV_METH_FROM_ARRAY_1(float_complex_value, FloatComplex,
bool);
830 SLOAV_OBV_METH_FROM_ARRAY_1(float_diag_matrix_value, FloatDiagMatrix,
bool);
831 SLOAV_OBV_METH_FROM_ARRAY_1(float_matrix_value, FloatMatrix,
bool);
832 SLOAV_OBV_METH_FROM_ARRAY_1(float_value,
float,
bool);
833 SLOAV_OBV_METH_FROM_ARRAY_1(is_sorted, sortmode, sortmode);
834 SLOAV_OBV_METH_FROM_ARRAY_1(is_sorted_rows, sortmode, sortmode);
835 SLOAV_OBV_METH_FROM_ARRAY_1(matrix_value, Matrix,
bool);
836 SLOAV_OBV_METH_FROM_ARRAY_1(reshape, octave_value,
const dim_vector&);
837 SLOAV_OBV_METH_FROM_ARRAY_1(sort_rows_ids, Array<octave_idx_type>, sortmode);
838 SLOAV_OBV_METH_FROM_ARRAY_1(sparse_bool_matrix_value, SparseBoolMatrix,
bool);
839 SLOAV_OBV_METH_FROM_ARRAY_1(sparse_complex_matrix_value, SparseComplexMatrix,
bool);
840 SLOAV_OBV_METH_FROM_ARRAY_1(sparse_matrix_value, SparseMatrix,
bool);
841 SLOAV_OBV_METH_FROM_ARRAY_1(string_value, std::string,
bool);
842 SLOAV_OBV_METH_FROM_ARRAY_2(int_value,
int,
bool,
bool);
843 SLOAV_OBV_METH_FROM_ARRAY_2(long_value,
long int,
bool,
bool);
844 SLOAV_OBV_METH_FROM_ARRAY_2(permute, octave_value,
const Array<int>&,
bool);
845 SLOAV_OBV_METH_FROM_ARRAY_2(print_info,
void, std::ostream&,
bool);
846 SLOAV_OBV_METH_FROM_ARRAY_2(print_raw,
void, std::ostream&,
bool);
847 SLOAV_OBV_METH_FROM_ARRAY_2(resize, octave_value,
const dim_vector&,
bool);
848 SLOAV_OBV_METH_FROM_ARRAY_2(short_value,
short int,
bool,
bool);
849 SLOAV_OBV_METH_FROM_ARRAY_2(sort, octave_value, octave_idx_type, sortmode);
850 SLOAV_OBV_METH_FROM_ARRAY_2(uint_value,
unsigned int,
bool,
bool);
851 SLOAV_OBV_METH_FROM_ARRAY_2(ulong_value,
unsigned long int,
bool,
bool);
852 SLOAV_OBV_METH_FROM_ARRAY_2(ushort_value,
unsigned short int,
bool,
bool);
853 SLOAV_OBV_METH_FROM_ARRAY_3(convert_to_str_internal, octave_value,
bool,
bool,
char);
854 SLOAV_OBV_METH_FROM_ARRAY_3(sort, octave_value, Array<octave_idx_type>&, octave_idx_type, sortmode);
855 SLOAV_OBV_METH_FROM_ARRAY_5(write,
int, octave_stream&,
int, oct_data_conv::data_type,
int, oct_mach_info::float_format);
856#undef SLOAV_OBV_METH_FROM_ARRAY_0
857#undef SLOAV_OBV_METH_FROM_ARRAY_1
858#undef SLOAV_OBV_METH_FROM_ARRAY_2
859#undef SLOAV_OBV_METH_FROM_ARRAY_3
860#undef SLOAV_OBV_METH_FROM_ARRAY_4
861#undef SLOAV_OBV_METH_FROM_ARRAY_5
876%define %swiglal_oct_array_frags(ACFTYPE, INFRAG, OUTFRAG, INCALL, OUTCALL, OVCLASS, OVTYPE, OVVALUE, ISOVTYPEEXPR)
879%fragment(%swiglal_oct_array_view_init_frag(ACFTYPE),
"init") %{
880#if SWIG_OCTAVE_PREREQ(4,4,0)
882 octave::type_info& typeinfo = octave::interpreter::the_interpreter()->get_type_info();
883 string_vector types = typeinfo.installed_type_names();
884 bool register_octave_array_view_class =
true;
885 bool register_octave_swig_packed =
true;
886 for (
int i = 0; i < types.numel(); ++i) {
887 if (types(i) == %swiglal_oct_array_view_class(ACFTYPE)::static_type_name()) {
888 register_octave_array_view_class =
false;
891 if (register_octave_array_view_class) {
892 %swiglal_oct_array_view_class(ACFTYPE)::register_type();
896 %swiglal_oct_array_view_class(ACFTYPE)::register_type();
901%fragment(%swiglal_oct_array_view_frag(ACFTYPE),
"header",
902 fragment=%swiglal_oct_array_view_init_frag(ACFTYPE),
903 fragment=
"swiglal_oct_array_view", fragment=INFRAG, fragment=OUTFRAG)
910 class %swiglal_oct_array_view_helper_class(ACFTYPE) {
915 typedef OVCLASS OVClass;
916 typedef OVTYPE OVType;
919 static OVType ovvalue(octave_value& ov) {
924 static int incall(
const octave_value& parent, octave_value& objelem,
void *elemptr,
int *pelemalloc,
const size_t esize,
const bool isptr, swig_type_info *
const tinfo,
const int tflags)
930 static octave_value outcall(
const octave_value& parent,
const bool copyobj,
void *elemptr,
const size_t esize,
const bool isptr, swig_type_info *
const tinfo,
const int tflags) {
937 class OCTINTERP_API %swiglal_oct_array_view_class(ACFTYPE) : public %swiglal_oct_array_view_tmpl(ACFTYPE) {
942#if !SWIG_OCTAVE_PREREQ(4,0,0)
943 DECLARE_OCTAVE_ALLOCATOR;
945 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA;
951 virtual ~%swiglal_oct_array_view_class(ACFTYPE)()
954 %swiglal_oct_array_view_class(ACFTYPE)()
955 : %swiglal_oct_array_view_tmpl(ACFTYPE)()
958 %swiglal_oct_array_view_class(ACFTYPE)(
const octave_value& parent,
963 const size_t strides[],
965 swig_type_info* tinfo,
967 : %swiglal_oct_array_view_tmpl(ACFTYPE)(parent, ptr, esize, ndims, dims, strides, isptr, tinfo, tflags)
973#if !SWIG_OCTAVE_PREREQ(4,0,0)
974 DEFINE_OCTAVE_ALLOCATOR(%swiglal_oct_array_view_class(ACFTYPE));
976 DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA(%swiglal_oct_array_view_class(ACFTYPE),
977 %swiglal_oct_array_view_ovtype(ACFTYPE),
978 OVCLASS::static_class_name());
985%fragment(%swiglal_array_copyin_frag(ACFTYPE),
"header",
986 fragment=%swiglal_oct_array_view_frag(ACFTYPE))
988 SWIGINTERN
int %swiglal_array_copyin_func(ACFTYPE)(
const octave_value& parent,
995 const size_t strides[],
997 swig_type_info *tinfo,
1002 %swiglal_oct_array_view_class(ACFTYPE) arrview(parent, ptr, esize, ndims, dims, strides, isptr, tinfo, tflags);
1003 return arrview.sloav_array_in(obj, pelemalloc, 0);
1008%fragment(%swiglal_array_copyout_frag(ACFTYPE),
"header",
1009 fragment=%swiglal_oct_array_view_frag(ACFTYPE))
1011 SWIGINTERN octave_value %swiglal_array_copyout_func(ACFTYPE)(
const octave_value& parent,
1015 const size_t dims[],
1016 const size_t strides[],
1018 swig_type_info *tinfo,
1023 %swiglal_oct_array_view_class(ACFTYPE) arrview(parent, ptr, esize, ndims, dims, strides, isptr, tinfo, tflags);
1024 return arrview.sloav_array_out(
true);
1029%fragment(%swiglal_array_viewin_frag(ACFTYPE),
"header",
1030 fragment=%swiglal_oct_array_view_frag(ACFTYPE))
1032 SWIGINTERN
int %swiglal_array_viewin_func(ACFTYPE)(
const octave_value& parent,
1039 swig_type_info *tinfo,
1045 return SWIG_MemoryError;
1049 OVTYPE val = obj.OVVALUE();
1054 dim_vector valdims = val.dims();
1056 if (valdims.length() > 2 || valdims.num_ones() == 0) {
1057 return SWIG_ValueError;
1060 else if (val.ndims() != %reinterpret_cast(ndims, octave_idx_type)) {
1061 return SWIG_ValueError;
1066 dims[0] = val.numel();
1068 for (
size_t i = 0; i < ndims; ++i) {
1069 dims[i] = valdims(i);
1075 return SWIG_TypeError;
1079 if (obj.type_name().find(
"swiglal_oct_array_view_") == 0) {
1080 return SWIG_TypeError;
1085 return SWIG_ValueError;
1089 if (!(ISOVTYPEEXPR)) {
1090 return SWIG_TypeError;
1094 if (val.byte_size() != val.numel() * esize) {
1095 return SWIG_TypeError;
1101 if (obj.is_complex_type() && !obj.is_scalar_type()) {
1102 if (obj.is_double_type()) {
1105 const ComplexNDArray t = obj.complex_array_value();
1106 *ptr = %reinterpret_cast(t.data(),
void*);
1107 c = *((Complex*) *ptr);
1109 if (c != *((Complex*) *ptr)) {
1110 return SWIG_UnknownError;
1112 }
else if (obj.is_single_type()) {
1115 const FloatComplexNDArray t = obj.float_complex_array_value();
1116 *ptr = %reinterpret_cast(t.data(),
void*);
1117 c = *((FloatComplex*) *ptr);
1119 if (c != *((FloatComplex*) *ptr)) {
1120 return SWIG_UnknownError;
1123 return SWIG_TypeError;
1126 *ptr = %reinterpret_cast(obj.mex_get_data(),
void*);
1129 return SWIG_ValueError;
1138%fragment(%swiglal_array_viewout_frag(ACFTYPE),
"header",
1139 fragment=%swiglal_oct_array_view_frag(ACFTYPE))
1141 SWIGINTERN octave_value %swiglal_array_viewout_func(ACFTYPE)(
const octave_value& parent,
1145 const size_t dims[],
1146 const size_t strides[],
1148 swig_type_info *tinfo,
1152 octave_base_value *objval =
new %swiglal_oct_array_view_class(ACFTYPE)(parent, ptr, esize, ndims, dims, strides, isptr, tinfo, tflags);
1153 return octave_value(objval);
1161%swiglal_oct_array_frags(SWIGTYPE,
"swiglal_as_SWIGTYPE",
"swiglal_from_SWIGTYPE",
1162 %arg(swiglal_as_SWIGTYPE(parent, objelem, elemptr, esize, isptr, tinfo, tflags)),
1163 %arg(swiglal_from_SWIGTYPE(parent, copyobj, elemptr, esize, isptr, tinfo, tflags)),
1164 octave_cell, Cell, cell_value,
false);
1168%swiglal_oct_array_frags(LALchar,
"SWIG_AsLALcharPtrAndSize",
"SWIG_FromLALcharPtr",
1169 %arg(SWIG_AsLALcharPtrAndSize(objelem, %reinterpret_cast(elemptr,
char**), 0, pelemalloc)),
1170 %arg(SWIG_FromLALcharPtr(*%reinterpret_cast(elemptr,
char**))),
1171 octave_cell, Cell, cell_value,
false);
1175%define %swiglal_oct_array_asvalfrom_frags(
TYPE, OVCLASS, OVTYPE, OVVALUE, ISOVTYPEEXPR)
1176%swiglal_oct_array_frags(
TYPE, SWIG_AsVal_frag(
TYPE), SWIG_From_frag(
TYPE),
1177 %arg(SWIG_AsVal(
TYPE)(objelem, %reinterpret_cast(elemptr,
TYPE*))),
1178 %arg(SWIG_From(
TYPE)(*%reinterpret_cast(elemptr,
TYPE*))),
1179 OVCLASS, OVTYPE, OVVALUE, ISOVTYPEEXPR);
1183%swiglal_oct_array_asvalfrom_frags(int8_t, octave_int8_matrix, intNDArray<octave_int<int8_t> >, int8_array_value, obj.is_int8_type());
1184%swiglal_oct_array_asvalfrom_frags(uint8_t, octave_uint8_matrix, intNDArray<octave_int<uint8_t> >, uint8_array_value, obj.is_uint8_type());
1185%swiglal_oct_array_asvalfrom_frags(int16_t, octave_int16_matrix, intNDArray<octave_int<int16_t> >, int16_array_value, obj.is_int16_type());
1186%swiglal_oct_array_asvalfrom_frags(uint16_t, octave_uint16_matrix, intNDArray<octave_int<uint16_t> >, uint16_array_value, obj.is_uint16_type());
1187%swiglal_oct_array_asvalfrom_frags(int32_t, octave_int32_matrix, intNDArray<octave_int<int32_t> >, int32_array_value, obj.is_int32_type());
1188%swiglal_oct_array_asvalfrom_frags(uint32_t, octave_uint32_matrix, intNDArray<octave_int<uint32_t> >, uint32_array_value, obj.is_uint32_type());
1189%swiglal_oct_array_asvalfrom_frags(int64_t, octave_int64_matrix, intNDArray<octave_int<int64_t> >, int64_array_value, obj.is_int64_type());
1190%swiglal_oct_array_asvalfrom_frags(uint64_t, octave_uint64_matrix, intNDArray<octave_int<uint64_t> >, uint64_array_value, obj.is_uint64_type());
1193%swiglal_oct_array_asvalfrom_frags(
float, octave_float_matrix, FloatMatrix, float_matrix_value, obj.is_real_type() && obj.is_single_type());
1194%swiglal_oct_array_asvalfrom_frags(
double, octave_matrix, Matrix, matrix_value, obj.is_real_type() && obj.is_double_type());
1197%swiglal_oct_array_asvalfrom_frags(gsl_complex_float, octave_float_complex_matrix, FloatComplexMatrix, float_complex_matrix_value, obj.is_complex_type() && obj.is_single_type());
1198%swiglal_oct_array_asvalfrom_frags(gsl_complex, octave_complex_matrix, ComplexMatrix, complex_matrix_value, obj.is_complex_type() && obj.is_double_type());
1199%swiglal_oct_array_asvalfrom_frags(
COMPLEX8, octave_float_complex_matrix, FloatComplexMatrix, float_complex_matrix_value, obj.is_complex_type() && obj.is_single_type());
1200%swiglal_oct_array_asvalfrom_frags(
COMPLEX16, octave_complex_matrix, ComplexMatrix, complex_matrix_value, obj.is_complex_type() && obj.is_double_type());
#define gmtime_r(timep, result)
static REAL8TimeSeries * error(const REAL8TimeSeries *s1, const REAL8TimeSeries *s0)
#define crect(re, im)
Construct a COMPLEX16 from real and imaginary parts.
double complex COMPLEX16
Double-precision floating-point complex number (16 bytes total)
#define crectf(re, im)
Construct a COMPLEX8 from real and imaginary parts.
float complex COMPLEX8
Single-precision floating-point complex number (8 bytes total)