Warning: this documentation for the development version is under construction.

/home/vivien/public_html/.src_seldon/share/MatrixFlag.cxx

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_CXX
00021 
00022 
00023 #include "MatrixFlag.hxx"
00024 
00025 
00026 namespace Seldon
00027 {
00028 
00029 
00031   // SELDONTRANSPOSE //
00033 
00034 
00035   SeldonTranspose::SeldonTranspose(int status)
00036   {
00037     status_ = status;
00038 #ifdef SELDON_WITH_BLAS
00039     if (status_ == 0)
00040       cblas_status_ = CblasTrans;
00041     else if (status_ == 1)
00042       cblas_status_ = CblasNoTrans;
00043     else
00044       cblas_status_ = CblasConjTrans;
00045 #endif
00046   }
00047 
00048 
00049 #ifdef SELDON_WITH_BLAS
00050   SeldonTranspose::SeldonTranspose(const enum CBLAS_TRANSPOSE status):
00051     cblas_status_(status)
00052   {
00053     if (cblas_status_ == CblasTrans)
00054       status_ = 0;
00055     else if (cblas_status_ == CblasNoTrans)
00056       status_ = 1;
00057     else
00058       status_ = 2;
00059   }
00060 #endif
00061 
00062 
00063 #ifdef SELDON_WITH_BLAS
00064   SeldonTranspose::operator CBLAS_TRANSPOSE() const
00065   {
00066     return cblas_status_;
00067   }
00068 #endif
00069 
00070 
00071   char SeldonTranspose::Char() const
00072   {
00073     if (status_ == 0)
00074       return 'T';
00075     else if (status_ == 1)
00076       return 'N';
00077     else
00078       return 'C';
00079   }
00080 
00081 
00082   char SeldonTranspose::RevChar() const
00083   {
00084     if (status_ == 0)
00085       return 'N';
00086     else if (status_ == 1)
00087       return 'T';
00088     else
00089       return 'N';
00090   }
00091 
00092 
00093   bool SeldonTranspose::Trans() const
00094   {
00095     return (status_ == 0);
00096   }
00097 
00098 
00099   bool SeldonTranspose::NoTrans() const
00100   {
00101     return (status_ == 1);
00102   }
00103 
00104 
00105   bool SeldonTranspose::ConjTrans() const
00106   {
00107     return (status_ == 2);
00108   }
00109 
00110 
00111   class_SeldonTrans::class_SeldonTrans(): SeldonTranspose(0)
00112   {
00113   }
00114 
00115 
00116   class_SeldonNoTrans::class_SeldonNoTrans(): SeldonTranspose(1)
00117   {
00118   }
00119 
00120 
00121   class_SeldonConjTrans::class_SeldonConjTrans(): SeldonTranspose(2)
00122   {
00123   }
00124 
00125 
00126 #ifndef SELDON_WITH_COMPILED_LIBRARY
00127   class_SeldonTrans SeldonTrans;
00128   class_SeldonNoTrans SeldonNoTrans;
00129   class_SeldonConjTrans SeldonConjTrans;
00130 #endif
00131 
00132 
00134   // SELDONDIAG //
00136 
00137 
00138   SeldonDiag::SeldonDiag(int status)
00139   {
00140     status_ = status;
00141 #ifdef SELDON_WITH_BLAS
00142     if (status_ == 0)
00143       cblas_status_ = CblasNonUnit;
00144     else
00145       cblas_status_ = CblasUnit;
00146 #endif
00147   }
00148 
00149 
00150 #ifdef SELDON_WITH_BLAS
00151   SeldonDiag::operator CBLAS_DIAG() const
00152   {
00153     return cblas_status_;
00154   }
00155 #endif
00156 
00157 
00158   char SeldonDiag::Char() const
00159   {
00160     return (status_ == 0) ? 'N' : 'U';
00161   }
00162 
00163 
00164   bool SeldonDiag::NonUnit() const
00165   {
00166     return (status_ == 0);
00167   }
00168 
00169 
00170   bool SeldonDiag::Unit() const
00171   {
00172     return (status_ == 1);
00173   }
00174 
00175 
00176   class_SeldonNonUnit::class_SeldonNonUnit(): SeldonDiag(0)
00177   {
00178   }
00179 
00180 
00181   class_SeldonUnit::class_SeldonUnit(): SeldonDiag(1)
00182   {
00183   }
00184 
00185 
00186 #ifndef SELDON_WITH_COMPILED_LIBRARY
00187   class_SeldonNonUnit SeldonNonUnit;
00188   class_SeldonUnit SeldonUnit;
00189 #endif
00190 
00191 
00193   // SELDONUPLO //
00195 
00196 
00197   SeldonUplo::SeldonUplo(int status)
00198   {
00199     status_ = status;
00200 #ifdef SELDON_WITH_BLAS
00201     if (status_ == 0)
00202       cblas_status_ = CblasUpper;
00203     else
00204       cblas_status_ = CblasLower;
00205 #endif
00206   }
00207 
00208 
00209 #ifdef SELDON_WITH_BLAS
00210   SeldonUplo::operator CBLAS_UPLO() const
00211   {
00212     return cblas_status_;
00213   }
00214 #endif
00215 
00216 
00217   SeldonUplo::operator char() const
00218   {
00219     return (status_ == 0) ? 'U' : 'L';
00220   }
00221 
00222 
00223   bool SeldonUplo::Upper() const
00224   {
00225     return (status_ == 0);
00226   }
00227 
00228 
00229   bool SeldonUplo::Lower() const
00230   {
00231     return (status_ == 1);
00232   }
00233 
00234 
00235   char SeldonUplo::Char() const
00236   {
00237     return (status_ == 0) ? 'U' : 'L';
00238   }
00239 
00240 
00241   char SeldonUplo::RevChar() const
00242   {
00243     return (status_ == 0) ? 'L' : 'U';
00244   }
00245 
00246 
00247 #ifndef SELDON_WITH_COMPILED_LIBRARY
00248   SeldonUplo SeldonUpper(0);
00249   SeldonUplo SeldonLower(1);
00250 #endif
00251 
00252 
00254   // SELDONNORM //
00256 
00257 
00258   SeldonNorm::SeldonNorm(int status)
00259   {
00260     status_ = status;
00261   }
00262 
00263 
00264   SeldonNorm::operator char() const
00265   {
00266     return (status_ == 0) ? 'I' : '1';
00267   }
00268 
00269 
00270   char SeldonNorm::Char() const
00271   {
00272     return (status_ == 0) ? 'I' : '1';
00273   }
00274 
00275 
00276   char SeldonNorm::RevChar() const
00277   {
00278     return (status_ == 0) ? '1' : 'I';
00279   }
00280 
00281 
00282 #ifndef SELDON_WITH_COMPILED_LIBRARY
00283   SeldonNorm SeldonNormInf(0);
00284   SeldonNorm SeldonNorm1(1);
00285 #endif
00286 
00287 
00289   // SELDONCONJUGATE //
00291 
00292 
00293   SeldonConjugate::SeldonConjugate(bool status)
00294   {
00295     status_ = status;
00296   }
00297 
00298 
00299   inline bool SeldonConjugate::Conj() const
00300   {
00301     return status_;
00302   }
00303 
00304 
00305 #ifndef SELDON_WITH_COMPILED_LIBRARY
00306   SeldonConjugate SeldonUnconj(false);
00307   SeldonConjugate SeldonConj(true);
00308 #endif
00309 
00310 
00312   // SELDONSIDE //
00314 
00315 
00316   SeldonSide::SeldonSide(int status)
00317   {
00318     status_ = status;
00319 #ifdef SELDON_WITH_BLAS
00320     if (status_ == 0)
00321       cblas_status_ = CblasLeft;
00322     else
00323       cblas_status_ = CblasRight;
00324 #endif
00325   }
00326 
00327 
00328 #ifdef SELDON_WITH_BLAS
00329   SeldonSide::SeldonSide(const enum CBLAS_SIDE status):
00330     cblas_status_(status)
00331   {
00332     if (cblas_status_ == CblasLeft)
00333       status_ = 0;
00334     else
00335       status_ = 1;
00336   }
00337 #endif
00338 
00339 
00340 #ifdef SELDON_WITH_BLAS
00341   SeldonSide::operator CBLAS_SIDE() const
00342   {
00343     return cblas_status_;
00344   }
00345 #endif
00346 
00347 
00348   bool SeldonSide::Left() const
00349   {
00350     return (status_ == 0);
00351   }
00352 
00353 
00354   bool SeldonSide::Right() const
00355   {
00356     return (status_ == 1);
00357   }
00358 
00359 
00360   class_SeldonLeft::class_SeldonLeft(): SeldonSide(0)
00361   {
00362   }
00363 
00364 
00365   class_SeldonRight::class_SeldonRight(): SeldonSide(1)
00366   {
00367   }
00368 
00369 
00370 #ifndef SELDON_WITH_COMPILED_LIBRARY
00371   class_SeldonLeft SeldonLeft;
00372   class_SeldonRight SeldonRight;
00373 #endif
00374 
00375 
00376 }
00377 
00378 
00379 #define SELDON_FILE_SHARE_MATRIXFLAG_CXX
00380 #endif