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
MatrixType.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 2006-2017 David Bateman
4 Copyright (C) 2006 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_MatrixType_h)
25 #define octave_MatrixType_h 1
26 
27 #include "octave-config.h"
28 
29 #include "MSparse.h"
30 
31 class Matrix;
32 class ComplexMatrix;
33 class FloatMatrix;
34 class FloatComplexMatrix;
35 class SparseMatrix;
37 
38 class
39 OCTAVE_API
41 {
42 public:
44  {
45  Unknown = 0,
58  Rectangular
59  };
60 
61  MatrixType (void);
62 
63  MatrixType (const MatrixType &a);
64 
65  MatrixType (const Matrix &a);
66 
67  MatrixType (const ComplexMatrix &a);
68 
69  MatrixType (const FloatMatrix &a);
70 
72 
73  template <typename T>
74  MatrixType (const MSparse<T> &a);
75 
76  MatrixType (const matrix_type t, bool _full = false);
77 
78  MatrixType (const matrix_type t, const octave_idx_type np,
79  const octave_idx_type *p, bool _full = false);
80 
81  MatrixType (const matrix_type t, const octave_idx_type ku,
82  const octave_idx_type kl, bool _full = false);
83 
84  ~MatrixType (void);
85 
87 
88  int type (bool quiet = true);
89 
90  int type (const Matrix &a);
91 
92  int type (const ComplexMatrix &a);
93 
94  int type (const FloatMatrix &a);
95 
96  int type (const FloatComplexMatrix &a);
97 
98  int type (const SparseMatrix &a);
99 
100  int type (const SparseComplexMatrix &a);
101 
102  double band_density (void) const { return bandden; }
103 
104  int nupper (void) const { return upper_band; }
105 
106  int nlower (void) const { return lower_band; }
107 
108  bool is_dense (void) const { return dense; }
109 
110  bool is_diagonal (void) const
111  { return (typ == Diagonal || typ == Permuted_Diagonal); }
112 
113  bool is_upper_triangular (void) const
114  { return (typ == Upper || typ == Permuted_Upper); }
115 
116  bool is_lower_triangular (void) const
117  { return (typ == Lower || typ == Permuted_Lower); }
118 
119  bool is_banded (void)
120  { return (typ == Banded || typ == Banded_Hermitian); }
121 
122  bool is_tridiagonal (void) const
123  { return (typ == Tridiagonal || typ == Tridiagonal_Hermitian); }
124 
125  bool is_hermitian (void) const
126  {
127  return (typ == Banded_Hermitian || typ == Tridiagonal_Hermitian
128  || typ == Hermitian);
129  }
130 
131  bool is_rectangular (void) const { return (typ == Rectangular); }
132 
133  bool is_known (void) const { return (typ != Unknown); }
134 
135  bool is_unknown (void) const { return (typ == Unknown); }
136 
137  void info (void) const;
138 
139  octave_idx_type * triangular_perm (void) const { return perm; }
140 
141  void invalidate_type (void) { typ = Unknown; }
142 
143  void mark_as_diagonal (void) { typ = Diagonal; }
144 
145  void mark_as_permuted_diagonal (void) { typ = Permuted_Diagonal; }
146 
147  void mark_as_upper_triangular (void) { typ = Upper; }
148 
149  void mark_as_lower_triangular (void) { typ = Lower; }
150 
151  void mark_as_tridiagonal (void) {typ = Tridiagonal; }
152 
154  { typ = Banded; upper_band = ku; lower_band = kl; }
155 
156  void mark_as_full (void) { typ = Full; }
157 
158  void mark_as_rectangular (void) { typ = Rectangular; }
159 
160  void mark_as_dense (void) { dense = true; }
161 
162  void mark_as_not_dense (void) { dense = false; }
163 
164  void mark_as_symmetric (void);
165 
166  void mark_as_unsymmetric (void);
167 
168  void mark_as_permuted (const octave_idx_type np, const octave_idx_type *p);
169 
170  void mark_as_unpermuted (void);
171 
172  MatrixType transpose (void) const;
173 
174 private:
175  void type (int new_typ) { typ = static_cast<matrix_type>(new_typ); }
176 
178  double sp_bandden;
179  double bandden;
182  bool dense;
183  bool full;
186 };
187 
188 #endif
void mark_as_lower_triangular(void)
Definition: MatrixType.h:149
void mark_as_diagonal(void)
Definition: MatrixType.h:143
bool is_banded(void)
Definition: MatrixType.h:119
bool is_unknown(void) const
Definition: MatrixType.h:135
bool is_lower_triangular(void) const
Definition: MatrixType.h:116
bool is_tridiagonal(void) const
Definition: MatrixType.h:122
int nupper(void) const
Definition: MatrixType.h:104
double sp_bandden
Definition: MatrixType.h:178
static void transpose(octave_idx_type N, const octave_idx_type *ridx, const octave_idx_type *cidx, octave_idx_type *ridx2, octave_idx_type *cidx2)
Definition: symrcm.cc:382
void mark_as_permuted_diagonal(void)
Definition: MatrixType.h:145
bool is_hermitian(void) const
Definition: MatrixType.h:125
bool is_dense(void) const
Definition: MatrixType.h:108
void mark_as_full(void)
Definition: MatrixType.h:156
bool is_known(void) const
Definition: MatrixType.h:133
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
bool dense
Definition: MatrixType.h:182
octave_idx_type * triangular_perm(void) const
Definition: MatrixType.h:139
octave_idx_type lower_band
Definition: MatrixType.h:181
calling an anonymous function involves an overhead quite comparable to the overhead of an m file function Passing a handle to a built in function is because the interpreter is not involved in the internal loop For a
Definition: cellfun.cc:398
void type(int new_typ)
Definition: MatrixType.h:175
octave_idx_type upper_band
Definition: MatrixType.h:180
octave_idx_type nperm
Definition: MatrixType.h:184
void mark_as_upper_triangular(void)
Definition: MatrixType.h:147
void mark_as_dense(void)
Definition: MatrixType.h:160
int nlower(void) const
Definition: MatrixType.h:106
idx type
Definition: ov.cc:3129
Definition: dMatrix.h:37
matrix_type typ
Definition: MatrixType.h:177
void mark_as_rectangular(void)
Definition: MatrixType.h:158
void invalidate_type(void)
Definition: MatrixType.h:141
octave_idx_type * perm
Definition: MatrixType.h:185
bool is_rectangular(void) const
Definition: MatrixType.h:131
p
Definition: lu.cc:138
void mark_as_not_dense(void)
Definition: MatrixType.h:162
void mark_as_tridiagonal(void)
Definition: MatrixType.h:151
bool is_diagonal(void) const
Definition: MatrixType.h:110
void mark_as_banded(const octave_idx_type ku, const octave_idx_type kl)
Definition: MatrixType.h:153
double band_density(void) const
Definition: MatrixType.h:102
bool is_upper_triangular(void) const
Definition: MatrixType.h:113
double bandden
Definition: MatrixType.h:179
SparseComplexMatrix & operator=(const SparseComplexMatrix &a)
Definition: CSparse.h:108