BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
EmcLSSMatrix.h
Go to the documentation of this file.
1//--------------------------------------------------------------------------
2// Environment:
3// This software was developed for the BESIII collaboration. If you
4// use all or part of it, please give an appropriate acknowledgement.
5//
6// Copyright Information:
7// Copyright (C) 2005 IHEP
8//
9//------------------------------------------------------------------------
10
11#ifndef EMCLSSMATRIX_H
12#define EMCLSSMATRIX_H
13
14//-------------
15// C Headers --
16//-------------
17extern "C" {}
18
19//---------------
20// C++ Headers --
21//---------------
22#include <iostream>
23
24//---------------
25// Gaudi Headers --
26//---------------
27using namespace std;
28
29// ---------------------
30// -- Class Interface --
31// ---------------------
32
33/**
34 * Implementation of a Large Sparse Symmetric Matrix,
35 *
36 * Per row only the nonzero elements are stored together with their column
37 * indices.
38 * (the storiage of the row index is a tribute to SLAP which needs it)
39 *
40 * @see
41 *
42 * @author Chunxiu Liu (originator/contributor etc.);
43 */
44
46
47 //--------------------
48 // Instance Members --
49 //--------------------
50
51public:
52 // Constructors
54
55 // constructor with number of rows and expected number of nonzeros per row
56 EmcLSSMatrix( int rows, int nonzero_col );
57
58 // constructor with number of rows and expected number of nonzeros per row
59 // , message output flag
60 EmcLSSMatrix( int rows, int nonzero_col, int MsgFlag );
61
62 // Copy Constructor
64
65 // Destructor
67
68 // Get matrix element, indexing starts from (0,0)
69 double& operator()( int row, int col );
70
71 // number of rows
72 const int& num_rows() const { return _nrrows; }
73
74 // number of columns
75 const int& num_cols() const { return _nrcol; }
76
77 // size of matrix
78 const long& size() const { return _size; }
79
80 double* matrix( const int& rowind = 0 ) const;
81 int* row() const { return _rows; }
82 int* column( const int& rowind = 0 ) const;
83
84 // number of non Zero elements in a column
85 int num_filled_rows( const int col ) const;
86
87 // number of non Zero elements in a row
88 int num_filled_cols( const int row ) const;
89
90 // number of non Zero elements of the matrix
91 long int num_nonZeros();
92
93 // print a list of all non zero elements
94 void print_NonZeros();
95
96 // print a row
97 void print_row( int rownr );
98
99 // write out rows, columns and matrix elements to a file
100 void writeOut( ostream& Out );
101
102 // read in rows, columns and matrix elements from a file
103 void readIn( istream& In );
104
105 // Modifiers
106
107 // set verbose
108 void set_verbose( bool setting ) { _verb = setting; }
109
110 // reset matrix to zero
111 void reset();
112
113 // reduce matrix, make a array with only non-zero elements
114 bool reduce_Matrix( int* xRef_list );
115
116protected:
117 // Helper functions
118 long int find( int row, int col );
119
120private:
121 // Data members
122 const long _size;
123 const int _nrrows;
124 const int _nrcol;
125 double* _matrix;
126 int* _columns;
127 int* _rows;
128 double* _nothing;
129 bool _verb;
130 // message output flag,
131 int _MsgFlag;
132};
133
134#endif // EMCLSSMATRIX_H
int num_filled_cols(const int row) const
bool reduce_Matrix(int *xRef_list)
int * row() const
long int num_nonZeros()
long int find(int row, int col)
void print_NonZeros()
void print_row(int rownr)
int * column(const int &rowind=0) const
void writeOut(ostream &Out)
void set_verbose(bool setting)
double & operator()(int row, int col)
void readIn(istream &In)
double * matrix(const int &rowind=0) const
int num_filled_rows(const int col) const
const long & size() const
const int & num_rows() const
const int & num_cols() const
double * m1
Definition qcdloop1.h:83