#ifndef __IPSYMTMATRIX_HPP__
#define __IPSYMTMATRIX_HPP__
#include "IpUtils.hpp"
#include "IpSymMatrix.hpp"
namespace Ipopt
{
class SymTMatrixSpace;
class IPOPTLIB_EXPORT SymTMatrix: public SymMatrix
{
public:
SymTMatrix(
const SymTMatrixSpace* owner_space
);
~SymTMatrix();
void SetValues(
const Number* Values
);
Index Nonzeros() const;
const Index* Irows() const;
const Index* Jcols() const;
Number* Values();
const Number* Values() const;
void FillStruct(
Index* Irn,
Index* Jcn
) const;
void FillValues(
Number* Values
) const;
protected:
virtual void MultVectorImpl(
Number alpha,
const Vector& x,
Number beta,
Vector& y
) const;
virtual bool HasValidNumbersImpl() const;
virtual void ComputeRowAMaxImpl(
Vector& rows_norms,
bool init
) const;
virtual void PrintImpl(
const Journalist& jnlst,
EJournalLevel level,
EJournalCategory category,
const std::string& name,
Index indent,
const std::string& prefix
) const;
private:
SymTMatrix();
SymTMatrix(
const SymTMatrix&
);
void operator=(
const SymTMatrix&
);
const SymTMatrixSpace* owner_space_;
Number* values_;
bool initialized_;
};
class IPOPTLIB_EXPORT SymTMatrixSpace: public SymMatrixSpace
{
public:
SymTMatrixSpace(
Index dim,
Index nonZeros,
const Index* iRows,
const Index* jCols
);
~SymTMatrixSpace();
virtual SymMatrix* MakeNewSymMatrix() const
{
return MakeNewSymTMatrix();
}
SymTMatrix* MakeNewSymTMatrix() const
{
return new SymTMatrix(this);
}
Index Nonzeros() const
{
return nonZeros_;
}
const Index* Irows() const
{
return iRows_;
}
const Index* Jcols() const
{
return jCols_;
}
private:
Number* AllocateInternalStorage() const;
void FreeInternalStorage(
Number* values
) const;
const Index nonZeros_;
Index* iRows_;
Index* jCols_;
friend class SymTMatrix;
};
inline Index SymTMatrix::Nonzeros() const
{
return owner_space_->Nonzeros();
}
inline const Index* SymTMatrix::Irows() const
{
return owner_space_->Irows();
}
inline const Index* SymTMatrix::Jcols() const
{
return owner_space_->Jcols();
}
} #endif