31 #include "octave-config.h"
118 type_name (),
"real scalar");
120 retval = m_matrix(0).double_value ();
134 type_name (),
"real scalar");
136 retval = m_matrix(0).float_value ();
151 error (
"invalid conversion of %s to Matrix", type_name ().c_str ());
153 retval =
Matrix (dv(0), dv(1));
157 vec[i] = m_matrix(i).double_value ();
168 error (
"invalid conversion of %s to FloatMatrix", type_name ().c_str ());
174 vec[i] = m_matrix(i).float_value ();
185 error (
"invalid conversion of %s to Matrix", type_name ().c_str ());
191 vec[i] =
Complex (m_matrix(i).double_value ());
202 error (
"invalid conversion of %s to FloatMatrix", type_name ().c_str ());
216 NDArray retval (m_matrix.dims ());
220 vec[i] = m_matrix(i).double_value ();
231 vec[i] = m_matrix(i).float_value ();
242 vec[i] =
Complex (m_matrix(i).double_value ());
264 if (warn && m_matrix.any_element_not_one_or_zero ())
269 vec[i] = m_matrix(i).bool_value ();
283 vec[i] = m_matrix(i).char_value ();
301 matrix_ref ().changesign ();
306 return m_idx_cache ? *m_idx_cache
310 int write (octave::stream& os,
int block_size,
313 {
return os.write (m_matrix, block_size, output_type, skip, flt_fmt); }
320 OCTAVE_INT_T::val_type *pd
321 =
static_cast<OCTAVE_INT_T::val_type *
> (retval->
get_data ());
327 for (
mwIndex i = 0; i < nel; i++)
328 pd[i] = pdata[i].value ();
338 return m_matrix.
abs ();
340 return m_matrix.
signum ();
374 return save_hdf5_internal (loc_id, s_hdf5_save_type, name, flag);
379 return load_hdf5_internal (loc_id, s_hdf5_save_type, name);
411 bool resize_ok =
false)
427 return tmp.
index_op (idx, resize_ok);
512 double double_value (
bool =
false)
const {
return scalar.double_value (); }
514 float float_value (
bool =
false)
const {
return scalar.float_value (); }
516 double scalar_value (
bool =
false)
const {
return scalar.double_value (); }
519 {
return scalar.float_value (); }
525 retval(0, 0) = scalar.double_value ();
533 retval(0, 0) = scalar.float_value ();
541 retval(0, 0) =
Complex (scalar.double_value ());
557 retval(0) = scalar.double_value ();
565 retval(0) = scalar.float_value ();
573 retval(0) =
Complex (scalar.double_value ());
587 if (warn && scalar != 0.0 && scalar != 1.0)
590 return scalar.bool_value ();
598 if (warn && scalar != 0.0 && scalar != 1.0)
601 retval(0) = scalar.bool_value ();
610 retval(0) = scalar.char_value ();
627 int write (octave::stream& os,
int block_size,
632 block_size, output_type, skip, flt_fmt);
640 OCTAVE_INT_T::val_type *pd
641 =
static_cast<OCTAVE_INT_T::val_type *
> (retval->
get_data ());
643 pd[0] = scalar.value ();
653 return scalar.
abs ();
687 return save_hdf5_internal (loc_id, s_hdf5_save_type, name, flag);
692 return load_hdf5_internal (loc_id, s_hdf5_save_type, name);
N Dimensional Array with copy-on-write semantics.
T * fortran_vec()
Size of the specified dimension.
Vector representing the dimensions (size) of an Array.
octave_idx_type numel(int n=0) const
Number of elements that a matrix with this dimensions would have.
octave_idx_type ndims() const
Number of dimensions.
octave::idx_vector index_vector(bool=false) const
octave_base_value * empty_clone() const
mxArray * as_mxArray(bool interleaved) const
double double_value(bool=false) const
uint64NDArray uint64_array_value() const
float float_value(bool=false) const
uint32NDArray uint32_array_value() const
FloatMatrix float_matrix_value(bool=false) const
octave_base_value * clone() const
octave_value map(unary_mapper_t umap) const
boolNDArray bool_array_value(bool warn=false) const
FloatComplexMatrix float_complex_matrix_value(bool=false) const
int16NDArray int16_array_value() const
builtin_type_t builtin_type() const
bool save_hdf5(octave_hdf5_id loc_id, const char *name, bool flag)
float float_scalar_value(bool=false) const
uint16NDArray uint16_array_value() const
FloatNDArray float_array_value(bool=false) const
Matrix matrix_value(bool=false) const
int write(octave::stream &os, int block_size, oct_data_conv::data_type output_type, int skip, octave::mach_info::float_format flt_fmt) const
FloatComplexNDArray float_complex_array_value(bool=false) const
int32NDArray int32_array_value() const
ComplexNDArray complex_array_value(bool=false) const
int8NDArray int8_array_value() const
NDArray array_value(bool=false) const
int64NDArray int64_array_value() const
bool load_hdf5(octave_hdf5_id loc_id, const char *name)
charNDArray char_array_value(bool=false) const
ComplexMatrix complex_matrix_value(bool=false) const
uint8NDArray uint8_array_value() const
double scalar_value(bool=false) const
octave_uint8 uint8_scalar_value() const
Matrix matrix_value(bool=false) const
uint16NDArray uint16_array_value() const
octave_value do_index_op(const octave_value_list &idx, bool resize_ok=false)
uint32NDArray uint32_array_value() const
FloatNDArray float_array_value(bool=false) const
bool bool_value(bool warn=false) const
FloatMatrix float_matrix_value(bool=false) const
bool save_hdf5(octave_hdf5_id loc_id, const char *name, bool flag)
octave_int32 int32_scalar_value() const
octave_uint32 uint32_scalar_value() const
builtin_type_t builtin_type() const
octave_int16 int16_scalar_value() const
int64NDArray int64_array_value() const
NDArray array_value(bool=false) const
ComplexNDArray complex_array_value(bool=false) const
int write(octave::stream &os, int block_size, oct_data_conv::data_type output_type, int skip, octave::mach_info::float_format flt_fmt) const
octave_uint16 uint16_scalar_value() const
octave_base_value * empty_clone() const
float float_value(bool=false) const
double double_value(bool=false) const
mxArray * as_mxArray(bool interleaved) const
uint8NDArray uint8_array_value() const
ComplexMatrix complex_matrix_value(bool=false) const
octave::idx_vector index_vector(bool=false) const
int16NDArray int16_array_value() const
octave_int8 int8_scalar_value() const
FloatComplexNDArray float_complex_array_value(bool=false) const
double scalar_value(bool=false) const
FloatComplexMatrix float_complex_matrix_value(bool=false) const
octave_int64 int64_scalar_value() const
int8NDArray int8_array_value() const
float float_scalar_value(bool=false) const
octave_uint64 uint64_scalar_value() const
int32NDArray int32_array_value() const
octave_value map(unary_mapper_t umap) const
uint64NDArray uint64_array_value() const
octave_base_value * clone() const
octave_value resize(const dim_vector &dv, bool fill=false) const
charNDArray char_array_value(bool=false) const
bool load_hdf5(octave_hdf5_id loc_id, const char *name)
boolNDArray bool_array_value(bool warn=false) const
octave_value index_op(const octave_value_list &idx, bool resize_ok=false)
octave_value signum() const
void() error(const char *fmt,...)
void err_invalid_conversion(const std::string &from, const std::string &to)
void warn_logical_conversion()
void warn_implicit_conversion(const char *id, const char *from, const char *to)
octave::idx_vector idx_vector
intNDArray< octave_int16 > int16NDArray
intNDArray< octave_int32 > int32NDArray
intNDArray< octave_int64 > int64NDArray
intNDArray< octave_int8 > int8NDArray
std::complex< double > Complex
std::complex< float > FloatComplex
octave_int< uint32_t > octave_uint32
octave_int< int32_t > octave_int32
octave_int< int16_t > octave_int16
octave_int< int8_t > octave_int8
octave_int< int64_t > octave_int64
octave_int< uint64_t > octave_uint64
octave_int< uint16_t > octave_uint16
octave_int< uint8_t > octave_uint8
T::size_type numel(const T &str)
#define DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
#define OCTAVE_INT_MX_CLASS
#define OCTAVE_TYPE_PREDICATE_FUNCTION
#define OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION
#define OCTAVE_VALUE_INT_MATRIX_T
#define OCTAVE_VALUE_INT_SCALAR_T
intNDArray< octave_uint16 > uint16NDArray
intNDArray< octave_uint32 > uint32NDArray
intNDArray< octave_uint64 > uint64NDArray
intNDArray< octave_uint8 > uint8NDArray