24 #if defined (HAVE_CONFIG_H) 47 const T *avec =
a.fortran_vec ();
56 T *rvec = r.fortran_vec ();
60 rvec = std::copy (avec + ii, avec + nr, rvec);
73 std::fill (rvec, rvec + ii, T ());
74 std::copy (avec + ii, avec + nr, rvec + ii);
89 const T *avec =
a.fortran_vec ();
97 = ((j2 - j1) * ((j1+1-
k) + (j2-
k))) / 2 + (nc - j2) * nr;
103 rvec = std::copy (avec, avec + ii, rvec);
112 T *rvec = r.fortran_vec ();
116 std::copy (avec, avec + ii, rvec);
117 std::fill (rvec + ii, rvec + nr, T ());
129 template <
typename T>
134 error (R
"(tril: "pack" not implemented for sparse matrices)"); 149 template <
typename T>
154 error (R
"(triu: "pack" not implemented for sparse matrices)"); 169 template <
typename T>
176 template <
typename T>
187 bool lower = (
name ==
"tril");
194 pack = (args(
nargin-1).string_value () ==
"pack");
203 k = args(1).idx_type_value (
true);
208 if (
dims.ndims () != 2)
209 error (
"%s: need a 2-D matrix",
name.c_str ());
211 error (
"%s: requested diagonal out of range",
name.c_str ());
240 #define ARRAYCASE(TYP) \ 242 retval = do_trilu (arg.TYP ## _array_value (), k, lower, pack); \ 264 error (R
"(%s: "pack" not implemented for class %s)", 283 std::list<octave_value_list> idx_tmp;
284 ov_idx(1) =
static_cast<double> (nc+1);
285 ov_idx(0) =
Range (1, nr);
286 idx_tmp.push_back (ov_idx);
287 ov_idx(1) =
static_cast<double> (nc);
299 ov_idx(1) =
static_cast<double> (j);
300 ov_idx(0) =
Range (nr_limit, nr);
301 std::list<octave_value_list> idx;
302 idx.push_back (ov_idx);
314 ov_idx(1) =
static_cast<double> (j);
315 ov_idx(0) =
Range (1, nr_limit);
316 std::list<octave_value_list> idx;
317 idx.push_back (ov_idx);
OCTINTERP_API void print_usage(void)
OCTAVE_EXPORT octave_value_list or N dimensional array whose elements are all equal to the IEEE symbol zero divided by zero($0/0$)
octave_idx_type * cidx(void)
const T * fortran_vec(void) const
#define DEFUN(name, args_name, nargout_name, doc)
Macro to define a builtin function.
void error(const char *fmt,...)
static Array< T > do_tril(const Array< T > &a, octave_idx_type k, bool pack)
static Array< T > do_triu(const Array< T > &a, octave_idx_type k, bool pack)
calling an anonymous function involves an overhead quite comparable to the overhead of an m file function Passing a handle to a built in function is because the interpreter is not involved in the internal loop For a
nd deftypefn *std::string name
dim_vector dims(void) const
bool issparse(void) const
octave_idx_type * ridx(void)
std::string class_name(void) const
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
SparseComplexMatrix sparse_complex_matrix_value(bool frc_str_conv=false) const
octave_idx_type cols(void) const
N Dimensional Array with copy-on-write semantics.
charNDArray max(char d, const charNDArray &m)
builtin_type_t builtin_type(void) const
boolNDArray bool_array_value(bool warn=false) const
This is a simple wrapper template that will subclass an Array<T> type or any later type derived from ...
octave_idx_type length(void) const
SparseMatrix sparse_matrix_value(bool frc_str_conv=false) const
Sparse< T > maybe_compress(bool remove_zeros=false)
SparseBoolMatrix sparse_bool_matrix_value(bool warn=false) const
ComplexNDArray complex_array_value(bool frc_str_conv=false) const
Vector representing the dimensions (size) of an Array.
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
NDArray array_value(bool frc_str_conv=false) const
static Array< T > do_trilu(const Array< T > &a, octave_idx_type k, bool lower, bool pack)
charNDArray min(char d, const charNDArray &m)
octave_value do_index_op(const octave_value_list &idx, bool resize_ok=false)