Skip to main content
added 13 characters in body; edited tags
Source Link
Anton Menshov
  • 8.7k
  • 7
  • 41
  • 94

I have a question about Matlab and restarted gmres. I would like to use gmres.m provided here. This code seems to be a popular for the scientific computation newcomer. I also want to modify this code for my particular case.

But I have a question about recording the number of matrix-vector products and the 2-norm of each residual vector. If you use the built-in function gmres.m (e.g., gmres(30)) to solve a linear system, one obtains

iter = [17,20], % the total number of matrix-vector products is (17 - 1)*30 + 12 (= 492).

iter = [17,20], % the total number of matrix-vector products is (17 - 1)*30 + 12 (= 492).

and resvec, a 493-by-1$493\times1$ vector.

Moreover, in the gmres.m function these two outputs are not available. As you know, we always call the gmres.m in MATLAB, as in the following style:

[x, flag, relres, iter, resvec] = gmres(A, b, restart, tol, maxit);

[x, flag, relres, iter, resvec] = gmres(A, b, restart, tol, maxit);

Then, I want to use these outputs to plot the convergence histories, i.e.,

X-axis: the number of matrix-vector products,

Y-axis: 2-norm of relative residual, i.e., norm(b - Ax_m)/norm(b);norm(b - Ax_m)/norm(b);

So, how can I record this two outputs reasonably in the modified gmres.m? Despite my many attempts to deal with this problem, I still fail to manage it. It makes me very confused, especially for recording resvec. Can anyone provide suggestions aboutfor handling this problem.?

I have a question about Matlab and restarted gmres. I would like to use gmres.m provided here. This code seems to be a popular for the scientific computation newcomer. I also want to modify this code for my particular case.

But I have a question about recording the number of matrix-vector products and the 2-norm of each residual vector. If you use the built-in function gmres.m (e.g., gmres(30)) to solve a linear system, one obtains

iter = [17,20], % the total number of matrix-vector products is (17 - 1)*30 + 12 (= 492).

and resvec, a 493-by-1 vector.

Moreover, in the gmres.m function these two outputs are not available. As you know, we always call the gmres.m in MATLAB, as following style:

[x, flag, relres, iter, resvec] = gmres(A, b, restart, tol, maxit);

Then, I want to use these outputs to plot the convergence histories, i.e.,

X-axis: the number of matrix-vector products,

Y-axis: 2-norm of relative residual, i.e., norm(b - Ax_m)/norm(b);

So, how can I record this two outputs reasonably in the modified gmres.m? Despite my many attempts to deal with this problem, I still fail to manage it. It makes me very confused, especially for recording resvec. Can anyone provide suggestions about handling this problem.

I have a question about Matlab and restarted gmres. I would like to use gmres.m provided here. This code seems to be popular for the scientific computation newcomer. I also want to modify this code for my particular case.

But I have a question about recording the number of matrix-vector products and the 2-norm of each residual vector. If you use the built-in function gmres.m (e.g., gmres(30)) to solve a linear system, one obtains

iter = [17,20], % the total number of matrix-vector products is (17 - 1)*30 + 12 (= 492).

and resvec, a $493\times1$ vector.

Moreover, in the gmres.m function these two outputs are not available. As you know, we always call the gmres.m in MATLAB in the following style:

[x, flag, relres, iter, resvec] = gmres(A, b, restart, tol, maxit);

Then, I want to use these outputs to plot the convergence histories, i.e.,

X-axis: the number of matrix-vector products,

Y-axis: 2-norm of relative residual, i.e., norm(b - Ax_m)/norm(b);

So, how can I record this two outputs reasonably in the modified gmres.m? Despite my many attempts to deal with this problem, I still fail to manage it. It makes me very confused, especially for recording resvec. Can anyone provide suggestions for handling this problem?

edited tags
Link
Christian Clason
  • 12.4k
  • 3
  • 49
  • 68
added 336 characters in body
Source Link

I have a question about Matlab and restarted gmres. I would like to use gmres.m provided here. This code seems to be a popular for the scientific computation newcomer. I also want to modify this code for my particular case.

But I have a question about recording the number of matrix-vector products and the 2-norm of each residual vector. If you use the built-in function gmres.m (e.g., gmres(30)) to solve a linear system, one obtains

iter = [17,20], % the total number of matrix-vector products is (17 - 1)*30 + 12 (= 492).

iter = [17,20], % the total number of matrix-vector products is (17 - 1)*30 + 12 (= 492).

and resvec, a 493-by-1 vector.

Moreover, in the gmres.m function these two outputs are not available. As you know, we always call the gmres.m in MATLAB, as following style:

[x, flag, relres, iter, resvec] = gmres(A, b, restart, tol, maxit);

Then, I want to use these outputs to plot the convergence histories, i.e.,

X-axis: the number of matrix-vector products,

Y-axis: 2-norm of relative residual, i.e., norm(b - Ax_m)/norm(b);

So, how can I record this two outputs reasonably in the modified gmres.m? Despite my many attempts to deal with this problem, I still fail to manage it. It makes me very confused, especially for recording resvec. Can anyone provide suggestions about handling this problem.

I have a question about Matlab and restarted gmres. I would like to use gmres.m provided here. This code seems to be a popular for the scientific computation newcomer. I also want to modify this code for my particular case.

But I have a question about recording the number of matrix-vector products and the 2-norm of each residual vector. If you use the built-in function gmres.m (e.g., gmres(30)) to solve a linear system, one obtains

iter = [17,20], % the total number of matrix-vector products is (17 - 1)*30 + 12 (= 492).

and resvec, a 493-by-1 vector.

Moreover, in the gmres.m function these two outputs are not available.

So, how can I record this two outputs reasonably in the modified gmres.m? Despite my many attempts to deal with this problem, I still fail to manage it. It makes me very confused, especially for recording resvec. Can anyone provide suggestions about handling this problem.

I have a question about Matlab and restarted gmres. I would like to use gmres.m provided here. This code seems to be a popular for the scientific computation newcomer. I also want to modify this code for my particular case.

But I have a question about recording the number of matrix-vector products and the 2-norm of each residual vector. If you use the built-in function gmres.m (e.g., gmres(30)) to solve a linear system, one obtains

iter = [17,20], % the total number of matrix-vector products is (17 - 1)*30 + 12 (= 492).

and resvec, a 493-by-1 vector.

Moreover, in the gmres.m function these two outputs are not available. As you know, we always call the gmres.m in MATLAB, as following style:

[x, flag, relres, iter, resvec] = gmres(A, b, restart, tol, maxit);

Then, I want to use these outputs to plot the convergence histories, i.e.,

X-axis: the number of matrix-vector products,

Y-axis: 2-norm of relative residual, i.e., norm(b - Ax_m)/norm(b);

So, how can I record this two outputs reasonably in the modified gmres.m? Despite my many attempts to deal with this problem, I still fail to manage it. It makes me very confused, especially for recording resvec. Can anyone provide suggestions about handling this problem.

cleaned up and clarified text/grammar, formatting, improved title a bit, fixed link
Source Link
Loading
Source Link
Loading