26 #if ! defined (octave_ov_base_diag_h)
27 #define octave_ov_base_diag_h 1
29 #include "octave-config.h"
45 template <
typename DMT,
typename MT>
65 std::size_t
byte_size ()
const {
return m_matrix.byte_size (); }
77 subsref (
const std::string& type,
const std::list<octave_value_list>& idx);
80 const std::list<octave_value_list>& idx,
int)
81 {
return subsref (type, idx); }
87 subsasgn (
const std::string& type,
const std::list<octave_value_list>& idx,
95 {
return to_dense ().
reshape (new_dims); }
100 && ((vec.
xelem (0) == 1 && vec.
xelem (1) == 0)
101 || (vec.
xelem (0) == 0 && vec.
xelem (1) == 1)))
102 return DMT (m_matrix);
104 return to_dense ().permute (vec, inv);
108 resize (
const dim_vector& dv,
bool fill =
false)
const;
115 {
return matrix_type (); }
125 {
return to_dense ().
sort (dim, mode); }
128 {
return to_dense ().
sort (sidx, dim, mode); }
131 {
return to_dense ().issorted (mode); }
137 {
return to_dense ().is_sorted_rows (mode); }
147 OCTINTERP_API
bool is_true ()
const;
151 OCTINTERP_API
double double_value (
bool =
false)
const;
153 OCTINTERP_API
float float_value (
bool =
false)
const;
156 {
return double_value (frc_str_conv); }
159 index_vector (
bool =
false)
const;
161 OCTINTERP_API
Matrix matrix_value (
bool =
false)
const;
163 OCTINTERP_API
FloatMatrix float_matrix_value (
bool =
false)
const;
165 OCTINTERP_API
Complex complex_value (
bool =
false)
const;
167 OCTINTERP_API
FloatComplex float_complex_value (
bool =
false)
const;
169 OCTINTERP_API
ComplexMatrix complex_matrix_value (
bool =
false)
const;
172 float_complex_matrix_value (
bool =
false)
const;
174 OCTINTERP_API
ComplexNDArray complex_array_value (
bool =
false)
const;
177 float_complex_array_value (
bool =
false)
const;
179 OCTINTERP_API
boolNDArray bool_array_value (
bool warn =
false)
const;
181 OCTINTERP_API
charNDArray char_array_value (
bool =
false)
const;
183 OCTINTERP_API
NDArray array_value (
bool =
false)
const;
185 OCTINTERP_API
FloatNDArray float_array_value (
bool =
false)
const;
187 OCTINTERP_API
SparseMatrix sparse_matrix_value (
bool =
false)
const;
190 sparse_complex_matrix_value (
bool =
false)
const;
217 convert_to_str_internal (
bool pad,
bool force,
char type)
const;
220 print_raw (std::ostream& os,
bool pr_as_read_syntax =
false)
const;
224 OCTINTERP_API std::string
228 OCTINTERP_API
bool save_ascii (std::ostream& os);
230 OCTINTERP_API
bool load_ascii (std::istream& is);
233 write (octave::stream& os,
int block_size,
237 OCTINTERP_API
mxArray * as_mxArray (
bool interleaved)
const;
239 OCTINTERP_API
bool print_as_scalar ()
const;
241 OCTINTERP_API
void print (std::ostream& os,
bool pr_as_read_syntax =
false);
244 print_info (std::ostream& os,
const std::string& prefix)
const;
246 OCTINTERP_API
void short_disp (std::ostream& os)
const;
257 typename DMT::element_type&)
const = 0;
Array< octave_idx_type > sort_rows_idx(sortmode mode=ASCENDING) const
Sort by rows returns only indices.
T & xelem(octave_idx_type n)
Size of the specified dimension.
octave_idx_type numel() const
Number of elements in the array.
Vector representing the dimensions (size) of an Array.
MatrixType matrix_type(const MatrixType &) const
bool is_matrix_type() const
bool is_diag_matrix() const
uint64NDArray uint64_array_value() const
octave_value all(int dim=0) const
sortmode is_sorted_rows(sortmode mode=UNSORTED) const
int16NDArray int16_array_value() const
octave_base_diag(const octave_base_diag &m)
~octave_base_diag()=default
octave_value reshape(const dim_vector &new_dims) const
octave_value squeeze() const
int32NDArray int32_array_value() const
uint8NDArray uint8_array_value() const
uint16NDArray uint16_array_value() const
octave_value sort(Array< octave_idx_type > &sidx, octave_idx_type dim=0, sortmode mode=ASCENDING) const
octave_value any(int dim=0) const
octave_idx_type nnz() const
octave_value_list subsref(const std::string &type, const std::list< octave_value_list > &idx, int)
octave_value permute(const Array< int > &vec, bool inv=false) const
double scalar_value(bool frc_str_conv=false) const
int8NDArray int8_array_value() const
std::size_t byte_size() const
sortmode issorted(sortmode mode=UNSORTED) const
MatrixType matrix_type() const
octave_base_diag(const DMT &m)
uint32NDArray uint32_array_value() const
virtual bool chk_valid_scalar(const octave_value &, typename DMT::element_type &) const =0
Array< octave_idx_type > sort_rows_idx(sortmode mode=ASCENDING) const
octave_value sort(octave_idx_type dim=0, sortmode mode=ASCENDING) const
int64NDArray int64_array_value() const
octave_value full_value() const
virtual octave_value subsref(const std::string &type, const std::list< octave_value_list > &idx)
virtual octave_value diag(octave_idx_type k=0) const
octave_value sort(octave_idx_type dim=0, sortmode mode=ASCENDING) const
octave_value any(int dim=0) const
octave_value reshape(const dim_vector &dv) const
octave_value all(int dim=0) const
octave::idx_vector idx_vector
bool is_true(const std::string &s)
std::complex< double > Complex
std::complex< float > FloatComplex