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

/home/vivien/public_html/.src_seldon/matrix/Matrix_Base.hxx

00001 // Copyright (C) 2001-2009 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 // To be included by Seldon.hxx
00021 
00022 #ifndef SELDON_FILE_MATRIX_BASE_HXX
00023 
00024 #include "../share/Common.hxx"
00025 #include "../share/Properties.hxx"
00026 #include "../share/Storage.hxx"
00027 #include "../share/Errors.hxx"
00028 #include "../share/Allocator.hxx"
00029 
00030 namespace Seldon
00031 {
00032 
00033 
00035 
00039   template <class T, class Allocator = SELDON_DEFAULT_ALLOCATOR<T> >
00040   class Matrix_Base
00041   {
00042     // typdef declarations.
00043   public:
00044     typedef typename Allocator::value_type value_type;
00045     typedef typename Allocator::pointer pointer;
00046     typedef typename Allocator::const_pointer const_pointer;
00047     typedef typename Allocator::reference reference;
00048     typedef typename Allocator::const_reference const_reference;
00049 
00050     // Static attributes.
00051   protected:
00052     static Allocator allocator_;
00053 
00054     // Attributes.
00055   protected:
00056     // Number of rows.
00057     int m_;
00058     // Number of columns.
00059     int n_;
00060     // Pointer to stored elements.
00061     pointer data_;
00062 
00063     // Methods.
00064   public:
00065     // Constructors.
00066     Matrix_Base();
00067     explicit Matrix_Base(int i, int j);
00068     Matrix_Base(const Matrix_Base<T, Allocator>& A);
00069 
00070     // Destructor.
00071     ~Matrix_Base();
00072 
00073     // Basic methods.
00074     int GetM() const;
00075     int GetN() const;
00076     int GetM(const Seldon::SeldonTranspose& status) const;
00077     int GetN(const Seldon::SeldonTranspose& status) const;
00078 #ifdef SELDON_WITH_BLAS
00079     int GetM(const CBLAS_TRANSPOSE& status) const;
00080     int GetN(const CBLAS_TRANSPOSE& status) const;
00081 #endif
00082     int GetSize() const;
00083     pointer GetData() const;
00084     const_pointer GetDataConst() const;
00085     void* GetDataVoid() const;
00086     const void* GetDataConstVoid() const;
00087 
00088     Allocator& GetAllocator();
00089 
00090   };
00091 
00092 
00093   // Matrix allocator.
00094   template <class T, class Allocator>
00095   Allocator Matrix_Base<T, Allocator>::allocator_;
00096 
00097 
00098   template <class T, class Prop, class Storage, class Allocator>
00099   ostream& operator << (ostream& out,
00100                         const Matrix<T, Prop, Storage, Allocator>& A);
00101 
00102 
00103 } // namespace Seldon.
00104 
00105 #define SELDON_FILE_MATRIX_BASE_HXX
00106 #endif