26 #if defined (HAVE_CONFIG_H) 72 error (fmt, idx.c_str (), msg.c_str ());
98 int nargin = args.length ();
103 int dim = (
nargin == 1 ? -1
104 : args(1).int_value (
"all: DIM must be an integer")-1);
107 error (
"all: invalid dimension argument = %d", dim + 1);
109 return ovl (args(0).all (dim));
163 int nargin = args.length ();
168 int dim = (
nargin == 1 ? -1
169 : args(1).int_value (
"any: DIM must be an integer")-1);
172 error (
"any: invalid dimension argument = %d", dim + 1);
174 return ovl (args(0).
any (dim));
200 DEFUN (atan2, args, ,
214 if (args.length () != 2)
219 if (! args(0).isnumeric ())
222 if (! args(1).isnumeric ())
225 if (args(0).iscomplex () || args(1).iscomplex ())
226 error (
"atan2: not defined for complex numbers");
228 if (args(0).is_single_type () || args(1).is_single_type ())
230 if (args(0).is_scalar_type () && args(1).is_scalar_type ())
231 retval = atan2f (args(0).float_value (), args(1).float_value ());
236 retval = binmap<float> (a0, a1, std::atan2,
"atan2");
241 if (args(0).is_scalar_type () && args(1).is_scalar_type ())
242 retval = atan2 (args(0).scalar_value (), args(1).scalar_value ());
243 else if (args(0).issparse ())
247 retval = binmap<double> (m0, m1, std::atan2,
"atan2");
251 NDArray a0 = args(0).array_value ();
252 NDArray a1 = args(1).array_value ();
253 retval = binmap<double> (a0, a1, std::atan2,
"atan2");
346 retval = binmap<float> (a0, a1, std::hypot,
"hypot");
357 retval = binmap<double> (m0, m1, std::hypot,
"hypot");
363 retval = binmap<double> (a0, a1, std::hypot,
"hypot");
370 DEFUN (hypot, args, ,
392 int nargin = args.length ();
400 retval = do_hypot (args(0), args(1));
451 template <
typename T,
typename ET>
489 if (args.length () != 1)
496 else if (args(0).is_single_type ())
498 if (args(0).isreal ())
504 map_2_xlog2 (
x,
f,
e);
507 else if (args(0).iscomplex ())
513 map_2_xlog2 (
x,
f,
e);
517 else if (args(0).isreal ())
523 map_2_xlog2 (
x,
f,
e);
526 else if (args(0).iscomplex ())
532 map_2_xlog2 (
x,
f,
e);
596 if (args.length () != 2)
601 if (! args(0).isnumeric ())
604 if (! args(1).isnumeric ())
607 if (args(0).iscomplex () || args(1).iscomplex ())
608 error (
"rem: not defined for complex numbers");
610 if (args(0).isinteger () || args(1).isinteger ())
620 error (
"rem: cannot combine %s and %d",
621 args(0).class_name ().c_str (),
622 args(1).class_name ().c_str ());
626 #define MAKE_INT_BRANCH(X) \ 629 X##NDArray a0 = args(0).X##_array_value (); \ 630 X##NDArray a1 = args(1).X##_array_value (); \ 631 retval = binmap<octave_##X,octave_##X,octave_##X> (a0, a1, rem, "rem"); \ 644 #undef MAKE_INT_BRANCH 650 else if (args(0).is_single_type () || args(1).is_single_type ())
652 if (args(0).is_scalar_type () && args(1).is_scalar_type ())
658 retval = binmap<float> (a0, a1, octave::math::rem<float>,
"rem");
663 if (args(0).is_scalar_type () && args(1).is_scalar_type ())
665 else if (args(0).issparse () || args(1).issparse ())
669 retval = binmap<double> (m0, m1, octave::math::rem<double>,
"rem");
673 NDArray a0 = args(0).array_value ();
674 NDArray a1 = args(1).array_value ();
675 retval = binmap<double> (a0, a1, octave::math::rem<double>,
"rem");
775 if (args.length () != 2)
780 if (! args(0).isnumeric ())
783 if (! args(1).isnumeric ())
786 if (args(0).iscomplex () || args(1).iscomplex ())
787 error (
"mod: not defined for complex numbers");
789 if (args(0).isinteger () || args(1).isinteger ())
799 error (
"mod: cannot combine %s and %d",
800 args(0).class_name ().c_str (),
801 args(1).class_name ().c_str ());
805 #define MAKE_INT_BRANCH(X) \ 808 X##NDArray a0 = args(0).X##_array_value (); \ 809 X##NDArray a1 = args(1).X##_array_value (); \ 810 retval = binmap<octave_##X,octave_##X,octave_##X> (a0, a1, mod, "mod"); \ 823 #undef MAKE_INT_BRANCH 829 else if (args(0).is_single_type () || args(1).is_single_type ())
831 if (args(0).is_scalar_type () && args(1).is_scalar_type ())
837 retval = binmap<float> (a0, a1, octave::math::mod<float>,
"mod");
842 if (args(0).is_scalar_type () && args(1).is_scalar_type ())
844 else if (args(0).issparse () || args(1).issparse ())
848 retval = binmap<double> (m0, m1, octave::math::mod<double>,
"mod");
852 NDArray a0 = args(0).array_value ();
853 NDArray a1 = args(1).array_value ();
854 retval = binmap<double> (a0, a1, octave::math::mod<double>,
"mod");
909 #define DATA_REDUCTION(FCN) \ 911 int nargin = args.length (); \ 913 if (nargin < 1 || nargin > 2) \ 916 octave_value retval; \ 918 octave_value arg = args(0); \ 920 int dim = (nargin == 1 ? -1 : args(1).int_value (true) - 1); \ 923 error (#FCN ": invalid dimension argument = %d", dim + 1); \ 927 if (arg.issparse ()) \ 929 SparseMatrix tmp = arg.sparse_matrix_value (); \ 931 retval = tmp.FCN (dim); \ 933 else if (arg.is_single_type ()) \ 935 FloatNDArray tmp = arg.float_array_value (); \ 937 retval = tmp.FCN (dim); \ 941 NDArray tmp = arg.array_value (); \ 943 retval = tmp.FCN (dim); \ 946 else if (arg.iscomplex ()) \ 948 if (arg.issparse ()) \ 950 SparseComplexMatrix tmp = arg.sparse_complex_matrix_value (); \ 952 retval = tmp.FCN (dim); \ 954 else if (arg.is_single_type ()) \ 956 FloatComplexNDArray tmp \ 957 = arg.float_complex_array_value (); \ 959 retval = tmp.FCN (dim); \ 963 ComplexNDArray tmp = arg.complex_array_value (); \ 965 retval = tmp.FCN (dim); \ 969 err_wrong_type_arg (#FCN, arg); \ 973 DEFUN (cumprod, args, ,
1016 DEFUN (cumsum, args, ,
1041 int nargin = args.length ();
1043 bool isnative =
false;
1044 bool isdouble =
false;
1050 if (
str ==
"native")
1052 else if (
str ==
"double")
1055 error (
"cumsum: unrecognized string argument");
1066 dim = args(1).int_value () - 1;
1068 error (
"cumsum: invalid dimension argument = %d", dim + 1);
1101 #define MAKE_INT_BRANCH(X) \ 1104 retval = arg.X ## _array_value ().cumsum (dim); \ 1106 retval = arg.array_value ().cumsum (dim); \ 1118 #undef MAKE_INT_BRANCH 1166 DEFUN (diag, args, ,
1199 int nargin = args.length ();
1219 error (
"diag: V must be a vector");
1221 octave_idx_type m = args(1).xidx_type_value (
"diag: invalid dimensions");
1222 octave_idx_type n = args(2).xidx_type_value (
"diag: invalid dimensions");
1295 DEFUN (prod, args, ,
1326 int nargin = args.length ();
1328 bool isnative =
false;
1329 bool isdouble =
false;
1335 if (
str ==
"native")
1337 else if (
str ==
"double")
1340 error (
"prod: unrecognized type argument '%s'",
str.c_str ());
1355 dim = args(1).int_value () - 1;
1357 error (
"prod: invalid dimension DIM = %d", dim + 1);
1387 #define MAKE_INT_BRANCH(X) \ 1390 retval = arg.X ## _array_value ().prod (dim); \ 1392 retval = arg.array_value ().prod (dim); \ 1404 #undef MAKE_INT_BRANCH 1503 int n_args = args.
length ();
1504 for (
int i = 0;
i < n_args;
i++)
1505 if (args(
i).
numel () != 1)
1511 template <
typename TYPE,
typename T>
1517 int n_args = args.
length ();
1520 && all_scalar_1x1 (args))
1524 if (dim == -1 || dim == -2)
1532 for (
int j = 0; j < n_args; j++)
1536 result(j) = octave_value_extract<T> (args(j));
1543 for (
int j = 0; j < n_args; j++)
1547 array_list[j] = octave_value_extract<TYPE> (args(j));
1554 template <
typename TYPE,
typename T>
1560 int n_args = args.
length ();
1563 for (
int j = 0; j < n_args; j++)
1567 sparse_list[j] = octave_value_extract<TYPE> (args(j));
1574 template <
typename TYPE>
1580 single_type_concat<TYPE, typename TYPE::element_type> (
result, args, dim);
1585 template <
typename MAP>
1591 int n_args = args.
length ();
1594 for (
int j = 0; j < n_args; j++)
1598 map_list[j] = octave_value_extract<MAP> (args(j));
1609 if (all_scalar_1x1 (args))
1610 single_type_concat_map<octave_scalar_map> (
result, args, dim);
1612 single_type_concat_map<octave_map> (
result, args, dim);
1641 catch (octave::execution_exception&
e)
1643 error (
e,
"conversion from %s to %s failed", dtype.c_str (),
1648 error (
"conversion from %s to %s failed", dtype.c_str (),
1661 error (
"no constructor for %s!", dtype.c_str ());
1669 catch (octave::execution_exception&
e)
1671 error (
e,
"%s constructor failed for %s argument", dtype.c_str (),
1676 error (
"%s constructor failed for %s argument", dtype.c_str (),
1708 catch (octave::execution_exception&
e)
1710 error (
e,
"%s/%s method failed", dtype.c_str (), cattype.c_str ());
1714 error (
"%s/%s method did not return a value", dtype.c_str (),
1734 if (t1_type == dtype)
1737 tmp(j++) = attempt_type_conversion (elt, dtype);
1745 std::list<std::string> parents =
tmp(0).parent_class_name_list ();
1763 int n_args = args.
length ();
1767 else if (n_args == 1)
1769 else if (n_args > 1)
1774 bool all_sq_strings_p =
true;
1775 bool all_dq_strings_p =
true;
1776 bool all_real_p =
true;
1777 bool all_cmplx_p =
true;
1778 bool any_sparse_p =
false;
1779 bool any_cell_p =
false;
1780 bool any_class_p =
false;
1782 bool first_elem_is_struct =
false;
1784 for (
int i = 0;
i < n_args;
i++)
1790 first_elem_is_struct = args(
i).isstruct ();
1797 if (all_sq_strings_p && ! args(
i).is_sq_string ())
1798 all_sq_strings_p =
false;
1799 if (all_dq_strings_p && ! args(
i).is_dq_string ())
1800 all_dq_strings_p =
false;
1801 if (all_real_p && ! args(
i).isreal ())
1803 if (all_cmplx_p && ! (args(
i).iscomplex ()
1804 || args(
i).isreal ()))
1805 all_cmplx_p =
false;
1806 if (! any_sparse_p && args(
i).issparse ())
1807 any_sparse_p =
true;
1808 if (! any_cell_p && args(
i).iscell ())
1810 if (! any_class_p && args(
i).isobject ())
1814 if (any_cell_p && ! any_class_p && ! first_elem_is_struct)
1817 for (
int i = 0;
i < n_args;
i++)
1819 if (args(
i).iscell ())
1820 args(j++) = args(
i);
1823 if (args(
i).isempty ())
1826 args(j++) =
Cell (args(
i));
1842 retval = do_single_type_concat<SparseMatrix> (args, dim);
1844 retval = do_single_type_concat<SparseComplexMatrix> (args, dim);
1849 retval = do_single_type_concat<NDArray> (args, dim);
1851 retval = do_single_type_concat<ComplexNDArray> (args, dim);
1857 retval = do_single_type_concat<FloatNDArray> (args, dim);
1859 retval = do_single_type_concat<FloatComplexNDArray> (args, dim);
1863 char type = (all_dq_strings_p ?
'"' :
'\'');
1878 retval = do_single_type_concat<SparseBoolMatrix> (args, dim);
1880 retval = do_single_type_concat<boolNDArray> (args, dim);
1883 retval = do_single_type_concat<int8NDArray> (args, dim);
1885 retval = do_single_type_concat<int16NDArray> (args, dim);
1887 retval = do_single_type_concat<int32NDArray> (args, dim);
1889 retval = do_single_type_concat<int64NDArray> (args, dim);
1891 retval = do_single_type_concat<uint8NDArray> (args, dim);
1893 retval = do_single_type_concat<uint16NDArray> (args, dim);
1895 retval = do_single_type_concat<uint32NDArray> (args, dim);
1897 retval = do_single_type_concat<uint64NDArray> (args, dim);
1899 retval = do_single_type_concat<Cell> (args, dim);
1901 retval = do_single_type_concat_map (args, dim);
1910 if (dim == -1 || dim == -2)
1916 for (
int i = 1;
i < args.length ();
i++)
1918 if (! (
dv.*concat_rule) (args(
i).dims (), dim))
1919 error (
"cat: dimension mismatch");
1943 for (
int j = 0; j < n_args; j++)
1955 error (
"%s: indexing error",
fname.c_str ());
1960 ra_idx(dim) += (dim < dv_tmp.
ndims () ? dv_tmp(dim) : 1);
1971 DEFUN (horzcat, args, ,
1986 return do_cat (args, -2,
"horzcat");
2210 DEFUN (vertcat, args, ,
2225 return do_cat (args, -1,
"vertcat");
2280 if (args.length () == 0)
2283 int dim = args(0).xint_value (
"cat: DIM must be an integer") - 1;
2286 error (
"cat: DIM must be a valid dimension");
2288 return ovl (do_cat (args.slice (1, args.length () - 1), dim,
"cat"));
2443 if (args.
length () != 2 || args(1).
length () < args(1).ndims ())
2446 Array<int> vec = args(1).int_vector_value ();
2450 int n = vec.
numel ();
2451 for (
int i = 0;
i < n;
i++)
2457 DEFUN (permute, args, ,
2487 return do_permute (args,
false);
2490 DEFUN (ipermute, args, ,
2506 return do_permute (args,
true);
2527 DEFUN (ndims, args, ,
2547 return ovl (args(0).ndims ());
2601 retval = args(0).numel ();
2678 const dim_vector dimensions = args(0).dims ();
2689 int ndims = dimensions.
ndims ();
2693 for (
int i = 0;
i < ndims;
i++)
2694 m(
i) = dimensions(
i);
2701 if (! args(1).is_real_scalar ())
2702 error (
"size: DIM must be a positive integer");
2709 error (
"size: requested dimension DIM (= %d) out of range", nd);
2722 DEFUN (size_equal, args, ,
2742 if (a_dims != b_dims)
2760 return ovl (args(0).nnz ());
2779 DEFUN (nzmax, args, ,
2793 return ovl (args(0).nzmax ());
2796 DEFUN (rows, args, ,
2806 return ovl (args(0).rows ());
2836 DEFUN (columns, args, ,
2846 return ovl (args(0).columns ());
2890 bool isnative =
false;
2891 bool isdouble =
false;
2892 bool isextra =
false;
2898 if (
str ==
"native")
2900 else if (
str ==
"double")
2902 else if (
str ==
"extra")
2905 error (
"sum: unrecognized type argument '%s'",
str.c_str ());
2916 dim = args(1).int_value () - 1;
2918 error (
"sum: invalid dimension DIM = %d", dim + 1);
2930 warning (
"sum: 'extra' not yet implemented for sparse matrices");
2943 warning (
"sum: 'extra' not yet implemented for sparse matrices");
2953 if (isdouble || isextra)
2960 if (isdouble || isextra)
2966 #define MAKE_INT_BRANCH(X) \ 2969 retval = arg.X ## _array_value ().sum (dim); \ 2971 retval = arg.X ## _array_value ().dsum (dim); \ 2983 #undef MAKE_INT_BRANCH 3079 DEFUN (sumsq, args, ,
3207 DEFUN (iscomplex, args, ,
3217 return ovl (args(0).iscomplex ());
3238 DEFUN (complex, args, ,
3325 if (re.
numel () == 1)
3328 if (re_val.
nnz () == 0)
3340 i < im_val.
cidx (j + 1);
i++)
3347 else if (im.
numel () == 1)
3350 if (im_val.
nnz () == 0)
3363 i < re_val.
cidx (j + 1);
i++)
3372 if (re_val.
dims () != im_val.
dims ())
3373 error (
"complex: dimension mismatch");
3383 if (re.
numel () == 1)
3387 if (im.
numel () == 1)
3412 if (im.
numel () == 1)
3429 if (re_val.
dims () != im_val.
dims ())
3430 error (
"complex: dimension mismatch");
3444 else if (re.
numel () == 1)
3448 if (im.
numel () == 1)
3471 if (im.
numel () == 1)
3486 if (re_val.
dims () != im_val.
dims ())
3487 error (
"complex: dimension mismatch");
3545 DEFUN (isreal, args, ,
3558 return ovl (args(0).isreal ());
3561 DEFUN (isempty, args, ,
3572 return ovl (args(0).isempty ());
3612 DEFUN (isscalar, args, ,
3622 return ovl (args(0).
numel () == 1);
3659 return ovl (
sz.ndims () == 2 && (
sz(0) == 1 ||
sz(1) == 1));
3682 DEFUN (isrow, args, ,
3694 return ovl (
sz.ndims () == 2 &&
sz(0) == 1);
3726 DEFUN (iscolumn, args, ,
3738 return ovl (
sz.ndims () == 2 &&
sz(1) == 1);
3770 DEFUN (ismatrix, args, ,
3782 return ovl (
sz.ndims () == 2 &&
sz(0) >= 0 &&
sz(1) >= 0);
3813 DEFUN (issquare, args, ,
3825 return ovl (
sz.ndims () == 2 &&
sz(0) ==
sz(1));
3882 dims(
i) = (args(
i).isempty ()
3883 ? 0 : args(
i).xidx_type_value (
"%s: dimension arguments must be scalar integers",
fcn));
3888 dims.chop_trailing_singletons ();
3939 if (
val == 1 &&
dims.ndims () == 2 &&
dims(0) == 1)
3951 error (
"%s: invalid class name",
fcn);
3992 dims(
i) = (args(
i).isempty ()
3993 ? 0 : args(
i).xidx_type_value (
"%s: dimension arguments must be scalar integers",
fcn));
3998 dims.chop_trailing_singletons ();
4016 error (
"%s: invalid class name",
fcn);
4056 dims(
i) = (args(
i).isempty ()
4057 ? 0 : args(
i).xidx_type_value (
"%s: dimension arguments must be scalar integers",
fcn));
4062 dims.chop_trailing_singletons ();
4080 error (
"%s: invalid class name",
fcn);
4121 dims(
i) = (args(
i).isempty ()
4122 ? 0 : args(
i).xidx_type_value (
"%s: dimension arguments must be scalar integers",
fcn));
4127 dims.chop_trailing_singletons ();
4138 static_cast<FloatComplex> (
val));
4146 error (
"%s: invalid class name",
fcn);
4176 dims(
i) = (args(
i).isempty ()
4177 ? 0 : args(
i).xidx_type_value (
"%s: dimension arguments must be scalar integers",
fcn));
4182 dims.chop_trailing_singletons ();
4194 DEFUN (ones, args, ,
4225 return fill_matrix (args, 1,
"ones");
4262 DEFUN (zeros, args, ,
4286 return fill_matrix (args, 0,
"zeros");
4467 double e_val = exp (1.0);
4470 return fill_matrix (args, e_val,
"e");
4473 template <
typename T>
4477 T epsval =
x.abs ();
4478 typedef typename T::value_type P;
4481 P
val = epsval.xelem (
i);
4485 epsval(
i) = std::numeric_limits<P>::denorm_min ();
4490 const P digits = std::numeric_limits<P>::digits;
4491 epsval(
i) =
std::pow (static_cast<P> (2.0),
4492 static_cast<P> (exponent - digits));
4535 if (args.
length () == 1 && ! args(0).is_string ())
4549 error (
"eps: X must be of a floating point type");
4552 retval = fill_matrix (args, std::numeric_limits<double>::epsilon (),
4553 std::numeric_limits<float>::epsilon (),
"eps");
4623 double pi_val = M_PI;
4625 double pi_val = 4.0 *
atan (1.0);
4628 return fill_matrix (args, pi_val,
"pi");
4631 DEFUN (realmax, args, ,
4670 DEFUN (realmin, args, ,
4747 return fill_matrix (args,
Complex (0.0, 1.0),
"I");
4790 DEFUN (
false, args, ,
4805 return fill_matrix (args,
false,
"false");
4808 DEFUN (
true, args, ,
4823 return fill_matrix (args,
true,
"true");
4826 template <
typename MT>
4832 typename MT::element_type one (1);
4834 if (nr == 1 && nc == 1)
4840 typename MT::element_type
zero (0);
4844 if (nr > 0 && nc > 0)
4848 for (
int i = 0;
i < n;
i++)
4858 #define INSTANTIATE_EYE(T) \ 4859 template octave_value identity_matrix<T> (int, int) 4885 retval = identity_matrix<int8NDArray> (nr, nc);
4929 error (
"eye: invalid class name");
4936 #undef INT_EYE_MATRIX 5040 template <
typename MT>
5045 typedef typename MT::column_vector_type CVT;
5046 typedef typename MT::element_type T;
5052 T bs = octave_value_extract<T> (base);
5055 T
ls = octave_value_extract<T> (limit);
5060 CVT lv = octave_value_extract<CVT> (limit);
5061 CVT bv (lv.numel (), bs);
5067 CVT bv = octave_value_extract<CVT> (base);
5070 T
ls = octave_value_extract<T> (limit);
5071 CVT lv (bv.numel (),
ls);
5076 CVT lv = octave_value_extract<CVT> (limit);
5122 error (
"linspace: N must be a scalar");
5132 bool isvector1 = sz1.
ndims () == 2 && (sz1(0) == 1 || sz1(1) == 1);
5134 bool isvector2 = sz2.
ndims () == 2 && (sz2(0) == 1 || sz2(1) == 1);
5136 if (! isvector1 || ! isvector2)
5137 error (
"linspace: START, END must be scalars or vectors");
5144 retval = do_linspace<FloatComplexMatrix> (arg_1, arg_2, npoints);
5146 retval = do_linspace<FloatMatrix> (arg_1, arg_2, npoints);
5151 retval = do_linspace<ComplexMatrix> (arg_1, arg_2, npoints);
5153 retval = do_linspace<Matrix> (arg_1, arg_2, npoints);
5276 int ndim = vec.
numel ();
5287 for (
int i = 0;
i < ndim;
i++)
5309 DEFUN (reshape, args, ,
5356 if (new_size.
numel () < 2)
5357 error (
"reshape: SIZE must have 2 or more dimensions");
5363 if (new_size(
i) < 0)
5364 error (
"reshape: SIZE must be non-negative");
5366 new_dims(
i) = new_size(
i);
5376 if (args(
i).isempty ())
5379 error (
"reshape: only a single dimension can be unknown");
5386 new_dims(
i-1) = args(
i).idx_type_value ();
5388 if (new_dims(
i-1) < 0)
5389 error (
"reshape: SIZE must be non-negative");
5398 new_dims(empty_dim-1) = 0;
5404 if (a_nel != size_empty_dim * nel)
5405 error (
"reshape: SIZE is not divisible by the product of known dimensions (= %d)",
5408 new_dims(empty_dim-1) = size_empty_dim;
5413 retval = args(0).reshape (new_dims);
5465 dim = args(1).idx_type_value ();
5468 error (
"vec: DIM must be greater than zero");
5480 for (
int i = 0;
i < dim-1;
i++)
5506 DEFUN (squeeze, args, ,
5519 return ovl (args(0).squeeze ());
5522 DEFUN (full, args, ,
5533 return ovl (args(0).full_value ());
5606 if (x_arg.
ndims () != 2)
5607 error (
"norm: only valid for 2-D objects");
5609 enum {sfmatrix, sfcols, sfrows, sffrob, sfinf, sfneginf} strflag = sfmatrix;
5614 if (
str ==
"cols" ||
str ==
"columns")
5616 else if (
str ==
"rows")
5618 else if (
str ==
"fro")
5620 else if (
str ==
"inf")
5622 else if (
str ==
"-inf")
5625 error (
"norm: unrecognized option: %s",
str.c_str ());
5639 if (strflag != sfcols && strflag != sfrows)
5640 error (
"norm: invalid combination of options");
5642 if (
str ==
"cols" ||
str ==
"columns" ||
str ==
"rows")
5643 error (
"norm: invalid combination of options");
5647 else if (
str ==
"inf")
5649 else if (
str ==
"-inf")
5652 error (
"norm: unrecognized option: %s",
str.c_str ());
5800 DEFUN (uplus, args, ,
5810 DEFUN (uminus, args, ,
5852 DEFUN (ctranspose, args, ,
5921 DEFUN (plus, args, ,
5942 DEFUN (minus, args, ,
5952 DEFUN (mtimes, args, ,
5974 DEFUN (mrdivide, args, ,
5986 DEFUN (mpower, args, ,
5998 DEFUN (mldivide, args, ,
6096 DEFUN (rdivide, args, ,
6108 DEFUN (power, args, ,
6126 DEFUN (ldivide, args, ,
6183 DEFUN (colon, args, ,
6260 warning (
"tic: ignoring extra arguments");
6269 double frac = std::modf (
tmp, &ip);
6270 uint64_t microsecs =
static_cast<uint64_t
> (CLOCKS_PER_SEC * frac);
6271 microsecs += CLOCKS_PER_SEC *
static_cast<uint64_t
> (ip);
6307 octave_uint64 id = args(0).xuint64_scalar_value (
"toc: invalid ID");
6309 uint64_t
val =
id.value ();
6312 = (
static_cast<double> (
val / CLOCKS_PER_SEC)
6313 + static_cast<double> (
val % CLOCKS_PER_SEC)
6321 error (
"toc called before timer set");
6331 octave_stdout <<
"Elapsed time is " << etime <<
" seconds.\n";
6343 DEFUN (cputime, args, ,
6367 double usr = cpu_tm.
user ();
6368 double sys = cpu_tm.
system ();
6370 return ovl (usr + sys, usr, sys);
6449 bool return_idx = (
nargout > 1);
6450 bool have_sortmode = (
nargin > 1 && args(1).is_string ());
6459 if (
mode ==
"ascend")
6461 else if (
mode ==
"descend")
6464 error (R
"(sort: MODE must be either "ascend" or "descend")"); 6467 dim = args(1).nint_value () - 1;
6473 error (
"sort: DIM must be a valid dimension");
6475 std::string mode = args(2).xstring_value (
"sort: MODE must be a string");
6477 if (
mode ==
"ascend")
6479 else if (
mode ==
"descend")
6482 error (R
"(sort: MODE must be either "ascend" or "descend")"); 6486 if (
nargin == 1 || have_sortmode)
6493 error (
"sort: DIM must be a valid dimension");
6695 DEFUN (__sort_rows_idx__, args, ,
6706 if (
nargin == 2 && ! args(1).is_string ())
6707 error (
"__sort_rows_idx__: second argument must be a string");
6713 if (
mode ==
"ascend")
6715 else if (
mode ==
"descend")
6718 error (R
"(__sort_rows_idx__: MODE must be either "ascend" or "descend")"); 6724 error (
"__sort_rows_idx__: sparse matrices not yet supported");
6727 error (
"__sort_rows_idx__: needs a 2-D object");
6745 if (
mode ==
"ascending")
6747 else if (
mode ==
"descending")
6749 else if (
mode ==
"either")
6752 error (R
"(issorted: MODE must be "ascending", "descending", or "either")"); 6757 DEFUN (issorted, args, ,
6782 bool by_rows =
false;
6789 smode = get_sort_mode_option (args(2));
6791 std::string tmp = args(1).xstring_value (
"issorted: second argument must be a string");
6795 smode = get_sort_mode_option (args(1));
6805 error (
"issorted: sparse matrices not yet supported");
6808 error (
"issorted: A must be a 2-D object");
6815 error (
"issorted: needs a vector");
6869 DEFUN (nth_element, args, ,
6901 dim = args(2).int_value (
true) - 1;
6903 error (
"nth_element: DIM must be a valid dimension");
6931 #define MAKE_INT_BRANCH(X) \ 6933 retval = argx.X ## _array_value ().nth_element (n, dim); \ 6946 #undef MAKE_INT_BRANCH 6957 index_error (
"nth_element: invalid N value %s. %s",
6958 e.idx (),
e.details ());
6979 template <
typename NDT>
6981 do_accumarray_sum (
const idx_vector& idx,
const NDT& vals,
6984 typedef typename NDT::element_type T;
6987 else if (idx.
extent (n) > n)
6988 error (
"accumarray: index out of range");
6992 if (vals.numel () == 1)
6993 retval.idx_add (idx, vals (0));
6994 else if (vals.numel () == idx.
length (n))
6995 retval.idx_add (idx, vals);
6997 error (
"accumarray: dimensions mismatch");
7002 DEFUN (__accumarray_sum__, args, ,
7014 error (
"__accumarray_sum__: first argument must be numeric");
7023 n = args(2).idx_type_value (
true);
7037 retval = do_accumarray_sum (idx,
7046 retval = do_accumarray_sum (idx,
7057 index_error (
"__accumarray_sum__: invalid IDX %s. %s",
7058 e.idx (),
e.details ());
7064 template <
typename NDT>
7066 do_accumarray_minmax (
const idx_vector& idx,
const NDT& vals,
7068 const typename NDT::element_type& zero_val)
7070 typedef typename NDT::element_type T;
7073 else if (idx.
extent (n) > n)
7074 error (
"accumarray: index out of range");
7083 if (vals.numel () == 1)
7085 else if (vals.numel () == l)
7086 (
retval.*op) (idx, vals);
7088 error (
"accumarray: dimensions mismatch");
7103 error (
"accumarray: first argument must be numeric");
7112 n = args(3).idx_type_value (
true);
7121 zero.double_value ());
7126 ismin,
zero.float_value ());
7131 n, ismin,
zero.complex_value ());
7135 retval = do_accumarray_minmax (idx,
7138 zero.float_complex_value ());
7141 #define MAKE_INT_BRANCH(X) \ 7143 retval = do_accumarray_minmax (idx, vals.X ## _array_value (), \ 7144 n, ismin, zero.X ## _scalar_value ()); \ 7156 #undef MAKE_INT_BRANCH 7160 zero.bool_value ());
7169 index_error (
"do_accumarray_minmax_fun: invalid index %s. %s",
7170 e.idx (),
e.details ());
7176 DEFUN (__accumarray_min__, args, ,
7182 return do_accumarray_minmax_fun (args,
true);
7185 DEFUN (__accumarray_max__, args, ,
7191 return do_accumarray_minmax_fun (args,
false);
7194 template <
typename NDT>
7196 do_accumdim_sum (
const idx_vector& idx,
const NDT& vals,
7199 typedef typename NDT::element_type T;
7202 else if (idx.
extent (n) > n)
7203 error (
"accumdim: index out of range");
7210 else if (dim >= rdv.
ndims ())
7217 if (idx.
length () != vals_dim(dim))
7218 error (
"accumdim: dimension mismatch");
7220 retval.idx_add_nd (idx, vals, dim);
7225 DEFUN (__accumdim_sum__, args, ,
7237 error (
"__accumdim_sum__: first argument must be numeric");
7246 dim = args(2).int_value () - 1;
7250 n = args(3).idx_type_value (
true);
7257 retval = do_accumdim_sum (idx,
7277 index_error (
"__accumdim_sum__: invalid IDX %s. %s",
7278 e.idx (),
e.details ());
7284 template <
typename NDT>
7287 const NDT& tval,
const NDT& fval)
7289 typedef typename NDT::element_type T;
7293 bool tscl = tval.numel () == 1;
7294 bool fscl = fval.numel () == 1;
7296 if ((! tscl && tval.dims () !=
dv) || (! fscl && fval.dims () !=
dv))
7297 error (
"merge: MASK, TVAL, and FVAL dimensions must match");
7299 T *rv =
retval.fortran_vec ();
7302 const T *tv = tval.data ();
7303 const T *fv = fval.data ();
7304 const bool *mv = mask.
data ();
7313 rv[
i] = (mv[
i] ? ts :
fs);
7319 rv[
i] = (mv[
i] ? ts : fv[
i]);
7328 rv[
i] = (mv[
i] ? tv[
i] :
fs);
7333 rv[
i] = (mv[
i] ? tv[
i] : fv[
i]);
7340 #define MAKE_INT_BRANCH(INTX) \ 7341 else if (tval.is_ ## INTX ## _type () && fval.is_ ## INTX ## _type ()) \ 7343 retval = do_merge (mask, \ 7344 tval.INTX ## _array_value (), \ 7345 fval.INTX ## _array_value ()); \ 7348 DEFUN (merge, args, ,
7381 error (
"merge: first argument must be logical or numeric");
7424 sq_string ?
'\'' :
'"');
7443 error (
"merge: cannot merge %s with %s with array mask",
7453 #undef MAKE_INT_BRANCH 7455 template <
typename SparseT>
7464 while (order > 0 &&
k > 0)
7466 idx_vector col1 (
':'), col2 (
':'), sl1 (1,
k), sl2 (0,
k-1);
7468 - SparseT (
retval.index (col2, sl2));
7477 while (order > 0 &&
k > 0)
7479 idx_vector col1 (
':'), col2 (
':'), sl1 (1,
k), sl2 (0,
k-1);
7481 - SparseT (
retval.index (sl2, col2));
7500 dim =
array.dims ().first_non_singleton ();
7503 if (
dv(dim) <= order)
7517 else if (
dv(dim) == 1)
7522 order -=
dv(dim) - 1;
7532 if (
array.isinteger ())
7534 if (
array.is_int8_type ())
7535 retval =
array.int8_array_value ().diff (order, dim);
7536 else if (
array.is_int16_type ())
7537 retval =
array.int16_array_value ().diff (order, dim);
7538 else if (
array.is_int32_type ())
7539 retval =
array.int32_array_value ().diff (order, dim);
7540 else if (
array.is_int64_type ())
7541 retval =
array.int64_array_value ().diff (order, dim);
7542 else if (
array.is_uint8_type ())
7543 retval =
array.uint8_array_value ().diff (order, dim);
7544 else if (
array.is_uint16_type ())
7545 retval =
array.uint16_array_value ().diff (order, dim);
7546 else if (
array.is_uint32_type ())
7547 retval =
array.uint32_array_value ().diff (order, dim);
7548 else if (
array.is_uint64_type ())
7549 retval =
array.uint64_array_value ().diff (order, dim);
7553 else if (
array.issparse ())
7555 if (
array.iscomplex ())
7561 else if (
array.is_single_type ())
7563 if (
array.iscomplex ())
7564 retval =
array.float_complex_array_value ().diff (order, dim);
7566 retval =
array.float_array_value ().diff (order, dim);
7570 if (
array.iscomplex ())
7571 retval =
array.complex_array_value ().diff (order, dim);
7579 DEFUN (diff, args, ,
7617 error (
"diff: X must be numeric or logical");
7623 if (args(1).is_scalar_type ())
7624 order = args(1).idx_type_value (
true,
false);
7625 else if (! args(1).is_zero_by_zero ())
7626 error (
"diff: order K must be a scalar or []");
7628 error (
"diff: order K must be non-negative");
7633 dim = args(2).int_value (
true,
false);
7634 if (dim < 1 || dim > args(0).ndims ())
7635 error (
"diff: DIM must be a valid dimension");
7640 return do_diff (args(0), order, dim);
7656 template <
typename T>
7662 assert (rep.
ndims () == 2 && rep.
rows () == 2);
7670 error (
"repelems: second row must contain non-negative numbers");
7676 T *dest =
retval.fortran_vec ();
7681 std::fill_n (dest,
k, src.
checkelem (rep(0,
i) - 1));
7688 DEFUN (repelems, args, ,
7719 const Matrix rm = args(1).matrix_value ();
7721 if (rm.
rows () != 2 || rm.
ndims () != 2)
7722 error (
"repelems: R must be a matrix with two rows");
7731 if (static_cast<double> (rx) != rm(
i))
7732 error (
"repelems: R must be a matrix of integers");
7737 switch (
x.builtin_type ())
7739 #define BTYP_BRANCH(X, EX) \ 7741 retval = do_repelems (x.EX ## _value (), r); \ 7784 if (! args(0).isnumeric ())
7785 error (
"base64_encode: encoding is supported only for numeric arrays");
7787 if (args(0).iscomplex () || args(0).issparse ())
7788 error (
"base64_encode: encoding complex or sparse data is not supported");
7792 if (args(0).isinteger ())
7794 #define MAKE_INT_BRANCH(X) \ 7795 if (args(0).is_ ## X ## _type ()) \ 7797 const X##NDArray in = args(0). X## _array_value (); \ 7798 size_t inlen = in.numel () * sizeof (X## _t) / sizeof (char); \ 7799 const char *inc = reinterpret_cast<const char *> (in.data ()); \ 7801 if (octave::base64_encode (inc, inlen, &out)) \ 7803 retval(0) = octave_value (out); \ 7817 #undef MAKE_INT_BRANCH 7822 else if (args(0).is_single_type ())
7826 inlen = in.
numel () *
sizeof (
float) /
sizeof (
char);
7828 inc =
reinterpret_cast<const char *
> (in.
data ());
7840 inlen = in.
numel () *
sizeof (
double) /
sizeof (
char);
7842 inc =
reinterpret_cast<const char *
> (in.
data ());
7903 args(1).octave_idx_type_vector_value ();
float lo_ieee_float_na_value(void)
OCTINTERP_API octave_value_list feval(const std::string &name, const octave_value_list &args=octave_value_list(), int nargout=0)
octave_idx_type rows(void) const
OCTAVE_API ColumnVector xrownorms(const Matrix &m, double p)
FloatComplexNDArray cumsum(int dim=-1) const
octave_int< uint64_t > octave_uint64
octave_idx_type idx_type_value(bool req_int=false, bool frc_str_conv=false) const
Template for N-dimensional array classes with like-type math operators.
static octave_map cat(int dim, octave_idx_type n, const octave_scalar_map *map_list)
SparseMatrix prod(int dim=-1) const
intNDArray< octave_int64 > int64NDArray
Range range_value(void) const
const octave_base_value const Array< octave_idx_type > & ra_idx
template octave_value identity_matrix< uint64NDArray >(int, int)
std::string string_value(bool force=false) const
template octave_value identity_matrix< uint16NDArray >(int, int)
NDArray dsum(int dim=-1) const
const T * data(void) const
bool islogical(void) const
octave_idx_type extent(octave_idx_type n) const
ComplexNDArray xsum(int dim=-1) const
OCTINTERP_API void print_usage(void)
octave_value_list slice(octave_idx_type offset, octave_idx_type len, bool tags=false) const
template octave_value identity_matrix< boolNDArray >(int, int)
identity matrix If supplied two scalar respectively For allows like xample val
F77_RET_T const F77_REAL const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE &F77_RET_T const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE * f
intNDArray< octave_uint32 > uint32NDArray
Return the CPU time used by your Octave session The first output is the total time spent executing your process and is equal to the sum of second and third which are the number of CPU seconds spent executing in user mode and the number of CPU seconds spent executing in system mode
OCTAVE_EXPORT octave_value_list or N dimensional array whose elements are all equal to the IEEE symbol zero divided by zero($0/0$)
std::string xstring_value(const char *fmt,...) const
intNDArray< octave_uint8 > uint8NDArray
SparseMatrix sum(int dim=-1) const
intNDArray< octave_uint16 > uint16NDArray
octave_idx_type * cidx(void)
octave_int< T > mod(const octave_int< T > &x, const octave_int< T > &y)
void resize(int n, int fill_value=0)
static void transpose(octave_idx_type N, const octave_idx_type *ridx, const octave_idx_type *cidx, octave_idx_type *ridx2, octave_idx_type *cidx2)
#define DEFUN(name, args_name, nargout_name, doc)
Macro to define a builtin function.
OCTINTERP_API octave_idx_type dims_to_numel(const dim_vector &dims, const octave_value_list &idx)
void error(const char *fmt,...)
boolNDArray all(int dim=-1) const
#define MAKE_INT_BRANCH(X)
double lo_ieee_inf_value(void)
static octave_value identity_matrix(int nr, int nc, oct_data_conv::data_type dt)
const dim_vector & dims(void) const
Return a const-reference so that dims ()(i) works efficiently.
Array< octave_idx_type > sort_rows_idx(sortmode mode=ASCENDING) const
FloatComplexNDArray sum(int dim=-1) const
NDArray cumsum(int dim=-1) const
ComplexNDArray sum(int dim=-1) const
the second is matched to the second specifier and placed in the second column and so forth If there are more words than specifiers then the process is repeated until all words have been processed or the limit imposed by any(non-whitespace) text in the format that is not one of these specifiers is considered a literal. If there is a literal between two format specifiers then that same literal must appear in the input stream between the matching words. The following specifiers are valid
SparseMatrix cumsum(int dim=-1) const
octave_idx_type columns(void) const
double lo_ieee_nan_value(void)
Complex atan(const Complex &x)
intNDArray< octave_int16 > int16NDArray
bool base64_encode(const char *inc, const size_t inlen, char **out)
FloatNDArray float_array_value(bool frc_str_conv=false) const
double frexp(double x, int *expptr)
OCTAVE_EXPORT octave_value_list or class The return code an ordinary file in Octave s or(after appending @samp{.m}) a function file in Octave 's ode
bool isobject(void) const
ComplexNDArray dprod(int dim=-1) const
boolNDArray any(int dim=-1) const
Complex log2(const Complex &x)
float float_value(bool frc_str_conv=false) const
OCTAVE_EXPORT octave_value_list isnumeric
ComplexNDArray prod(int dim=-1) const
FloatNDArray prod(int dim=-1) const
double lo_ieee_na_value(void)
octave_value do_single_type_concat(const dim_vector &dv, tm_const &tmp)
octave_value resize(const dim_vector &dv, bool fill=false) const
bool is_defined(void) const
template octave_value identity_matrix< uint32NDArray >(int, int)
FloatNDArray cumsum(int dim=-1) const
bool concat(const dim_vector &dvb, int dim)
This corresponds to cat().
charNDArray char_array_value(bool frc_str_conv=false) const
bool iscellstr(void) const
octave_idx_type nnz(void) const
Actual number of nonzero terms.
sortmode is_sorted_rows(sortmode mode=UNSORTED) const
octave_value single_subsref(const std::string &type, const octave_value_list &idx)
#define DEFALIAS(alias, name)
Macro to define an alias for another existing function name.
then the function must return scalars which will be concatenated into the return array(s). If code
octave_value sort(octave_idx_type dim=0, sortmode mode=ASCENDING) const
OCTAVE_EXPORT octave_value_list or N dimensional array whose elements are all equal to the special constant used to designate missing values Note that NA always compares not equal to NA(NA !=NA). To find NA values
template octave_value identity_matrix< int16NDArray >(int, int)
OCTAVE_EXPORT octave_value_list islogical
symbol_table & __get_symbol_table__(const std::string &who)
octave_value & assign(assign_op op, const std::string &type, const std::list< octave_value_list > &idx, const octave_value &rhs)
OCTAVE_EXPORT octave_value_list isdir nd deftypefn *std::string nm
NDArray xsum(int dim=-1) const
SparseComplexMatrix sum(int dim=-1) const
void maybe_warn_string_concat(bool all_dq_strings_p, bool all_sq_strings_p)
octave_value do_unary_op(octave::type_info &ti, octave_value::unary_op op, const octave_value &v)
ComplexNDArray dsum(int dim=-1) const
OCTAVE_EXPORT octave_value_list return the number of command line arguments passed to Octave If called with the optional argument the function xample nargout(@histc)
intNDArray< octave_int8 > int8NDArray
OCTINTERP_API octave_value do_class_concat(const octave_value_list &ovl, std::string cattype, int dim)
double double_value(void) const
octave_idx_type numel(const octave_value_list &idx)
FloatComplexNDArray prod(int dim=-1) const
OCTAVE_EXPORT octave_value_list isfloat
octave_idx_type columns(void) const
std::string get_dispatch_type(const octave_value_list &args, builtin_type_t &builtin_type)
static Array< T > cat(int dim, octave_idx_type n, const Array< T > *array_list)
Concatenation along a specified (0-based) dimension, equivalent to cat().
OCTINTERP_API octave_value do_binary_op(octave::type_info &ti, octave_value::binary_op op, const octave_value &a, const octave_value &b)
float lo_ieee_float_inf_value(void)
bool is_single_type(void) const
OCTAVE_API RowVector xcolnorms(const Matrix &m, double p)
double scalar_value(bool frc_str_conv=false) const
Array< octave_value > array_value(void) const
Array< double > base64_decode(const std::string &str)
int first_non_singleton(int def=0) const
dim_vector dims(void) const
double norm(const ColumnVector &v)
octave_int< T > pow(const octave_int< T > &a, const octave_int< T > &b)
octave_idx_type rows(void) const
bool issparse(void) const
octave_idx_type length(octave_idx_type n=0) const
Complex xcomplex_value(const char *fmt,...) const
#define panic_impossible()
octave_idx_type * ridx(void)
FloatComplex xfloat_complex_value(const char *fmt,...) const
OCTAVE_API double xnorm(const ColumnVector &x, double p)
ComplexNDArray xcomplex_array_value(const char *fmt,...) const
SparseBoolMatrix all(int dim=-1) const
SparseComplexMatrix cumsum(int dim=-1) const
std::string class_name(void) const
octave_value find_method(const std::string &name, const std::string &dispatch_type)
the exceeded dimensions are set to if fewer subscripts than dimensions are the exceeding dimensions are merged into the final requested dimension For consider the following dims
static dim_vector alloc(int n)
dim_vector redim(int n) const
Force certain dimensionality, preserving numel ().
float lo_ieee_float_nan_value(void)
FloatComplexNDArray float_complex_array_value(bool frc_str_conv=false) const
void err_wrong_type_arg(const char *name, const char *s)
With real return the complex result
bool isvector(const dim_vector &dim)
SparseComplexMatrix sparse_complex_matrix_value(bool frc_str_conv=false) const
OCTINTERP_API void get_dimensions(const octave_value &a, const char *warn_for, dim_vector &dim)
ComplexMatrix linspace(const ComplexColumnVector &x1, const ComplexColumnVector &x2, octave_idx_type n)
FloatComplexNDArray xfloat_complex_array_value(const char *fmt,...) const
SparseMatrix sum(int dim=-1) const
void warning(const char *fmt,...)
FloatNDArray sum(int dim=-1) const
octave_value reshape(const dim_vector &dv) const
SparseComplexMatrix prod(int dim=-1) const
ComplexNDArray cumsum(int dim=-1) const
octave_value diag(octave_idx_type k=0) const
return octave_value(v1.char_array_value() . concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string()) ? '\'' :'"'))
octave_idx_type cols(void) const
N Dimensional Array with copy-on-write semantics.
OCTAVE_API double xfrobnorm(const Matrix &x)
charNDArray max(char d, const charNDArray &m)
intNDArray< octave_int32 > int32NDArray
builtin_type_t builtin_type(void) const
boolNDArray bool_array_value(bool warn=false) const
SparseBoolMatrix any(int dim=-1) const
This is a simple wrapper template that will subclass an Array<T> type or any later type derived from ...
OCTAVE_EXPORT octave_value_list ls
numel(ar{a}, ar{b}) nd group nd example oindent will return 6
OCTINTERP_API octave_value do_cat_op(octave::type_info &ti, const octave_value &a, const octave_value &b, const Array< octave_idx_type > &ra_idx)
template octave_value identity_matrix< int32NDArray >(int, int)
bool is_sq_string(void) const
OCTAVE_EXPORT octave_value_list isa nd deftypefn *return ovl(args(0).isinteger())
octave_idx_type numel(int n=0) const
Number of elements that a matrix with this dimensions would have.
T & checkelem(octave_idx_type n)
OCTAVE_EXPORT octave_value_list or N dimensional array whose elements are all equal to the IEEE symbol NaN(Not a Number). NaN is the result of operations which do not produce a well defined 0 result. Common operations which produce a NaN are arithmetic with infinity ex($\infty - \infty$)
template octave_value identity_matrix< uint8NDArray >(int, int)
Array< T > nth_element(const idx_vector &n, int dim=0) const
Returns the n-th element in increasing order, using the same ordering as used for sort...
void warn_implicit_conversion(const char *id, const char *from, const char *to)
octave_int< T > rem(const octave_int< T > &x, const octave_int< T > &y)
double double_value(bool frc_str_conv=false) const
octave_idx_type length(void) const
bool isvector(void) const
nd example oindent opens the file binary numeric values will be read assuming they are stored in IEEE format with the least significant bit and then converted to the native representation Opening a file that is already open simply opens it again and returns a separate file id It is not an error to open a file several times
NDArray sum(int dim=-1) const
SparseMatrix sparse_matrix_value(bool frc_str_conv=false) const
the element is set to zero In other the statement xample y
bool hvcat(const dim_vector &dvb, int dim)
This corresponds to [,] (horzcat, dim = 0) and [;] (vertcat, dim = 1).
#define OCTAVE_LOCAL_BUFFER(T, buf, size)
bool all_strings_p(void) const
octave::sys::file_stat fs(filename)
void resize(octave_idx_type n, const octave_value &rfv=octave_value())
ColumnVector transform(const Matrix &m, double x, double y, double z)
NDArray prod(int dim=-1) const
bool iscomplex(void) const
dim_vector dims(void) const
SparseBoolMatrix sparse_bool_matrix_value(bool warn=false) const
bool is_string(void) const
std::complex< float > FloatComplex
double system(void) const
template octave_value identity_matrix< int64NDArray >(int, int)
static data_type string_to_data_type(const std::string &s)
bool is_double_type(void) const
static octave_value do_diff(const octave_value &array, octave_idx_type order, int dim=-1)
NDArray dprod(int dim=-1) const
octave_idx_type ndims(void) const
Number of dimensions.
SparseComplexMatrix xsparse_complex_matrix_value(const char *fmt,...) const
static SparseT do_sparse_diff(const SparseT &array, octave_idx_type order, int dim)
std::complex< double > Complex
std::string get_concat_class(const std::string &c1, const std::string &c2)
bool is_range(void) const
#define BTYP_BRANCH(X, EX)
static void index_error(const char *fmt, const std::string &idx, const std::string &msg)
octave_idx_type numel(void) const
Number of elements in the array.
ComplexNDArray complex_array_value(bool frc_str_conv=false) const
octave_value abs(void) const
Vector representing the dimensions (size) of an Array.
Array< std::string > cellstr_value(void) const
OCTINTERP_API void check_dimensions(dim_vector &dim, const char *warnfor)
If this string is the system will ring the terminal sometimes it is useful to be able to print the original representation of the string
void single_type_concat(Array< T > &result, tm_const &tmp)
OCTINTERP_API octave_value do_colon_op(const octave_value &base, const octave_value &limit, bool is_for_cmd_expr=false)
#define INSTANTIATE_EYE(T)
bool is_scalar_type(void) const
Cell cell_value(void) const
NDArray array_value(bool frc_str_conv=false) const
bool isnumeric(void) const
octave_idx_type rows(void) const
static Sparse< T > cat(int dim, octave_idx_type n, const Sparse< T > *sparse_list)
#define DATA_REDUCTION(FCN)
F77_RET_T const F77_REAL const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE &F77_RET_T const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T const F77_DBLE * x
charNDArray min(char d, const charNDArray &m)
intNDArray< octave_uint64 > uint64NDArray