Mercurial > hg > octave-nkf
annotate libinterp/octave-value/ov-re-sparse.h @ 20817:c3c052b9192a
Improve performance and error reporting of betainv, gaminv (bug #34363).
* betainv.m: Replace for loop with do-until loop. Shorten max loop cycles to
40, rather than 10,000. Issue warning if algorithm fails.
* gaminv.m: Replace for loop with do-until loop. Shorten max loop cycles to
40, rather than 100. Issue warning if algorithm fails.
author | Rik <rik@octave.org> |
---|---|
date | Sun, 11 Oct 2015 16:55:17 -0700 |
parents | 09ed6f7538dd |
children |
rev | line source |
---|---|
5164 | 1 /* |
2 | |
19898
4197fc428c7d
maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents:
19795
diff
changeset
|
3 Copyright (C) 2004-2015 David Bateman |
11523 | 4 Copyright (C) 1998-2004 Andy Adler |
7016 | 5 |
6 This file is part of Octave. | |
5164 | 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 | |
7016 | 10 Free Software Foundation; either version 3 of the License, or (at your |
11 option) any later version. | |
5164 | 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 | |
7016 | 19 along with Octave; see the file COPYING. If not, see |
20 <http://www.gnu.org/licenses/>. | |
5164 | 21 |
22 */ | |
23 | |
17822
ebb3ef964372
maint: Use common #define syntax "octave_filename_h" in h_files.
Rik <rik@octave.org>
parents:
17787
diff
changeset
|
24 #if !defined (octave_ov_re_sparse_h) |
ebb3ef964372
maint: Use common #define syntax "octave_filename_h" in h_files.
Rik <rik@octave.org>
parents:
17787
diff
changeset
|
25 #define octave_ov_re_sparse_h 1 |
5164 | 26 |
27 #include <cstdlib> | |
28 | |
8950
d865363208d6
include <iosfwd> instead of <iostream> in header files
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
29 #include <iosfwd> |
5164 | 30 #include <string> |
31 | |
32 #include "mx-base.h" | |
33 #include "str-vec.h" | |
34 | |
35 #include "error.h" | |
36 #include "oct-stream.h" | |
37 #include "ov-base.h" | |
38 #include "ov-typeinfo.h" | |
39 | |
40 #include "dSparse.h" | |
5785 | 41 #include "MatrixType.h" |
5164 | 42 #include "ov-base-sparse.h" |
43 #include "ov-cx-sparse.h" | |
44 | |
45 class octave_value_list; | |
46 | |
47 class tree_walker; | |
48 | |
49 class | |
6109 | 50 OCTINTERP_API |
5164 | 51 octave_sparse_matrix : public octave_base_sparse<SparseMatrix> |
52 { | |
53 public: | |
54 | |
55 octave_sparse_matrix (void) | |
56 : octave_base_sparse<SparseMatrix> () { } | |
57 | |
58 octave_sparse_matrix (const Matrix& m) | |
59 : octave_base_sparse<SparseMatrix> (SparseMatrix (m)) { } | |
60 | |
61 octave_sparse_matrix (const NDArray& m) | |
62 : octave_base_sparse<SparseMatrix> (SparseMatrix (m)) { } | |
63 | |
64 octave_sparse_matrix (const SparseMatrix& m) | |
65 : octave_base_sparse<SparseMatrix> (m) { } | |
66 | |
5785 | 67 octave_sparse_matrix (const SparseMatrix& m, const MatrixType& t) |
5164 | 68 : octave_base_sparse<SparseMatrix> (m, t) { } |
69 | |
70 octave_sparse_matrix (const MSparse<double>& m) | |
71 : octave_base_sparse<SparseMatrix> (m) { } | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
72 |
6863 | 73 octave_sparse_matrix (const MSparse<double>& m, const MatrixType& t) |
74 : octave_base_sparse<SparseMatrix> (m, t) { } | |
75 | |
76 octave_sparse_matrix (const Sparse<double>& m) | |
77 : octave_base_sparse<SparseMatrix> (SparseMatrix (m)) { } | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
78 |
6863 | 79 octave_sparse_matrix (const Sparse<double>& m, const MatrixType& t) |
80 : octave_base_sparse<SparseMatrix> (SparseMatrix (m), t) { } | |
81 | |
5164 | 82 octave_sparse_matrix (const octave_sparse_matrix& m) |
83 : octave_base_sparse<SparseMatrix> (m) { } | |
84 | |
85 ~octave_sparse_matrix (void) { } | |
86 | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
87 octave_base_value *clone (void) const |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
88 { return new octave_sparse_matrix (*this); } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
89 octave_base_value *empty_clone (void) const |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
90 { return new octave_sparse_matrix (); } |
5164 | 91 |
5759 | 92 octave_base_value *try_narrowing_conversion (void); |
5164 | 93 |
18129
e473c4853afc
enable non-integer ranges as indices by default and deprecate preference
John W. Eaton <jwe@octave.org>
parents:
17822
diff
changeset
|
94 idx_vector index_vector (bool require_integers = false) const; |
5164 | 95 |
9685 | 96 builtin_type_t builtin_type (void) const { return btyp_double; } |
97 | |
5164 | 98 bool is_real_matrix (void) const { return true; } |
99 | |
100 bool is_real_type (void) const { return true; } | |
101 | |
5895 | 102 bool is_double_type (void) const { return true; } |
103 | |
7576 | 104 bool is_float_type (void) const { return true; } |
105 | |
5164 | 106 double double_value (bool = false) const; |
107 | |
108 double scalar_value (bool frc_str_conv = false) const | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
109 { return double_value (frc_str_conv); } |
5164 | 110 |
111 Matrix matrix_value (bool = false) const; | |
112 | |
113 Complex complex_value (bool = false) const; | |
114 | |
5943 | 115 boolNDArray bool_array_value (bool warn = false) const; |
5898 | 116 |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
117 charNDArray char_array_value (bool = false) const; |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
118 |
5164 | 119 ComplexMatrix complex_matrix_value (bool = false) const; |
120 | |
121 ComplexNDArray complex_array_value (bool = false) const; | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
122 |
5164 | 123 NDArray array_value (bool = false) const; |
124 | |
125 SparseMatrix sparse_matrix_value (bool = false) const | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
126 { return matrix; } |
5164 | 127 |
128 SparseComplexMatrix sparse_complex_matrix_value (bool = false) const | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
129 { return SparseComplexMatrix (matrix); } |
5164 | 130 |
9852
aabf7a8c2e57
implement sparse logical conversion
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
131 SparseBoolMatrix sparse_bool_matrix_value (bool warn = false) const; |
aabf7a8c2e57
implement sparse logical conversion
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
132 |
5322 | 133 octave_value convert_to_str_internal (bool pad, bool force, char type) const; |
5282 | 134 |
5164 | 135 #if 0 |
136 int write (octave_stream& os, int block_size, | |
10313 | 137 oct_data_conv::data_type output_type, int skip, |
138 oct_mach_info::float_format flt_fmt) const | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
139 { return os.write (matrix, block_size, output_type, skip, flt_fmt); } |
5164 | 140 #endif |
141 | |
142 bool save_binary (std::ostream& os, bool& save_as_floats); | |
143 | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
144 bool load_binary (std::istream& is, bool swap, |
10313 | 145 oct_mach_info::float_format fmt); |
5164 | 146 |
20070
09ed6f7538dd
avoid needing to include hdf5 in public header files (bug #44370, #43180)
John W. Eaton <jwe@octave.org> and Mike Miller <mtmiller@ieee.org>
parents:
19898
diff
changeset
|
147 bool save_hdf5 (octave_hdf5_id loc_id, const char *name, bool save_as_floats); |
5164 | 148 |
20070
09ed6f7538dd
avoid needing to include hdf5 in public header files (bug #44370, #43180)
John W. Eaton <jwe@octave.org> and Mike Miller <mtmiller@ieee.org>
parents:
19898
diff
changeset
|
149 bool load_hdf5 (octave_hdf5_id loc_id, const char *name); |
5164 | 150 |
5900 | 151 mxArray *as_mxArray (void) const; |
152 | |
9812
f80c566bc751
improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents:
9685
diff
changeset
|
153 octave_value map (unary_mapper_t umap) const; |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
154 |
5164 | 155 private: |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
156 octave_value map (double (*fcn) (double)) const; |
5164 | 157 |
158 | |
159 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA | |
160 }; | |
161 | |
162 #endif |