GNU Octave  4.2.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ov-re-sparse.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 2004-2017 David Bateman
4 Copyright (C) 1998-2004 Andy Adler
5 
6 This file is part of Octave.
7 
8 Octave is free software; you can redistribute it and/or modify it
9 under the terms of the GNU General Public License as published by the
10 Free Software Foundation; either version 3 of the License, or (at your
11 option) any later version.
12 
13 Octave is distributed in the hope that it will be useful, but WITHOUT
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 for more details.
17 
18 You should have received a copy of the GNU General Public License
19 along with Octave; see the file COPYING. If not, see
20 <http://www.gnu.org/licenses/>.
21 
22 */
23 
24 #if ! defined (octave_ov_re_sparse_h)
25 #define octave_ov_re_sparse_h 1
26 
27 #include "octave-config.h"
28 
29 #include <cstdlib>
30 
31 #include <iosfwd>
32 #include <string>
33 
34 #include "mx-base.h"
35 #include "str-vec.h"
36 
37 #include "error.h"
38 #include "oct-stream.h"
39 #include "ov-base.h"
40 #include "ov-typeinfo.h"
41 
42 #include "dSparse.h"
43 #include "MatrixType.h"
44 #include "ov-base-sparse.h"
45 #include "ov-cx-sparse.h"
46 
47 class octave_value_list;
48 
49 class tree_walker;
50 
51 class
54 {
55 public:
56 
59 
62 
65 
68 
70  : octave_base_sparse<SparseMatrix> (m, t) { }
71 
74 
76  : octave_base_sparse<SparseMatrix> (m, t) { }
77 
80 
83 
86 
88 
89  octave_base_value *clone (void) const
90  { return new octave_sparse_matrix (*this); }
92  { return new octave_sparse_matrix (); }
93 
94  octave_base_value *try_narrowing_conversion (void);
95 
96  idx_vector index_vector (bool require_integers = false) const;
97 
98  builtin_type_t builtin_type (void) const { return btyp_double; }
99 
100  bool is_real_matrix (void) const { return true; }
101 
102  bool is_real_type (void) const { return true; }
103 
104  bool is_double_type (void) const { return true; }
105 
106  bool is_float_type (void) const { return true; }
107 
108  double double_value (bool = false) const;
109 
110  double scalar_value (bool frc_str_conv = false) const
111  { return double_value (frc_str_conv); }
112 
113  Matrix matrix_value (bool = false) const;
114 
115  Complex complex_value (bool = false) const;
116 
117  boolNDArray bool_array_value (bool warn = false) const;
118 
119  charNDArray char_array_value (bool = false) const;
120 
121  ComplexMatrix complex_matrix_value (bool = false) const;
122 
123  ComplexNDArray complex_array_value (bool = false) const;
124 
125  NDArray array_value (bool = false) const;
126 
127  SparseMatrix sparse_matrix_value (bool = false) const
128  { return matrix; }
129 
131  { return SparseComplexMatrix (matrix); }
132 
133  SparseBoolMatrix sparse_bool_matrix_value (bool warn = false) const;
134 
135  octave_value convert_to_str_internal (bool pad, bool force, char type) const;
136 
137  octave_value as_double (void) const;
138 
139 #if 0
140  int write (octave_stream& os, int block_size,
141  oct_data_conv::data_type output_type, int skip,
143  { return os.write (matrix, block_size, output_type, skip, flt_fmt); }
144 #endif
145 
146  bool save_binary (std::ostream& os, bool& save_as_floats);
147 
148  bool load_binary (std::istream& is, bool swap,
150 
151  bool save_hdf5 (octave_hdf5_id loc_id, const char *name, bool save_as_floats);
152 
153  bool load_hdf5 (octave_hdf5_id loc_id, const char *name);
154 
155  mxArray *as_mxArray (void) const;
156 
157  octave_value map (unary_mapper_t umap) const;
158 
159 private:
160  octave_value map (double (*fcn) (double)) const;
161 
163 };
164 
165 #endif
SparseComplexMatrix sparse_complex_matrix_value(bool=false) const
Definition: ov-re-sparse.h:130
octave_sparse_matrix(const MSparse< double > &m, const MatrixType &t)
Definition: ov-re-sparse.h:75
octave_sparse_matrix(const Sparse< double > &m)
Definition: ov-re-sparse.h:78
SparseMatrix sparse_matrix_value(bool=false) const
Definition: ov-re-sparse.h:127
octave_sparse_matrix(const MSparse< double > &m)
Definition: ov-re-sparse.h:72
octave_idx_type write(const octave_value &data, octave_idx_type block_size, oct_data_conv::data_type output_type, octave_idx_type skip, octave::mach_info::float_format flt_fmt)
Definition: oct-stream.cc:6647
octave_base_value * empty_clone(void) const
Definition: ov-re-sparse.h:91
builtin_type_t builtin_type(void) const
Definition: ov-re-sparse.h:98
octave_sparse_matrix(const SparseMatrix &m)
Definition: ov-re-sparse.h:66
the sparsity preserving column transformation such that that defines the pivoting threshold can be given in which case it defines the then the first element defines the pivoting tolerance for the unsymmetric the values defined such that for full matrix
Definition: lu.cc:138
octave::mach_info::float_format flt_fmt
Definition: load-save.cc:723
OCTAVE_EXPORT octave_value_list return the number of command line arguments passed to Octave If called with the optional argument the function t
Definition: ov-usr-fcn.cc:935
builtin_type_t
Definition: ov-base.h:61
bool is_real_type(void) const
Definition: ov-re-sparse.h:102
octave_sparse_matrix(const Sparse< double > &m, const MatrixType &t)
Definition: ov-re-sparse.h:81
octave_function * fcn
Definition: ov-class.cc:1743
bool is_float_type(void) const
Definition: ov-re-sparse.h:106
bool swap
Definition: load-save.cc:725
#define DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
Definition: ov-base.h:148
OCTAVE_EXPORT octave_value_list any number nd example oindent prints the prompt xample Pick a any number!nd example oindent and waits for the user to enter a value The string entered by the user is evaluated as an so it may be a literal a variable name
Definition: input.cc:871
#define OCTINTERP_API
Definition: mexproto.h:69
nd deftypefn *octave_map m
Definition: ov-struct.cc:2058
bool save_as_floats
Definition: load-save.cc:1581
int64_t octave_hdf5_id
idx type
Definition: ov.cc:3129
Definition: dMatrix.h:37
octave_sparse_matrix(const Matrix &m)
Definition: ov-re-sparse.h:60
octave_sparse_matrix(const NDArray &m)
Definition: ov-re-sparse.h:63
bool is_real_matrix(void) const
Definition: ov-re-sparse.h:100
double scalar_value(bool frc_str_conv=false) const
Definition: ov-re-sparse.h:110
octave_map map(dims)
octave_base_value * clone(void) const
Definition: ov-re-sparse.h:89
octave_sparse_matrix(const octave_sparse_matrix &m)
Definition: ov-re-sparse.h:84
octave_sparse_matrix(const SparseMatrix &m, const MatrixType &t)
Definition: ov-re-sparse.h:69
bool is_double_type(void) const
Definition: ov-re-sparse.h:104
std::complex< double > Complex
Definition: oct-cmplx.h:31
write the output to stdout if nargout is
Definition: load-save.cc:1576