27 #ifndef GMATRIXBASE_HPP
28 #define GMATRIXBASE_HPP
148 virtual const double&
operator()(
const int& row,
const int& column)
const = 0;
157 virtual void clear(
void) = 0;
159 virtual std::string
classname(
void)
const = 0;
160 virtual double&
at(
const int& row,
const int& column) = 0;
161 virtual const double&
at(
const int& row,
const int& column)
const = 0;
162 virtual GVector row(
const int& row)
const = 0;
163 virtual void row(
const int& row,
const GVector& vector) = 0;
165 virtual void column(
const int& column,
const GVector& vector) = 0;
168 virtual double fill(
void)
const = 0;
169 virtual double min(
void)
const = 0;
170 virtual double max(
void)
const = 0;
171 virtual double sum(
void)
const = 0;
176 const int&
size(
void)
const;
177 const int&
columns(
void)
const;
178 const int&
rows(
void)
const;
192 const int& num = 15)
const;
double get_min_element(void) const
Return minimum matrix element.
virtual std::string print(const GChatter &chatter=NORMAL) const =0
Print content of object.
void scale_elements(const double &scalar)
Scale all matrix elements with a scalar.
Abstract matrix base class interface definition.
std::string print_row_compression(const GChatter &chatter=NORMAL) const
Print row compression scheme if it exists.
void init_members(void)
Initialise class members.
const int & size(void) const
Return number of matrix elements.
virtual void add_to_row(const int &row, const GVector &vector)=0
double get_element_sum(void) const
Returns sum over all matrix elements.
virtual GVector row(const int &row) const =0
Definition of interface for all GammaLib classes.
int m_rows
Number of rows.
virtual double sum(void) const =0
virtual std::string classname(void) const =0
Return class name.
int m_num_colsel
Number of selected columns (for compressed decomposition)
virtual double & at(const int &row, const int &column)=0
virtual double & operator()(const int &row, const int &column)=0
void set_all_elements(const double &value)
Set all elements to a specific value.
virtual void clear(void)=0
Clear object.
std::string print_elements(const GChatter &chatter=NORMAL, const int &num=15) const
Print all matrix elements.
double * m_data
Matrix data.
const int & rows(void) const
Return number of matrix rows.
Interface class for all GammaLib classes.
void copy_members(const GMatrixBase &matrix)
Copy class members.
int m_cols
Number of columns.
double get_max_element(void) const
Returns maximum matrix element.
virtual GVector column(const int &column) const =0
virtual double max(void) const =0
int m_alloc
Size of allocated matrix memory.
virtual bool operator==(const GMatrixBase &matrix) const
Equalty operator.
std::string print_col_compression(const GChatter &chatter=NORMAL) const
Print column compression scheme if it exists.
Vector class interface definition.
virtual ~GMatrixBase(void)
Destructor.
virtual GMatrixBase * clone(void) const =0
Clones object.
int m_elements
Number of elements stored in matrix.
GMatrixBase(void)
Void constructor.
virtual GVector operator*(const GVector &vector) const =0
virtual bool operator!=(const GMatrixBase &matrix) const
Non-equality operator.
virtual double min(void) const =0
virtual GMatrixBase & operator=(const GMatrixBase &matrix)
Assignment operator.
virtual void add_to_column(const int &column, const GVector &vector)=0
void free_members(void)
Delete class members.
int m_num_rowsel
Number of selected rows (for compressed decomposition)
int * m_colstart
Column start indices (m_cols+1)
int * m_rowsel
Row selection (for compressed decomposition)
void select_non_zero(void)
Setup compressed matrix factorisation.
virtual double fill(void) const =0
const int & columns(void) const
Return number of matrix columns.
int * m_colsel
Column selection (for compressed decomposition)
bool is_empty(void) const
Check if matrix is empty.