10#include "mspass/utility/MsPASSError.h"
11#include <boost/archive/binary_iarchive.hpp>
12#include <boost/archive/binary_oarchive.hpp>
13#include <boost/serialization/vector.hpp>
40 std::ostringstream oss;
41 oss <<
"dmatrix object: indexing error" << std::endl
42 <<
"Matrix index (" << row <<
"," << column
43 <<
")is outside range = " << nrr <<
"," << ncc << std::endl;
45 badness = ErrorSeverity::Invalid;
75 std::ostringstream oss;
76 oss <<
"dmatrix class: size mismatch error in binary operator"
78 <<
"matrix on left is " << nrow1 <<
"X" << ncol1
79 <<
" while matrix on right is " << nrow2 <<
"X" << ncol2 << std::endl;
81 badness = ErrorSeverity::Invalid;
87 size_t nrow1, ncol1, nrow2, ncol2;
114 dmatrix(
const size_t nr,
const size_t nc);
128 double operator()(
const size_t rowindex,
const size_t colindex)
const;
230 double *get_address(
size_t r,
size_t c)
const;
248 std::vector<size_t>
size()
const;
253 std::vector<double> ary;
258 friend class boost::serialization::access;
259 template <
class Archive>
260 void serialize(Archive &ar,
const unsigned int version) {
261 ar & nrr & ncc & length;
Base class for error object thrown by MsPASS library routines.
Definition MsPASSError.h:38
std::string message
Definition MsPASSError.h:108
ErrorSeverity badness
Definition MsPASSError.h:110
special convenience class for matrix indexing errors.
Definition dmatrix.h:25
dmatrix_index_error(const size_t nrmax, const size_t ncmax, const size_t ir, const size_t ic)
Definition dmatrix.h:34
Convenience class for dmatrix use errors.
Definition dmatrix.h:60
dmatrix_size_error(const size_t nr1, const size_t nc1, const size_t nr2, const size_t nc2)
Definition dmatrix.h:69
Lightweight, simple matrix object.
Definition dmatrix.h:104
dmatrix & operator=(const dmatrix &other)
Definition dmatrix.cc:93
size_t rows() const
Definition dmatrix.cc:215
dmatrix & operator-=(const dmatrix &other)
Subtract one matrix to another.
Definition dmatrix.cc:112
dmatrix & operator+=(const dmatrix &other)
Add one matrix to another.
Definition dmatrix.cc:103
friend std::ostream & operator<<(std::ostream &os, dmatrix &A)
Text output operator.
friend dmatrix operator*(const dmatrix &A, const dmatrix &B)
Procedure to multiply two matrices. This could be implemented with a dmatrix::operator but this was a...
Definition dmatrix.cc:140
std::vector< size_t > size() const
Return a vector with 2 elements giving the size.
Definition dmatrix.cc:207
dmatrix operator+(const dmatrix &other) const
Definition dmatrix.cc:121
void zero()
Definition dmatrix.cc:203
size_t columns() const
Definition dmatrix.cc:216
dmatrix operator-(const dmatrix &other) const
Definition dmatrix.cc:130
friend dmatrix tr(const dmatrix &A) noexcept
Transpose a matrix.
Definition dmatrix.cc:183
double operator()(const size_t rowindex, const size_t colindex) const
Definition dmatrix.cc:39
dmatrix()
Definition dmatrix.cc:8
~dmatrix()
Definition dmatrix.cc:35
A vector compatible with dmatrix objects.
Definition dmatrix.h:273
dvector & operator=(const dvector &other)
Definition dmatrix.cc:219
dvector()
Definition dmatrix.h:276
friend dvector operator*(const dmatrix &A, const dvector &x)
Definition dmatrix.cc:239
double & operator()(size_t rowindex)
Definition dmatrix.cc:234
dvector(size_t nrv)
Definition dmatrix.h:278