How do I stop the code and get the results?
12 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I am trying to run the Matlab code for Arnoldi method. The code dose not stop because the matrix is too large,. Is there a way to get the output?
[V,H] = Arnoldi();
function [V,H]=Arnoldi(A,v1,m)
% Load the data
load('soc-Epinions1.mat');
A = Problem.A;
n=size(A,1);
m=9000;
V=zeros(n,m);
H=zeros(m,m);
v1=rand(n,1);
V(:,1)=v1/norm(v1);
for j=1:m % the Anoldi loop
z=A*V(:,j);
for i=1:j
H(i,j)=V(:,i)'*z;
z=z-H(i,j)*V(:,i);
end
H(j+1,j)=norm(z);
if H(j+1,j)==0, break, end
V(:,j+1)=z/H(j+1,j);
end
H=H(1:m,1:m);
V=V(1:n,1:m);
f=diag(V*(expm(H)-eye(m))*V')
end
6 comentarios
Walter Roberson
el 5 de Mzo. de 2022
Perhaps they just ran the code on a larger system. The code ran on my system. Not quickly, but it ran.
Respuestas (1)
Steven Lord
el 5 de Mzo. de 2022
If you're out of time and need to get the results that have been computed, under certain circumstances (the main ones being the MATLAB Editor is open and you're using a sufficiently new release, plus the code has to give MATLAB a chance to recognize and process events) press the Pause button on the Editor tab of the toolstrip. save or assignin (into the base workspace) the results that you want to access and then either quit debugging (if you want to terminate the execution of the function) or continue (if you want to let it continue.)
Note that if you do this and quit debugging there's no way to "let MATLAB restart from where it was" unless your function was specifically designed to accept variables representing the state of the function's execution.
6 comentarios
Walter Roberson
el 8 de Mzo. de 2022
syms f [5 3]
syms V [5 3]
b1 = diag(f*V')
b2 = sum(f.*conj(V),2)
b1 - b2
So... you can use
load('soc-Epinions1.mat');
A = Problem.A;
n = size(A,1);
v1 = randn(n,1);
m = 2000;
[V, H] = Arnoldi4(A, v1, m);
f = V*(expm(H)-eye(m));
b = sum(f .* conj(V),2);
Ver también
Categorías
Más información sobre Data Type Conversion en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!