3 #ifndef CONICBUNDLE_PSCPRIMAL_HXX 4 #define CONICBUNDLE_PSCPRIMAL_HXX 96 { init(symmat);
return *
this; }
122 { assert(factor>=0.); *
this *= factor;
return 0;}
136 SparseCoeffmatVector::const_iterator it=block->find(column);
137 if (it==block->end())
140 value=it->second->ip(*
this);
163 { init(sdp);
return *
this; }
178 this->support_xbpeya(*pd,factor,1.);
188 { assert(factor>=0.); *
this *= factor;
return 0;}
201 SparseCoeffmatVector::const_iterator it=block->find(column);
202 if (it==block->end())
205 if (it->second->support_in(*
this)==0){
208 value=it->second->ip(*
this);
233 gramblock(pr.gramblock,std::
sqrt(factor)) {assert(factor>=0.);}
238 { init(sdp); gramblock.
init(0,0,0.);
return *
this; }
241 { init(sdp); gramblock=sdp.
gramblock;
return *
this; }
265 this->support_xbpeya(*pd,factor,1.);
272 this->support_xbpeya(*ps,factor,1.);
288 if (gramblock.
dim()!=0) {
290 gramblock.
init(0,0,0.);
298 { assert(factor>=0.); *
this *= factor; gramblock*=
std::sqrt(factor);
return 0;}
312 SparseCoeffmatVector::const_iterator it=block->find(column);
313 if (it==block->end())
316 if (it->second->support_in(*
this)==0){
319 value=it->second->ip(*
this);
320 if (gramblock.
dim()>0)
321 value+=it->second->gramip(gramblock);
343 std::map<CH_Matrix_Classes::Integer,PSCPrimal*>
primal;
int Integer
all integer numbers in calculations and indexing are of this type
Definition: matop.hxx:40
PrimalData * clone_primal_data() const
returns a newly generated identical Object
Definition: PSCPrimal.hxx:166
PrimalData * clone_primal_data() const
returns a newly generated identical Object
Definition: PSCPrimal.hxx:247
int aggregate_Gram_matrix(const CH_Matrix_Classes::Matrix &P, double factor=1.)
add factor*P*P^T on the support to this
Definition: PSCPrimal.hxx:183
SparsePSCPrimal & operator=(const CH_Matrix_Classes::Sparsesym &sdp)
assigns this Sparsesym, only the same support will be used in all Gram operations ...
Definition: PSCPrimal.hxx:162
Integer rowdim() const
returns the row dimension
Definition: matrix.hxx:215
double Real
all real numbers in calculations are of this type
Definition: matop.hxx:50
int assign_Gram_matrix(const CH_Matrix_Classes::Matrix &P)
for each element aij in the support set aij=<P.row(i),P.row(j)>
Definition: PSCPrimal.hxx:170
virtual int aggregate_Gram_matrix(const CH_Matrix_Classes::Matrix &P, double factor=1.)=0
add factor*P*P^T to this
SparsePSCPrimal(const SparsePSCPrimal &pr, double factor=1.)
copy constructor, only the same support will be used in all Gram operations
Definition: PSCPrimal.hxx:159
const DensePSCPrimal & operator=(const CH_Matrix_Classes::Symmatrix &symmat)
assigns a symmetric matrix
Definition: PSCPrimal.hxx:95
Matrix class for integral values of type Integer
Definition: indexmat.hxx:195
Matrix & init(const Matrix &A, Real d=1., int atrans=0)
initialize to *this=A*d where A may be transposed
Definition: matrix.hxx:1035
void dim(Integer &_nr, Integer &_nc) const
returns the number of rows in _nr and the number of columns in _nc
Definition: matrix.hxx:209
GramSparsePSCPrimal(const GramSparsePSCPrimal &pr, double factor=1.)
copy constructor
Definition: PSCPrimal.hxx:230
virtual int aggregate_primal_data(const PrimalData &pd, double factor=1.)=0
add factor*pd to this
const CH_Matrix_Classes::Matrix & get_grammatrix() const
returns the matrix giving rise to the Gram matrix
Definition: PSCPrimal.hxx:244
Header declaring the classes ConicBundle::PSCOracle and ConicBundle::PSCBundleParameters (needed for ...
GramSparsePSCPrimal(const CH_Matrix_Classes::Sparsesym &sps, double factor=1.)
initialize to the given sparse symmetric matrix, the gram part is zero
Definition: PSCPrimal.hxx:228
Matrix class of symmetric matrices with real values of type Real
Definition: symmat.hxx:43
SparsePSCPrimal(const CH_Matrix_Classes::Sparsesym &sps, double factor=1.)
copy constructor from a CH_Matrix_Classes::Sparssym, only the support of this matrix will be used in ...
Definition: PSCPrimal.hxx:157
const CH_Matrix_Classes::Indexmatrix & blockdim() const
returns a column vector with row i giving the order of block i
Definition: SparseCoeffmatMatrix.hxx:117
virtual int scale_primal_data(double factor)
multiply/scale *this with a nonnegative factor
Definition: PSCPrimal.hxx:297
conic bundle method solver for sum of convex functions. See the ConicBundle_Manual for a quick introd...
Definition: CBSolver.hxx:22
DensePSCPrimal(CH_Matrix_Classes::Integer n)
direct size initialization to a zero matrix
Definition: PSCPrimal.hxx:93
DensePSCPrimal(const DensePSCPrimal &symmat, double factor=1.)
copy constructor
Definition: PSCPrimal.hxx:89
int aggregate_primal_data(const PrimalData &it, double factor=1.)
if it is a SparseSDPRimal, add factor*it to this on the support of this
Definition: PSCPrimal.hxx:174
represents an PSCPrimal as the sum of a Gram matrix and a sparse symmetric matrix ...
Definition: PSCPrimal.hxx:221
stores/organizes the CoeffmatPointer pointers to Coeffmat matrices with the purpose of describing the...
Definition: SparseCoeffmatMatrix.hxx:50
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
DensePSCPrimal()
initialize to a symmetric matrix of size 0
Definition: PSCPrimal.hxx:87
virtual int aggregate_primal_data(const PrimalData &it, double factor=1.)
add factor*it to this (it must also be a DensePSCPrimal)
Definition: PSCPrimal.hxx:108
int aggregate_primal_data(const PrimalData &it, double factor=1.)
if it is a GramSparsePSCPrimal or SparseSDPRimal, add factor*it to this on only the support of this s...
Definition: PSCPrimal.hxx:260
CH_Matrix_Classes::Indexmatrix Xdim
stores the sizes of the block
Definition: PSCPrimal.hxx:342
GramSparsePSCPrimal & operator=(const GramSparsePSCPrimal &sdp)
copy the information
Definition: PSCPrimal.hxx:240
Symmatrix & rankadd(const Matrix &A, Symmatrix &C, Real alpha=1., Real beta=0., int trans=0)
returns C=beta*C+alpha* A*A^T, where A may be transposed. If beta==0. then C is initiliazed to the co...
std::map< CH_Matrix_Classes::Integer, PSCPrimal * > primal
holds the PSCPrimal of blcok i if there is one
Definition: PSCPrimal.hxx:343
Header declaring the output class CBout.
virtual int scale_primal_data(double factor)
multiply/scale *this with a nonnegative factor
Definition: PSCPrimal.hxx:121
virtual int scale_primal_data(double factor)
multiply/scale *this with a nonnegative factor
Definition: PSCPrimal.hxx:187
virtual int primal_ip(CH_Matrix_Classes::Real &value, const SparseCoeffmatMatrix &A, CH_Matrix_Classes::Integer column) const =0
if compatible evaluate value=ip(*this,A.column[i])
Matrix Classes and Linear Algebra. See Matrix Classes (namespace CH_Matrix_Classes) for a quick intro...
Definition: PSCOracle.hxx:20
Sparsesym & support_rankadd(const Matrix &A, Sparsesym &C, Real alpha=1., Real beta=0., int trans=0)
returns C=beta*C+alpha*AA^T (or A^TA), but only on the current support of C
virtual int primal_ip(CH_Matrix_Classes::Real &value, const SparseCoeffmatMatrix &A, CH_Matrix_Classes::Integer column) const
if compatible evaluate value=ip(*this,A.column[i])
Definition: PSCPrimal.hxx:301
Matrix class of symmetric matrices with real values of type Real
Definition: sparssym.hxx:89
implements a general purpose dense symmetric PSCPrimal based on CH_Matrix_Classes::Symmatrix ...
Definition: PSCPrimal.hxx:81
Matrix class for real values of type Real
Definition: matrix.hxx:74
virtual int aggregate_Gram_matrix(const CH_Matrix_Classes::Matrix &P, double factor=1.)
add factor*P*P^T to this
Definition: PSCPrimal.hxx:117
implements a sparse symmetric PSCPrimal collecting data only on a sparse, prespecified support; it is...
Definition: PSCPrimal.hxx:153
virtual int primal_ip(CH_Matrix_Classes::Real &value, const SparseCoeffmatMatrix &A, CH_Matrix_Classes::Integer column) const
if compatible evaluate value=ip(*this,A.column[i])
Definition: PSCPrimal.hxx:125
virtual PrimalData * clone_primal_data() const =0
returns a newly generated identical Object
virtual int primal_ip(CH_Matrix_Classes::Real &value, const SparseCoeffmatMatrix &A, CH_Matrix_Classes::Integer column) const
if compatible evaluate value=ip(*this,A.column[i])
Definition: PSCPrimal.hxx:191
const SparseCoeffmatVector * block(CH_Matrix_Classes::Integer i) const
returns NULL if the block is empty and a pointer to a Vector of CoeffmatPointers otherwise ...
int aggregate_Gram_matrix(const CH_Matrix_Classes::Matrix &P, double factor=1.)
add factor*P*P^T to this, collecting all available information only in the sparse part...
Definition: PSCPrimal.hxx:286
In Lagrangean relaxation an approximate primal solution can be generated by supplying primal informat...
Definition: CBSolver.hxx:151
Header declaring the classes ConicBundle::SparseCoeffmatMatrix (needed for ConicBundle::PSCAffineFunc...
CH_Matrix_Classes::Integer blockdim(CH_Matrix_Classes::Integer i) const
returns the size of block i
Definition: PSCPrimal.hxx:377
CH_Matrix_Classes::Integer coldim() const
returns the number of columns (i.e. of blockdiagonal matrices)
Definition: SparseCoeffmatMatrix.hxx:121
virtual int scale_primal_data(double factor)=0
multiply/scale *this with a nonnegative factor
Indexmatrix & xbpeya(Indexmatrix &x, const Indexmatrix &y, Integer alpha=1, Integer beta=0, int ytrans=0)
returns x= alpha*y+beta*x, where y may be transposed (ytrans=1); if beta==0. then x is initialized to...
GramSparsePSCPrimal & operator=(const CH_Matrix_Classes::Sparsesym &sdp)
assign the sparse symmetric matrix to this and set the gram part to zero
Definition: PSCPrimal.hxx:237
int assign_Gram_matrix(const CH_Matrix_Classes::Matrix &P)
Set the grammatrix part to and set all values on the sparse support to zero (but keep this support e...
Definition: PSCPrimal.hxx:251
virtual int assign_Gram_matrix(const CH_Matrix_Classes::Matrix &P)
assign P*P^T to this
Definition: PSCPrimal.hxx:104
void dim(Integer &_nr, Integer &_nc) const
returns the number of rows in _nr and the number of columns in _nc
Definition: indexmat.hxx:315
double sqrt(int a)
return sqrt for int a
Definition: mymath.hxx:121
CH_Matrix_Classes::Matrix gramblock
the gram matrix part is gramblock*transpose(grampblock)
Definition: PSCPrimal.hxx:224
virtual PrimalData * clone_primal_data() const
returns a newly generated identical Object, see PrimalData::clone_primal_data()
Definition: PSCPrimal.hxx:99
virtual int assign_Gram_matrix(const CH_Matrix_Classes::Matrix &P)=0
intialize the primal corresponding to the (positive semidefinite) Gram matrix P*P^T ...
implements a block diagonal PSCPrimal consisting of several PSCPrimal blocks
Definition: PSCPrimal.hxx:339
PSCPrimal is the corresponding positive semidefinite object for PSCOracle like PrimalMatrix for a Mat...
Definition: PSCPrimal.hxx:46
CH_Matrix_Classes::Integer get_nblocks() const
returns the number of blocks
Definition: PSCPrimal.hxx:375
DensePSCPrimal(const CH_Matrix_Classes::Symmatrix &symmat, double factor=1.)
copy constructor from a CH_Matrix_Classes::Symmatrix
Definition: PSCPrimal.hxx:91