79 octave::idx_vector i = idx (0).index_vector ();
87 octave::idx_vector i = idx (0).index_vector ();
90 octave::idx_vector j = idx (1).index_vector ();
97 error (
"sparse indexing needs 1 or 2 indices");
100 catch (octave::index_exception& ie)
103 ie.set_pos_if_unset (n_idx, k+1);
113 const std::list<octave_value_list>& idx)
120 retval = do_index_op (idx.front ());
126 std::string nm = type_name ();
127 error (
"%s cannot be indexed with %c", nm.c_str (), type[0]);
132 error (
"unexpected: index not '(', '{', or '.' in octave_base_sparse<T>::subsref - please report this bug");
141 const std::list<octave_value_list>& idx,
150 if (type.length () != 1)
152 std::string nm = type_name ();
153 error (
"in indexed assignment of %s, last lhs index must be ()",
157 retval = numeric_assign (type, idx, rhs);
166 std::string nm = type_name ();
167 error (
"%s cannot be indexed with %c", nm.c_str (), type[0]);
172 retval = tmp.
subsasgn (type, idx, rhs);
177 error (
"unexpected: index not '(', '{', or '.' in octave_base_sparse<T>::subsasgn - please report this bug");
183template <
typename MT>
201 octave::idx_vector i = idx (0).index_vector ();
203 matrix.delete_elements (i);
210 octave::idx_vector i = idx (0).index_vector ();
213 octave::idx_vector j = idx (1).index_vector ();
215 matrix.delete_elements (i, j);
221 error (
"sparse indexing needs 1 or 2 indices");
224 catch (octave::index_exception& ie)
227 ie.set_pos_if_unset (
len, k+1);
232 typ.invalidate_type ();
257 if (t1.any_element_is_nan ())
258 octave::err_nan_to_logical_conversion ();
287 print_raw (os, pr_as_read_syntax);
294 const std::string& prefix)
const
296 matrix.print_info (os, prefix);
302 bool pr_as_read_syntax)
const
304 octave::preserve_stream_state stream_state (os);
314 os <<
"Compressed Column Sparse (rows = " << nr
324 double dnel = dnr * dnc;
328 double pct = (nz / dnel * 100);
350 os <<
" [" << std::setprecision (prec) << pct <<
"%]";
373 os <<
" (" << matrix.ridx (i)+1 <<
", " << j+1 <<
") -> ";
381template <
typename MT>
389template <
typename MT>
395 std::ostringstream buf;
407 matrix.maybe_compress ();
409 os <<
"# nnz: " << nnz () <<
"\n";
410 os <<
"# rows: " << dv(0) <<
"\n";
411 os <<
"# columns: " << dv(1) <<
"\n";
429 error (
"load: failed to extract number of rows and columns");
438 error (
"load: failed to load matrix constant");
479 if (umap == umap_xtolower || umap == umap_xtoupper)
SparseBoolMatrix all(int dim=-1) const
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_value subsref(const std::string &type, const std::list< octave_value_list > &idx)
void print(std::ostream &os, bool pr_as_read_syntax=false)
bool load_ascii(std::istream &is)
void print_raw(std::ostream &os, bool pr_as_read_syntax=false) const
bool save_ascii(std::ostream &os)
octave_value fast_elem_extract(octave_idx_type n) const
octave_value subsasgn(const std::string &type, const std::list< octave_value_list > &idx, const octave_value &rhs)
void delete_elements(const octave_value_list &idx)
octave_value map(octave_base_value::unary_mapper_t umap) const
float_display_format get_edit_display_format() const
bool print_as_scalar() const
octave_value resize(const dim_vector &dv, bool=false) const
void print_info(std::ostream &os, const std::string &prefix) const
octave_value do_index_op(const octave_value_list &idx, bool resize_ok=false)
std::string edit_display(const float_display_format &fmt, octave_idx_type i, octave_idx_type j) const
octave_idx_type length() const
SparseMatrix sparse_matrix_value(bool frc_str_conv=false) const
static octave_value empty_conv(const std::string &type, const octave_value &rhs=octave_value())
octave_value next_subsref(const std::string &type, const std::list< octave_value_list > &idx, std::size_t skip=1)
SparseBoolMatrix sparse_bool_matrix_value(bool warn=false) const
builtin_type_t builtin_type() const
SparseComplexMatrix sparse_complex_matrix_value(bool frc_str_conv=false) const
octave_value subsasgn(const std::string &type, const std::list< octave_value_list > &idx, const octave_value &rhs)
void error(const char *fmt,...)
void warn_array_as_logical(const dim_vector &dv)
std::string extract_keyword(std::istream &is, const char *keyword, const bool next_only)
void octave_print_internal(std::ostream &os, const float_display_format &fmt, bool d, bool pr_as_read_syntax)