13 numRows(nRows), numCols(nCols), theVec(nRows * nCols) {
17 numRows(aMatrix.numRows), numCols(aMatrix.numCols), theVec(
33 theVec.resize(nRows * nCols);
42 for (
unsigned int i = 0; i <
numRows; ++i) {
43 for (
unsigned int j = 0; j <
numCols; ++j) {
44 aResult(j, i) =
theVec[numCols * i + j];
68 std::cout <<
" VMatrix: " <<
numRows <<
"*" <<
numCols << std::endl;
69 for (
unsigned int i = 0; i <
numRows; ++i) {
70 for (
unsigned int j = 0; j <
numCols; ++j) {
72 std::cout << std::endl << std::setw(4) << i <<
","
73 << std::setw(4) << j <<
"-" << std::setw(4)
74 << std::min(j + 4, numCols) <<
":";
76 std::cout << std::setw(13) <<
theVec[numCols * i + j];
79 std::cout << std::endl << std::endl;
85 for (
unsigned int i = 0; i < this->
numRows; ++i) {
87 for (
unsigned int j = 0; j < this->
numCols; ++j) {
88 sum +=
theVec[numCols * i + j] * aVector(j);
99 for (
unsigned int i = 0; i <
numRows; ++i) {
100 for (
unsigned int j = 0; j < aMatrix.
numCols; ++j) {
102 for (
unsigned int k = 0; k <
numCols; ++k) {
103 sum +=
theVec[numCols * i + k] * aMatrix(k, j);
114 for (
unsigned int i = 0; i <
numRows; ++i) {
115 for (
unsigned int j = 0; j <
numCols; ++j) {
116 aResult(i, j) =
theVec[numCols * i + j] + aMatrix(i, j);
125 numRows(nRows), theVec((nRows * nRows + nRows) / 2) {
137 theVec.resize((nRows * nRows + nRows) / 2);
150 std::cout <<
" VSymMatrix: " <<
numRows <<
"*" <<
numRows << std::endl;
151 for (
unsigned int i = 0; i <
numRows; ++i) {
152 for (
unsigned int j = 0; j <= i; ++j) {
154 std::cout << std::endl << std::setw(4) << i <<
","
155 << std::setw(4) << j <<
"-" << std::setw(4)
156 << std::min(j + 4, i) <<
":";
158 std::cout << std::setw(13) <<
theVec[(i * i + i) / 2 + j];
161 std::cout << std::endl << std::endl;
167 for (
unsigned int i = 0; i <
numRows; ++i) {
168 for (
unsigned int j = 0; j <= i; ++j) {
169 aResult(i, j) =
theVec[(i * i + i) / 2 + j] - aMatrix(i, j);
178 for (
unsigned int i = 0; i <
numRows; ++i) {
179 aResult(i) =
theVec[(i * i + i) / 2 + i] * aVector(i);
180 for (
unsigned int j = 0; j < i; ++j) {
181 aResult(j) +=
theVec[(i * i + i) / 2 + j] * aVector(i);
182 aResult(i) +=
theVec[(i * i + i) / 2 + j] * aVector(j);
192 for (
unsigned int l = 0; l < nCol; ++l) {
193 for (
unsigned int i = 0; i <
numRows; ++i) {
194 aResult(i, l) =
theVec[(i * i + i) / 2 + i] * aMatrix(i, l);
195 for (
unsigned int j = 0; j < i; ++j) {
196 aResult(j, l) +=
theVec[(i * i + i) / 2 + j] * aMatrix(i, l);
197 aResult(i, l) +=
theVec[(i * i + i) / 2 + j] * aMatrix(j, l);
207 numRows(nRows), theVec(nRows) {
211 numRows(aVector.numRows), theVec(aVector.theVec) {
235 std::memcpy(&aResult.
theVec[0], &
theVec[start],
sizeof(
double) * len);
246 sizeof(
double) * aVector.
numRows);
259 std::cout <<
" VVector: " <<
numRows << std::endl;
260 for (
unsigned int i = 0; i <
numRows; ++i) {
263 std::cout << std::endl << std::setw(4) << i <<
"-" << std::setw(4)
264 << std::min(i + 4, numRows) <<
":";
266 std::cout << std::setw(13) <<
theVec[i];
268 std::cout << std::endl << std::endl;
274 for (
unsigned int i = 0; i <
numRows; ++i) {
275 aResult(i) =
theVec[i] - aVector(i);
298 const double eps = 1.0E-10;
300 std::vector<int> next(aSize);
301 std::vector<double> diag(aSize);
305 for (
int i = 1; i <= nSize; ++i) {
307 diag[i - 1] = fabs(
theVec[(i * i + i) / 2 - 1]);
309 next[aSize - 1] = -1;
311 unsigned int nrank = 0;
312 for (
int i = 1; i <= nSize; ++i) {
321 int jj = (j * j + j) / 2 - 1;
322 if (fabs(
theVec[jj]) > std::max(fabs(vkk), eps * diag[j - 1])) {
332 int kk = (k * k + k) / 2 - 1;
336 next[last - 1] = next[k - 1];
345 for (
int j = 1; j <= nSize; ++j) {
360 for (
int l = 1; l <= k - 1; ++l) {
367 for (
int l = k + 1; l <= j; ++l) {
373 for (
int l = 1; l <= j; ++l) {
382 for (
int k = 1; k <= nSize; ++k) {
383 if (next[k - 1] >= 0) {
384 int kk = (k * k - k) / 2 - 1;
385 for (
int j = 1; j <= nSize; ++j) {
386 if (next[j - 1] >= 0) {
395 for (
int ij = 0; ij < (nSize * nSize + nSize) / 2; ++ij) {