share/MatrixFlag.hxx

00001 // Copyright (C) 2001-2010 Vivien Mallet
00002 //
00003 // This file is part of the linear-algebra library Seldon,
00004 // http://seldon.sourceforge.net/.
00005 //
00006 // Seldon is free software; you can redistribute it and/or modify it under the
00007 // terms of the GNU Lesser General Public License as published by the Free
00008 // Software Foundation; either version 2.1 of the License, or (at your option)
00009 // any later version.
00010 //
00011 // Seldon is distributed in the hope that it will be useful, but WITHOUT ANY
00012 // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00013 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
00014 // more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public License
00017 // along with Seldon. If not, see http://www.gnu.org/licenses/.
00018 
00019 
00020 #ifndef SELDON_FILE_SHARE_MATRIXFLAG_HXX
00021 
00022 
00023 namespace Seldon
00024 {
00025 
00026 
00028   // SELDONTRANSPOSE //
00030 
00031 
00032   class SeldonTranspose
00033   {
00034 #ifdef SELDON_WITH_BLAS
00035   protected:
00036     CBLAS_TRANSPOSE cblas_status_;
00037 #endif
00038 
00039   protected:
00040     // 0: Trans, 1: NoTrans, 2: ConjTrans.
00041     int status_;
00042 
00043   public:
00044     SeldonTranspose(int status);
00045 #ifdef SELDON_WITH_BLAS
00046     SeldonTranspose(const enum CBLAS_TRANSPOSE status);
00047     operator CBLAS_TRANSPOSE() const;
00048 #endif
00049     char Char() const;
00050     char RevChar() const;
00051     bool Trans() const;
00052     bool NoTrans() const;
00053     bool ConjTrans() const;
00054   };
00055 
00056 
00057   class class_SeldonTrans: public SeldonTranspose
00058   {
00059   public:
00060     class_SeldonTrans();
00061   };
00062 
00063 
00064   class class_SeldonNoTrans: public SeldonTranspose
00065   {
00066   public:
00067     class_SeldonNoTrans();
00068   };
00069 
00070 
00071   class class_SeldonConjTrans: public SeldonTranspose
00072   {
00073   public:
00074     class_SeldonConjTrans();
00075   };
00076 
00077 
00078   extern class_SeldonTrans SeldonTrans;
00079   extern class_SeldonNoTrans SeldonNoTrans;
00080   extern class_SeldonConjTrans SeldonConjTrans;
00081 
00082 
00084   // SELDONDIAG //
00086 
00087 
00088   class SeldonDiag
00089   {
00090 #ifdef SELDON_WITH_BLAS
00091   protected:
00092     CBLAS_DIAG cblas_status_;
00093 #endif
00094 
00095   protected:
00096     // 0: NonUnit, 1: Unit.
00097     int status_;
00098 
00099   public:
00100     SeldonDiag(int status);
00101 #ifdef SELDON_WITH_BLAS
00102     operator CBLAS_DIAG() const;
00103 #endif
00104     char Char() const;
00105     bool NonUnit() const;
00106     bool Unit() const;
00107   };
00108 
00109 
00110   class class_SeldonNonUnit: public SeldonDiag
00111   {
00112   public:
00113     class_SeldonNonUnit();
00114   };
00115 
00116 
00117   class class_SeldonUnit: public SeldonDiag
00118   {
00119   public:
00120     class_SeldonUnit();
00121   };
00122 
00123 
00124   extern class_SeldonNonUnit SeldonNonUnit;
00125   extern class_SeldonUnit SeldonUnit;
00126 
00127 
00129   // SELDONUPLO //
00131 
00132 
00133   class SeldonUplo
00134   {
00135 #ifdef SELDON_WITH_BLAS
00136   protected:
00137     CBLAS_UPLO cblas_status_;
00138 #endif
00139 
00140   protected:
00141     // 0: Upper, 1: Lower.
00142     int status_;
00143 
00144   public:
00145     SeldonUplo(int status);
00146 #ifdef SELDON_WITH_BLAS
00147     operator CBLAS_UPLO() const;
00148 #endif
00149     operator char() const;
00150     bool Upper() const;
00151     bool Lower() const;
00152     char Char() const;
00153     char RevChar() const;
00154   };
00155 
00156 
00157   extern SeldonUplo SeldonUpper;
00158   extern SeldonUplo SeldonLower;
00159 
00160 
00162   // SELDONNORM //
00164 
00165 
00166   class SeldonNorm
00167   {
00168   protected:
00169     // 0: Infinity-norm, 1: 1-norm.
00170     int status_;
00171 
00172   public:
00173     SeldonNorm(int status);
00174     operator char() const;
00175     char Char() const;
00176     char RevChar() const;
00177   };
00178 
00179 
00180   extern SeldonNorm SeldonNormInf;
00181   extern SeldonNorm SeldonNorm1;
00182 
00183 
00185   // SELDONCONJUGATE //
00187 
00188 
00189   class SeldonConjugate
00190   {
00191   protected:
00192     // false: Unconj, true: Conj.
00193     bool status_;
00194 
00195   public:
00196     SeldonConjugate(bool status);
00197     inline bool Conj() const;
00198   };
00199 
00200 
00201   extern SeldonConjugate SeldonUnconj;
00202   extern SeldonConjugate SeldonConj;
00203 
00204 
00206   // SELDONSIDE //
00208 
00209 
00210   class SeldonSide
00211   {
00212 #ifdef SELDON_WITH_BLAS
00213   protected:
00214     CBLAS_SIDE cblas_status_;
00215 #endif
00216 
00217   protected:
00218     // 0: Left, 1: Right.
00219     int status_;
00220 
00221   public:
00222     SeldonSide(int status);
00223 #ifdef SELDON_WITH_BLAS
00224     SeldonSide(const enum CBLAS_SIDE status);
00225     operator CBLAS_SIDE() const;
00226 #endif
00227     bool Left() const;
00228     bool Right() const;
00229   };
00230 
00231 
00232   class class_SeldonLeft: public SeldonSide
00233   {
00234   public:
00235     class_SeldonLeft();
00236   };
00237 
00238 
00239   class class_SeldonRight: public SeldonSide
00240   {
00241   public:
00242     class_SeldonRight();
00243   };
00244 
00245 
00246   extern class_SeldonLeft SeldonLeft;
00247   extern class_SeldonRight SeldonRight;
00248 
00249 
00250 }
00251 
00252 
00253 #define SELDON_FILE_SHARE_MATRIXFLAG_HXX
00254 #endif