Matrix Science header

ms_matrix.hpp

00001 /*
00002  * Copyright (C) 2002-2013, Matrix Science Limited, London, UK.
00003  * All rights reserved.
00004  *
00005  * @(#)$Source: /vol/cvsroot/parser/inc/ms_matrix.hpp,v $
00006  * @(#)$Revision: 1.4 $
00007  * @(#)$Date: 2016/05/19 16:07:07 $
00008  */
00009 
00010 #ifndef MS_MATRIX_HPP
00011 #define MS_MATRIX_HPP
00012 
00013 #ifdef _WIN32
00014 #pragma warning(disable:4251)   // Don't want all classes to be exported
00015 #pragma warning(disable:4786)   // Debug symbols too long
00016 #   ifndef _MATRIX_USE_STATIC_LIB
00017 #       ifdef MS_MASCOTRESFILE_EXPORTS
00018 #           define MS_MASCOTRESFILE_API __declspec(dllexport)
00019 #       else
00020 #           define MS_MASCOTRESFILE_API __declspec(dllimport)
00021 #       endif
00022 #   else
00023 #       define MS_MASCOTRESFILE_API
00024 #   endif
00025 #else
00026 #   define MS_MASCOTRESFILE_API
00027 #endif
00028 
00029 #include <vector>
00030 
00031 namespace matrix_science
00032 {
00038 
00039 
00050     class MS_MASCOTRESFILE_API ms_matrix
00051     {
00052         public:
00053 
00054             typedef std::vector<double> column_vector_t;
00055             typedef std::vector<column_vector_t> matrix_t;
00056 
00058             static ms_matrix diagonalMatrix(size_t s, double v);
00059 
00061             static ms_matrix identityMatrix(size_t s);
00062 
00064             static ms_matrix rowMatrix(const std::vector<double> & v);
00065 
00067             static ms_matrix columnMatrix(const std::vector<double> & v);
00068 
00070             ms_matrix();
00071 
00073             ms_matrix(const matrix_t & m);
00074 
00076             ms_matrix(size_t si, size_t sj, double v = 0.0);
00077 
00079             size_t sizei() const;
00080 
00082             size_t sizej() const;
00083 
00084 #ifndef SWIG
00085 
00086             column_vector_t & operator[](size_t i);
00087 
00089             const column_vector_t & operator[](size_t i) const;
00090 #endif
00091 
00092             double getCR(size_t i, size_t j) const;
00094             void setCR(size_t i, size_t j, double value);
00095 
00097             double getRC(size_t i, size_t j) const { return getCR(j, i); }
00099             void setRC(size_t i, size_t j, double value) {  setCR(j, i, value); }
00100 
00102             const matrix_t & data() const;
00103 #ifndef SWIG
00104 
00105             bool operator==(const ms_matrix & m) const;
00106 
00108             bool operator!=(const ms_matrix & m) const;
00109 #endif
00110 
00111             bool isZero() const;
00112 
00114             void resize(size_t si, size_t sj, double v = 0.0);
00115 
00117             double multiplyByRow(const std::vector<double> & column, size_t row) const;
00118 
00120             ms_matrix operator*(const ms_matrix & m) const;
00121 
00123             void transpose();
00124 
00125         private:
00126             matrix_t matrix_;
00127     };
00128  // end of tools_group
00130 } // namespace matrix_science
00131 
00132 #endif // MS_MATRIX_HPP
00133 
00134 /*------------------------------- End of File -------------------------------*/
Copyright © 2016 Matrix Science Ltd.  All Rights Reserved. Generated on Fri Jun 2 2017 01:44:51