45 std::vector<long double> element(1);
46 M_.push_back(element);
53 std::vector<long double> row(m);
70 return M_[i - 1][j - 1];
75 M_[i - 1][j - 1] = aij;
80 return M_[i - 1][j - 1];
86 int size = row.size();
95 std::cout.setf(std::ios::showpoint);
96 std::cout.setf(std::ios::scientific);
99 std::cout << std::setiosflags(std::ios::fixed) << std::setprecision(10);
102 if (M_.capacity() == 1 && M_[0].capacity() == 1) {
103 std::cout <<
"[ " << M_[0][0] <<
" ]" << std::endl;
106 for (
int i = 0; i < rows_; i++) {
109 for (
int j = 0; j < cols_ - 1; j++) {
110 std::cout <<
" " << std::setw(9) << M_[i][j] <<
" ";
112 std::cout << std::setw(9) << M_[i][cols_ - 1] <<
" ]" << std::endl;
126 std::vector<long double> row(cols_);
127 M_.assign(rows_, row);
130 for (
int i = 0; i < rows_; i++) {
131 for (
int j = 0; j < cols_; j++) {
132 M_[i][j] = rhs.M_[i][j];
143 if (this->rows_ == rhs.rows_ && this->cols_ == rhs.cols_) {
145 for (
int i = 0; i < rows_; i++) {
146 for (
int j = 0; j < cols_; j++) {
147 M_[i][j] += rhs.M_[i][j];
158 if (this->rows_ == rhs.rows_ && this->cols_ == rhs.cols_) {
160 for (
int i = 0; i < rows_; i++) {
161 for (
int j = 0; j < cols_; j++) {
162 M_[i][j] -= rhs.M_[i][j];
181 LMatrix temp(this->rows_, rhs.cols_);
185 if (this->cols_ == rhs.rows_) {
188 for (
int i = 0; i < rows_; i++) {
189 for (
int j = 0; j < rhs.cols_; j++) {
194 for (
int k = 0; k < rows_; k++) {
195 aij = aij + M_[i][k] * rhs.M_[k][j];
239 for (
int i = 0; i < A.rows_; i++) {
240 for (
int j = 0; j < A.cols_; j++) {
241 aij = A(i + 1, j + 1) * k;
256 for (
int i = 0; i < A.rows_; i++) {
257 for (
int j = 0; j < A.cols_; j++) {
258 aij = A(i + 1, j + 1) * k;
273 if (A.cols_ == A.rows_) {
274 for (
int i = 0; i < k - 1; i++) {
287 for (
int i = 0; i < n ; i++) {
const LMatrix & operator*=(const LMatrix &rhs)
const LMatrix & operator=(const LMatrix &rhs)
void SetElement(int i, int j, long double aij)
void AddRow(std::vector< long double > row)
const LMatrix & operator-=(const LMatrix &rhs)
const long double & operator()(int i, int j) const
const LMatrix & operator+=(const LMatrix &rhs)
taken directly from OsiSolverInterface.cpp on 2/17/14 from https://projects.coin-or....
LMatrix operator-(const LMatrix &lhs, const LMatrix &rhs)
LMatrix operator+(const LMatrix &lhs, const LMatrix &rhs)
LMatrix operator^(const LMatrix &A, const int k)
LMatrix operator*(const LMatrix &lhs, const LMatrix &rhs)