69 const std::vector<unsigned int>* anIndex,
70 const std::vector<double>* aVector) {
72 for (
unsigned int i = 0; i < anIndex->size(); ++i) {
73 int iIndex = (*anIndex)[i] - 1;
74 for (
unsigned int j = 0; j <= i; ++j) {
75 int jIndex = (*anIndex)[j] - 1;
76 if (iIndex < nBorder) {
77 theBorder(iIndex, jIndex) += (*aVector)[i] * aWeight
79 }
else if (jIndex < nBorder) {
80 theMixed(jIndex, iIndex - nBorder) += (*aVector)[i] * aWeight
83 unsigned int nBand = iIndex - jIndex;
84 theBand(nBand, jIndex - nBorder) += (*aVector)[i] * aWeight
98 const std::vector<unsigned int> anIndex)
const {
100 TMatrixDSym aMatrix(anIndex.size());
102 for (
unsigned int i = 0; i < anIndex.size(); ++i) {
103 int iIndex = anIndex[i] - 1;
104 for (
unsigned int j = 0; j <= i; ++j) {
105 int jIndex = anIndex[j] - 1;
106 if (iIndex < nBorder) {
107 aMatrix(i, j) =
theBorder(iIndex, jIndex);
108 }
else if (jIndex < nBorder) {
109 aMatrix(i, j) = -
theMixed(jIndex, iIndex - nBorder);
111 unsigned int nBand = iIndex - jIndex;
112 aMatrix(i, j) =
theBand(nBand, jIndex - nBorder);
114 aMatrix(j, i) = aMatrix(i, j);
163 const VVector borderSolution = inverseBorder * auxVec;
167 aSolution.
putVec(borderSolution);
181 std::cout <<
"Border part " << std::endl;
183 std::cout <<
"Mixed part " << std::endl;
185 std::cout <<
"Band part " << std::endl;
204 for (
int i = 0; i < nCol; ++i) {
205 auxVec(i) =
theBand(0, i) * 16.0;
207 for (
int i = 0; i < nCol; ++i) {
217 for (
int j = 1; j <
std::min(nRow, nCol - i); ++j) {
219 for (
int k = 0;
k <
std::min(nRow, nCol - i) - j; ++
k) {
238 VVector aSolution(aRightHandSide);
239 for (
int i = 0; i < nCol; ++i)
241 for (
int j = 1; j <
std::min(nRow, nCol - i); ++j) {
242 aSolution(j + i) -=
theBand(j, i) * aSolution(i);
245 for (
int i = nCol - 1; i >= 0; i--)
247 double rxw =
theBand(0, i) * aSolution(i);
248 for (
int j = 1; j <
std::min(nRow, nCol - i); ++j) {
249 rxw -=
theBand(j, i) * aSolution(j + i);
267 VMatrix aSolution(aRightHandSide);
268 for (
unsigned int iBorder = 0; iBorder <
numBorder; iBorder++) {
269 for (
int i = 0; i < nCol; ++i)
271 for (
int j = 1; j <
std::min(nRow, nCol - i); ++j) {
272 aSolution(iBorder, j + i) -=
theBand(j, i)
273 * aSolution(iBorder, i);
276 for (
int i = nCol - 1; i >= 0; i--)
278 double rxw =
theBand(0, i) * aSolution(iBorder, i);
279 for (
int j = 1; j <
std::min(nRow, nCol - i); ++j) {
280 rxw -=
theBand(j, i) * aSolution(iBorder, j + i);
282 aSolution(iBorder, i) = rxw;
296 VMatrix inverseBand(nRow, nCol);
298 for (
int i = nCol - 1; i >= 0; i--) {
300 for (
int j = i; j >=
std::max(0, i - nRow + 1); j--) {
301 for (
int k = j + 1;
k <
std::min(nCol, j + nRow); ++
k) {
302 rxw -= inverseBand(
abs(i -
k), std::min(i,
k))
305 inverseBand(i - j, j) = rxw;
322 VMatrix aBand((nBand + 1), nCol);
323 for (
int i = 0; i < nCol; ++i) {
324 for (
int j =
std::max(0, i - nBand); j <= i; ++j) {
326 for (
int l = 0; l < nBorder; ++l) {
327 sum += anArray(i, l) * aSymArray(l, l) * anArray(j, l);
328 for (
int k = 0;
k < l; ++
k) {
329 sum += anArray(i, l) * aSymArray(l,
k) * anArray(j,
k)
330 + anArray(i,
k) * aSymArray(l,
k) * anArray(j, l);
333 aBand(i - j, j) = sum;