23 #if defined (HAVE_CONFIG_H)
72 : count (1),
dv (0, 0), all_str (
false),
75 all_mt (true), any_cell (
false), any_sparse (
false),
77 first_elem_is_struct (
false), class_nm (), ok (
false)
81 : count (1),
dv (0, 0), all_str (
false), all_sq_str (
false),
83 all_mt (true), any_cell (
false), any_sparse (
false),
85 first_elem_is_struct (
false), class_nm (), ok (
false)
145 if (
this != &x && rep != x.
rep)
147 if (rep && --rep->count == 0)
161 if (rep && --rep->count == 0)
168 bool empty (
void)
const {
return rep->empty (); }
170 size_t length (
void)
const {
return rep->length (); }
191 operator bool ()
const {
return (rep && rep->ok); }
193 iterator
begin (
void) {
return rep->begin (); }
194 const_iterator
begin (
void)
const {
return rep->begin (); }
196 iterator
end (
void) {
return rep->end (); }
197 const_iterator
end (
void)
const {
return rep->end (); }
211 else if (c1.empty ())
213 else if (c2.empty ())
215 else if (c1 ==
"class" || c2 ==
"class")
219 bool c1_is_int = (c1 ==
"int8" || c1 ==
"uint8"
220 || c1 ==
"int16" || c1 ==
"uint16"
221 || c1 ==
"int32" || c1 ==
"uint32"
222 || c1 ==
"int64" || c1 ==
"uint64");
223 bool c2_is_int = (c2 ==
"int8" || c2 ==
"uint8"
224 || c2 ==
"int16" || c2 ==
"uint16"
225 || c2 ==
"int32" || c2 ==
"uint32"
226 || c2 ==
"int64" || c2 ==
"uint64");
228 bool c1_is_char = (c1 ==
"char");
229 bool c2_is_char = (c2 ==
"char");
231 bool c1_is_double = (c1 ==
"double");
232 bool c2_is_double = (c2 ==
"double");
234 bool c1_is_single = (c1 ==
"single");
235 bool c2_is_single = (c2 ==
"single");
237 bool c1_is_logical = (c1 ==
"logical");
238 bool c2_is_logical = (c2 ==
"logical");
240 bool c1_is_built_in_type
241 = (c1_is_int || c1_is_char || c1_is_double || c1_is_single
244 bool c2_is_built_in_type
245 = (c2_is_int || c2_is_char || c2_is_double || c2_is_single
250 if (c1 ==
"struct" && c2 == c1)
252 else if (c1 ==
"cell" || c2 ==
"cell")
254 else if (c1_is_char && c2_is_built_in_type)
256 else if (c2_is_char && c1_is_built_in_type)
258 else if (c1_is_int && c2_is_built_in_type)
260 else if (c2_is_int && c1_is_built_in_type)
262 else if (c1_is_single && c2_is_built_in_type)
264 else if (c2_is_single && c1_is_built_in_type)
266 else if (c1_is_double && c2_is_built_in_type)
268 else if (c2_is_double && c1_is_built_in_type)
270 else if (c1_is_logical && c2_is_logical)
277 OCTAVE_NORETURN
static
281 error (
"%s (%s vs %s)", msg, x.
str ().c_str (), y.
str ().c_str ());
353 bool first_elem =
true;
380 do_init_element (tlst(
i), first_elem);
384 do_init_element (tmp, first_elem);
388 if (any_cell && ! any_class && ! first_elem_is_struct)
410 else if ((! any_class) && (!
dv.
hvcat (this_elt_dv, 1)))
411 eval_error (
"horizontal dimensions mismatch",
dv, this_elt_dv);
421 bool elt_changed =
false;
440 bool first_elem =
true;
457 else if (!
dv.
hvcat (this_elt_dv, 1))
458 eval_error (
"horizontal dimensions mismatch",
dv, this_elt_dv);
472 all_mt (true), any_cell (
false), any_sparse (
false),
497 operator bool ()
const {
return ok; }
539 all_1x1 = ! tm.
empty ();
541 bool first_elem =
true;
542 bool first_elem_is_struct =
false;
564 if (tmp && ! tmp.
empty ())
604 if (any_cell && ! any_class && ! first_elem_is_struct)
638 else if (all_str &&
dv.
ndims () == 2
639 && this_elt_dv.
ndims () == 2)
643 if (this_elt_nc >
cols ())
645 dv(0) += this_elt_nr;
647 else if ((! any_class) && (!
dv.
hvcat (this_elt_dv, 0)))
648 eval_error (
"vertical dimensions mismatch",
dv, this_elt_dv);
658 error (
"invalid number of output arguments for matrix list");
660 return rvalue1 (nargout);
666 if (! (all_dq_strings_p || all_sq_strings_p))
668 "concatenation of different character string types may have unintended consequences");
671 template <
typename TYPE,
typename T>
692 TYPE ra = octave_value_extract<TYPE> (*q);
696 if (! ra.is_empty ())
709 template <
typename TYPE,
typename T>
731 assert (static_cast<size_t> (result.
numel ()) == row.
length ());
734 result(i++) = octave_value_extract<T> (*q);
747 array_list[
i] = octave_value_extract<TYPE> (*q);
760 template <
typename TYPE,
typename T>
789 sparse_list[
i] = octave_value_extract<TYPE> (*q);
794 sparse_row_list[j] = stmp;
801 template <
typename MAP>
827 map_list[
i] = octave_value_extract<MAP> (*q);
832 map_row_list[j] = mtmp;
839 template <
typename TYPE>
858 if (
tmp.all_1x1_p ())
859 single_type_concat<octave_scalar_map> (result,
dv,
tmp);
894 if (
rows.length () == 1)
914 bool frc_str_conv =
false;
918 if (tmp && ! tmp.
empty ())
938 else if (result_type ==
"double")
943 retval = do_single_type_concat<SparseMatrix> (
dv,
tmp);
945 retval = do_single_type_concat<SparseComplexMatrix> (
dv,
tmp);
950 retval = do_single_type_concat<NDArray> (
dv,
tmp);
952 retval = do_single_type_concat<ComplexNDArray> (
dv,
tmp);
955 else if (result_type ==
"single")
958 retval = do_single_type_concat<FloatNDArray> (
dv,
tmp);
960 retval = do_single_type_concat<FloatComplexNDArray> (
dv,
tmp);
962 else if (result_type ==
"char")
964 char type = all_dq_strings_p ?
'"' :
'\'';
968 "numeric", result_type);
974 single_type_concat<charNDArray> (
result,
tmp);
978 else if (result_type ==
"logical")
981 retval = do_single_type_concat<SparseBoolMatrix> (
dv,
tmp);
983 retval = do_single_type_concat<boolNDArray> (
dv,
tmp);
985 else if (result_type ==
"int8")
986 retval = do_single_type_concat<int8NDArray> (
dv,
tmp);
987 else if (result_type ==
"int16")
988 retval = do_single_type_concat<int16NDArray> (
dv,
tmp);
989 else if (result_type ==
"int32")
990 retval = do_single_type_concat<int32NDArray> (
dv,
tmp);
991 else if (result_type ==
"int64")
992 retval = do_single_type_concat<int64NDArray> (
dv,
tmp);
993 else if (result_type ==
"uint8")
994 retval = do_single_type_concat<uint8NDArray> (
dv,
tmp);
995 else if (result_type ==
"uint16")
996 retval = do_single_type_concat<uint16NDArray> (
dv,
tmp);
997 else if (result_type ==
"uint32")
998 retval = do_single_type_concat<uint32NDArray> (
dv,
tmp);
999 else if (result_type ==
"uint64")
1000 retval = do_single_type_concat<uint64NDArray> (
dv,
tmp);
1001 else if (result_type ==
"cell")
1002 retval = do_single_type_concat<Cell> (
dv,
tmp);
1003 else if (result_type ==
"struct")
1046 q != row.
end (); q++)
1053 goto found_non_empty;
1068 int dv_len = dv.
ndims ();
1100 if (frc_str_conv && ! retval.
is_string ())
1114 new_matrix->
copy_base (*
this, scope, context);
tm_row_const & operator=(const tm_row_const &x)
bool any_class_p(void) const
bool some_strings_p(void) const
void warning_with_id(const char *id, const char *fmt,...)
bool is_object(void) const
octave::base_list< tree_argument_list * >::const_iterator const_iterator
OCTAVE_EXPORT octave_value_list column
static octave_map cat(int dim, octave_idx_type n, const octave_scalar_map *map_list)
std::string str(char sep= 'x') const
bool is_real_type(void) const
const octave_base_value const Array< octave_idx_type > & ra_idx
octave_value do_cat_op(const octave_value &v1, const octave_value &v2, const Array< octave_idx_type > &ra_idx)
std::string get_concat_class(const std::string &c1, const std::string &c2)
octave_idx_type numel(void) const
Number of elements in the array.
bool all_real_p(void) const
std::string class_name(void) const
identity matrix If supplied two scalar respectively For allows like xample val
octave_idx_type length(void) const
static octave_value do_single_type_concat(const dim_vector &dv, tm_const &tmp)
bool all_dq_strings_p(void) const
bool all_complex_p(void) const
#define DEFUN(name, args_name, nargout_name, doc)
bool any_cell_p(void) const
bool all_empty_p(void) const
void error(const char *fmt,...)
tree_expression * dup(symbol_table::scope_id scope, symbol_table::context_id context) const
#define SET_INTERNAL_VARIABLE(NM)
tm_const(const tree_matrix &tm)
octave_idx_type & elem(int i)
bool all_strings_p(void) const
static Sparse< T > cat(int dim, octave_idx_type n, const Sparse< T > *sparse_list)
octave_value resize(const dim_vector &dv, bool fill=false) const
std::list< octave_value >::iterator iterator
const_iterator end(void) const
static std::string static_class_name(void)
Array< T > & insert(const Array< T > &a, const Array< octave_idx_type > &idx)
Insert an array into another at a specified position.
tm_row_const_rep::iterator iterator
bool any_sparse_p(void) const
octave_idx_type columns(void) const
create a structure array and initialize its values The dimensions of each cell array of values must match Singleton cells and non cell values are repeated so that they fill the entire array If the cells are empty
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)
tm_row_const_rep::const_iterator const_iterator
octave_value convert_to_str(bool pad=false, bool force=false, char type= '\'') const
bool is_sparse_type(void) const
octave_idx_type numel(const octave_value_list &idx)
static llvm::LLVMContext & context
size_t length(void) const
octave_value do_single_type_concat< octave_map >(const dim_vector &dv, tm_const &tmp)
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().
bool is_string(void) const
bool all_sq_strings_p(void) const
void accept(tree_walker &tw)
bool is_complex_type(void) const
static OCTAVE_NORETURN void eval_error(const char *msg, const dim_vector &x, const dim_vector &y)
octave_refcount< int > count
bool all_strings_p(void) const
bool some_strings_p(void) const
static octave_value do_class_concat(tm_const &tmc)
tm_row_const_rep(const tree_argument_list &row)
bool all_1x1_p(void) const
bool all_dq_strings_p(void) const
bool all_zero_dims(void) const
bool any_zero(void) const
the sparsity preserving column transformation such that that defines the pivoting threshold can be given in which case it defines the c
void copy_base(const tree_array_list &array_list)
std::string class_name(void) const
dim_vector dims(void) const
octave_value rvalue1(int nargout=1)
bool first_elem_is_struct
With real return the complex result
bool all_complex_p(void) const
bool any_class_p(void) const
octave_value resize(const dim_vector &dv, bool=false) const
N Dimensional Array with copy-on-write semantics.
virtual octave_value rvalue1(int nargout=1)
octave_idx_type cols(void) const
bool is_empty(void) const
std::list< octave_value >::const_iterator const_iterator
octave_idx_type rows(void)
bool is_sq_string(void) const
void init(const tree_argument_list &)
bool all_sq_strings_p(void) const
dim_vector dims(void) const
const_iterator begin(void) const
bool is_dq_string(void) const
void do_init_element(const octave_value &, bool &)
=val(i)}if ode{val(i)}occurs in table i
bool zero_by_zero(void) const
bool is_cs_list(void) const
bool any_sparse_p(void) const
void warn_implicit_conversion(const char *id, const char *from, const char *to)
size_t length(void) const
tm_row_const(const tree_argument_list &row)
bool all_real_p(void) const
octave_idx_type ndims(void) const
Number of dimensions.
bool any_cell_p(void) const
octave_idx_type rows(void) const
std::string class_name(void) const
the element is set to zero In other the statement xample y
octave_idx_type cols(void)
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_1x1_p(void) const
bool is_undefined(void) const
tm_row_const(const tm_row_const &x)
octave_value_list list_value(void) const
void init(const tree_matrix &tm)
bool all_empty_p(void) const
bool first_elem_struct_p(void) const
octave_value_list rvalue(int nargout)
void append(const octave_value &s)
static void single_type_concat(Array< T > &result, tm_const &tmp)
Vector representing the dimensions (size) of an Array.
virtual void visit_matrix(tree_matrix &)=0
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
where the brackets indicate optional arguments and and character or cell array For character arrays the conversion is repeated for every row
F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &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 F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T F77_REAL F77_REAL &F77_RET_T F77_DBLE F77_DBLE &F77_RET_T const F77_DBLE * x
return octave_value(v1.char_array_value().concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string())? '\'': '"'))
void maybe_warn_string_concat(bool all_dq_strings_p, bool all_sq_strings_p)