38 numRows(nRows), numCols(nCols), theVec(nRows * nCols)
58 theVec.resize(nRows * nCols);
68 for (
unsigned int j = 0; j <
numCols; ++j) {
69 aResult(j,
i) =
theVec[numCols *
i + j];
95 for (
unsigned int j = 0; j <
numCols; ++j) {
97 std::cout << std::endl << std::setw(4) <<
i <<
"," 98 << std::setw(4) << j <<
"-" << std::setw(4)
110 for (
unsigned int i = 0;
i < this->
numRows; ++
i) {
112 for (
unsigned int j = 0; j < this->
numCols; ++j) {
113 sum +=
theVec[numCols *
i + j] * aVector(j);
125 for (
unsigned int j = 0; j < aMatrix.
numCols; ++j) {
128 sum +=
theVec[numCols *
i +
k] * aMatrix(
k, j);
140 for (
unsigned int j = 0; j <
numCols; ++j) {
141 aResult(
i, j) =
theVec[numCols *
i + j] + aMatrix(
i, j);
149 if (
this != &aMatrix) {
154 for (
unsigned int j = 0; j <
numCols; ++j) {
155 theVec[numCols *
i + j] = aMatrix(
i, j);
177 theVec.resize((nRows * nRows + nRows) / 2);
192 for (
unsigned int j = 0; j <=
i; ++j) {
194 std::cout << std::endl << std::setw(4) <<
i <<
"," 195 << std::setw(4) << j <<
"-" << std::setw(4)
208 for (
unsigned int j = 0; j <=
i; ++j) {
209 aResult(
i, j) =
theVec[(
i *
i +
i) / 2 + j] - aMatrix(
i, j);
220 for (
unsigned int j = 0; j <
i; ++j) {
221 aResult(j) +=
theVec[(i * i +
i) / 2 + j] * aVector(i);
222 aResult(i) +=
theVec[(i * i +
i) / 2 + j] * aVector(j);
232 for (
unsigned int l = 0;
l < nCol; ++
l) {
235 for (
unsigned int j = 0; j <
i; ++j) {
236 aResult(j,
l) +=
theVec[(i * i +
i) / 2 + j] * aMatrix(i,
l);
237 aResult(i,
l) +=
theVec[(i * i +
i) / 2 + j] * aMatrix(j,
l);
275 std::memcpy(&aResult.
theVec[0], &
theVec[start],
sizeof(
double) * len);
286 sizeof(
double) * aVector.
numRows);
303 std::cout << std::endl << std::setw(4) <<
i <<
"-" << std::setw(4)
322 if (
this != &aVector) {
350 const double eps = 1.0E-10;
352 std::vector<int>
next(aSize);
353 std::vector<double> diag(aSize);
357 for (
int i = 1;
i <= nSize; ++
i) {
359 diag[
i - 1] = fabs(
theVec[(
i *
i +
i) / 2 - 1]);
361 next[aSize - 1] = -1;
363 unsigned int nrank = 0;
364 for (
int i = 1;
i <= nSize; ++
i) {
373 int jj = (j * j + j) / 2 - 1;
384 int kk = (k * k +
k) / 2 - 1;
388 next[last - 1] = next[k - 1];
397 for (
int j = 1; j <= nSize; ++j) {
412 for (
int l = 1;
l <= k - 1; ++
l) {
419 for (
int l = k + 1;
l <= j; ++
l) {
425 for (
int l = 1;
l <= j; ++
l) {
434 for (
int k = 1; k <= nSize; ++
k) {
435 if (next[k - 1] >= 0) {
436 int kk = (k * k -
k) / 2 - 1;
437 for (
int j = 1; j <= nSize; ++j) {
438 if (next[j - 1] >= 0) {
447 for (
int ij = 0; ij < (nSize * nSize + nSize) / 2; ++ij) {
VVector getVec(unsigned int len, unsigned int start=0) const
Get part of vector.
void print() const
Print matrix.
unsigned int getNumRows() const
Get number of rows.
VVector operator*(const VVector &aVector) const
Multiplication Matrix*Vector.
Simple Matrix based on std::vector<double>
VVector(const unsigned int nRows=0)
VVector operator*(const VVector &aVector) const
Multiplication SymMatrix*Vector.
unsigned int invert()
Matrix inversion.
void print() const
Print vector.
void putVec(const VVector &aVector, unsigned int start=0)
Put part of vector.
void resize(const unsigned int nRows, const unsigned int nCols)
Resize Matrix.
unsigned int numCols
Number of columns.
VVector operator-(const VVector &aVector) const
Subtraction Vector-Vector.
unsigned int getNumRows() const
Get number of rows.
void resize(const unsigned int nRows)
Resize symmetric matrix.
VMatrix transpose() const
Get transposed matrix.
VSymMatrix(const unsigned int nRows=0)
void resize(const unsigned int nRows)
Resize vector.
unsigned int numRows
Number of rows.
Namespace for the general broken lines package.
Simple symmetric Matrix based on std::vector<double>
VMatrix & operator=(const VMatrix &aMatrix)
Assignment Matrix=Matrix.
unsigned int numRows
Number of rows.
VVector & operator=(const VVector &aVector)
Assignment Vector=Vector.
void print() const
Print matrix.
std::vector< double > theVec
Data (symmetric storage)
unsigned int getNumCols() const
Get number of columns.
Simple Vector based on std::vector<double>
unsigned int getNumRows() const
Get number of rows (= number of colums).
std::vector< double > theVec
Data.
std::vector< double > theVec
Data.
VMatrix(const unsigned int nRows=0, const unsigned int nCols=0)
unsigned int numRows
Number of rows.
VMatrix operator+(const VMatrix &aMatrix) const
Addition Matrix+Matrix.
VSymMatrix operator-(const VMatrix &aMatrix) const
Subtraction SymMatrix-(sym)Matrix.