26 #if defined (HAVE_CONFIG_H)
54 OCTAVE_NORETURN
static
58 error (
"%s (%s vs %s)", msg,
x.str ().c_str (), y.
str ().c_str ());
65 bool elt_changed =
false;
85 bool first_elem =
true;
108 std::string this_elt_class_name
165 bool first_elem =
true;
167 for (
auto *elt : row)
174 error (
"undefined element in matrix list");
228 else if (result_type ==
"double")
233 return sparse_array_concat<SparseMatrix> ();
235 return sparse_array_concat<SparseComplexMatrix> ();
240 return array_concat<NDArray> ();
242 return array_concat<ComplexNDArray> ();
245 else if (result_type ==
"single")
248 return array_concat<FloatNDArray> ();
250 return array_concat<FloatComplexNDArray> ();
252 else if (result_type ==
"char")
256 "numeric", result_type);
262 else if (result_type ==
"logical")
265 return sparse_array_concat<SparseBoolMatrix> ();
267 return array_concat<boolNDArray> ();
269 else if (result_type ==
"int8")
270 return array_concat<int8NDArray> ();
271 else if (result_type ==
"int16")
272 return array_concat<int16NDArray> ();
273 else if (result_type ==
"int32")
274 return array_concat<int32NDArray> ();
275 else if (result_type ==
"int64")
276 return array_concat<int64NDArray> ();
277 else if (result_type ==
"uint8")
278 return array_concat<uint8NDArray> ();
279 else if (result_type ==
"uint16")
280 return array_concat<uint16NDArray> ();
281 else if (result_type ==
"uint32")
282 return array_concat<uint32NDArray> ();
283 else if (result_type ==
"uint64")
284 return array_concat<uint64NDArray> ();
285 else if (result_type ==
"cell")
286 return array_concat<Cell> ();
287 else if (result_type ==
"struct")
290 return map_concat<octave_scalar_map> ();
292 return map_concat<octave_map> ();
300 bool first_elem =
true;
301 bool first_elem_is_struct =
false;
307 for (
const auto *elt : tm)
377 std::string this_elt_class_name = elt.class_name ();
391 && this_elt_dv.
ndims () == 2)
403 if (this_elt_nc >
cols ())
404 m_dv(1) = this_elt_nc;
405 m_dv(0) += this_elt_nr;
419 array_concat_internal<charNDArray> (result);
435 if (tmrc.length () == 1)
436 rows(j++) = *(tmrc.begin ());
442 for (
const auto& elt : tmrc)
449 if (
rows.length () == 1)
494 for (
const auto& elt : row)
501 goto found_non_empty;
505 ctmp = (*(
m_tm_rows.begin () -> begin ()));
528 for (
const auto& elt : row)
559 template <
typename TYPE>
568 if (row.dims ().any_zero ())
571 for (
const auto& elt : row)
575 TYPE ra = octave_value_extract<TYPE> (elt);
581 result.insert (ra,
r, c);
592 template <
typename TYPE>
595 typedef typename TYPE::element_type ELT_T;
611 assert (
static_cast<size_t> (result.numel ()) == row.
length ());
613 for (
const auto& elt : row)
614 result(i++) = octave_value_extract<ELT_T> (elt);
623 for (
const auto& elt : row)
627 array_list[i++] = octave_value_extract<TYPE> (elt);
630 return TYPE::cat (-2, ncols, array_list);
635 array_concat_internal<TYPE> (result);
640 template <
typename TYPE>
658 for (
auto& elt : row)
662 sparse_list[i] = octave_value_extract<TYPE> (elt);
666 TYPE stmp = TYPE::cat (-2, ncols, sparse_list);
667 sparse_row_list[j] = stmp;
671 return TYPE::cat (-1, nrows, sparse_row_list);
674 template <
typename MAP>
689 for (
auto& elt : row)
693 map_list[i] = octave_value_extract<MAP> (elt);
698 map_row_list[j] = mtmp;
Vector representing the dimensions (size) of an Array.
std::string str(char sep='x') const
bool zero_by_zero(void) const
bool hvcat(const dim_vector &dvb, int dim)
This corresponds to [,] (horzcat, dim = 0) and [;] (vertcat, dim = 1).
octave_idx_type ndims(void) const
Number of dimensions.
bool any_zero(void) const
type_info & get_type_info(void)
void array_concat_internal(TYPE &result) const
octave_value char_array_concat(char string_fill_char) const
tree_evaluator & m_evaluator
octave_map map_concat(void) const
std::list< tm_row_const > m_tm_rows
TYPE array_concat(void) const
octave_value generic_concat(void) const
void init(const tree_matrix &tm)
octave_value class_concat(void) const
octave_value concat(char string_fill_char) const
TYPE sparse_array_concat(void) const
bool all_sq_strings_p(void) const
bool m_first_elem_is_struct
bool first_elem_struct_p(void) const
bool some_strings_p(void) const
bool any_cell_p(void) const
bool all_empty_p(void) const
bool any_class_p(void) const
bool all_dq_strings_p(void) const
octave_idx_type rows(void) const
bool any_sparse_p(void) const
bool all_1x1_p(void) const
bool all_real_p(void) const
octave_idx_type cols(void) const
bool all_strings_p(void) const
bool all_complex_p(void) const
std::list< octave_value > m_values
void init_element(const octave_value &, bool &)
void init(const tree_argument_list &, tree_evaluator &tw)
size_t length(void) const
interpreter & get_interpreter(void)
octave_value resize(const dim_vector &dv, bool=false) const
octave_idx_type columns(void) const
octave_idx_type rows(void) const
static octave_map cat(int dim, octave_idx_type n, const octave_scalar_map *map_list)
octave_idx_type length(void) const
bool issparse(void) const
octave_idx_type numel(void) const
bool is_dq_string(void) const
bool is_cs_list(void) const
bool is_string(void) const
std::string class_name(void) const
bool isstruct(void) const
bool all_zero_dims(void) const
octave_value_list list_value(void) const
bool isobject(void) const
bool is_sq_string(void) const
bool is_undefined(void) const
octave_value resize(const dim_vector &dv, bool fill=false) const
bool iscomplex(void) const
dim_vector dims(void) const
octave_value do_class_concat(const octave_value_list &ovl, std::string cattype, int dim)
void error(const char *fmt,...)
void warn_implicit_conversion(const char *id, const char *from, const char *to)
F77_RET_T const F77_DBLE * x
std::string get_concat_class(const std::string &c1, const std::string &c2)
void maybe_warn_string_concat(bool all_dq_strings_p, bool all_sq_strings_p)
#define OCTAVE_LOCAL_BUFFER(T, buf, size)
const octave_base_value const Array< octave_idx_type > & ra_idx
return octave_value(v1.char_array_value() . concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string()) ? '\'' :'"'))
octave_value::octave_value(const Array< char > &chm, char type) return retval
OCTINTERP_API octave_value do_cat_op(octave::type_info &ti, const octave_value &a, const octave_value &b, const Array< octave_idx_type > &ra_idx)
static OCTAVE_NORETURN void eval_error(const char *msg, const dim_vector &x, const dim_vector &y)