77 catch (octave_execution_exception)
91 static_cast<double> (count
92 + static_cast<octave_idx_type>(1)));
118 template<
typename BNDA,
typename NDA>
124 std::string name = args(0).string_value ();
130 if (name ==
"isempty")
132 BNDA result (f_args.
dims ());
137 else if (name ==
"islogical")
139 BNDA result (f_args.
dims ());
144 else if (name ==
"isnumeric")
146 BNDA result (f_args.
dims ());
151 else if (name ==
"isreal")
153 BNDA result (f_args.
dims ());
158 else if (name ==
"length")
160 NDA result (f_args.
dims ());
162 result(count) =
static_cast<double> (f_args.
elem (count).
length ());
165 else if (name ==
"ndims")
167 NDA result (f_args.
dims ());
169 result(count) =
static_cast<double> (f_args.
elem (count).
ndims ());
172 else if (name ==
"numel" || name ==
"prodofsize")
174 NDA result (f_args.
dims ());
176 result(count) =
static_cast<double> (f_args.
elem (count).
numel ());
179 else if (name ==
"size")
183 int d = args(2).nint_value () - 1;
186 error (
"cellfun: K must be a positive integer");
190 NDA result (f_args.
dims ());
195 result(count) =
static_cast<double> (dv(d));
203 error (
"cellfun: not enough arguments for \"size\"");
205 else if (name ==
"isclass")
209 std::string class_name = args(2).string_value ();
210 BNDA result (f_args.
dims ());
212 result(count) = (f_args.
elem (count).
class_name () == class_name);
217 error (
"cellfun: not enough arguments for \"isclass\"");
227 while (nargin > 3 && args(nargin-2).is_string ())
231 size_t compare_len =
std::max (arg.length (),
static_cast<size_t> (2));
233 if (arg.
compare (
"uniformoutput", compare_len))
234 uniform_output = args(nargin-1).bool_value ();
235 else if (arg.
compare (
"errorhandler", compare_len))
237 if (args(nargin-1).is_function_handle ()
238 || args(nargin-1).is_inline_function ())
240 error_handler = args(nargin-1);
242 else if (args(nargin-1).is_string ())
244 std::string err_name = args(nargin-1).string_value ();
250 error (
"cellfun: invalid function NAME: %s",
257 error (
"cellfun: invalid value for 'ErrorHandler' function");
263 error (
"cellfun: unrecognized parameter %s",
274 DEFUN (cellfun, args, nargout,
276 @deftypefn {Built-in Function} {} cellfun (@var{name}, @var{C})\n\
277 @deftypefnx {Built-in Function} {} cellfun (\"size\", @var{C}, @var{k})\n\
278 @deftypefnx {Built-in Function} {} cellfun (\"isclass\", @var{C}, @var{class})\n\
279 @deftypefnx {Built-in Function} {} cellfun (@var{func}, @var{C})\n\
280 @deftypefnx {Built-in Function} {} cellfun (@var{func}, @var{C}, @var{D})\n\
281 @deftypefnx {Built-in Function} {[@var{a}, @dots{}] =} cellfun (@dots{})\n\
282 @deftypefnx {Built-in Function} {} cellfun (@dots{}, \"ErrorHandler\", @var{errfunc})\n\
283 @deftypefnx {Built-in Function} {} cellfun (@dots{}, \"UniformOutput\", @var{val})\n\
285 Evaluate the function named @var{name} on the elements of the cell array\n\
288 Elements in @var{C} are passed on to the named function individually. The\n\
289 function @var{name} can be one of the functions\n\
293 Return 1 for empty elements.\n\
296 Return 1 for logical elements.\n\
299 Return 1 for numeric elements.\n\
302 Return 1 for real elements.\n\
305 Return a vector of the lengths of cell elements.\n\
308 Return the number of dimensions of each element.\n\
312 Return the number of elements contained within each cell element. The\n\
313 number is the product of the dimensions of the object at each cell element.\n\
316 Return the size along the @var{k}-th dimension.\n\
319 Return 1 for elements of @var{class}.\n\
322 Additionally, @code{cellfun} accepts an arbitrary function @var{func}\n\
323 in the form of an inline function, function handle, or the name of a\n\
324 function (in a character string). The function can take one or more\n\
325 arguments, with the inputs arguments given by @var{C}, @var{D}, etc.\n\
326 Equally the function can return one or more output arguments. For example:\n\
330 cellfun (\"atan2\", @{1, 0@}, @{0, 1@})\n\
331 @result{} [ 1.57080 0.00000 ]\n\
335 The number of output arguments of @code{cellfun} matches the number of output\n\
336 arguments of the function. The outputs of the function will be collected\n\
337 into the output arguments of @code{cellfun} like this:\n\
341 function [a, b] = twoouts (x)\n\
345 [aa, bb] = cellfun (@@twoouts, @{1, 2, 3@})\n\
354 Note that per default the output argument(s) are arrays of the same size as\n\
355 the input arguments. Input arguments that are singleton (1x1) cells will be\n\
356 automatically expanded to the size of the other arguments.\n\
358 If the parameter @qcode{\"UniformOutput\"} is set to true (the default),\n\
359 then the function must return scalars which will be concatenated into the\n\
360 return array(s). If @qcode{\"UniformOutput\"} is false, the outputs are\n\
361 concatenated into a cell array (or cell arrays). For example:\n\
365 cellfun (\"tolower\", @{\"Foo\", \"Bar\", \"FooBar\"@},\n\
366 \"UniformOutput\", false)\n\
367 @result{} @{\"foo\", \"bar\", \"foobar\"@}\n\
371 Given the parameter @qcode{\"ErrorHandler\"}, then @var{errfunc} defines a\n\
372 function to call in case @var{func} generates an error. The form of the\n\
376 function [@dots{}] = errfunc (@var{s}, @dots{})\n\
380 where there is an additional input argument to @var{errfunc} relative to\n\
381 @var{func}, given by @var{s}. This is a structure with the elements\n\
382 @qcode{\"identifier\"}, @qcode{\"message\"} and @qcode{\"index\"}, giving\n\
383 respectively the error identifier, the error message, and the index into the\n\
384 input arguments of the element that caused the error. For example:\n\
388 function y = foo (s, x), y = NaN; endfunction\n\
389 cellfun (\"factorial\", @{-1,2@}, \"ErrorHandler\", @@foo)\n\
394 Use @code{cellfun} intelligently. The @code{cellfun} function is a\n\
395 useful tool for avoiding loops. It is often used with anonymous\n\
396 function handles; however, calling an anonymous function involves an\n\
397 overhead quite comparable to the overhead of an m-file function.\n\
398 Passing a handle to a built-in function is faster, because the\n\
399 interpreter is not involved in the internal loop. For example:\n\
404 v = cellfun (@@(x) det (x), a); # compute determinants\n\
405 v = cellfun (@@det, a); # faster\n\
409 @seealso{arrayfun, structfun, spfun}\n\
413 int nargin = args.
length ();
414 int nargout1 = (nargout < 1 ? 1 : nargout);
418 error (
"cellfun: function requires at least 2 arguments");
425 if (! args(1).is_cell ())
427 error (
"cellfun: C must be a cell array");
434 retval = try_cellfun_internal_ops<boolNDArray,NDArray>(args, nargin);
441 std::string name = args(0).string_value ();
446 std::string fname =
"function y = " + fcn_name +
"(x) y = ";
450 fname,
"; endfunction");
460 error (
"cellfun: invalid function NAME: %s", name.c_str ());
471 bool uniform_output =
true;
488 if (f -> is_overloaded ())
498 if (name !=
"size" && name !=
"class")
506 try_cellfun_internal_ops<boolNDArray, NDArray> (tmp_args,
510 try_cellfun_internal_ops<Cell, Cell> (tmp_args, nargin);
535 const Cell *cinputs = inputs;
544 for (
int j = 0; j < nargin; j++)
546 if (! args(j+1).is_cell ())
548 error (
"cellfun: arguments must be cells");
552 inputs[j] = args(j+1).cell_value ();
553 mask[j] = inputs[j].numel () != 1;
555 inputlist(j) = cinputs[j](0);
558 for (
int j = 0; j < nargin; j++)
562 fdims = inputs[j].dims ();
563 k = inputs[j].numel ();
564 for (
int i = j+1; i < nargin; i++)
566 if (mask[i] && inputs[i].dims () != fdims)
568 error (
"cellfun: dimensions mismatch");
586 std::list<octave_value_list> idx_list (1);
587 idx_list.front ().resize (1);
588 std::string idx_type =
"(";
594 for (
int j = 0; j < nargin; j++)
597 inputlist.
xelem (j) = cinputs[j](count);
607 if (nargout > 0 && tmp.
length () < nargout)
609 error (
"cellfun: function returned fewer than nargout values");
615 && tmp.
length () > 0 && tmp(0).is_defined ()))
617 int num_to_copy = tmp.
length ();
619 if (num_to_copy > nargout1)
620 num_to_copy = nargout1;
624 for (
int j = 0; j < num_to_copy; j++)
626 if (tmp(j).is_defined ())
630 if (val.
numel () == 1)
631 retv[j] = val.
resize (fdims);
634 error (
"cellfun: all values must be scalars when UniformOutput = true");
642 for (
int j = 0; j < num_to_copy; j++)
644 if (tmp(j).is_defined ())
648 if (! retv[j].fast_elem_insert (count, val))
650 if (val.
numel () == 1)
652 idx_list.front ()(0) = count + 1.0;
654 idx_type, idx_list, val);
661 error (
"cellfun: all values must be scalars when UniformOutput = true");
676 for (
int j = 0; j < nargout1; j++)
678 if (nargout > 0 && retv[j].is_undefined ())
688 for (
int j = 0; j < nargout1; j++)
691 bool have_some_output =
false;
695 for (
int j = 0; j < nargin; j++)
698 inputlist.
xelem (j) = cinputs[j](count);
708 if (nargout > 0 && tmp.
length () < nargout)
710 error (
"cellfun: function returned fewer than nargout values");
716 && tmp.
length () > 0 && tmp(0).is_defined ()))
718 int num_to_copy = tmp.
length ();
720 if (num_to_copy > nargout1)
721 num_to_copy = nargout1;
724 have_some_output =
true;
726 for (
int j = 0; j < num_to_copy; j++)
727 results[j](count) = tmp(j);
731 if (have_some_output || fdims.
any_zero ())
735 for (
int j = 0; j < nargout1; j++)
736 retval(j) = results[j];
741 error (
"cellfun: argument NAME must be a string or function handle");
1062 DEFUN (arrayfun, args, nargout,
1064 @deftypefn {Function File} {} arrayfun (@var{func}, @var{A})\n\
1065 @deftypefnx {Function File} {@var{x} =} arrayfun (@var{func}, @var{A})\n\
1066 @deftypefnx {Function File} {@var{x} =} arrayfun (@var{func}, @var{A}, @var{b}, @dots{})\n\
1067 @deftypefnx {Function File} {[@var{x}, @var{y}, @dots{}] =} arrayfun (@var{func}, @var{A}, @dots{})\n\
1068 @deftypefnx {Function File} {} arrayfun (@dots{}, \"UniformOutput\", @var{val})\n\
1069 @deftypefnx {Function File} {} arrayfun (@dots{}, \"ErrorHandler\", @var{errfunc})\n\
1071 Execute a function on each element of an array.\n\
1073 This is useful for functions that do not accept array arguments. If the\n\
1074 function does accept array arguments it is better to call the function\n\
1077 The first input argument @var{func} can be a string, a function\n\
1078 handle, an inline function, or an anonymous function. The input\n\
1079 argument @var{A} can be a logic array, a numeric array, a string\n\
1080 array, a structure array, or a cell array. By a call of the function\n\
1081 @command{arrayfun} all elements of @var{A} are passed on to the named\n\
1082 function @var{func} individually.\n\
1084 The named function can also take more than two input arguments, with\n\
1085 the input arguments given as third input argument @var{b}, fourth\n\
1086 input argument @var{c}, @dots{} If given more than one array input\n\
1087 argument then all input arguments must have the same sizes, for\n\
1092 arrayfun (@@atan2, [1, 0], [0, 1])\n\
1093 @result{} [ 1.5708 0.0000 ]\n\
1097 If the parameter @var{val} after a further string input argument\n\
1098 @qcode{\"UniformOutput\"} is set @code{true} (the default), then the named\n\
1099 function @var{func} must return a single element which then will be\n\
1100 concatenated into the return value and is of type matrix. Otherwise,\n\
1101 if that parameter is set to @code{false}, then the outputs are\n\
1102 concatenated in a cell array. For example:\n\
1106 arrayfun (@@(x,y) x:y, \"abc\", \"def\", \"UniformOutput\", false)\n\
1116 If more than one output arguments are given then the named function\n\
1117 must return the number of return values that also are expected, for\n\
1122 [A, B, C] = arrayfun (@@find, [10; 0], \"UniformOutput\", false)\n\
1142 If the parameter @var{errfunc} after a further string input argument\n\
1143 @qcode{\"ErrorHandler\"} is another string, a function handle, an inline\n\
1144 function, or an anonymous function, then @var{errfunc} defines a\n\
1145 function to call in the case that @var{func} generates an error.\n\
1146 The definition of the function must be of the form\n\
1149 function [@dots{}] = errfunc (@var{s}, @dots{})\n\
1153 where there is an additional input argument to @var{errfunc}\n\
1154 relative to @var{func}, given by @var{s}. This is a structure with\n\
1155 the elements @qcode{\"identifier\"}, @qcode{\"message\"}, and\n\
1156 @qcode{\"index\"} giving, respectively, the error identifier, the error\n\
1157 message, and the index of the array elements that caused the error. The\n\
1158 size of the output argument of @var{errfunc} must have the same size as the\n\
1159 output argument of @var{func}, otherwise a real error is thrown. For\n\
1164 function y = ferr (s, x), y = \"MyString\"; endfunction\n\
1165 arrayfun (@@str2num, [1234],\n\
1166 \"UniformOutput\", false, \"ErrorHandler\", @@ferr)\n\
1174 @seealso{spfun, cellfun, structfun}\n\
1178 int nargin = args.
length ();
1179 int nargout1 = (nargout < 1 ? 1 : nargout);
1184 "arrayfun: function requires at least 2 arguments");
1190 bool symbol_table_lookup =
false;
1196 std::string name = args(0).string_value ();
1201 std::string fname =
"function y = " + fcn_name +
"(x) y = ";
1205 fname,
"; endfunction");
1216 "arrayfun: invalid function NAME: %s",
1219 symbol_table_lookup =
true;
1234 if (! symbol_table_lookup)
1244 if (f -> is_overloaded ())
1256 bool uniform_output =
true;
1276 for (
int j = 0; j < nargin; j++)
1278 inputs[j] = args(j+1);
1279 mask[j] = inputs[j].numel () != 1;
1282 inputlist(j) = inputs[j];
1285 for (
int j = 0; j < nargin; j++)
1289 fdims = inputs[j].dims ();
1290 k = inputs[j].numel ();
1292 for (
int i = j+1; i < nargin; i++)
1294 if (mask[i] && inputs[i].dims () != fdims)
1297 "arrayfun: dimensions mismatch");
1316 std::list<octave_value_list> idx_list (1);
1317 idx_list.front ().resize (1);
1318 std::string idx_type =
"(";
1324 idx_list.front ()(0) = count + 1.0;
1326 for (
int j = 0; j < nargin; j++)
1342 if (nargout > 0 && tmp.
length () < nargout)
1345 "arrayfun: function returned fewer than nargout values");
1351 && tmp.
length () > 0 && tmp(0).is_defined ()))
1353 int num_to_copy = tmp.
length ();
1355 if (num_to_copy > nargout1)
1356 num_to_copy = nargout1;
1360 for (
int j = 0; j < num_to_copy; j++)
1362 if (tmp(j).is_defined ())
1366 if (val.
numel () == 1)
1367 retv[j] = val.
resize (fdims);
1371 "arrayfun: all values must be scalars when UniformOutput = true");
1379 for (
int j = 0; j < num_to_copy; j++)
1381 if (tmp(j).is_defined ())
1385 if (! retv[j].fast_elem_insert (count, val))
1387 if (val.
numel () == 1)
1389 idx_list.front ()(0) = count + 1.0;
1391 idx_type, idx_list, val);
1399 "arrayfun: all values must be scalars when UniformOutput = true");
1412 retval.
resize (nargout1);
1414 for (
int j = 0; j < nargout1; j++)
1416 if (nargout > 0 && retv[j].is_undefined ())
1419 retval(j) = retv[j];
1424 std::list<octave_value_list> idx_list (1);
1425 idx_list.front ().resize (1);
1426 std::string idx_type =
"(";
1430 for (
int j = 0; j < nargout1; j++)
1433 bool have_some_output =
false;
1437 idx_list.front ()(0) = count + 1.0;
1439 for (
int j = 0; j < nargin; j++)
1455 if (nargout > 0 && tmp.
length () < nargout)
1458 "arrayfun: function returned fewer than nargout values");
1464 && tmp.
length () > 0 && tmp(0).is_defined ()))
1466 int num_to_copy = tmp.
length ();
1468 if (num_to_copy > nargout1)
1469 num_to_copy = nargout1;
1471 if (num_to_copy > 0)
1472 have_some_output =
true;
1474 for (
int j = 0; j < num_to_copy; j++)
1475 results[j](count) = tmp(j);
1479 if (have_some_output || fdims.
any_zero ())
1481 retval.
resize (nargout1);
1483 for (
int j = 0; j < nargout1; j++)
1484 retval(j) = results[j];
1490 "arrayfun: argument NAME must be a string or function handle");
1717 int dvl = dimv.
length ();
1720 for (
int i = 0; i < dvl; i++)
1728 perm.
clear (maxd, 1);
1729 for (
int i = 0; i < dvl; i++)
1731 int k = dimv(i) - 1;
1734 error (
"num2cell: dimension indices must be positive");
1737 else if (i > 0 && k < dimv(i-1) - 1)
1739 error (
"num2cell: dimension indices must be strictly increasing");
1747 for (
int k = 0, i = dvl; k < maxd; k++)
1751 for (
int i = 0; i < maxd; i++)
1759 static inline typename NDA::element_type
1761 {
return array(i); }
1765 {
return Cell (array(i)); }
1774 Cell retval (array.dims ());
1789 NDA parray = array.permute (perm);
1793 parray = parray.reshape (
dim_vector (nela, nelc));
1795 Cell retval (celldv);
1798 retval.
xelem (i) = NDA (parray.column (i).reshape (arraydv));
1820 for (
int i = 0; i < n; i++)
1860 error (
"num2cell (A, dim) not implemented for class objects");
1866 DEFUN (num2cell, args, ,
1868 @deftypefn {Built-in Function} {@var{C} =} num2cell (@var{A})\n\
1869 @deftypefnx {Built-in Function} {@var{C} =} num2cell (@var{A}, @var{dim})\n\
1870 Convert the numeric matrix @var{A} to a cell array.\n\
1872 If @var{dim} is defined, the value @var{C} is of dimension 1 in this\n\
1873 dimension and the elements of @var{A} are placed into @var{C} in slices.\n\
1878 num2cell ([1,2;3,4])\n\
1886 num2cell ([1,2;3,4],1)\n\
1899 @seealso{mat2cell}\n\
1902 int nargin = args.length ();
1905 if (nargin < 1 || nargin > 2)
1912 dimv = args(1).int_vector_value (
true);
1958 else if (array.
is_map ())
1981 for (
int i = 0; i < nd; i++)
1991 error (
"mat2cell: mismatch on %d-th dimension (%d != %d)",
2000 template<
class container>
2023 template <
class Array2D>
2028 assert (nd == 1 || nd == 2);
2029 assert (a.ndims () == 2);
2036 retval.clear (nridx, ncidx);
2039 if (a.rows () > 1 && a.cols () == 1 && ncidx == 1)
2041 else if (a.rows () == 1 && nridx == 1 && nd == 2)
2070 retval(i,j) = a.index (ridx[i], cidx[j]);
2080 template <
class ArrayND>
2093 for (
int i = 0; i < nd; i++)
2095 rdv(i) = nidx[i] = d[i].
length ();
2105 for (
int i = 0; i < nd; i++)
2107 idx[i] = xidx + idxtot;
2120 for (
int i = 0; i < nd; i++)
2121 ra_idx(i) = idx[i][ridx[i]];
2123 retval(j) = a.index (
ra_idx);
2132 template <
class ArrayND>
2136 if (a.ndims () == 2 && nd <= 2)
2157 for (
int i = 0; i < nd; i++)
2159 rdv(i) = nidx[i] = d[i].
length ();
2169 for (
int i = 0; i < nd; i++)
2171 idx[i] = xidx + idxtot;
2184 for (
int i = 0; i < nd; i++)
2185 ra_idx(i) = idx[i][ridx[i]];
2198 DEFUN (mat2cell, args, ,
2200 @deftypefn {Built-in Function} {@var{C} =} mat2cell (@var{A}, @var{m}, @var{n})\n\
2201 @deftypefnx {Built-in Function} {@var{C} =} mat2cell (@var{A}, @var{d1}, @var{d2}, @dots{})\n\
2202 @deftypefnx {Built-in Function} {@var{C} =} mat2cell (@var{A}, @var{r})\n\
2203 Convert the matrix @var{A} to a cell array.\n\
2205 If @var{A} is 2-D, then it is required that\n\
2206 @code{sum (@var{m}) == size (@var{A}, 1)} and\n\
2207 @code{sum (@var{n}) == size (@var{A}, 2)}. Similarly, if @var{A} is\n\
2208 multi-dimensional and the number of dimensional arguments is equal to the\n\
2209 dimensions of @var{A}, then it is required that\n\
2210 @code{sum (@var{di}) == size (@var{A}, i)}.\n\
2212 Given a single dimensional argument @var{r}, the other dimensional\n\
2213 arguments are assumed to equal @code{size (@var{A},@var{i})}.\n\
2215 An example of the use of mat2cell is\n\
2218 mat2cell (reshape (1:16,4,4), [3,1], [3,1])\n\
2240 @seealso{num2cell, cell2mat}\n\
2243 int nargin = args.length ();
2253 for (
int i = 1; i < nargin; i++)
2255 d[i-1] = args(i).octave_idx_type_vector_value (
true);
2262 if (sparse && nargin > 3)
2264 error (
"mat2cell: sparse arguments only support 2-D indexing");
2287 #define BTYP_BRANCH(X,Y) \
2289 retval = do_mat2cell (a.Y ## _value (), d, nargin - 1); \
2335 template <
class NDA>
2344 if (array.is_vector () && (dim == -1
2345 || (dim == 0 && array.columns () == 1)
2346 || (dim == 1 && array.rows () == 1)))
2354 int ndims = dv.
length ();
2364 retval(i) = array.
index (idx);
2371 DEFUN (cellslices, args, ,
2373 @deftypefn {Built-in Function} {@var{sl} =} cellslices (@var{x}, @var{lb}, @var{ub}, @var{dim})\n\
2374 Given an array @var{x}, this function produces a cell array of slices from\n\
2375 the array determined by the index vectors @var{lb}, @var{ub}, for lower and\n\
2376 upper bounds, respectively.\n\
2378 In other words, it is equivalent to the following code:\n\
2383 sl = cell (1, n);\n\
2384 for i = 1:length (lb)\n\
2385 sl@{i@} = x(:,@dots{},lb(i):ub(i),@dots{},:);\n\
2390 The position of the index is determined by @var{dim}. If not specified,\n\
2391 slicing is done along the first non-singleton dimension.\n\
2392 @seealso{cell2mat, cellindexmat, cellfun}\n\
2396 int nargin = args.
length ();
2397 if (nargin == 3 || nargin == 4)
2405 dim = args(3).int_value () - 1;
2407 error (
"cellslices: DIM must be a valid dimension");
2413 error (
"cellslices: the lengths of LB and UB must match");
2476 retcell =
Cell (1, n);
2478 int ndims = dv.
length ();
2485 idx(dim) =
Range (lb(i), ub(i));
2507 DEFUN (cellindexmat, args, ,
2509 @deftypefn {Built-in Function} {@var{y} =} cellindexmat (@var{x}, @var{varargin})\n\
2510 Perform indexing of matrices in a cell array.\n\
2512 Given a cell array of matrices @var{x}, this function computes\n\
2516 Y = cell (size (X));\n\
2517 for i = 1:numel (X)\n\
2518 Y@{i@} = X@{i@}(varargin@{:@});\n\
2522 @seealso{cellslices, cellfun}\n\
2526 if (args.length () >= 1)
2528 if (args(0).is_cell ())
2530 const Cell x = args(0).cell_value ();
2547 error (
"cellindexmat: X must be a cell");
uint8NDArray uint8_array_value(void) const
bool is_object(void) const
ComplexNDArray complex_array_value(bool frc_str_conv=false) const
bool is_empty(void) const
charNDArray char_array_value(bool frc_str_conv=false) const
bool is_real_type(void) const
void gripe_wrong_type_arg(const char *name, const char *s, bool is_error)
const octave_base_value const Array< octave_idx_type > & ra_idx
octave_value_list slice(octave_idx_type offset, octave_idx_type len, bool tags=false) const
static NDA::element_type do_num2cell_elem(const NDA &array, octave_idx_type i)
#define OCTAVE_LOCAL_BUFFER_INIT(T, buf, size, value)
int8NDArray int8_array_value(void) const
static const idx_vector colon
bool is_uint16_type(void) const
OCTINTERP_API void print_usage(void)
bool is_function(void) const
octave_idx_type numel(void) const
Number of elements in the array.
int16NDArray int16_array_value(void) const
octave_idx_type length(void) const
octave_map map_value(void) const
static Cell do_mat2cell_2d(const Array2D &a, const Array< octave_idx_type > *d, int nd)
bool is_numeric_type(void) const
bool is_defined(void) const
void resize(int n, int fill_value=0)
uint64NDArray uint64_array_value(void) const
#define DEFUN(name, args_name, nargout_name, doc)
void error(const char *fmt,...)
int32NDArray int32_array_value(void) const
static void get_mapper_fun_options(const octave_value_list &args, int &nargin, bool &uniform_output, octave_value &error_handler)
bool is_int8_type(void) const
octave_value resize(const dim_vector &dv, bool fill=false) const
T & elem(octave_idx_type n)
Cell do_mat2cell_nd(const ArrayND &a, const Array< octave_idx_type > *d, int nd)
static Cell do_num2cell(const NDA &array, const Array< int > &dimv)
bool is_int32_type(void) const
octave_fcn_handle * fcn_handle_value(bool silent=false) const
static octave_value find_function(const std::string &name, const octave_value_list &args=octave_value_list(), bool local_funcs=true)
int increment_index(octave_idx_type *idx, int start=0) const
boolNDArray bool_array_value(bool warn=false) const
int first_non_singleton(int def=0) const
bool is_function_handle(void) const
octave_idx_type numel(int n=0) const
Number of elements that a matrix with this dimensions would have.
F77_RET_T const double const double double * d
std::string unique_symbol_name(const std::string &basename)
Cell cell_value(void) const
Cell cell_value(void) const
int64NDArray int64_array_value(void) const
static Cell do_cellslices_nda(const NDA &array, const Array< octave_idx_type > &lb, const Array< octave_idx_type > &ub, int dim=-1)
const dim_vector & dims(void) const
Return a const-reference so that dims ()(i) works efficiently.
octave_value single_subsref(const std::string &type, const octave_value_list &idx)
octave_value_list do_multi_index_op(int nargout, const octave_value_list &idx)
FloatNDArray float_array_value(bool frc_str_conv=false) const
int buffer_error_messages
bool is_char_matrix(void) const
F77_RET_T const double const double * f
bool is_sparse_type(void) const
bool valid_identifier(const char *s)
octave_idx_type numel(const octave_value_list &idx)
bool is_bool_type(void) const
void error_with_id(const char *id, const char *fmt,...)
bool is_matrix_type(void) const
FloatComplexNDArray float_complex_array_value(bool frc_str_conv=false) const
bool is_string(void) const
bool is_inline_function(void) const
bool is_complex_type(void) const
void resize(const dim_vector &dv, const T &rfv)
bool is_int64_type(void) const
octave_idx_type length(void) const
bool any_zero(void) const
SparseComplexMatrix sparse_complex_matrix_value(bool frc_str_conv=false) const
static bool mat2cell_mismatch(const dim_vector &dv, const Array< octave_idx_type > *d, int nd)
static dim_vector alloc(int n)
dim_vector dims(void) const
octave_function * function_value(bool silent=false) const
T & xelem(octave_idx_type n)
bool is_int16_type(void) const
static void prepare_idx(container *idx, int idim, int nd, const Array< octave_idx_type > *d)
Handles the reference counting for all the derived classes.
charNDArray max(char d, const charNDArray &m)
octave_idx_type length(void) const
Number of elements in the array.
bool is_empty(void) const
This is a simple wrapper template that will subclass an Array type or any later type derived from ...
static octave_value_list try_cellfun_internal_ops(const octave_value_list &args, int nargin)
NDArray array_value(bool frc_str_conv=false) const
static dim_vector get_object_dims(octave_value &obj)
static Cell do_object2cell(const octave_value &obj, const Array< int > &dimv)
#define BTYP_BRANCH(X, Y)
bool is_uint8_type(void) const
void assign(const std::string &k, const octave_value &val)
static void do_num2cell_helper(const dim_vector &dv, const Array< int > &dimv, dim_vector &celldv, dim_vector &arraydv, Array< int > &perm)
octave_function * extract_function(const octave_value &arg, const std::string &warn_for, const std::string &fname, const std::string &header, const std::string &trailer)
bool compare(const std::string &s, size_t limit=std::string::npos) const
std::string class_name(void) const
Cell index(const octave_value_list &idx, bool resize_ok=false) const
#define OCTAVE_LOCAL_BUFFER(T, buf, size)
bool is_undefined(void) const
bool is_uint64_type(void) const
void resize(octave_idx_type n, const octave_value &rfv=octave_value())
std::string last_error_id(void)
SparseMatrix sparse_matrix_value(bool frc_str_conv=false) const
bool is_single_type(void) const
bool is_uint32_type(void) const
Cell do_mat2cell(const ArrayND &a, const Array< octave_idx_type > *d, int nd)
octave_value & xelem(octave_idx_type i)
uint32NDArray uint32_array_value(void) const
builtin_type_t builtin_type(void) const
uint16NDArray uint16_array_value(void) const
octave_value_list & prepend(const octave_value &val)
return octave_value(v1.char_array_value().concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string())? '\'': '"'))
F77_RET_T const double * x
static octave_value_list get_output_list(octave_idx_type count, octave_idx_type nargout, const octave_value_list &inputlist, octave_value &func, octave_value &error_handler)
bool is_integer_type(void) const
std::string last_error_message(void)
octave_value do_index_op(const octave_value_list &idx, bool resize_ok=false)