/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Emc/EmcCalib/EmcBhaCalib/EmcBhaCalib-00-00-34/EmcBhaCalib/EmcLSSMatrix.h

Go to the documentation of this file.
00001 //--------------------------------------------------------------------------
00002 // Environment:
00003 //      This software was developed for the BESIII collaboration.  If you
00004 //      use all or part of it, please give an appropriate acknowledgement.
00005 //
00006 // Copyright Information:
00007 //      Copyright (C) 2005         IHEP
00008 //
00009 //------------------------------------------------------------------------
00010 
00011 #ifndef EMCLSSMATRIX_H
00012 #define EMCLSSMATRIX_H
00013 
00014 //-------------
00015 // C Headers --
00016 //-------------
00017 extern "C" {
00018 }
00019 
00020 //---------------
00021 // C++ Headers --
00022 //---------------
00023 #include <iostream>
00024 
00025 //---------------
00026 // Gaudi Headers --
00027 //---------------
00028 using namespace std;
00029 
00030 
00031 //              ---------------------
00032 //              -- Class Interface --
00033 //              ---------------------
00034 
00047 class EmcLSSMatrix { 
00048 
00049 //--------------------
00050 // Instance Members --
00051 //--------------------
00052 
00053 public:
00054 
00055   //Constructors
00056   EmcLSSMatrix();
00057 
00058   // constructor with number of rows and expected number of nonzeros per row 
00059   EmcLSSMatrix( int rows, int nonzero_col);
00060 
00061   // constructor with number of rows and expected number of nonzeros per row
00062   // , message output flag 
00063   EmcLSSMatrix( int rows, int nonzero_col, int MsgFlag);
00064 
00065   //Copy Constructor
00066   EmcLSSMatrix(const EmcLSSMatrix &m1 );
00067 
00068   // Destructor
00069   ~EmcLSSMatrix();
00070 
00071   // Get matrix element, indexing starts from (0,0)   
00072   double& operator()(int row, int col);
00073 
00074   // number of rows
00075   const int& num_rows() const { return _nrrows; }
00076 
00077   // number of columns     
00078   const int& num_cols() const { return _nrcol ; }
00079 
00080   // size of matrix   
00081   const long& size() const { return _size; }
00082 
00083   double* matrix( const int& rowind =0 ) const;
00084   int* row() const { return _rows; }
00085   int* column(const int& rowind = 0) const;
00086 
00087   // number of non Zero elements in a column
00088   int num_filled_rows(const int col) const;
00089   
00090   // number of non Zero elements in a row
00091   int num_filled_cols(const int row) const;
00092 
00093   //number of non Zero elements of the matrix
00094   long int num_nonZeros();
00095 
00096   //print a list of all non zero elements
00097   void print_NonZeros();
00098 
00099   // print a row
00100   void print_row(int rownr);
00101 
00102   //write out rows, columns and matrix elements to a file
00103   void writeOut( ostream& Out);
00104 
00105   //read in rows, columns and matrix elements from a file
00106   void readIn( istream& In);
00107 
00108   // Modifiers
00109 
00110   // set verbose
00111   void set_verbose(bool setting) { _verb = setting; }
00112 
00113   //reset matrix to zero
00114   void reset();
00115 
00116   //reduce matrix, make a array with only non-zero elements    
00117   bool reduce_Matrix(int* xRef_list);
00118 
00119 protected:
00120   
00121   // Helper functions
00122   long int find(int row, int col);
00123   
00124  private:
00125   
00126   // Data members
00127   const long _size;
00128   const int _nrrows;
00129   const int _nrcol;
00130   double * _matrix;
00131   int * _columns;
00132   int * _rows;
00133   double* _nothing;
00134   bool _verb;
00135   // message output flag, 
00136   int _MsgFlag;
00137 };
00138 
00139 #endif // EMCLSSMATRIX_H 
00140 

Generated on Tue Nov 29 22:58:15 2016 for BOSS_7.0.2 by  doxygen 1.4.7