Matrix Science header

ms_matrix.hpp

00001 /*
00002  * Copyright (C) 2002-2013, Matrix Science Limited, London, UK.
00003  * All rights reserved.
00004  *
00005  * @(#)$Source: parser/inc/ms_matrix.hpp $
00006  * @(#)$Revision: 436aa2996c6a3d2d2f0cdb88fab902c2780ae29a | MSPARSER_REL_2_8_1-0-gea32989045 $
00007  * @(#)$Date: 2019-05-16 11:53:33 +0100 $
00008  */
00009 
00010 #ifndef MS_MATRIX_HPP
00011 #define MS_MATRIX_HPP
00012 
00013 
00014 #include <vector>
00015 
00016 namespace matrix_science
00017 {
00023 
00024 
00035     class MS_MASCOTRESFILE_API ms_matrix
00036     {
00037         public:
00038 
00039             typedef std::vector<double> column_vector_t;
00040             typedef std::vector<column_vector_t> matrix_t;
00041 
00043             static ms_matrix diagonalMatrix(size_t s, double v);
00044 
00046             static ms_matrix identityMatrix(size_t s);
00047 
00049             static ms_matrix rowMatrix(const std::vector<double> & v);
00050 
00052             static ms_matrix columnMatrix(const std::vector<double> & v);
00053 
00055             ms_matrix();
00056 
00058             ms_matrix(const matrix_t & m);
00059 
00061             ms_matrix(size_t si, size_t sj, double v = 0.0);
00062 
00064             size_t sizei() const;
00065 
00067             size_t sizej() const;
00068 
00069 #ifndef SWIG
00070 
00071             column_vector_t & operator[](size_t i);
00072 
00074             const column_vector_t & operator[](size_t i) const;
00075 #endif
00076 
00077             double getCR(size_t i, size_t j) const;
00079             void setCR(size_t i, size_t j, double value);
00080 
00082             double getRC(size_t i, size_t j) const { return getCR(j, i); }
00084             void setRC(size_t i, size_t j, double value) {  setCR(j, i, value); }
00085 
00087             const matrix_t & data() const;
00088 #ifndef SWIG
00089 
00090             bool operator==(const ms_matrix & m) const;
00091 
00093             bool operator!=(const ms_matrix & m) const;
00094 
00096             ms_matrix operator*(const ms_matrix & m) const;
00097 #endif
00098 
00099             bool isZero() const;
00100 
00102             void resize(size_t si, size_t sj, double v = 0.0);
00103 
00105             double multiplyByRow(const std::vector<double> & column, size_t row) const;
00106 
00108             void setColumnDown(size_t row, size_t col, const std::vector<double> & vec);
00109 
00111             void setColumnUp(size_t row, size_t col, const std::vector<double> & vec);
00112 
00114             void transpose();
00115 
00117             void logContents(ms_errs & errs, const char * description) const;
00118 
00119         private:
00120             matrix_t matrix_;
00121     };
00122  // end of tools_group
00124 } // namespace matrix_science
00125 
00126 #endif // MS_MATRIX_HPP
00127 
00128 /*------------------------------- End of File -------------------------------*/

Copyright © 2022 Matrix Science Ltd.  All Rights Reserved. Generated on Thu Mar 31 2022 01:12:29