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;
67 for (
auto& elt : m_values)
85 bool first_elem =
true;
87 for (
const auto& val : m_values)
100 else if (! m_dv.hvcat (this_elt_dv, 1))
101 eval_error (
"horizontal dimensions mismatch", m_dv, this_elt_dv);
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 panic_unless (
static_cast<std::size_t
> (result.numel ())
614 for (
const auto& elt : row)
615 result(i++) = octave_value_extract<ELT_T> (elt);
624 for (
const auto& elt : row)
628 array_list[i++] = octave_value_extract<TYPE> (elt);
631 return TYPE::cat (-2, ncols, array_list);
636 array_concat_internal<TYPE> (result);
641 template <
typename TYPE>
659 for (
auto& elt : row)
663 sparse_list[i] = octave_value_extract<TYPE> (elt);
667 TYPE stmp = TYPE::cat (-2, ncols, sparse_list);
668 sparse_row_list[j] = stmp;
672 return TYPE::cat (-1, nrows, sparse_row_list);
675 template <
typename MAP>
690 for (
auto& elt : row)
694 map_list[i] = octave_value_extract<MAP> (elt);
699 map_row_list[j] = mtmp;
Vector representing the dimensions (size) of an Array.
OCTAVE_API std::string str(char sep='x') const
bool zero_by_zero(void) const
OCTAVE_API 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)
OCTINTERP_API 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
OCTINTERP_API octave_value_list list_value(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 convert_to_str(bool pad=false, bool force=false, char type='\'') 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 concat(char string_fill_char) const
void init(const tree_matrix &tm)
octave_value char_array_concat(char string_fill_char) const
void array_concat_internal(TYPE &result) const
octave_map map_concat(void) const
tree_evaluator & m_evaluator
std::list< tm_row_const > m_tm_rows
TYPE sparse_array_concat(void) const
octave_value class_concat(void) const
TYPE array_concat(void) const
octave_value generic_concat(void) const
octave_idx_type rows(void) const
bool all_complex_p(void) const
octave_idx_type cols(void) const
bool all_empty_p(void) const
bool m_first_elem_is_struct
bool first_elem_struct_p(void) const
bool any_cell_p(void) const
bool all_1x1_p(void) const
bool all_strings_p(void) const
bool any_class_p(void) const
bool all_dq_strings_p(void) const
bool all_real_p(void) const
bool any_sparse_p(void) const
bool all_sq_strings_p(void) const
bool some_strings_p(void) const
std::size_t length(void) const
void init(const tree_argument_list &, tree_evaluator &tw)
std::list< octave_value > m_values
void init_element(const octave_value &, bool &)
interpreter & get_interpreter(void)
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
octave_value do_class_concat(const octave_value_list &ovl, const std::string &cattype, int dim)
void error(const char *fmt,...)
void panic_unless(bool cond)
void warn_implicit_conversion(const char *id, const char *from, const char *to)
F77_RET_T const F77_DBLE * x
#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()) ? '\'' :'"'))
OCTINTERP_API octave_value cat_op(type_info &ti, const octave_value &a, const octave_value &b, const Array< octave_idx_type > &ra_idx)
void maybe_warn_string_concat(bool all_dq_strings_p, bool all_sq_strings_p)
std::string get_concat_class(const std::string &c1, const std::string &c2)
static OCTAVE_NORETURN void eval_error(const char *msg, const dim_vector &x, const dim_vector &y)