ConicBundle
Bigmatrix.hxx
Go to the documentation of this file.
1 
2 #ifndef CONICBUNDLE_BIGMATRIX_HXX
3 #define CONICBUNDLE_BIGMATRIX_HXX
4 
12 #include "lanczos.hxx"
13 #include "SparseCoeffmatMatrix.hxx"
14 
15 namespace ConicBundle {
19 
31  class Bigmatrix:
34  {
35  private:
37  typedef std::map<CH_Matrix_Classes::Integer,CH_Matrix_Classes::Real> Indexhash;
38 
40 
42 
45  std::vector<CH_Matrix_Classes::Indexmatrix> rowind;
46  std::vector<CH_Matrix_Classes::Matrix> rowval;
47 
49  std::vector<Indexhash> rowhash;
50 
51  std::vector<CoeffmatPointer> mcp;
52 
54 
56 
57  //---
58  bool use_dense;
60  bool symrep_init;
61 
62  //--- temporary variables for lanczosmult
68 
69  public:
71  Bigmatrix();
73  ~Bigmatrix();
75  void clear();
79  void reset_nmult() {nmult=0;}
82  const SparseCoeffmatVector* Ai,const bool dense=false);
83 
86 
88  int get_dense() const {return use_dense;}
89 
91  virtual CH_Matrix_Classes::Integer lanczosdim() const;
92 
95 
98 
101 
104  { make_symmatrix(symrep); return symrep; }
105 
107  friend std::ostream& operator<<(std::ostream& out,const Bigmatrix&);
108 };
109 
111 
112 } //end namespace ConicBundle
113 
114 #endif
115 
int Integer
all integer numbers in calculations and indexing are of this type
Definition: matop.hxx:40
void clear()
clear all data
CH_Matrix_Classes::Matrix mcv
multiplier values for the dense matrices
Definition: Bigmatrix.hxx:53
double Real
all real numbers in calculations are of this type
Definition: matop.hxx:50
int make_symmatrix(CH_Matrix_Classes::Symmatrix &S) const
write a dense version of the current matrix to S
void reset_nmult()
reset the counter of matrix vector products to zero
Definition: Bigmatrix.hxx:79
Matrix class for integral values of type Integer
Definition: indexmat.hxx:195
std::map< CH_Matrix_Classes::Integer, CH_Matrix_Classes::Real > Indexhash
for collecting the indices of sparse data this seems useful
Definition: Bigmatrix.hxx:37
std::vector< CH_Matrix_Classes::Indexmatrix > rowind
nonzero row indices in each column
Definition: Bigmatrix.hxx:45
bool symrep_init
flag whether symrep is computed already
Definition: Bigmatrix.hxx:60
std::vector< Indexhash > rowhash
for finding nonzero indices
Definition: Bigmatrix.hxx:49
CH_Matrix_Classes::Indexmatrix collectj
for collecting the sparse part
Definition: Bigmatrix.hxx:66
virtual int lanczosmult(const CH_Matrix_Classes::Matrix &A, CH_Matrix_Classes::Matrix &B) const
computes B = bigMatrix * A (A and B must not refer to the same memory) as required by CH_Matrix_Class...
AffineMatrixFunction needs to compute the maximum eigenvalue of an affine matrix function ...
Definition: Bigmatrix.hxx:31
int init(const CH_Matrix_Classes::Matrix &yi, CH_Matrix_Classes::Integer indim, const CoeffmatPointer C, const SparseCoeffmatVector *Ai, const bool dense=false)
compute a good representation of (if dense==true directly a dense one)
bool use_dense
usually false, set to true if matrix is sufficiently dense
Definition: Bigmatrix.hxx:58
std::vector< CH_Matrix_Classes::Matrix > rowval
corresponding nonzero row values
Definition: Bigmatrix.hxx:46
Abstract base class for supplying the input matrix for Lanzcosmethods.
Definition: lanczos.hxx:33
CH_Matrix_Classes::Matrix Bt
auxilliary variable used in matrix vector products
Definition: Bigmatrix.hxx:64
Matrix class of symmetric matrices with real values of type Real
Definition: symmat.hxx:43
CH_Matrix_Classes::Symmatrix symrep
if use_dense is true, the matrix is stored here
Definition: Bigmatrix.hxx:59
std::vector< CoeffmatPointer > mcp
pointers to dense matrices
Definition: Bigmatrix.hxx:51
conic bundle method solver for sum of convex functions. See the ConicBundle_Manual for a quick introd...
Definition: CBSolver.hxx:22
virtual CH_Matrix_Classes::Integer lanczosdim() const
the order of the matrix as required by CH_Matrix_Classes::Lanczosmatrix
CH_Matrix_Classes::Matrix di
diagonal elements
Definition: Bigmatrix.hxx:48
void set_tol(CH_Matrix_Classes::Real t)
sets the tolerance for considering computed values as zeros
Definition: Bigmatrix.hxx:85
std::map< CH_Matrix_Classes::Integer, CoeffmatPointer > SparseCoeffmatVector
this is used to extract a row/block or a column from a SparseCoeffmatMatrix
Definition: SparseCoeffmatMatrix.hxx:26
const CH_Matrix_Classes::Symmatrix & get_symrep() const
compute the dense version locally and return a reference to it
Definition: Bigmatrix.hxx:103
CH_Matrix_Classes::Indexmatrix colnz
nonzeros of each column
Definition: Bigmatrix.hxx:44
CH_Matrix_Classes::Matrix collectval
for collecting the sparse part
Definition: Bigmatrix.hxx:67
Header declaring the abstract classes CH_Matrix_Classes::Lanczosmatrix and CH_Matrix_Classes::Lanczos...
Matrix class for real values of type Real
Definition: matrix.hxx:74
int get_dense() const
return true if a dense representation was computed
Definition: Bigmatrix.hxx:88
CH_Matrix_Classes::Integer nmult
counts the number of Mat*vec operations
Definition: Bigmatrix.hxx:55
All derived classes share a common Memarray memory manager, which is generated with the first user an...
Definition: memarray.hxx:117
pointer class for Coeffmat for deleting objects on the heap if Coefmat::use_cnt is reduced to zero an...
Definition: Coeffmat.hxx:264
CH_Matrix_Classes::Real tol
tolerance for considering an element to be zero
Definition: Bigmatrix.hxx:39
CH_Matrix_Classes::Indexmatrix collecti
for collecting the sparse part
Definition: Bigmatrix.hxx:65
CH_Matrix_Classes::Integer dim
size of the matrix
Definition: Bigmatrix.hxx:41
Header declaring the classes ConicBundle::SparseCoeffmatMatrix (needed for ConicBundle::PSCAffineFunc...
CH_Matrix_Classes::Integer get_nmult() const
return number of matrix vector products
Definition: Bigmatrix.hxx:77
virtual CH_Matrix_Classes::Integer lanczosflops() const
the estimated flop count of a matrix vector multiplication as required by CH_Matrix_Classes::Lanczosm...
friend std::ostream & operator<<(std::ostream &out, const Bigmatrix &)
output information
CH_Matrix_Classes::Matrix At
auxilliary variable used in matrix vector products
Definition: Bigmatrix.hxx:63
CH_Matrix_Classes::Integer nz
total number of nonzeros (except diagonal)
Definition: Bigmatrix.hxx:43