BOSS 7.1.2
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//---------------
21// C++ Headers --
22//---------------
23#include <iostream>
24
25//---------------
26// Gaudi Headers --
27//---------------
28using namespace std;
29
30
31// ---------------------
32// -- Class Interface --
33// ---------------------
34
35/**
36 * Implementation of a Large Sparse Symmetric Matrix,
37 *
38 * Per row only the nonzero elements are stored together with their column
39 * indices.
40 * (the storiage of the row index is a tribute to SLAP which needs it)
41 *
42 * @see
43 *
44 * @author Chunxiu Liu (originator/contributor etc.);
45 */
46
48
49//--------------------
50// Instance Members --
51//--------------------
52
53public:
54
55 //Constructors
57
58 // constructor with number of rows and expected number of nonzeros per row
59 EmcLSSMatrix( int rows, int nonzero_col);
60
61 // constructor with number of rows and expected number of nonzeros per row
62 // , message output flag
63 EmcLSSMatrix( int rows, int nonzero_col, int MsgFlag);
64
65 //Copy Constructor
67
68 // Destructor
70
71 // Get matrix element, indexing starts from (0,0)
72 double& operator()(int row, int col);
73
74 // number of rows
75 const int& num_rows() const { return _nrrows; }
76
77 // number of columns
78 const int& num_cols() const { return _nrcol ; }
79
80 // size of matrix
81 const long& size() const { return _size; }
82
83 double* matrix( const int& rowind =0 ) const;
84 int* row() const { return _rows; }
85 int* column(const int& rowind = 0) const;
86
87 // number of non Zero elements in a column
88 int num_filled_rows(const int col) const;
89
90 // number of non Zero elements in a row
91 int num_filled_cols(const int row) const;
92
93 //number of non Zero elements of the matrix
94 long int num_nonZeros();
95
96 //print a list of all non zero elements
97 void print_NonZeros();
98
99 // print a row
100 void print_row(int rownr);
101
102 //write out rows, columns and matrix elements to a file
103 void writeOut( ostream& Out);
104
105 //read in rows, columns and matrix elements from a file
106 void readIn( istream& In);
107
108 // Modifiers
109
110 // set verbose
111 void set_verbose(bool setting) { _verb = setting; }
112
113 //reset matrix to zero
114 void reset();
115
116 //reduce matrix, make a array with only non-zero elements
117 bool reduce_Matrix(int* xRef_list);
118
119protected:
120
121 // Helper functions
122 long int find(int row, int col);
123
124 private:
125
126 // Data members
127 const long _size;
128 const int _nrrows;
129 const int _nrcol;
130 double * _matrix;
131 int * _columns;
132 int * _rows;
133 double* _nothing;
134 bool _verb;
135 // message output flag,
136 int _MsgFlag;
137};
138
139#endif // EMCLSSMATRIX_H
140
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:75