10 #include <boost/serialization/vector.hpp>
11 #include <boost/archive/binary_oarchive.hpp>
12 #include <boost/archive/binary_iarchive.hpp>
13 #include "mspass/utility/MsPASSError.h"
37 const size_t ncmax,
const size_t ir,
const size_t ic)
39 row = ir; column=ic; nrr=nrmax; ncc=ncmax;
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;
70 const size_t nr2,
const size_t nc2)
72 nrow1=nr1; ncol1=nc1;nrow2=nr2;ncol2=nc2;
73 std::ostringstream oss;
74 oss <<
"dmatrix class: size mismatch error in binary operator"<<std::endl
75 <<
"matrix on left is "<< nrow1 <<
"X" << ncol1
76 <<
" while matrix on right is "
77 << nrow2 <<
"X" << ncol2 << std::endl;
79 badness = ErrorSeverity::Invalid;
84 size_t nrow1, ncol1, nrow2, ncol2;
112 dmatrix(
const size_t nr,
const size_t nc);
126 double operator()(
const size_t rowindex,
const size_t colindex)
const;
224 double* get_address(
size_t r,
size_t c)
const;
242 std::vector<size_t>
size()
const;
246 std::vector<double> ary;
250 friend class boost::serialization::access;
251 template<
class Archive>
void serialize(Archive & ar,
252 const unsigned int version)
254 ar & nrr & ncc & length;
Base class for error object thrown by MsPASS library routines.
Definition: MsPASSError.h:40
std::string message
Definition: MsPASSError.h:109
ErrorSeverity badness
Definition: MsPASSError.h:116
special convenience class for matrix indexing errors.
Definition: dmatrix.h:27
dmatrix_index_error(const size_t nrmax, const size_t ncmax, const size_t ir, const size_t ic)
Definition: dmatrix.h:36
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:102
dmatrix & operator=(const dmatrix &other)
Definition: dmatrix.cc:89
friend std::ostream & operator<<(std::ostream &os, dmatrix &A)
Text output operator.
size_t rows() const
Definition: dmatrix.cc:228
dmatrix & operator-=(const dmatrix &other)
Subtract one matrix to another.
Definition: dmatrix.cc:111
dmatrix & operator+=(const dmatrix &other)
Add one matrix to another.
Definition: dmatrix.cc:101
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:139
std::vector< size_t > size() const
Return a vector with 2 elements giving the size.
Definition: dmatrix.cc:219
dmatrix operator+(const dmatrix &other) const
Definition: dmatrix.cc:121
void zero()
Definition: dmatrix.cc:215
size_t columns() const
Definition: dmatrix.cc:232
dmatrix operator-(const dmatrix &other) const
Definition: dmatrix.cc:129
friend dmatrix tr(const dmatrix &A) noexcept
Transpose a matrix.
Definition: dmatrix.cc:190
double operator()(const size_t rowindex, const size_t colindex) const
Definition: dmatrix.cc:44
dmatrix()
Definition: dmatrix.cc:8
~dmatrix()
Definition: dmatrix.cc:39
A vector compatible with dmatrix objects.
Definition: dmatrix.h:267
dvector & operator=(const dvector &other)
Definition: dmatrix.cc:238
dvector()
Definition: dmatrix.h:270
friend dvector operator*(const dmatrix &A, const dvector &x)
Definition: dmatrix.cc:262
double & operator()(size_t rowindex)
Definition: dmatrix.cc:256
dvector(size_t nrv)
Definition: dmatrix.h:272