diff --git a/include/GMatrixTools.hpp b/include/GMatrixTools.hpp
deleted file mode 100644
index 8c94619..0000000
--- a/include/GMatrixTools.hpp
+++ /dev/null
@@ -1,43 +0,0 @@
-/***************************************************************************
- * GMatrixTools.hpp - Matrix tools *
- * ----------------------------------------------------------------------- *
- * copyright (C) 2009 by Jurgen Knodlseder *
- * ----------------------------------------------------------------------- *
- * *
- * This program is free software: you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation, either version 3 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program. If not, see . *
- * *
- ***************************************************************************/
-
-#ifndef GMATRIXTOOLS_HPP
-#define GMATRIXTOOLS_HPP
-
-/* __ Includes ___________________________________________________________ */
-#include "GMatrix.hpp"
-#include "GSymMatrix.hpp"
-#include "GSparseMatrix.hpp"
-
-/* __ Namespaces _________________________________________________________ */
-
-/* __ Constants __________________________________________________________ */
-
-/* __ Prototypes _________________________________________________________ */
-GMatrix matrix(const GSymMatrix& m);
-GMatrix matrix(const GSparseMatrix& m);
-GSymMatrix sym_matrix(const GMatrix& m);
-GSymMatrix sym_matrix(const GSparseMatrix& m);
-GSparseMatrix sparse_matrix(const GMatrix& m);
-GSparseMatrix sparse_matrix(const GSymMatrix& m);
-
-
-#endif /* GMATRIXTOOLS_HPP */
diff --git a/include/GammaLib.hpp b/include/GammaLib.hpp
index 35caee1..4cd85fe 100644
--- a/include/GammaLib.hpp
+++ b/include/GammaLib.hpp
@@ -38,7 +38,6 @@
/* __ Numerics module ____________________________________________________ */
#include "GVector.hpp"
#include "GMatrixBase.hpp"
-#include "GMatrixTools.hpp"
#include "GMatrix.hpp"
#include "GSymMatrix.hpp"
#include "GSparseMatrix.hpp"
diff --git a/include/Makefile.am b/include/Makefile.am
index a33e4ba..a640b4e 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -111,7 +111,6 @@ pkginclude_HEADERS = GammaLib.hpp \
GFits.hpp \
GVector.hpp \
GMatrixBase.hpp \
- GMatrixTools.hpp \
GMatrix.hpp \
GSymMatrix.hpp \
GSparseMatrix.hpp \
@@ -123,6 +122,6 @@ pkginclude_HEADERS = GammaLib.hpp \
GOptimizerLM.hpp \
GOptimizerPars.hpp \
GOptimizerFunction.hpp \
- GTestSuite.hpp \
+ GTestSuite.hpp \
GTestSuites.hpp \
GTestCase.hpp
\ No newline at end of file
diff --git a/pyext/GMatrix.i b/pyext/GMatrix.i
index 91109f0..b6b5d27 100755
--- a/pyext/GMatrix.i
+++ b/pyext/GMatrix.i
@@ -18,13 +18,17 @@
* along with this program. If not, see . *
* *
***************************************************************************/
+/**
+ * @file GMatrix.i
+ * @brief Generic matrix class definition.
+ * @author Juergen Knoedlseder
+ */
%{
/* Put headers and other declarations here that are needed for compilation */
#include "GMatrix.hpp"
#include "GTools.hpp"
%}
-//%feature("notabstract") GMatrix;
/***********************************************************************//**
* @class GMatrix
@@ -38,39 +42,45 @@ class GMatrix : public GMatrixBase {
public:
// Constructors and destructors
GMatrix(void);
- GMatrix(int rows, int cols);
- GMatrix(const GMatrix& m);
+ GMatrix(const int& rows, const int& cols);
+ GMatrix(const GMatrix& matrix);
+ GMatrix(const GSymMatrix& matrix);
+ GMatrix(const GSparseMatrix& matrix);
virtual ~GMatrix(void);
- // Operators
- GMatrix operator+ (const GMatrix& m) const;
- GMatrix operator- (const GMatrix& m) const;
- GMatrix operator* (const GMatrix& m) const;
- GVector operator* (const GVector& v) const;
- GMatrix operator- () const;
- GMatrix& operator+= (const GMatrix& m);
- GMatrix& operator-= (const GMatrix& m);
- GMatrix& operator*= (const GMatrix& m);
- GMatrix& operator*= (const double& s);
- GMatrix& operator/= (const double& s);
+ // Implemented pure virtual base class operators
+ GVector operator*(const GVector& vector) const;
- // Methods
- void clear(void);
- void transpose(void);
- void invert(void);
- void add_col(const GVector& v, int col);
- void insert_col(const GVector& v, int col);
- GVector extract_row(int row) const;
- GVector extract_col(int col) const;
- GMatrix extract_lower_triangle(void) const;
- GMatrix extract_upper_triangle(void) const;
- double fill(void) const;
- double min(void) const;
- double max(void) const;
- double sum(void) const;
- void eulerx(const double& angle);
- void eulery(const double& angle);
- void eulerz(const double& angle);
+ // Other operators
+ GMatrix operator+(const GMatrix& matrix) const;
+ GMatrix operator-(const GMatrix& matrix) const;
+ GMatrix operator*(const GMatrix& matrix) const;
+ GMatrix operator-(void) const;
+ GMatrix& operator+=(const GMatrix& matrix);
+ GMatrix& operator-=(const GMatrix& matrix);
+ GMatrix& operator*=(const GMatrix& matrix);
+ GMatrix& operator*=(const double& scalar);
+ GMatrix& operator/=(const double& scalar);
+
+ // Implemented pure virtual base class methods
+ void clear(void);
+ void transpose(void);
+ void invert(void);
+ void add_col(const GVector& vector, const int& col);
+ void insert_col(const GVector& vector, const int& col);
+ GVector extract_row(const int& row) const;
+ GVector extract_col(const int& col) const;
+ double fill(void) const;
+ double min(void) const;
+ double max(void) const;
+ double sum(void) const;
+
+ // Other methods
+ GMatrix extract_lower_triangle(void) const;
+ GMatrix extract_upper_triangle(void) const;
+ void eulerx(const double& angle);
+ void eulery(const double& angle);
+ void eulerz(const double& angle);
};
diff --git a/pyext/GMatrixBase.i b/pyext/GMatrixBase.i
index a156c5c..94641dc 100755
--- a/pyext/GMatrixBase.i
+++ b/pyext/GMatrixBase.i
@@ -1,7 +1,7 @@
/***************************************************************************
- * GMatrixBase.hpp - Matrix abstract base class SWIG file *
+ * GMatrixBase.i - Abstract matrix base class *
* ----------------------------------------------------------------------- *
- * copyright : (C) 2006 by Jurgen Knodlseder *
+ * copyright (C) 2006-2012 by Juergen Knoedlseder *
* ----------------------------------------------------------------------- *
* *
* This program is free software: you can redistribute it and/or modify *
@@ -18,60 +18,54 @@
* along with this program. If not, see . *
* *
***************************************************************************/
+/**
+ * @file GMatrixBase.i
+ * @brief Abstract matrix base class definition
+ * @author Juergen Knoedlseder
+ */
%{
/* Put headers and other declarations here that are needed for compilation */
#include "GMatrixBase.hpp"
%}
-/***************************************************************************
- * GMatrixBase class definition *
- * ----------------------------------------------------------------------- *
- * GMatrixBase is an abstract base class for all matrix classes. It *
- * defines the common interfaces of the matrix objects and provides some *
- * common services to the derived classes. *
+/***********************************************************************//**
+ * @class GMatrixBase
+ *
+ * @brief Abstract matrix base class interface defintion
+ *
+ * This is an abstract base class for all matrix classes. It defines the
+ * common interface of the matrix objects and provides some common services
+ * to the derived classes.
***************************************************************************/
class GMatrixBase {
-
-// Methods that are available to everybody
public:
- // Constructors and destructors
- GMatrixBase();
- GMatrixBase(const GMatrixBase& m);
- virtual ~GMatrixBase();
+ // Constructors and destructors
+ GMatrixBase(void);
+ GMatrixBase(const GMatrixBase& matrix);
+ virtual ~GMatrixBase(void);
+
+ // Pure virtual operators
+ virtual GVector operator*(const GVector& vector) const = 0;
+
+ // Implemented base class operators
+ virtual bool operator==(const GMatrixBase& matrix) const;
+ virtual bool operator!=(const GMatrixBase& matrix) const;
- // Operators (first virtual, then pure virtual)
- virtual int operator== (const GMatrixBase& m) const;
- virtual int operator!= (const GMatrixBase& m) const;
- //
- //virtual GMatrixBase operator+ (const GMatrixBase& m) const = 0;
- //virtual GMatrixBase operator- (const GMatrixBase& m) const = 0;
- //virtual GMatrixBase operator* (const GMatrixBase& m) const = 0;
- virtual GVector operator* (const GVector& v) const = 0;
- //virtual GMatrixBase operator- () const = 0;
- //virtual GMatrixBase& operator+= (const GMatrixBase& m) = 0;
- //virtual GMatrixBase& operator-= (const GMatrixBase& m) = 0;
- //virtual GMatrixBase& operator*= (const GMatrixBase& m) = 0;
- //virtual GMatrixBase& operator*= (const double& s) = 0;
- //virtual GMatrixBase& operator/= (const double& s) = 0;
+ // Pure virtual methods
+ virtual void clear() = 0;
+ virtual void transpose() = 0;
+ virtual void invert() = 0;
+ virtual void add_col(const GVector& vector, const int& col) = 0;
+ virtual void insert_col(const GVector& vector, const int& col) = 0;
+ virtual GVector extract_row(const int& row) const = 0;
+ virtual GVector extract_col(const int& col) const = 0;
+ virtual double fill(void) const = 0;
+ virtual double min(void) const = 0;
+ virtual double max(void) const = 0;
+ virtual double sum(void) const = 0;
- // Methods (first virtual, then pure virtual)
- virtual int cols(void) const { return m_cols; }
- virtual int rows(void) const { return m_rows; }
- //
- //virtual void add_col(const GVector& v, int col) = 0;
- //virtual void cholesky_decompose(int compress = 1) = 0;
- //virtual GVector cholesky_solver(const GVector& v, int compress = 1) = 0;
- //virtual void cholesky_invert(int compress = 1) = 0;
- virtual void clear() = 0;
- virtual GVector extract_row(int row) const = 0;
- virtual GVector extract_col(int col) const = 0;
- //virtual GMatrix extract_lower_triangle() const = 0;
- //virtual GMatrix extract_upper_triangle() const = 0;
- //virtual void insert_col(const GVector& v, int col) = 0;
- virtual double fill() const = 0;
- virtual double min() const = 0;
- virtual double max() const = 0;
- virtual double sum() const = 0;
- virtual void transpose() = 0;
+ // Implemented base class methods
+ virtual int cols(void) const;
+ virtual int rows(void) const;
};
diff --git a/pyext/GSparseMatrix.i b/pyext/GSparseMatrix.i
index 9ee4b84..e89131c 100644
--- a/pyext/GSparseMatrix.i
+++ b/pyext/GSparseMatrix.i
@@ -1,7 +1,7 @@
/***************************************************************************
* GSparseMatrix.i - Sparse Matrix class SWIG file *
* ----------------------------------------------------------------------- *
- * copyright (C) 2008-2011 by Jurgen Knodlseder *
+ * copyright (C) 2008-2012 by Juergen Knoedlseder *
* ----------------------------------------------------------------------- *
* *
* This program is free software: you can redistribute it and/or modify *
@@ -18,13 +18,17 @@
* along with this program. If not, see . *
* *
***************************************************************************/
+/**
+ * @file GSparseMatrix.i
+ * @brief Sparse matrix class definition.
+ * @author Juergen Knoedlseder
+ */
%{
/* Put headers and other declarations here that are needed for compilation */
#include "GSparseMatrix.hpp"
#include "GTools.hpp"
%}
-%feature("notabstract") GSparseMatrix;
/***************************************************************************
* GSparseMatrix class definition *
@@ -35,64 +39,70 @@
class GSparseMatrix : public GMatrixBase {
public:
// Constructors and destructors
- GSparseMatrix(int rows, int cols, int elements = 0);
- GSparseMatrix(const GSparseMatrix& m);
- virtual ~GSparseMatrix();
+ GSparseMatrix(void);
+ GSparseMatrix(const int& rows, const int& cols, const int& elements = 0);
+ GSparseMatrix(const GMatrix& matrix);
+ GSparseMatrix(const GSymMatrix& matrix);
+ GSparseMatrix(const GSparseMatrix& matrix);
+ virtual ~GSparseMatrix(void);
- // Operators
- //GSparseMatrix& operator= (const GSparseMatrix& m);
- //double& operator() (int row, int col);
- //const double& operator() (int row, int col) const;
- GSparseMatrix operator+ (const GSparseMatrix& m) const;
- GSparseMatrix operator- (const GSparseMatrix& m) const;
- GSparseMatrix operator* (const GSparseMatrix& m) const;
- GVector operator* (const GVector& v) const;
- int operator== (const GSparseMatrix& m) const;
- int operator!= (const GSparseMatrix& m) const;
- GSparseMatrix operator- () const;
- GSparseMatrix& operator+= (const GSparseMatrix& m);
- GSparseMatrix& operator-= (const GSparseMatrix& m);
- GSparseMatrix& operator*= (const GSparseMatrix& m);
- GSparseMatrix& operator*= (const double& d);
- GSparseMatrix& operator/= (const double& d);
+ // Implemented pure virtual base class operators
+ GVector operator*(const GVector& vector) const;
- // Matrix methods
- void add_col(const GVector& v, int col);
- void add_col(const double* values, const int* rows, int number, int col);
- void cholesky_decompose(int compress = 1);
- GVector cholesky_solver(const GVector& v, int compress = 1);
- void cholesky_invert(int compress = 1);
- void clear();
- GVector extract_row(int row) const;
- GVector extract_col(int col) const;
- //TBD GSparseMatrix extract_lower_triangle() const;
- //TBD GSparseMatrix extract_upper_triangle() const;
- double fill() const;
- void insert_col(const GVector& v, int col);
- void insert_col(const double* values, const int* rows, int number, int col);
- double min() const;
- double max() const;
- void set_mem_block(int block);
- void stack_init(int size = 0, int entries = 0);
- int stack_push_column(const GVector& v, int col);
- int stack_push_column(const double* values, const int* rows,
- int number, int col);
- void stack_flush(void);
- void stack_destroy(void);
- double sum() const;
- void transpose();
+ // Overloaded virtual base class operators
+ bool operator==(const GSparseMatrix& matrix) const;
+ bool operator!=(const GSparseMatrix& matrix) const;
+
+ // Other operators
+ GSparseMatrix operator+(const GSparseMatrix& matrix) const;
+ GSparseMatrix operator-(const GSparseMatrix& matrix) const;
+ GSparseMatrix operator*(const GSparseMatrix& matrix) const;
+ GSparseMatrix operator-(void) const;
+ GSparseMatrix& operator+=(const GSparseMatrix& matrix);
+ GSparseMatrix& operator-=(const GSparseMatrix& matrix);
+ GSparseMatrix& operator*=(const GSparseMatrix& matrix);
+ GSparseMatrix& operator*=(const double& scalar);
+ GSparseMatrix& operator/=(const double& scalar);
+
+ // Implemented pure virtual base class methods
+ void clear(void);
+ void transpose(void);
+ void invert(void);
+ void add_col(const GVector& vector, const int& col);
+ void insert_col(const GVector& vector, const int& col);
+ GVector extract_row(const int& row) const;
+ GVector extract_col(const int& col) const;
+ double fill(void) const;
+ double min(void) const;
+ double max(void) const;
+ double sum(void) const;
+
+ // Other methods
+ void add_col(const double* values, const int* rows,
+ int number, const int& col);
+ void insert_col(const double* values, const int* rows,
+ int number, const int& col);
+ void cholesky_decompose(bool compress = true);
+ GVector cholesky_solver(const GVector& vector, bool compress = true);
+ void cholesky_invert(bool compress = true);
+ void set_mem_block(const int& block);
+ void stack_init(const int& size = 0, const int& entries = 0);
+ int stack_push_column(const GVector& vector, const int& col);
+ int stack_push_column(const double* values, const int* rows,
+ const int& number, const int& col);
+ void stack_flush(void);
+ void stack_destroy(void);
};
/***************************************************************************
* GSparseMatrix class SWIG extension *
+ *
+ * @todo Use typemap to allow for a [row,col] matrix access
***************************************************************************/
%extend GSparseMatrix {
char *__str__() {
- std::ostringstream buffer;
- buffer << *self;
- std::string str = buffer.str();
- return tochar(str);
+ return tochar(self->print());
}
double __getslice__(int row, int col) {
if (row >=0 && row < (int)self->rows() && col >= 0 && col < (int)self->cols())
diff --git a/pyext/GSymMatrix.i b/pyext/GSymMatrix.i
index 8cd28e6..6348331 100644
--- a/pyext/GSymMatrix.i
+++ b/pyext/GSymMatrix.i
@@ -18,13 +18,17 @@
* along with this program. If not, see . *
* *
***************************************************************************/
+/**
+ * @file GSymMatrix.i
+ * @brief SYmmetric matrix class definition.
+ * @author Juergen Knoedlseder
+ */
%{
/* Put headers and other declarations here that are needed for compilation */
#include "GSymMatrix.hpp"
#include "GTools.hpp"
%}
-%feature("notabstract") GSymMatrix;
/***********************************************************************//**
* @class GSymMatrix
@@ -38,40 +42,44 @@ class GSymMatrix : public GMatrixBase {
public:
// Constructors and destructors
GSymMatrix(void);
- GSymMatrix(int rows, int cols);
+ GSymMatrix(const int& rows, const int& cols);
GSymMatrix(const GMatrix& matrix);
GSymMatrix(const GSymMatrix& matrix);
GSymMatrix(const GSparseMatrix& matrix);
virtual ~GSymMatrix(void);
- // Operators
- GSymMatrix operator+ (const GSymMatrix& m) const;
- GSymMatrix operator- (const GSymMatrix& m) const;
- GSymMatrix operator* (const GSymMatrix& m) const;
- GVector operator* (const GVector& v) const;
- GSymMatrix operator- () const;
- GSymMatrix& operator+= (const GSymMatrix& m);
- GSymMatrix& operator-= (const GSymMatrix& m);
- GSymMatrix& operator*= (const GSymMatrix& m);
- GSymMatrix& operator*= (const double& d);
- GSymMatrix& operator/= (const double& d);
+ // Implemented pure virtual base class operators
+ virtual GVector operator*(const GVector& v) const;
- // Methods
- virtual void add_col(const GVector& v, int col);
- virtual void cholesky_decompose(int compress = 1);
- virtual GVector cholesky_solver(const GVector& v, int compress = 1);
- virtual void cholesky_invert(int compress = 1);
- virtual void clear(void);
- virtual GVector extract_row(int row) const;
- virtual GVector extract_col(int col) const;
- virtual GMatrix extract_lower_triangle() const;
- virtual GMatrix extract_upper_triangle() const;
- virtual void insert_col(const GVector& v, int col);
- virtual double fill(void) const;
- virtual double min(void) const;
- virtual double max(void) const;
- virtual double sum(void) const;
- virtual void transpose(void);
+ // Other operators
+ virtual GSymMatrix operator+(const GSymMatrix& matrix) const;
+ virtual GSymMatrix operator-(const GSymMatrix& matrix) const;
+ virtual GMatrix operator*(const GSymMatrix& matrix) const;
+ virtual GSymMatrix operator-(void) const;
+ virtual GSymMatrix& operator+=(const GSymMatrix& matrix);
+ virtual GSymMatrix& operator-=(const GSymMatrix& matrix);
+ virtual GSymMatrix& operator*=(const double& scaler);
+ virtual GSymMatrix& operator/=(const double& scalar);
+
+ // Implemented pure virtual base class methods
+ virtual void clear(void);
+ virtual void transpose(void);
+ virtual void invert(void);
+ virtual void add_col(const GVector& vector, const int& col);
+ virtual void insert_col(const GVector& vector, const int& col);
+ virtual GVector extract_row(const int& row) const;
+ virtual GVector extract_col(const int& col) const;
+ virtual double fill(void) const;
+ virtual double min(void) const;
+ virtual double max(void) const;
+ virtual double sum(void) const;
+
+ // Other methods
+ virtual GMatrix extract_lower_triangle(void) const;
+ virtual GMatrix extract_upper_triangle(void) const;
+ virtual void cholesky_decompose(bool compress = true);
+ virtual GVector cholesky_solver(const GVector& vector, bool compress = true);
+ virtual void cholesky_invert(bool compress = true);
};
diff --git a/pyext/gammalib/linalg.i b/pyext/gammalib/linalg.i
index 182b500..cc5a068 100644
--- a/pyext/gammalib/linalg.i
+++ b/pyext/gammalib/linalg.i
@@ -33,7 +33,6 @@
/* __ Linear Algebra _____________________________________________________ */
%include "GVector.i"
%include "GMatrixBase.i"
-//%include "GMatrixTools.i"
%include "GMatrix.i"
%include "GSymMatrix.i"
%include "GSparseMatrix.i"
diff --git a/src/linalg/GMatrixTools.cpp b/src/linalg/GMatrixTools.cpp
deleted file mode 100644
index 475f972..0000000
--- a/src/linalg/GMatrixTools.cpp
+++ /dev/null
@@ -1,164 +0,0 @@
-/***************************************************************************
- * GMatrixTools.cpp - Matrix tools *
- * ----------------------------------------------------------------------- *
- * copyright (C) 2009 by Jurgen Knodlseder *
- * ----------------------------------------------------------------------- *
- * *
- * This program is free software: you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation, either version 3 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program. If not, see . *
- * *
- ***************************************************************************/
-
-/* __ Includes ___________________________________________________________ */
-#include "GMatrixTools.hpp"
-
-/* __ Method name definitions ____________________________________________ */
-#define G_SYM_1 "GSymMatrix sym_matrix(const GMatrix&)"
-#define G_SYM_2 "GSymMatrix sym_matrix(const GMatrixSparse&)"
-
-
-/***********************************************************************//**
- * @brief GSymMatrix to GMatrix storage class convertor
- *
- * @param[in] m GSymMatrix to be converted
- ***************************************************************************/
-GMatrix matrix(const GSymMatrix& m)
-{
- // Allocate matrix
- GMatrix result = GMatrix(m.rows(), m.cols());
-
- // Fill matrix
- for (int col = 0; col < m.cols(); ++col) {
- for (int row = 0; row < m.rows(); ++row)
- result(row, col) = m(row, col);
- }
-
- // Return
- return result;
-}
-
-
-/***********************************************************************//**
- * @brief GSparseMatrix to GMatrix storage class convertor
- *
- * @param[in] m GSparseMatrix to be converted
- ***************************************************************************/
-GMatrix matrix(const GSparseMatrix& m)
-{
- // Allocate matrix
- GMatrix result = GMatrix(m.rows(), m.cols());
-
- // Fill matrix
- for (int col = 0; col < m.cols(); ++col) {
- for (int row = 0; row < m.rows(); ++row)
- result(row, col) = m(row, col);
- }
-
- // Return
- return result;
-}
-
-
-/***********************************************************************//**
- * @brief GMatrix to GSymMatrix storage class convertor
- *
- * @param[in] m GMatrix to be converted
- ***************************************************************************/
-GSymMatrix sym_matrix(const GMatrix& m)
-{
- // Allocate matrix
- GSymMatrix result = GSymMatrix(m.rows(), m.cols());
-
- // Fill matrix
- for (int col = 0; col < m.cols(); ++col) {
- for (int row = col; row < m.rows(); ++row) {
- double value_ll = m(row,col);
- double value_ur = m(col,row);
- if (value_ll != value_ur)
- throw GException::matrix_not_symmetric(G_SYM_1, m.rows(), m.cols());
- result(row, col) = m(row, col);
- }
- }
-
- // Return
- return result;
-}
-
-
-/***********************************************************************//**
- * @brief GSparseMatrix to GSymMatrix storage class convertor
- *
- * @param[in] m GSparseMatrix to be converted
- ***************************************************************************/
-GSymMatrix sym_matrix(const GSparseMatrix& m)
-{
- // Allocate matrix
- GSymMatrix result = GSymMatrix(m.rows(), m.cols());
-
- // Fill matrix
- for (int col = 0; col < m.cols(); ++col) {
- for (int row = col; row < m.rows(); ++row) {
- double value_ll = m(row,col);
- double value_ur = m(col,row);
- if (value_ll != value_ur)
- throw GException::matrix_not_symmetric(G_SYM_2, m.rows(), m.cols());
- result(row, col) = m(row, col);
- }
- }
-
- // Return
- return result;
-}
-
-
-/***********************************************************************//**
- * @brief GMatrix to GSparseMatrix storage class convertor
- *
- * @param[in] m GMatrix to be converted
- ***************************************************************************/
-GSparseMatrix sparse_matrix(const GMatrix& m)
-{
- // Allocate matrix
- GSparseMatrix result = GSparseMatrix(m.rows(), m.cols());
-
- // Fill matrix
- for (int col = 0; col < m.cols(); ++col) {
- for (int row = 0; row < m.rows(); ++row)
- result(row, col) = m(row, col);
- }
-
- // Return
- return result;
-}
-
-
-/***********************************************************************//**
- * @brief GSymMatrix to GSparseMatrix storage class convertor
- *
- * @param[in] m GSymMatrix to be converted
- ***************************************************************************/
-GSparseMatrix sparse_matrix(const GSymMatrix& m)
-{
- // Allocate matrix
- GSparseMatrix result = GSparseMatrix(m.rows(), m.cols());
-
- // Fill matrix
- for (int col = 0; col < m.cols(); ++col) {
- for (int row = 0; row < m.rows(); ++row)
- result(row, col) = m(row, col);
- }
-
- // Return
- return result;
-}
-
diff --git a/src/linalg/Makefile.am b/src/linalg/Makefile.am
index fa68692..2de124e 100644
--- a/src/linalg/Makefile.am
+++ b/src/linalg/Makefile.am
@@ -7,7 +7,6 @@ INCLUDES = -I$(top_srcdir)/include \
# Define sources for this directory
sources = GVector.cpp \
- GMatrixTools.cpp \
GMatrixBase.cpp \
GMatrix.cpp \
GSymMatrix.cpp \