25#include "fasp_functs.h"
72 const INT MIN_ITER = 0;
79 const REAL cr_max = 0.99;
80 const REAL cr_min = 0.174;
86 REAL r_norm, r_normb, gamma, t;
91 REAL r_norm_old = 0.0;
93 INT restart_max = restart;
96 INT Restart = restart;
97 INT Restart1 = Restart + 1;
98 unsigned LONG worksize = (Restart + 4) * (Restart + n) + 1 - n;
101 REAL * c = NULL, *s = NULL, *rs = NULL;
102 REAL * norms = NULL, *r = NULL, *w = NULL;
104 REAL **p = NULL, **hh = NULL;
107 if (PrtLvl >
PRINT_NONE) printf(
"\nCalling VGMRes solver (CSR) ...\n");
110 printf(
"### DEBUG: [-Begin-] %s ...\n", __FUNCTION__);
111 printf(
"### DEBUG: maxit = %d, tol = %.4le\n", MaxIt, tol);
118 while ((work == NULL) && (Restart > 5)) {
119 Restart = Restart - 5;
120 worksize = (Restart + 4) * (Restart + n) + 1 - n;
122 Restart1 = Restart + 1;
126 printf(
"### ERROR: No enough memory! [%s:%d]\n", __FILE__, __LINE__);
130 if (PrtLvl >
PRINT_MIN && Restart < restart) {
131 printf(
"### WARNING: vGMRES restart number set to %d!\n", Restart);
144 for (i = 0; i < Restart1; i++) p[i] = s + Restart + i * n;
146 for (i = 0; i < Restart1; i++) hh[i] = p[Restart] + n + i * Restart;
158 relres = r_norm / absres0;
167 relres = r_normb / absres0;
172 relres = absres0 / normu;
175 printf(
"### ERROR: Unknown stopping type! [%s]\n", __FUNCTION__);
180 if (relres < tol || absres0 < abstol)
goto FINISHED;
183 fasp_itinfo(PrtLvl, StopType, 0, relres, absres0, 0);
189 while (iter < MaxIt) {
191 rs[0] = r_norm_old = r_norm;
200 if (cr > cr_max || iter == 0) {
201 Restart = restart_max;
202 }
else if (cr < cr_min) {
205 if (Restart - d > restart_min) {
208 Restart = restart_max;
214 while (i < Restart && iter < MaxIt) {
223 pc->
fct(p[i - 1], r, pc->
data);
228 for (j = 0; j < i; j++) {
239 for (j = 1; j < i; ++j) {
240 t = hh[j - 1][i - 1];
241 hh[j - 1][i - 1] = s[j - 1] * hh[j][i - 1] + c[j - 1] * t;
242 hh[j][i - 1] = -s[j - 1] * t + c[j - 1] * hh[j][i - 1];
244 t = hh[i][i - 1] * hh[i][i - 1];
245 t += hh[i - 1][i - 1] * hh[i - 1][i - 1];
248 if (gamma == 0.0) gamma = epsmac;
249 c[i - 1] = hh[i - 1][i - 1] / gamma;
250 s[i - 1] = hh[i][i - 1] / gamma;
251 rs[i] = -s[i - 1] * rs[i - 1];
252 rs[i - 1] = c[i - 1] * rs[i - 1];
253 hh[i - 1][i - 1] = s[i - 1] * hh[i][i - 1] + c[i - 1] * hh[i - 1][i - 1];
255 absres = r_norm = fabs(rs[i]);
257 relres = absres / absres0;
259 norms[iter] = relres;
262 fasp_itinfo(PrtLvl, StopType, iter, relres, absres,
263 norms[iter] / norms[iter - 1]);
266 if (relres < tol && iter >= MIN_ITER)
break;
271 rs[i - 1] = rs[i - 1] / hh[i - 1][i - 1];
272 for (k = i - 2; k >= 0; k--) {
274 for (j = k + 1; j < i; j++) t -= hh[k][j] * rs[j];
277 rs[k] = t / hh[k][k];
295 if (relres < tol && iter >= MIN_ITER) {
297 REAL computed_relres = relres;
308 relres = absres / absres0;
316 relres = absres / absres0;
321 relres = absres / normu;
325 norms[iter] = relres;
336 ITS_COMPRES(computed_relres);
343 for (j = i; j > 0; j--) {
344 rs[j - 1] = -s[j - 1] * rs[j];
345 rs[j] = c[j - 1] * rs[j];
360 cr = r_norm / r_norm_old;
365 if (PrtLvl >
PRINT_NONE) ITS_FINAL(iter, MaxIt, relres);
380 printf(
"### DEBUG: [--End--] %s ...\n", __FUNCTION__);
417 const REAL tol,
const REAL abstol,
const INT MaxIt,
422 const INT MIN_ITER = 0;
429 const REAL cr_max = 0.99;
430 const REAL cr_min = 0.174;
436 REAL r_norm, r_normb, gamma, t;
441 REAL r_norm_old = 0.0;
443 INT restart_max = restart;
447 INT Restart = restart;
448 INT Restart1 = Restart + 1;
449 unsigned LONG worksize = (Restart + 4) * (Restart + n) + 1 - n;
452 REAL * c = NULL, *s = NULL, *rs = NULL;
453 REAL * norms = NULL, *r = NULL, *w = NULL;
455 REAL **p = NULL, **hh = NULL;
458 if (PrtLvl >
PRINT_NONE) printf(
"\nCalling VGMRes solver (BSR) ...\n");
461 printf(
"### DEBUG: [-Begin-] %s ...\n", __FUNCTION__);
462 printf(
"### DEBUG: maxit = %d, tol = %.4le\n", MaxIt, tol);
469 while ((work == NULL) && (Restart > 5)) {
470 Restart = Restart - 5;
471 worksize = (Restart + 4) * (Restart + n) + 1 - n;
473 Restart1 = Restart + 1;
477 printf(
"### ERROR: No enough memory! [%s:%d]\n", __FILE__, __LINE__);
481 if (PrtLvl >
PRINT_MIN && Restart < restart) {
482 printf(
"### WARNING: vGMRES restart number set to %d!\n", Restart);
495 for (i = 0; i < Restart1; i++) p[i] = s + Restart + i * n;
497 for (i = 0; i < Restart1; i++) hh[i] = p[Restart] + n + i * Restart;
509 relres = r_norm / absres0;
518 relres = r_normb / absres0;
523 relres = absres0 / normu;
526 printf(
"### ERROR: Unknown stopping type! [%s]\n", __FUNCTION__);
531 if (relres < tol || absres0 < abstol)
goto FINISHED;
534 fasp_itinfo(PrtLvl, StopType, 0, relres, absres0, 0);
540 while (iter < MaxIt) {
542 rs[0] = r_norm_old = r_norm;
551 if (cr > cr_max || iter == 0) {
552 Restart = restart_max;
553 }
else if (cr < cr_min) {
556 if (Restart - d > restart_min) {
559 Restart = restart_max;
565 while (i < Restart && iter < MaxIt) {
574 pc->
fct(p[i - 1], r, pc->
data);
579 for (j = 0; j < i; j++) {
590 for (j = 1; j < i; ++j) {
591 t = hh[j - 1][i - 1];
592 hh[j - 1][i - 1] = s[j - 1] * hh[j][i - 1] + c[j - 1] * t;
593 hh[j][i - 1] = -s[j - 1] * t + c[j - 1] * hh[j][i - 1];
595 t = hh[i][i - 1] * hh[i][i - 1];
596 t += hh[i - 1][i - 1] * hh[i - 1][i - 1];
599 if (gamma == 0.0) gamma = epsmac;
600 c[i - 1] = hh[i - 1][i - 1] / gamma;
601 s[i - 1] = hh[i][i - 1] / gamma;
602 rs[i] = -s[i - 1] * rs[i - 1];
603 rs[i - 1] = c[i - 1] * rs[i - 1];
604 hh[i - 1][i - 1] = s[i - 1] * hh[i][i - 1] + c[i - 1] * hh[i - 1][i - 1];
606 absres = r_norm = fabs(rs[i]);
608 relres = absres / absres0;
610 norms[iter] = relres;
613 fasp_itinfo(PrtLvl, StopType, iter, relres, absres,
614 norms[iter] / norms[iter - 1]);
617 if (relres < tol && iter >= MIN_ITER)
break;
622 rs[i - 1] = rs[i - 1] / hh[i - 1][i - 1];
623 for (k = i - 2; k >= 0; k--) {
625 for (j = k + 1; j < i; j++) t -= hh[k][j] * rs[j];
628 rs[k] = t / hh[k][k];
646 if (relres < tol && iter >= MIN_ITER) {
648 REAL computed_relres = relres;
659 relres = absres / absres0;
667 relres = absres / absres0;
672 relres = absres / normu;
676 norms[iter] = relres;
687 ITS_COMPRES(computed_relres);
694 for (j = i; j > 0; j--) {
695 rs[j - 1] = -s[j - 1] * rs[j];
696 rs[j] = c[j - 1] * rs[j];
711 cr = r_norm / r_norm_old;
716 if (PrtLvl >
PRINT_NONE) ITS_FINAL(iter, MaxIt, relres);
731 printf(
"### DEBUG: [--End--] %s ...\n", __FUNCTION__);
766 const REAL tol,
const REAL abstol,
const INT MaxIt,
771 const INT MIN_ITER = 0;
778 const REAL cr_max = 0.99;
779 const REAL cr_min = 0.174;
785 REAL r_norm, r_normb, gamma, t;
790 REAL r_norm_old = 0.0;
792 INT restart_max = restart;
796 INT Restart = restart;
797 INT Restart1 = Restart + 1;
798 unsigned LONG worksize = (Restart + 4) * (Restart + n) + 1 - n;
801 REAL * c = NULL, *s = NULL, *rs = NULL;
802 REAL * norms = NULL, *r = NULL, *w = NULL;
804 REAL **p = NULL, **hh = NULL;
807 if (PrtLvl >
PRINT_NONE) printf(
"\nCalling VGMRes solver (BLC) ...\n");
810 printf(
"### DEBUG: [-Begin-] %s ...\n", __FUNCTION__);
811 printf(
"### DEBUG: maxit = %d, tol = %.4le\n", MaxIt, tol);
818 while ((work == NULL) && (Restart > 5)) {
819 Restart = Restart - 5;
820 worksize = (Restart + 4) * (Restart + n) + 1 - n;
822 Restart1 = Restart + 1;
826 printf(
"### ERROR: No enough memory! [%s:%d]\n", __FILE__, __LINE__);
830 if (PrtLvl >
PRINT_MIN && Restart < restart) {
831 printf(
"### WARNING: vGMRES restart number set to %d!\n", Restart);
844 for (i = 0; i < Restart1; i++) p[i] = s + Restart + i * n;
846 for (i = 0; i < Restart1; i++) hh[i] = p[Restart] + n + i * Restart;
858 relres = r_norm / absres0;
867 relres = r_normb / absres0;
872 relres = absres0 / normu;
875 printf(
"### ERROR: Unknown stopping type! [%s]\n", __FUNCTION__);
880 if (relres < tol || absres0 < abstol)
goto FINISHED;
883 fasp_itinfo(PrtLvl, StopType, 0, relres, absres0, 0);
889 while (iter < MaxIt) {
891 rs[0] = r_norm_old = r_norm;
900 if (cr > cr_max || iter == 0) {
901 Restart = restart_max;
902 }
else if (cr < cr_min) {
905 if (Restart - d > restart_min) {
908 Restart = restart_max;
914 while (i < Restart && iter < MaxIt) {
923 pc->
fct(p[i - 1], r, pc->
data);
928 for (j = 0; j < i; j++) {
939 for (j = 1; j < i; ++j) {
940 t = hh[j - 1][i - 1];
941 hh[j - 1][i - 1] = s[j - 1] * hh[j][i - 1] + c[j - 1] * t;
942 hh[j][i - 1] = -s[j - 1] * t + c[j - 1] * hh[j][i - 1];
944 t = hh[i][i - 1] * hh[i][i - 1];
945 t += hh[i - 1][i - 1] * hh[i - 1][i - 1];
948 if (gamma == 0.0) gamma = epsmac;
949 c[i - 1] = hh[i - 1][i - 1] / gamma;
950 s[i - 1] = hh[i][i - 1] / gamma;
951 rs[i] = -s[i - 1] * rs[i - 1];
952 rs[i - 1] = c[i - 1] * rs[i - 1];
953 hh[i - 1][i - 1] = s[i - 1] * hh[i][i - 1] + c[i - 1] * hh[i - 1][i - 1];
955 absres = r_norm = fabs(rs[i]);
957 relres = absres / absres0;
959 norms[iter] = relres;
962 fasp_itinfo(PrtLvl, StopType, iter, relres, absres,
963 norms[iter] / norms[iter - 1]);
966 if (relres < tol && iter >= MIN_ITER)
break;
971 rs[i - 1] = rs[i - 1] / hh[i - 1][i - 1];
972 for (k = i - 2; k >= 0; k--) {
974 for (j = k + 1; j < i; j++) t -= hh[k][j] * rs[j];
977 rs[k] = t / hh[k][k];
995 if (relres < tol && iter >= MIN_ITER) {
997 REAL computed_relres = relres;
1008 relres = absres / absres0;
1016 relres = absres / absres0;
1021 relres = absres / normu;
1025 norms[iter] = relres;
1036 ITS_COMPRES(computed_relres);
1037 ITS_REALRES(relres);
1043 for (j = i; j > 0; j--) {
1044 rs[j - 1] = -s[j - 1] * rs[j];
1045 rs[j] = c[j - 1] * rs[j];
1060 cr = r_norm / r_norm_old;
1065 if (PrtLvl >
PRINT_NONE) ITS_FINAL(iter, MaxIt, relres);
1080 printf(
"### DEBUG: [--End--] %s ...\n", __FUNCTION__);
1117 const REAL tol,
const REAL abstol,
const INT MaxIt,
1122 const INT MIN_ITER = 0;
1129 const REAL cr_max = 0.99;
1130 const REAL cr_min = 0.174;
1136 REAL r_norm, r_normb, gamma, t;
1141 REAL r_norm_old = 0.0;
1143 INT restart_max = restart;
1147 INT Restart = restart;
1148 INT Restart1 = Restart + 1;
1149 unsigned LONG worksize = (Restart + 4) * (Restart + n) + 1 - n;
1152 REAL * c = NULL, *s = NULL, *rs = NULL;
1153 REAL * norms = NULL, *r = NULL, *w = NULL;
1155 REAL **p = NULL, **hh = NULL;
1158 if (PrtLvl >
PRINT_NONE) printf(
"\nCalling VGMRes solver (STR) ...\n");
1161 printf(
"### DEBUG: [-Begin-] %s ...\n", __FUNCTION__);
1162 printf(
"### DEBUG: maxit = %d, tol = %.4le\n", MaxIt, tol);
1169 while ((work == NULL) && (Restart > 5)) {
1170 Restart = Restart - 5;
1171 worksize = (Restart + 4) * (Restart + n) + 1 - n;
1173 Restart1 = Restart + 1;
1177 printf(
"### ERROR: No enough memory! [%s:%d]\n", __FILE__, __LINE__);
1181 if (PrtLvl >
PRINT_MIN && Restart < restart) {
1182 printf(
"### WARNING: vGMRES restart number set to %d!\n", Restart);
1195 for (i = 0; i < Restart1; i++) p[i] = s + Restart + i * n;
1197 for (i = 0; i < Restart1; i++) hh[i] = p[Restart] + n + i * Restart;
1209 relres = r_norm / absres0;
1218 relres = r_normb / absres0;
1223 relres = absres0 / normu;
1226 printf(
"### ERROR: Unknown stopping type! [%s]\n", __FUNCTION__);
1231 if (relres < tol || absres0 < abstol)
goto FINISHED;
1234 fasp_itinfo(PrtLvl, StopType, 0, relres, absres0, 0);
1240 while (iter < MaxIt) {
1242 rs[0] = r_norm_old = r_norm;
1251 if (cr > cr_max || iter == 0) {
1252 Restart = restart_max;
1253 }
else if (cr < cr_min) {
1256 if (Restart - d > restart_min) {
1259 Restart = restart_max;
1265 while (i < Restart && iter < MaxIt) {
1274 pc->
fct(p[i - 1], r, pc->
data);
1279 for (j = 0; j < i; j++) {
1290 for (j = 1; j < i; ++j) {
1291 t = hh[j - 1][i - 1];
1292 hh[j - 1][i - 1] = s[j - 1] * hh[j][i - 1] + c[j - 1] * t;
1293 hh[j][i - 1] = -s[j - 1] * t + c[j - 1] * hh[j][i - 1];
1295 t = hh[i][i - 1] * hh[i][i - 1];
1296 t += hh[i - 1][i - 1] * hh[i - 1][i - 1];
1299 if (gamma == 0.0) gamma = epsmac;
1300 c[i - 1] = hh[i - 1][i - 1] / gamma;
1301 s[i - 1] = hh[i][i - 1] / gamma;
1302 rs[i] = -s[i - 1] * rs[i - 1];
1303 rs[i - 1] = c[i - 1] * rs[i - 1];
1304 hh[i - 1][i - 1] = s[i - 1] * hh[i][i - 1] + c[i - 1] * hh[i - 1][i - 1];
1306 absres = r_norm = fabs(rs[i]);
1308 relres = absres / absres0;
1310 norms[iter] = relres;
1313 fasp_itinfo(PrtLvl, StopType, iter, relres, absres,
1314 norms[iter] / norms[iter - 1]);
1317 if (relres < tol && iter >= MIN_ITER)
break;
1322 rs[i - 1] = rs[i - 1] / hh[i - 1][i - 1];
1323 for (k = i - 2; k >= 0; k--) {
1325 for (j = k + 1; j < i; j++) t -= hh[k][j] * rs[j];
1328 rs[k] = t / hh[k][k];
1346 if (relres < tol && iter >= MIN_ITER) {
1348 REAL computed_relres = relres;
1359 relres = absres / absres0;
1367 relres = absres / absres0;
1372 relres = absres / normu;
1376 norms[iter] = relres;
1387 ITS_COMPRES(computed_relres);
1388 ITS_REALRES(relres);
1394 for (j = i; j > 0; j--) {
1395 rs[j - 1] = -s[j - 1] * rs[j];
1396 rs[j] = c[j - 1] * rs[j];
1411 cr = r_norm / r_norm_old;
1416 if (PrtLvl >
PRINT_NONE) ITS_FINAL(iter, MaxIt, relres);
1431 printf(
"### DEBUG: [--End--] %s ...\n", __FUNCTION__);
1469 const REAL tol,
const REAL abstol,
const INT MaxIt,
1473 const INT min_iter = 0;
1479 const REAL cr_max = 0.99;
1480 const REAL cr_min = 0.174;
1487 REAL r_norm, b_norm, den_norm;
1488 REAL epsilon, gamma, t;
1490 REAL * c = NULL, *s = NULL, *rs = NULL;
1491 REAL * norms = NULL, *r = NULL, *w = NULL;
1492 REAL **p = NULL, **hh = NULL;
1496 REAL r_norm_old = 0.0;
1498 INT restart_max = restart;
1499 INT restart_min = 3;
1501 INT Restart = restart;
1502 INT Restart1 = Restart + 1;
1503 unsigned LONG worksize = (restart + 4) * (restart + n) + 1 - n;
1506 if (PrtLvl >
PRINT_NONE) printf(
"\nCalling VGMRes solver (MatFree) ...\n");
1509 printf(
"### DEBUG: [-Begin-] %s ...\n", __FUNCTION__);
1510 printf(
"### DEBUG: maxit = %d, tol = %.4le\n", MaxIt, tol);
1517 while ((work == NULL) && (Restart > 5)) {
1518 Restart = Restart - 5;
1519 worksize = (Restart + 4) * (Restart + n) + 1 - n;
1521 Restart1 = Restart + 1;
1525 printf(
"### ERROR: No enough memory! [%s:%d]\n", __FILE__, __LINE__);
1529 if (PrtLvl >
PRINT_MIN && Restart < restart) {
1530 printf(
"### WARNING: vGMRES restart number set to %d!\n", Restart);
1542 for (i = 0; i < Restart1; i++) p[i] = s + Restart + i * n;
1543 for (i = 0; i < Restart1; i++) hh[i] = p[Restart] + n + i * Restart;
1554 ITS_PUTNORM(
"right-hand side", b_norm);
1555 ITS_PUTNORM(
"residual", r_norm);
1563 epsilon = tol * den_norm;
1566 while (iter < MaxIt) {
1568 r_norm_old = r_norm;
1569 if (r_norm == 0.0) {
1585 if (cr > cr_max || iter == 0) {
1586 Restart = restart_max;
1587 }
else if (cr < cr_min) {
1590 if (Restart - d > restart_min) {
1593 Restart = restart_max;
1597 if (r_norm <= epsilon && iter >= min_iter) {
1602 if (r_norm <= epsilon) {
1616 while (i < Restart && iter < MaxIt) {
1625 pc->
fct(p[i - 1], r, pc->
data);
1630 for (j = 0; j < i; j++) {
1642 for (j = 1; j < i; ++j) {
1643 t = hh[j - 1][i - 1];
1644 hh[j - 1][i - 1] = s[j - 1] * hh[j][i - 1] + c[j - 1] * t;
1645 hh[j][i - 1] = -s[j - 1] * t + c[j - 1] * hh[j][i - 1];
1647 t = hh[i][i - 1] * hh[i][i - 1];
1648 t += hh[i - 1][i - 1] * hh[i - 1][i - 1];
1650 if (gamma == 0.0) gamma = epsmac;
1651 c[i - 1] = hh[i - 1][i - 1] / gamma;
1652 s[i - 1] = hh[i][i - 1] / gamma;
1653 rs[i] = -s[i - 1] * rs[i - 1];
1654 rs[i - 1] = c[i - 1] * rs[i - 1];
1655 hh[i - 1][i - 1] = s[i - 1] * hh[i][i - 1] + c[i - 1] * hh[i - 1][i - 1];
1656 r_norm = fabs(rs[i]);
1658 norms[iter] = r_norm;
1661 fasp_itinfo(PrtLvl, StopType, iter, norms[iter] / b_norm, norms[iter],
1662 norms[iter] / norms[iter - 1]);
1664 fasp_itinfo(PrtLvl, StopType, iter, norms[iter], norms[iter],
1665 norms[iter] / norms[iter - 1]);
1669 if (r_norm <= epsilon && iter >= min_iter)
break;
1675 rs[i - 1] = rs[i - 1] / hh[i - 1][i - 1];
1676 for (k = i - 2; k >= 0; k--) {
1678 for (j = k + 1; j < i; j++) t -= hh[k][j] * rs[j];
1681 rs[k] = t / hh[k][k];
1696 if (r_norm <= epsilon && iter >= min_iter) {
1701 if (r_norm <= epsilon) {
1711 for (j = i; j > 0; j--) {
1712 rs[j - 1] = -s[j - 1] * rs[j];
1713 rs[j] = c[j - 1] * rs[j];
1728 cr = r_norm / r_norm_old;
1732 if (PrtLvl >
PRINT_NONE) ITS_FINAL(iter, MaxIt, r_norm);
1747 printf(
"### DEBUG: [--End--] %s ...\n", __FUNCTION__);
void fasp_darray_cp(const INT n, const REAL *x, REAL *y)
Copy an array to the other y=x.
void fasp_mem_free(void *mem)
Free up previous allocated memory body and set pointer to NULL.
void * fasp_mem_calloc(const unsigned int size, const unsigned int type)
Allocate, initiate, and check memory.
void fasp_itinfo(const INT ptrlvl, const INT stop_type, const INT iter, const REAL relres, const REAL absres, const REAL factor)
Print out iteration information for iterative solvers.
void fasp_chkerr(const SHORT status, const char *fctname)
Check error status and print out error messages before quit.
REAL fasp_blas_darray_dotprod(const INT n, const REAL *x, const REAL *y)
Inner product of two arraies x and y.
void fasp_blas_darray_axpby(const INT n, const REAL a, const REAL *x, const REAL b, REAL *y)
y = a*x + b*y
REAL fasp_blas_darray_norm2(const INT n, const REAL *x)
L2 norm of array x.
void fasp_blas_darray_ax(const INT n, const REAL a, REAL *x)
x = a*x
void fasp_blas_darray_axpy(const INT n, const REAL a, const REAL *x, REAL *y)
y = a*x + y
void fasp_blas_dblc_mxv(const dBLCmat *A, const REAL *x, REAL *y)
Matrix-vector multiplication y = A*x.
void fasp_blas_dblc_aAxpy(const REAL alpha, const dBLCmat *A, const REAL *x, REAL *y)
Matrix-vector multiplication y = alpha*A*x + y.
void fasp_blas_dbsr_aAxpy(const REAL alpha, const dBSRmat *A, const REAL *x, REAL *y)
Compute y := alpha*A*x + y.
void fasp_blas_dbsr_mxv(const dBSRmat *A, const REAL *x, REAL *y)
Compute y := A*x.
void fasp_blas_dcsr_mxv(const dCSRmat *A, const REAL *x, REAL *y)
Matrix-vector multiplication y = A*x.
void fasp_blas_dcsr_aAxpy(const REAL alpha, const dCSRmat *A, const REAL *x, REAL *y)
Matrix-vector multiplication y = alpha*A*x + y.
void fasp_blas_dstr_aAxpy(const REAL alpha, const dSTRmat *A, const REAL *x, REAL *y)
Matrix-vector multiplication y = alpha*A*x + y.
void fasp_blas_dstr_mxv(const dSTRmat *A, const REAL *x, REAL *y)
Matrix-vector multiplication y = A*x.
INT fasp_solver_dblc_pvgmres(dBLCmat *A, dvector *b, dvector *x, precond *pc, const REAL tol, const REAL abstol, const INT MaxIt, const SHORT restart, const SHORT StopType, const SHORT PrtLvl)
Right preconditioned GMRES method in which the restart parameter can be adaptively modified during it...
INT fasp_solver_dcsr_pvgmres(dCSRmat *A, dvector *b, dvector *x, precond *pc, const REAL tol, const REAL abstol, const INT MaxIt, const SHORT restart, const SHORT StopType, const SHORT PrtLvl)
Right preconditioned GMRES method in which the restart parameter can be adaptively modified during it...
INT fasp_solver_pvgmres(mxv_matfree *mf, dvector *b, dvector *x, precond *pc, const REAL tol, const REAL abstol, const INT MaxIt, SHORT restart, const SHORT StopType, const SHORT PrtLvl)
Solve "Ax=b" using PGMRES(right preconditioned) iterative method in which the restart parameter can b...
INT fasp_solver_dbsr_pvgmres(dBSRmat *A, dvector *b, dvector *x, precond *pc, const REAL tol, const REAL abstol, const INT MaxIt, const SHORT restart, const SHORT StopType, const SHORT PrtLvl)
Right preconditioned GMRES method in which the restart parameter can be adaptively modified during it...
INT fasp_solver_dstr_pvgmres(dSTRmat *A, dvector *b, dvector *x, precond *pc, const REAL tol, const REAL abstol, const INT MaxIt, const SHORT restart, const SHORT StopType, const SHORT PrtLvl)
Right preconditioned GMRES method in which the restart parameter can be adaptively modified during it...
Main header file for the FASP project.
#define SHORT
FASP integer and floating point numbers.
#define MAX(a, b)
Definition of max, min, abs.
#define ERROR_SOLVER_MAXIT
#define STOP_REL_RES
Definition of iterative solver stopping criteria types.
#define BIGREAL
Some global constants.
#define PRINT_NONE
Print level for all subroutines – not including DEBUG output.
Block REAL CSR matrix format.
Block sparse row storage matrix of REAL type.
Sparse matrix of REAL type in CSR format.
Structure matrix of REAL type.
Vector with n entries of REAL type.
REAL * val
actual vector entries
Matrix-vector multiplication, replace the actual matrix.
void * data
data for MxV, can be a Matrix or something else
void(* fct)(const void *, const REAL *, REAL *)
action for MxV, void function pointer
Preconditioner data and action.
void * data
data for preconditioner, void pointer
void(* fct)(REAL *, REAL *, void *)
action for preconditioner, void function pointer