Lapack++
spdmd.h
Go to the documentation of this file.
00001 //      LAPACK++ (V. 1.1)
00002 //      (C) 1992-1996 All Rights Reserved.
00003 
00004 
00005 #ifndef _LA_SPD_MAT_DOUBLE_H_
00006 #define _LA_SPD_MAT_DOUBLE_H_
00007 
00008 #include LA_LOWER_TRIANG_MAT_DOUBLE_H
00009 
00010 
00011 class DLLIMPORT LaSpdMatDouble
00012 {
00013     LaLowerTriangMatDouble lower_data_;
00014     static int debug_;        // print out debug info.
00015     static int* info_;        // print out information on matrix.
00016 
00017 public:
00018 
00019     /*::::::::::::::::::::::::::*/
00020 
00021     /* Constructors/Destructors */
00022 
00023     /*::::::::::::::::::::::::::*/
00024 
00025 
00026     inline LaSpdMatDouble();
00027     inline LaSpdMatDouble(int, int);
00028     inline LaSpdMatDouble(double*, int, int);
00029     inline LaSpdMatDouble(const LaSpdMatDouble &);
00030     inline ~LaSpdMatDouble();
00031 
00032     // operators
00033 
00034     inline LaSpdMatDouble& ref(LaSpdMatDouble &);
00035     LaSpdMatDouble& copy(const LaSpdMatDouble &);
00036     LaSpdMatDouble& operator=(const double &);
00037     inline LaSpdMatDouble& operator=(LaSpdMatDouble &);
00038     inline double& operator()(int, int);
00039     inline const double& operator()(int, int) const;
00040 
00041     operator LaGenMatDouble();
00042     operator LaLowerTriangMatDouble();
00043 
00044     inline int size(int) const ;           // submatrix size
00045     inline int inc(int d) const ;          // explicit increment
00046     inline int gdim(int d) const ;         // global dimensions
00047     inline double* addr() const          // return address of data.
00048     {
00049         return lower_data_.addr();
00050     }
00051     inline int ref_count() const          // return ref_count of matrix.
00052     {
00053         return lower_data_.ref_count();
00054     }
00055     inline LaIndex index(int d) const       // return indices of matrix.
00056     {
00057         return lower_data_.index(d);
00058     }
00059     inline int shallow() const        // return indices of matrix.
00060     {
00061         return lower_data_.shallow();
00062     }
00063 
00064     inline int debug() const      // return debug flag.
00065     {
00066         return debug_;
00067     }
00068     inline int debug(int d)   // set debug flag.
00069     {
00070         return debug_ = d;
00071     }
00072 
00073     inline LaSpdMatDouble& resize(const LaSpdMatDouble&);
00074 
00075     inline const LaSpdMatDouble& info() const
00076     {
00077         int *t = info_;
00078         *t = 1;
00079         return *this;
00080     }
00081 
00082     //* I/O *//
00083 
00084     friend std::ostream& operator<<(std::ostream&, const LaSpdMatDouble&);
00085 
00086 };
00087 
00088 
00089 // constructor functions
00090 
00091 inline LaSpdMatDouble::LaSpdMatDouble() : lower_data_()
00092 {
00093 }
00094 
00095 inline LaSpdMatDouble::LaSpdMatDouble(int i, int j) : lower_data_(i, j)
00096 {
00097 }
00098 
00099 inline LaSpdMatDouble::LaSpdMatDouble(double *d, int i, int j): lower_data_(d, i, j)
00100 {
00101 }
00102 
00103 inline LaSpdMatDouble::LaSpdMatDouble(const LaSpdMatDouble &S)
00104 {
00105     lower_data_.copy(S.lower_data_);
00106 }
00107 
00108 // destructor function
00109 
00110 inline LaSpdMatDouble::~LaSpdMatDouble()
00111 {
00112     // automatically calls the destructor for LaLowerTriangMatDouble
00113 }
00114 
00115 // operator functions
00116 
00117 inline double& LaSpdMatDouble::operator()(int i, int j)
00118 {
00119 
00120     if (j > i)
00121         return (lower_data_(j, i));
00122     else
00123         return (lower_data_(i, j));
00124 
00125 }
00126 
00127 inline const double& LaSpdMatDouble::operator()(int i, int j) const
00128 {
00129 
00130     if (j > i)
00131         return (lower_data_(j, i));
00132     else
00133         return (lower_data_(i, j));
00134 
00135 }
00136 
00137 inline LaSpdMatDouble& LaSpdMatDouble::ref(LaSpdMatDouble &S)
00138 {
00139     lower_data_.ref(S.lower_data_);
00140 
00141     return *this;
00142 }
00143 
00144 inline LaSpdMatDouble& LaSpdMatDouble::resize(const LaSpdMatDouble &S)
00145 {
00146     lower_data_.resize(S.lower_data_);
00147 
00148     return *this;
00149 }
00150 
00151 inline LaSpdMatDouble& LaSpdMatDouble::operator=(LaSpdMatDouble &S)
00152 {
00153     return copy(S);
00154 }
00155 
00156 inline int LaSpdMatDouble::size(int d) const
00157 {
00158     return(lower_data_.size(d));
00159 }
00160 
00161 inline int LaSpdMatDouble::inc(int d) const
00162 {
00163     return(lower_data_.inc(d));
00164 }
00165 
00166 inline int LaSpdMatDouble::gdim(int d) const
00167 {
00168     return(lower_data_.gdim(d));
00169 }
00170 
00171 #endif
00172 // _LA_SPD_MAT_DOUBLE_H_