7 #include <gsl/gsl_matrix.h> 20 gsl_matrix_view _view;
36 _view = gsl_matrix_view_array(f, nr, nc);
43 inline const gsl_matrix *
gsl()
const {
return &_view.matrix; }
49 inline gsl_matrix *
gsl() {
return &_view.matrix; }
58 public IMBlas<Matrix, Vector>,
68 gsl_matrix *_matrix =
nullptr;
82 explicit inline Matrix(
size_t rows,
size_t columns) {
83 _matrix = gsl_matrix_calloc(rows, columns);
93 explicit inline Matrix(
size_t rows,
size_t columns,
double val)
95 gsl_matrix_set_all(gsl(), val);
103 inline Matrix(std::initializer_list<std::initializer_list<double>> lst)
107 size_t irows = lst.size();
110 for (
const auto &row : lst) {
111 iclmns = std::max(iclmns, row.size());
114 _matrix = gsl_matrix_calloc(irows, iclmns);
118 for (
const auto &l : lst) {
119 for (
const auto &val : l) {
121 gsl_matrix_set(gsl(), i, j, val);
134 :
Matrix(m.rows(), m.columns()) {
135 gsl_matrix_memcpy(gsl(), m.
gsl());
144 std::swap(_matrix, m._matrix);
152 if (_matrix !=
nullptr) {
153 gsl_matrix_free(_matrix);
161 inline const gsl_matrix *
gsl()
const {
return *&_matrix; }
167 inline gsl_matrix *
gsl() {
return *&_matrix; }
176 if (_matrix !=
nullptr) {
178 gsl_matrix_free(gsl());
183 gsl_matrix_memcpy(gsl(), m.
gsl());
195 if (_matrix !=
nullptr) {
197 gsl_matrix_free(gsl());
201 std::swap(_matrix, m._matrix);
213 gsl_matrix_set_identity(m.gsl());
Matrix(size_t rows, size_t columns)
Matrix Konstruktor erzeugt eine Nullmatrix.
Matrix(std::initializer_list< std::initializer_list< double >> lst)
Matrix Konstruktor.
The Matrix class Schnittstelle zur gsl Bibliothek.
The IMMinMax class Suche das minimale und maximale Element einer Matrix.
Matrix(size_t rows, size_t columns, double val)
Matrix Konstruktor in der alle Elemente denselben Wert haben.
Matrix(Matrix &&m)
Matrix move Konstruktor.
The IRowColumns struct Kopien von Spalten und Reihen erzeugen.
The IMBase class Basisfunktionalität für eine gsl-Matrix in Form einer Komponente T ist die Klasse...
The IRowColumns struct erzeugt Sichten auf Reihen und Spalten einer Matrix.
Matrix(const Matrix &m)
Matrix Kopierkonstruktor.
static Matrix identity(size_t N)
identity Erzeugt eine NxN Einheitsmatrix
Matrix & operator=(Matrix &&m)
operator = Move-Zuweisungsoperator
The IMCalc class kombinierte Rechenoperationen und Zuweisungen.
size_t columns() const
columns
The IMBlas class Schnittstelle zur BLAS mit Funktionen für Matrix-Vektor- und Matrix-Matrix-Multiplik...
Matrix & operator=(const Matrix &m)
operator = erzeuge Kopie
gsl_matrix * gsl()
gsl_vec ermöglicht direkten Zugriff auf gsl Funktionen
const gsl_matrix * gsl() const
gsl_vec ermöglicht direkten Zugriff auf gsl Funktionen
MatrixView(gsl_matrix_view v)
MView Konstruktor.
The MView class Sicht auf eine gsl-Matrix.
double f(double x, void *params)
f
MatrixView(size_t nr, size_t nc, double f[])
MView Konstruktor Sicht auf C-Feld.
const gsl_matrix * gsl() const
gsl ermöglicht direkten Zugriff auf gsl Funktionen
gsl_matrix * gsl()
gsl ermöglicht direkten Zugriff auf gsl Funktionen
Matrix()
Matrix Konstruktor erzeugt eine leere Matrix ohne Speicherreservierung.