fDiagMatrix.h

Go to the documentation of this file.
00001 /*
00002 
00003 Copyright (C) 1994-2012 John W. Eaton
00004 
00005 This file is part of Octave.
00006 
00007 Octave is free software; you can redistribute it and/or modify it
00008 under the terms of the GNU General Public License as published by the
00009 Free Software Foundation; either version 3 of the License, or (at your
00010 option) any later version.
00011 
00012 Octave is distributed in the hope that it will be useful, but WITHOUT
00013 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00014 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00015 for more details.
00016 
00017 You should have received a copy of the GNU General Public License
00018 along with Octave; see the file COPYING.  If not, see
00019 <http://www.gnu.org/licenses/>.
00020 
00021 */
00022 
00023 #if !defined (octave_FloatDiagMatrix_h)
00024 #define octave_FloatDiagMatrix_h 1
00025 
00026 #include "MDiagArray2.h"
00027 
00028 #include "fRowVector.h"
00029 #include "fColVector.h"
00030 #include "DET.h"
00031 
00032 #include "mx-defs.h"
00033 
00034 class
00035 OCTAVE_API
00036 FloatDiagMatrix : public MDiagArray2<float>
00037 {
00038 friend class FloatSVD;
00039 friend class FloatComplexSVD;
00040 
00041 public:
00042 
00043   FloatDiagMatrix (void) : MDiagArray2<float> () { }
00044 
00045   FloatDiagMatrix (octave_idx_type r, octave_idx_type c) : MDiagArray2<float> (r, c) { }
00046 
00047   FloatDiagMatrix (octave_idx_type r, octave_idx_type c, float val) : MDiagArray2<float> (r, c, val) { }
00048 
00049   FloatDiagMatrix (const FloatDiagMatrix& a) : MDiagArray2<float> (a) { }
00050 
00051   FloatDiagMatrix (const MDiagArray2<float>& a) : MDiagArray2<float> (a) { }
00052 
00053   template <class U>
00054   FloatDiagMatrix (const DiagArray2<U>& a) : MDiagArray2<float> (a) { }
00055 
00056   explicit FloatDiagMatrix (const Array<double>& a) : MDiagArray2<float> (a) { }
00057 
00058   FloatDiagMatrix (const Array<float>& a, octave_idx_type r, octave_idx_type c)
00059     : MDiagArray2<float> (a, r, c) { }
00060 
00061   FloatDiagMatrix& operator = (const FloatDiagMatrix& a)
00062     {
00063       MDiagArray2<float>::operator = (a);
00064       return *this;
00065     }
00066 
00067   bool operator == (const FloatDiagMatrix& a) const;
00068   bool operator != (const FloatDiagMatrix& a) const;
00069 
00070   FloatDiagMatrix& fill (float val);
00071   FloatDiagMatrix& fill (float val, octave_idx_type beg, octave_idx_type end);
00072   FloatDiagMatrix& fill (const FloatColumnVector& a);
00073   FloatDiagMatrix& fill (const FloatRowVector& a);
00074   FloatDiagMatrix& fill (const FloatColumnVector& a, octave_idx_type beg);
00075   FloatDiagMatrix& fill (const FloatRowVector& a, octave_idx_type beg);
00076 
00077   FloatDiagMatrix transpose (void) const { return MDiagArray2<float>::transpose(); }
00078   FloatDiagMatrix abs (void) const;
00079 
00080   friend OCTAVE_API FloatDiagMatrix real (const FloatComplexDiagMatrix& a);
00081   friend OCTAVE_API FloatDiagMatrix imag (const FloatComplexDiagMatrix& a);
00082 
00083   // resize is the destructive analog for this one
00084 
00085   FloatMatrix extract (octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) const;
00086 
00087   // extract row or column i.
00088 
00089   FloatRowVector row (octave_idx_type i) const;
00090   FloatRowVector row (char *s) const;
00091 
00092   FloatColumnVector column (octave_idx_type i) const;
00093   FloatColumnVector column (char *s) const;
00094 
00095   FloatDiagMatrix inverse (void) const;
00096   FloatDiagMatrix inverse (octave_idx_type& info) const;
00097   FloatDiagMatrix pseudo_inverse (void) const;
00098 
00099   // other operations
00100 
00101   FloatColumnVector diag (octave_idx_type k = 0) const
00102     { return MDiagArray2<float>::diag (k); }
00103 
00104   FloatDET determinant (void) const;
00105   float rcond (void) const;
00106 
00107   // i/o
00108 
00109   friend OCTAVE_API std::ostream& operator << (std::ostream& os, const FloatDiagMatrix& a);
00110 
00111 };
00112 
00113 OCTAVE_API FloatDiagMatrix real (const FloatComplexDiagMatrix& a);
00114 OCTAVE_API FloatDiagMatrix imag (const FloatComplexDiagMatrix& a);
00115 
00116 // diagonal matrix by diagonal matrix -> diagonal matrix operations
00117 
00118 OCTAVE_API FloatDiagMatrix
00119 operator * (const FloatDiagMatrix& a, const FloatDiagMatrix& b);
00120 
00121 MDIAGARRAY2_FORWARD_DEFS (MDiagArray2, FloatDiagMatrix, float)
00122 
00123 #endif
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines