00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #if !defined (octave_FloatComplexMatrix_h)
00025 #define octave_FloatComplexMatrix_h 1
00026
00027 #include "MArray2.h"
00028 #include "MDiagArray2.h"
00029 #include "MatrixType.h"
00030
00031 #include "mx-defs.h"
00032 #include "mx-op-decl.h"
00033 #include "oct-cmplx.h"
00034 #include "DET.h"
00035
00036 class
00037 OCTAVE_API
00038 FloatComplexMatrix : public MArray2<FloatComplex>
00039 {
00040 public:
00041
00042 typedef FloatComplexColumnVector column_vector_type;
00043 typedef FloatComplexRowVector row_vector_type;
00044
00045 typedef void (*solve_singularity_handler) (float rcon);
00046
00047 FloatComplexMatrix (void) : MArray2<FloatComplex> () { }
00048
00049 FloatComplexMatrix (octave_idx_type r, octave_idx_type c) : MArray2<FloatComplex> (r, c) { }
00050
00051 FloatComplexMatrix (octave_idx_type r, octave_idx_type c, const FloatComplex& val)
00052 : MArray2<FloatComplex> (r, c, val) { }
00053
00054 FloatComplexMatrix (const dim_vector& dv) : MArray2<FloatComplex> (dv) { }
00055
00056 FloatComplexMatrix (const dim_vector& dv, const FloatComplex& val)
00057 : MArray2<FloatComplex> (dv, val) { }
00058
00059 FloatComplexMatrix (const FloatComplexMatrix& a) : MArray2<FloatComplex> (a) { }
00060
00061 template <class U>
00062 FloatComplexMatrix (const MArray2<U>& a) : MArray2<FloatComplex> (a) { }
00063
00064 template <class U>
00065 FloatComplexMatrix (const Array2<U>& a) : MArray2<FloatComplex> (a) { }
00066
00067 explicit FloatComplexMatrix (const FloatMatrix& a);
00068
00069 explicit FloatComplexMatrix (const FloatRowVector& rv);
00070
00071 explicit FloatComplexMatrix (const FloatColumnVector& cv);
00072
00073 explicit FloatComplexMatrix (const FloatDiagMatrix& a);
00074
00075 explicit FloatComplexMatrix (const FloatComplexRowVector& rv);
00076
00077 explicit FloatComplexMatrix (const FloatComplexColumnVector& cv);
00078
00079 explicit FloatComplexMatrix (const FloatComplexDiagMatrix& a);
00080
00081 explicit FloatComplexMatrix (const boolMatrix& a);
00082
00083 explicit FloatComplexMatrix (const charMatrix& a);
00084
00085 FloatComplexMatrix (const FloatMatrix& re, const FloatMatrix& im);
00086
00087 FloatComplexMatrix& operator = (const FloatComplexMatrix& a)
00088 {
00089 MArray2<FloatComplex>::operator = (a);
00090 return *this;
00091 }
00092
00093 bool operator == (const FloatComplexMatrix& a) const;
00094 bool operator != (const FloatComplexMatrix& a) const;
00095
00096 bool is_hermitian (void) const;
00097
00098
00099
00100 FloatComplexMatrix& insert (const FloatMatrix& a, octave_idx_type r, octave_idx_type c);
00101 FloatComplexMatrix& insert (const FloatRowVector& a, octave_idx_type r, octave_idx_type c);
00102 FloatComplexMatrix& insert (const FloatColumnVector& a, octave_idx_type r, octave_idx_type c);
00103 FloatComplexMatrix& insert (const FloatDiagMatrix& a, octave_idx_type r, octave_idx_type c);
00104
00105 FloatComplexMatrix& insert (const FloatComplexMatrix& a, octave_idx_type r, octave_idx_type c);
00106 FloatComplexMatrix& insert (const FloatComplexRowVector& a, octave_idx_type r, octave_idx_type c);
00107 FloatComplexMatrix& insert (const FloatComplexColumnVector& a, octave_idx_type r, octave_idx_type c);
00108 FloatComplexMatrix& insert (const FloatComplexDiagMatrix& a, octave_idx_type r, octave_idx_type c);
00109
00110 FloatComplexMatrix& fill (float val);
00111 FloatComplexMatrix& fill (const FloatComplex& val);
00112 FloatComplexMatrix& fill (float val, octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2);
00113 FloatComplexMatrix& fill (const FloatComplex& val, octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2);
00114
00115 FloatComplexMatrix append (const FloatMatrix& a) const;
00116 FloatComplexMatrix append (const FloatRowVector& a) const;
00117 FloatComplexMatrix append (const FloatColumnVector& a) const;
00118 FloatComplexMatrix append (const FloatDiagMatrix& a) const;
00119
00120 FloatComplexMatrix append (const FloatComplexMatrix& a) const;
00121 FloatComplexMatrix append (const FloatComplexRowVector& a) const;
00122 FloatComplexMatrix append (const FloatComplexColumnVector& a) const;
00123 FloatComplexMatrix append (const FloatComplexDiagMatrix& a) const;
00124
00125 FloatComplexMatrix stack (const FloatMatrix& a) const;
00126 FloatComplexMatrix stack (const FloatRowVector& a) const;
00127 FloatComplexMatrix stack (const FloatColumnVector& a) const;
00128 FloatComplexMatrix stack (const FloatDiagMatrix& a) const;
00129
00130 FloatComplexMatrix stack (const FloatComplexMatrix& a) const;
00131 FloatComplexMatrix stack (const FloatComplexRowVector& a) const;
00132 FloatComplexMatrix stack (const FloatComplexColumnVector& a) const;
00133 FloatComplexMatrix stack (const FloatComplexDiagMatrix& a) const;
00134
00135 FloatComplexMatrix hermitian (void) const
00136 { return MArray2<FloatComplex>::hermitian (std::conj); }
00137 FloatComplexMatrix transpose (void) const
00138 { return MArray2<FloatComplex>::transpose (); }
00139
00140 friend OCTAVE_API FloatComplexMatrix conj (const FloatComplexMatrix& a);
00141
00142
00143
00144 FloatComplexMatrix extract (octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) const;
00145
00146 FloatComplexMatrix extract_n (octave_idx_type r1, octave_idx_type c1, octave_idx_type nr, octave_idx_type nc) const;
00147
00148
00149
00150 FloatComplexRowVector row (octave_idx_type i) const;
00151
00152 FloatComplexColumnVector column (octave_idx_type i) const;
00153
00154 private:
00155 FloatComplexMatrix tinverse (MatrixType &mattype, octave_idx_type& info,
00156 float& rcon, int force, int calc_cond) const;
00157
00158 FloatComplexMatrix finverse (MatrixType &mattype, octave_idx_type& info,
00159 float& rcon, int force, int calc_cond) const;
00160
00161 public:
00162 FloatComplexMatrix inverse (void) const;
00163 FloatComplexMatrix inverse (octave_idx_type& info) const;
00164 FloatComplexMatrix inverse (octave_idx_type& info, float& rcon, int force = 0,
00165 int calc_cond = 1) const;
00166
00167 FloatComplexMatrix inverse (MatrixType &mattype) const;
00168 FloatComplexMatrix inverse (MatrixType &mattype, octave_idx_type& info) const;
00169 FloatComplexMatrix inverse (MatrixType &mattype, octave_idx_type& info,
00170 float& rcon, int force = 0,
00171 int calc_cond = 1) const;
00172
00173 FloatComplexMatrix pseudo_inverse (float tol = 0.0) const;
00174
00175 FloatComplexMatrix fourier (void) const;
00176 FloatComplexMatrix ifourier (void) const;
00177
00178 FloatComplexMatrix fourier2d (void) const;
00179 FloatComplexMatrix ifourier2d (void) const;
00180
00181 FloatComplexDET determinant (void) const;
00182 FloatComplexDET determinant (octave_idx_type& info) const;
00183 FloatComplexDET determinant (octave_idx_type& info, float& rcon, int calc_cond = 1) const;
00184 FloatComplexDET determinant (MatrixType &mattype, octave_idx_type& info,
00185 float& rcon, int calc_cond = 1) const;
00186
00187 float rcond (void) const;
00188 float rcond (MatrixType &mattype) const;
00189
00190 private:
00191
00192 FloatComplexMatrix utsolve (MatrixType &typ, const FloatComplexMatrix& b,
00193 octave_idx_type& info, float& rcon,
00194 solve_singularity_handler sing_handler,
00195 bool calc_cond = false, blas_trans_type transt = blas_no_trans) const;
00196
00197
00198 FloatComplexMatrix ltsolve (MatrixType &typ, const FloatComplexMatrix& b,
00199 octave_idx_type& info, float& rcon,
00200 solve_singularity_handler sing_handler,
00201 bool calc_cond = false, blas_trans_type transt = blas_no_trans) const;
00202
00203
00204 FloatComplexMatrix fsolve (MatrixType &typ, const FloatComplexMatrix& b,
00205 octave_idx_type& info, float& rcon,
00206 solve_singularity_handler sing_handler,
00207 bool calc_cond = false) const;
00208
00209 public:
00210
00211 FloatComplexMatrix solve (MatrixType &typ, const FloatMatrix& b) const;
00212 FloatComplexMatrix solve (MatrixType &typ, const FloatMatrix& b,
00213 octave_idx_type& info) const;
00214 FloatComplexMatrix solve (MatrixType &typ, const FloatMatrix& b,
00215 octave_idx_type& info, float& rcon) const;
00216 FloatComplexMatrix solve (MatrixType &typ, const FloatMatrix& b, octave_idx_type& info,
00217 float& rcon, solve_singularity_handler sing_handler,
00218 bool singular_fallback = true,
00219 blas_trans_type transt = blas_no_trans) const;
00220
00221 FloatComplexMatrix solve (MatrixType &typ, const FloatComplexMatrix& b) const;
00222 FloatComplexMatrix solve (MatrixType &typ, const FloatComplexMatrix& b,
00223 octave_idx_type& info) const;
00224 FloatComplexMatrix solve (MatrixType &typ, const FloatComplexMatrix& b,
00225 octave_idx_type& info, float& rcon) const;
00226 FloatComplexMatrix solve (MatrixType &typ, const FloatComplexMatrix& b,
00227 octave_idx_type& info, float& rcon,
00228 solve_singularity_handler sing_handler,
00229 bool singular_fallback = true,
00230 blas_trans_type transt = blas_no_trans) const;
00231
00232 FloatComplexColumnVector solve (MatrixType &typ, const FloatColumnVector& b) const;
00233 FloatComplexColumnVector solve (MatrixType &typ, const FloatColumnVector& b,
00234 octave_idx_type& info) const;
00235 FloatComplexColumnVector solve (MatrixType &typ, const FloatColumnVector& b,
00236 octave_idx_type& info, float& rcon) const;
00237 FloatComplexColumnVector solve (MatrixType &typ, const FloatColumnVector& b,
00238 octave_idx_type& info, float& rcon,
00239 solve_singularity_handler sing_handler,
00240 blas_trans_type transt = blas_no_trans) const;
00241
00242 FloatComplexColumnVector solve (MatrixType &typ,
00243 const FloatComplexColumnVector& b) const;
00244 FloatComplexColumnVector solve (MatrixType &typ, const FloatComplexColumnVector& b,
00245 octave_idx_type& info) const;
00246 FloatComplexColumnVector solve (MatrixType &typ, const FloatComplexColumnVector& b,
00247 octave_idx_type& info, float& rcon) const;
00248 FloatComplexColumnVector solve (MatrixType &typ, const FloatComplexColumnVector& b,
00249 octave_idx_type& info, float& rcon,
00250 solve_singularity_handler sing_handler,
00251 blas_trans_type transt = blas_no_trans) const;
00252
00253
00254 FloatComplexMatrix solve (const FloatMatrix& b) const;
00255 FloatComplexMatrix solve (const FloatMatrix& b, octave_idx_type& info) const;
00256 FloatComplexMatrix solve (const FloatMatrix& b, octave_idx_type& info, float& rcon) const;
00257 FloatComplexMatrix solve (const FloatMatrix& b, octave_idx_type& info, float& rcon,
00258 solve_singularity_handler sing_handler,
00259 blas_trans_type transt = blas_no_trans) const;
00260
00261 FloatComplexMatrix solve (const FloatComplexMatrix& b) const;
00262 FloatComplexMatrix solve (const FloatComplexMatrix& b, octave_idx_type& info) const;
00263 FloatComplexMatrix solve (const FloatComplexMatrix& b, octave_idx_type& info, float& rcon) const;
00264 FloatComplexMatrix solve (const FloatComplexMatrix& b, octave_idx_type& info, float& rcon,
00265 solve_singularity_handler sing_handler,
00266 blas_trans_type transt = blas_no_trans) const;
00267
00268 FloatComplexColumnVector solve (const FloatColumnVector& b) const;
00269 FloatComplexColumnVector solve (const FloatColumnVector& b, octave_idx_type& info) const;
00270 FloatComplexColumnVector solve (const FloatColumnVector& b, octave_idx_type& info,
00271 float& rcon) const;
00272 FloatComplexColumnVector solve (const FloatColumnVector& b, octave_idx_type& info, float& rcon,
00273 solve_singularity_handler sing_handler,
00274 blas_trans_type transt = blas_no_trans) const;
00275
00276 FloatComplexColumnVector solve (const FloatComplexColumnVector& b) const;
00277 FloatComplexColumnVector solve (const FloatComplexColumnVector& b, octave_idx_type& info) const;
00278 FloatComplexColumnVector solve (const FloatComplexColumnVector& b, octave_idx_type& info,
00279 float& rcon) const;
00280 FloatComplexColumnVector solve (const FloatComplexColumnVector& b, octave_idx_type& info,
00281 float& rcon,
00282 solve_singularity_handler sing_handler,
00283 blas_trans_type transt = blas_no_trans) const;
00284
00285 FloatComplexMatrix lssolve (const FloatMatrix& b) const;
00286 FloatComplexMatrix lssolve (const FloatMatrix& b, octave_idx_type& info) const;
00287 FloatComplexMatrix lssolve (const FloatMatrix& b, octave_idx_type& info,
00288 octave_idx_type& rank) const;
00289 FloatComplexMatrix lssolve (const FloatMatrix& b, octave_idx_type& info,
00290 octave_idx_type& rank, float& rcon) const;
00291
00292 FloatComplexMatrix lssolve (const FloatComplexMatrix& b) const;
00293 FloatComplexMatrix lssolve (const FloatComplexMatrix& b, octave_idx_type& info) const;
00294 FloatComplexMatrix lssolve (const FloatComplexMatrix& b, octave_idx_type& info,
00295 octave_idx_type& rank) const;
00296 FloatComplexMatrix lssolve (const FloatComplexMatrix& b, octave_idx_type& info,
00297 octave_idx_type& rank, float& rcon) const;
00298
00299 FloatComplexColumnVector lssolve (const FloatColumnVector& b) const;
00300 FloatComplexColumnVector lssolve (const FloatColumnVector& b,
00301 octave_idx_type& info) const;
00302 FloatComplexColumnVector lssolve (const FloatColumnVector& b, octave_idx_type& info,
00303 octave_idx_type& rank) const;
00304 FloatComplexColumnVector lssolve (const FloatColumnVector& b, octave_idx_type& info,
00305 octave_idx_type& rank, float& rcon) const;
00306
00307 FloatComplexColumnVector lssolve (const FloatComplexColumnVector& b) const;
00308 FloatComplexColumnVector lssolve (const FloatComplexColumnVector& b,
00309 octave_idx_type& info) const;
00310 FloatComplexColumnVector lssolve (const FloatComplexColumnVector& b,
00311 octave_idx_type& info,
00312 octave_idx_type& rank) const;
00313 FloatComplexColumnVector lssolve (const FloatComplexColumnVector& b,
00314 octave_idx_type& info,
00315 octave_idx_type& rank, float& rcon) const;
00316
00317
00318
00319 FloatComplexMatrix& operator += (const FloatDiagMatrix& a);
00320 FloatComplexMatrix& operator -= (const FloatDiagMatrix& a);
00321
00322 FloatComplexMatrix& operator += (const FloatComplexDiagMatrix& a);
00323 FloatComplexMatrix& operator -= (const FloatComplexDiagMatrix& a);
00324
00325
00326
00327 FloatComplexMatrix& operator += (const FloatMatrix& a);
00328 FloatComplexMatrix& operator -= (const FloatMatrix& a);
00329
00330
00331
00332 boolMatrix operator ! (void) const;
00333
00334
00335
00336 typedef float (*dmapper) (const FloatComplex&);
00337 typedef FloatComplex (*cmapper) (const FloatComplex&);
00338 typedef bool (*bmapper) (const FloatComplex&);
00339
00340 FloatMatrix map (dmapper fcn) const;
00341 FloatComplexMatrix map (cmapper fcn) const;
00342 boolMatrix map (bmapper fcn) const;
00343
00344 bool any_element_is_nan (void) const;
00345 bool any_element_is_inf_or_nan (void) const;
00346 bool all_elements_are_real (void) const;
00347 bool all_integers (float& max_val, float& min_val) const;
00348 bool too_large_for_float (void) const;
00349
00350 boolMatrix all (int dim = -1) const;
00351 boolMatrix any (int dim = -1) const;
00352
00353 FloatComplexMatrix cumprod (int dim = -1) const;
00354 FloatComplexMatrix cumsum (int dim = -1) const;
00355 FloatComplexMatrix prod (int dim = -1) const;
00356 FloatComplexMatrix sum (int dim = -1) const;
00357 FloatComplexMatrix sumsq (int dim = -1) const;
00358 FloatMatrix abs (void) const;
00359
00360 FloatComplexMatrix diag (octave_idx_type k = 0) const;
00361
00362 bool row_is_real_only (octave_idx_type) const;
00363 bool column_is_real_only (octave_idx_type) const;
00364
00365 FloatComplexColumnVector row_min (void) const;
00366 FloatComplexColumnVector row_max (void) const;
00367
00368 FloatComplexColumnVector row_min (Array<octave_idx_type>& index) const;
00369 FloatComplexColumnVector row_max (Array<octave_idx_type>& index) const;
00370
00371 FloatComplexRowVector column_min (void) const;
00372 FloatComplexRowVector column_max (void) const;
00373
00374 FloatComplexRowVector column_min (Array<octave_idx_type>& index) const;
00375 FloatComplexRowVector column_max (Array<octave_idx_type>& index) const;
00376
00377
00378
00379 friend OCTAVE_API std::ostream& operator << (std::ostream& os, const FloatComplexMatrix& a);
00380 friend OCTAVE_API std::istream& operator >> (std::istream& is, FloatComplexMatrix& a);
00381
00382 static FloatComplex resize_fill_value (void) { return FloatComplex (0.0, 0.0); }
00383
00384 private:
00385
00386 FloatComplexMatrix (FloatComplex *d, octave_idx_type r, octave_idx_type c) : MArray2<FloatComplex> (d, r, c) { }
00387 };
00388
00389 extern OCTAVE_API FloatComplexMatrix conj (const FloatComplexMatrix& a);
00390
00391
00392
00393 extern OCTAVE_API FloatComplexMatrix
00394 operator * (const FloatColumnVector& a, const FloatComplexRowVector& b);
00395
00396 extern OCTAVE_API FloatComplexMatrix
00397 operator * (const FloatComplexColumnVector& a, const FloatRowVector& b);
00398
00399 extern OCTAVE_API FloatComplexMatrix
00400 operator * (const FloatComplexColumnVector& a, const FloatComplexRowVector& b);
00401
00402 extern OCTAVE_API FloatComplexMatrix
00403 Givens (const FloatComplex&, const FloatComplex&);
00404
00405 extern OCTAVE_API FloatComplexMatrix
00406 Sylvester (const FloatComplexMatrix&, const FloatComplexMatrix&, const FloatComplexMatrix&);
00407
00408 extern OCTAVE_API FloatComplexMatrix
00409 xgemm (const FloatComplexMatrix& a, const FloatComplexMatrix& b,
00410 blas_trans_type transa = blas_no_trans,
00411 blas_trans_type transb = blas_no_trans);
00412
00413 extern OCTAVE_API FloatComplexMatrix operator * (const FloatMatrix&, const FloatComplexMatrix&);
00414 extern OCTAVE_API FloatComplexMatrix operator * (const FloatComplexMatrix&, const FloatMatrix&);
00415 extern OCTAVE_API FloatComplexMatrix operator * (const FloatComplexMatrix&, const FloatComplexMatrix&);
00416
00417 extern OCTAVE_API FloatComplexMatrix min (const FloatComplex& c, const FloatComplexMatrix& m);
00418 extern OCTAVE_API FloatComplexMatrix min (const FloatComplexMatrix& m, const FloatComplex& c);
00419 extern OCTAVE_API FloatComplexMatrix min (const FloatComplexMatrix& a, const FloatComplexMatrix& b);
00420
00421 extern OCTAVE_API FloatComplexMatrix max (const FloatComplex& c, const FloatComplexMatrix& m);
00422 extern OCTAVE_API FloatComplexMatrix max (const FloatComplexMatrix& m, const FloatComplex& c);
00423 extern OCTAVE_API FloatComplexMatrix max (const FloatComplexMatrix& a, const FloatComplexMatrix& b);
00424
00425 extern OCTAVE_API FloatComplexMatrix linspace (const FloatComplexColumnVector& x1,
00426 const FloatComplexColumnVector& x2,
00427 octave_idx_type n);
00428
00429 MS_CMP_OP_DECLS (FloatComplexMatrix, FloatComplex, OCTAVE_API)
00430 MS_BOOL_OP_DECLS (FloatComplexMatrix, FloatComplex, OCTAVE_API)
00431
00432 SM_CMP_OP_DECLS (FloatComplex, FloatComplexMatrix, OCTAVE_API)
00433 SM_BOOL_OP_DECLS (FloatComplex, FloatComplexMatrix, OCTAVE_API)
00434
00435 MM_CMP_OP_DECLS (FloatComplexMatrix, FloatComplexMatrix, OCTAVE_API)
00436 MM_BOOL_OP_DECLS (FloatComplexMatrix, FloatComplexMatrix, OCTAVE_API)
00437
00438 MARRAY_FORWARD_DEFS (MArray2, FloatComplexMatrix, FloatComplex)
00439
00440 #endif
00441
00442
00443
00444
00445
00446