Skip to content

Commit

Permalink
Minor fixes in solve error estimation.
Browse files Browse the repository at this point in the history
  • Loading branch information
klho committed May 4, 2018
1 parent 1a5a1e9 commit 01641c0
Show file tree
Hide file tree
Showing 80 changed files with 199 additions and 150 deletions.
4 changes: 2 additions & 2 deletions hifde/test/fd_cube1.m
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ function fd_cube1(n,occ,rank_or_tol,skip,symm)
tic
Y = hifde_sv(F,X);
t = toc;
[e,niter] = snorm(N,@(x)(x - A*hifde_sv(F,x)),[],[],1);
[e,niter] = snorm(N,@(x)(x - A*hifde_sv(F,x)),@(x)(x - hifde_sv(F,A*x,'c')));
fprintf('sv: %10.4e / %4d / %10.4e (s)\n',e,niter,t)

if strcmpi(symm,'p')
Expand Down Expand Up @@ -128,7 +128,7 @@ function fd_cube1(n,occ,rank_or_tol,skip,symm)

% run PCG
tic
[Z,~,~,piter] = pcg(@(x)(A*x),X,1e-12,32,@(x)(hifde_sv(F,x)));
[Z,~,~,piter] = pcg(@(x)(A*x),X,1e-12,32,@(x)hifde_sv(F,x));
t = toc;
e1 = norm(Z - Y)/norm(Z);
e2 = norm(X - A*Z)/norm(X);
Expand Down
2 changes: 1 addition & 1 deletion hifde/test/fd_cube1_diag.m
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ function fd_cube1_diag(n,occ,rank_or_tol,skip,symm,spdiag)
tic
Y = hifde_sv(F,X);
t = toc;
[e,niter] = snorm(N,@(x)(x - A*hifde_sv(F,x)),[],[],1);
[e,niter] = snorm(N,@(x)(x - A*hifde_sv(F,x)),@(x)(x - hifde_sv(F,A*x,'c')));
fprintf('sv: %10.4e / %4d / %10.4e (s)\n',e,niter,t)

% prepare for diagonal extracation
Expand Down
4 changes: 2 additions & 2 deletions hifde/test/fd_cube1x.m
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ function fd_cube1x(n,occ,rank_or_tol,skip,symm)
tic
Y = hifde_sv(F,X);
t = toc;
[e,niter] = snorm(N,@(x)(x - A*hifde_sv(F,x)),[],[],1);
[e,niter] = snorm(N,@(x)(x - A*hifde_sv(F,x)),@(x)(x - hifde_sv(F,A*x,'c')));
fprintf('sv: %10.4e / %4d / %10.4e (s)\n',e,niter,t)

if strcmpi(symm,'p')
Expand Down Expand Up @@ -131,7 +131,7 @@ function fd_cube1x(n,occ,rank_or_tol,skip,symm)

% run PCG
tic
[Z,~,~,piter] = pcg(@(x)(A*x),X,1e-12,32,@(x)(hifde_sv(F,x)));
[Z,~,~,piter] = pcg(@(x)(A*x),X,1e-12,32,@(x)hifde_sv(F,x));
t = toc;
e1 = norm(Z - Y)/norm(Z);
e2 = norm(X - A*Z)/norm(X);
Expand Down
2 changes: 1 addition & 1 deletion hifde/test/fd_cube1x_diag.m
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ function fd_cube1x_diag(n,occ,rank_or_tol,skip,symm,spdiag)
tic
Y = hifde_sv(F,X);
t = toc;
[e,niter] = snorm(N,@(x)(x - A*hifde_sv(F,x)),[],[],1);
[e,niter] = snorm(N,@(x)(x - A*hifde_sv(F,x)),@(x)(x - hifde_sv(F,A*x,'c')));
fprintf('sv: %10.4e / %4d / %10.4e (s)\n',e,niter,t)

% prepare for diagonal extracation
Expand Down
4 changes: 2 additions & 2 deletions hifde/test/fd_cube2.m
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ function fd_cube2(n,occ,rank_or_tol,skip,symm)
tic
Y = hifde_sv(F,X);
t = toc;
[e,niter] = snorm(N,@(x)(x - A*hifde_sv(F,x)),[],[],1);
[e,niter] = snorm(N,@(x)(x - A*hifde_sv(F,x)),@(x)(x - hifde_sv(F,A*x,'c')));
fprintf('sv: %10.4e / %4d / %10.4e (s)\n',e,niter,t)

if strcmpi(symm,'p')
Expand Down Expand Up @@ -155,7 +155,7 @@ function fd_cube2(n,occ,rank_or_tol,skip,symm)

% run PCG
tic
[Z,~,~,piter] = pcg(@(x)(A*x),X,1e-12,32,@(x)(hifde_sv(F,x)));
[Z,~,~,piter] = pcg(@(x)(A*x),X,1e-12,32,@(x)hifde_sv(F,x));
t = toc;
e1 = norm(Z - Y)/norm(Z);
e2 = norm(X - A*Z)/norm(X);
Expand Down
4 changes: 2 additions & 2 deletions hifde/test/fd_cube2x.m
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ function fd_cube2x(n,occ,rank_or_tol,skip,symm)
tic
Y = hifde_sv(F,X);
t = toc;
[e,niter] = snorm(N,@(x)(x - A*hifde_sv(F,x)),[],[],1);
[e,niter] = snorm(N,@(x)(x - A*hifde_sv(F,x)),@(x)(x - hifde_sv(F,A*x,'c')));
fprintf('sv: %10.4e / %4d / %10.4e (s)\n',e,niter,t)

if strcmpi(symm,'p')
Expand Down Expand Up @@ -158,7 +158,7 @@ function fd_cube2x(n,occ,rank_or_tol,skip,symm)

% run PCG
tic
[Z,~,~,piter] = pcg(@(x)(A*x),X,1e-12,32,@(x)(hifde_sv(F,x)));
[Z,~,~,piter] = pcg(@(x)(A*x),X,1e-12,32,@(x)hifde_sv(F,x));
t = toc;
e1 = norm(Z - Y)/norm(Z);
e2 = norm(X - A*Z)/norm(X);
Expand Down
4 changes: 2 additions & 2 deletions hifde/test/fd_cube3.m
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,15 @@ function fd_cube3(n,k,occ,rank_or_tol,skip,symm)
tic
Y = hifde_sv(F,X);
t = toc;
[e,niter] = snorm(N,@(x)(x - A*hifde_sv(F,x)),[],[],1);
[e,niter] = snorm(N,@(x)(x - A*hifde_sv(F,x)),@(x)(x - hifde_sv(F,A*x,'c')));
fprintf('sv: %10.4e / %4d / %10.4e (s)\n',e,niter,t)

% run unpreconditioned GMRES
[~,~,~,iter] = gmres(@(x)(A*x),X,[],1e-12,128);

% run preconditioned GMRES
tic
[Z,~,~,piter] = gmres(@(x)(A*x),X,[],1e-12,32,@(x)(hifde_sv(F,x)));
[Z,~,~,piter] = gmres(@(x)(A*x),X,[],1e-12,32,@(x)hifde_sv(F,x));
t = toc;
e1 = norm(Z - Y)/norm(Z);
e2 = norm(X - A*Z)/norm(X);
Expand Down
4 changes: 2 additions & 2 deletions hifde/test/fd_cube3x.m
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,15 @@ function fd_cube3x(n,k,occ,rank_or_tol,skip,symm)
tic
Y = hifde_sv(F,X);
t = toc;
[e,niter] = snorm(N,@(x)(x - A*hifde_sv(F,x)),[],[],1);
[e,niter] = snorm(N,@(x)(x - A*hifde_sv(F,x)),@(x)(x - hifde_sv(F,A*x,'c')));
fprintf('sv: %10.4e / %4d / %10.4e (s)\n',e,niter,t)

% run unpreconditioned GMRES
[~,~,~,iter] = gmres(@(x)(A*x),X,[],1e-12,128);

% run preconditioned GMRES
tic
[Z,~,~,piter] = gmres(@(x)(A*x),X,[],1e-12,32,@(x)(hifde_sv(F,x)));
[Z,~,~,piter] = gmres(@(x)(A*x),X,[],1e-12,32,@(x)hifde_sv(F,x));
t = toc;
e1 = norm(Z - Y)/norm(Z);
e2 = norm(X - A*Z)/norm(X);
Expand Down
4 changes: 2 additions & 2 deletions hifde/test/fd_cube4x.m
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ function fd_cube4x(n,occ,rank_or_tol,skip,symm)
tic
Y = hifde_sv(F,X);
t = toc;
[e,niter] = snorm(N,@(x)(x - A*hifde_sv(F,x)),[],[],1);
[e,niter] = snorm(N,@(x)(x - A*hifde_sv(F,x)),@(x)(x - hifde_sv(F,A*x,'c')));
fprintf('sv: %10.4e / %4d / %10.4e (s)\n',e,niter,t)

if strcmpi(symm,'p')
Expand Down Expand Up @@ -168,7 +168,7 @@ function fd_cube4x(n,occ,rank_or_tol,skip,symm)

% run PCG
tic
[Z,~,~,piter] = pcg(@(x)(A*x),X,1e-12,32,@(x)(hifde_sv(F,x)));
[Z,~,~,piter] = pcg(@(x)(A*x),X,1e-12,32,@(x)hifde_sv(F,x));
t = toc;
e1 = norm(Z - Y)/norm(Z);
e2 = norm(X - A*Z)/norm(X);
Expand Down
4 changes: 2 additions & 2 deletions hifde/test/fd_square1.m
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ function fd_square1(n,occ,rank_or_tol,skip,symm)
tic
Y = hifde_sv(F,X);
t = toc;
[e,niter] = snorm(N,@(x)(x - A*hifde_sv(F,x)),[],[],1);
[e,niter] = snorm(N,@(x)(x - A*hifde_sv(F,x)),@(x)(x - hifde_sv(F,A*x,'c')));
fprintf('sv: %10.4e / %4d / %10.4e (s)\n',e,niter,t)

if strcmpi(symm,'p')
Expand Down Expand Up @@ -118,7 +118,7 @@ function fd_square1(n,occ,rank_or_tol,skip,symm)

% run PCG
tic
[Z,~,~,piter] = pcg(@(x)(A*x),X,1e-12,32,@(x)(hifde_sv(F,x)));
[Z,~,~,piter] = pcg(@(x)(A*x),X,1e-12,32,@(x)hifde_sv(F,x));
t = toc;
e1 = norm(Z - Y)/norm(Z);
e2 = norm(X - A*Z)/norm(X);
Expand Down
2 changes: 1 addition & 1 deletion hifde/test/fd_square1_diag.m
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ function fd_square1_diag(n,occ,rank_or_tol,skip,symm,spdiag)
tic
Y = hifde_sv(F,X);
t = toc;
[e,niter] = snorm(N,@(x)(x - A*hifde_sv(F,x)),[],[],1);
[e,niter] = snorm(N,@(x)(x - A*hifde_sv(F,x)),@(x)(x - hifde_sv(F,A*x,'c')));
fprintf('sv: %10.4e / %4d / %10.4e (s)\n',e,niter,t)

% prepare for diagonal extracation
Expand Down
4 changes: 2 additions & 2 deletions hifde/test/fd_square1x.m
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ function fd_square1x(n,occ,rank_or_tol,skip,symm)
tic
Y = hifde_sv(F,X);
t = toc;
[e,niter] = snorm(N,@(x)(x - A*hifde_sv(F,x)),[],[],1);
[e,niter] = snorm(N,@(x)(x - A*hifde_sv(F,x)),@(x)(x - hifde_sv(F,A*x,'c')));
fprintf('sv: %10.4e / %4d / %10.4e (s)\n',e,niter,t)

if strcmpi(symm,'p')
Expand Down Expand Up @@ -121,7 +121,7 @@ function fd_square1x(n,occ,rank_or_tol,skip,symm)

% run PCG
tic
[Z,~,~,piter] = pcg(@(x)(A*x),X,1e-12,32,@(x)(hifde_sv(F,x)));
[Z,~,~,piter] = pcg(@(x)(A*x),X,1e-12,32,@(x)hifde_sv(F,x));
t = toc;
e1 = norm(Z - Y)/norm(Z);
e2 = norm(X - A*Z)/norm(X);
Expand Down
2 changes: 1 addition & 1 deletion hifde/test/fd_square1x_diag.m
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ function fd_square1x_diag(n,occ,rank_or_tol,skip,symm,spdiag)
tic
Y = hifde_sv(F,X);
t = toc;
[e,niter] = snorm(N,@(x)(x - A*hifde_sv(F,x)),[],[],1);
[e,niter] = snorm(N,@(x)(x - A*hifde_sv(F,x)),@(x)(x - hifde_sv(F,A*x,'c')));
fprintf('sv: %10.4e / %4d / %10.4e (s)\n',e,niter,t)

% prepare for diagonal extracation
Expand Down
4 changes: 2 additions & 2 deletions hifde/test/fd_square2.m
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ function fd_square2(n,occ,rank_or_tol,skip,symm)
tic
Y = hifde_sv(F,X);
t = toc;
[e,niter] = snorm(N,@(x)(x - A*hifde_sv(F,x)),[],[],1);
[e,niter] = snorm(N,@(x)(x - A*hifde_sv(F,x)),@(x)(x - hifde_sv(F,A*x,'c')));
fprintf('sv: %10.4e / %4d / %10.4e (s)\n',e,niter,t)

if strcmpi(symm,'p')
Expand Down Expand Up @@ -140,7 +140,7 @@ function fd_square2(n,occ,rank_or_tol,skip,symm)

% run PCG
tic
[Z,~,~,piter] = pcg(@(x)(A*x),X,1e-12,32,@(x)(hifde_sv(F,x)));
[Z,~,~,piter] = pcg(@(x)(A*x),X,1e-12,32,@(x)hifde_sv(F,x));
t = toc;
e1 = norm(Z - Y)/norm(Z);
e2 = norm(X - A*Z)/norm(X);
Expand Down
4 changes: 2 additions & 2 deletions hifde/test/fd_square2x.m
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ function fd_square2x(n,occ,rank_or_tol,skip,symm)
tic
Y = hifde_sv(F,X);
t = toc;
[e,niter] = snorm(N,@(x)(x - A*hifde_sv(F,x)),[],[],1);
[e,niter] = snorm(N,@(x)(x - A*hifde_sv(F,x)),@(x)(x - hifde_sv(F,A*x,'c')));
fprintf('sv: %10.4e / %4d / %10.4e (s)\n',e,niter,t)

if strcmpi(symm,'p')
Expand Down Expand Up @@ -143,7 +143,7 @@ function fd_square2x(n,occ,rank_or_tol,skip,symm)

% run PCG
tic
[Z,~,~,piter] = pcg(@(x)(A*x),X,1e-12,32,@(x)(hifde_sv(F,x)));
[Z,~,~,piter] = pcg(@(x)(A*x),X,1e-12,32,@(x)hifde_sv(F,x));
t = toc;
e1 = norm(Z - Y)/norm(Z);
e2 = norm(X - A*Z)/norm(X);
Expand Down
4 changes: 2 additions & 2 deletions hifde/test/fd_square3.m
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,15 @@ function fd_square3(n,k,occ,rank_or_tol,skip,symm)
tic
Y = hifde_sv(F,X);
t = toc;
[e,niter] = snorm(N,@(x)(x - A*hifde_sv(F,x)),[],[],1);
[e,niter] = snorm(N,@(x)(x - A*hifde_sv(F,x)),@(x)(x - hifde_sv(F,A*x,'c')));
fprintf('sv: %10.4e / %4d / %10.4e (s)\n',e,niter,t)

% run unpreconditioned GMRES
[~,~,~,iter] = gmres(@(x)(A*x),X,[],1e-12,128);

% run preconditioned GMRES
tic
[Z,~,~,piter] = gmres(@(x)(A*x),X,[],1e-12,32,@(x)(hifde_sv(F,x)));
[Z,~,~,piter] = gmres(@(x)(A*x),X,[],1e-12,32,@(x)hifde_sv(F,x));
t = toc;
e1 = norm(Z - Y)/norm(Z);
e2 = norm(X - A*Z)/norm(X);
Expand Down
4 changes: 2 additions & 2 deletions hifde/test/fd_square3x.m
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,15 @@ function fd_square3x(n,k,occ,rank_or_tol,skip,symm)
tic
Y = hifde_sv(F,X);
t = toc;
[e,niter] = snorm(N,@(x)(x - A*hifde_sv(F,x)),[],[],1);
[e,niter] = snorm(N,@(x)(x - A*hifde_sv(F,x)),@(x)(x - hifde_sv(F,A*x,'c')));
fprintf('sv: %10.4e / %4d / %10.4e (s)\n',e,niter,t)

% run unpreconditioned GMRES
[~,~,~,iter] = gmres(@(x)(A*x),X,[],1e-12,128);

% run preconditioned GMRES
tic
[Z,~,~,piter] = gmres(@(x)(A*x),X,[],1e-12,32,@(x)(hifde_sv(F,x)));
[Z,~,~,piter] = gmres(@(x)(A*x),X,[],1e-12,32,@(x)hifde_sv(F,x));
t = toc;
e1 = norm(Z - Y)/norm(Z);
e2 = norm(X - A*Z)/norm(X);
Expand Down
4 changes: 2 additions & 2 deletions hifde/test/fd_square4x.m
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ function fd_square4x(n,occ,rank_or_tol,skip,symm)
tic
Y = hifde_sv(F,X);
t = toc;
[e,niter] = snorm(N,@(x)(x - A*hifde_sv(F,x)),[],[],1);
[e,niter] = snorm(N,@(x)(x - A*hifde_sv(F,x)),@(x)(x - hifde_sv(F,A*x,'c')));
fprintf('sv: %10.4e / %4d / %10.4e (s)\n',e,niter,t)

if strcmpi(symm,'p')
Expand Down Expand Up @@ -144,7 +144,7 @@ function fd_square4x(n,occ,rank_or_tol,skip,symm)

% run PCG
tic
[Z,~,~,piter] = pcg(@(x)(A*x),X,1e-12,32,@(x)(hifde_sv(F,x)));
[Z,~,~,piter] = pcg(@(x)(A*x),X,1e-12,32,@(x)hifde_sv(F,x));
t = toc;
e1 = norm(Z - Y)/norm(Z);
e2 = norm(X - A*Z)/norm(X);
Expand Down
4 changes: 2 additions & 2 deletions hifde/test/fd_square5x.m
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ function fd_square5x(n,occ,rank_or_tol,skip,symm)
tic
Y = hifde_sv(F,X);
t = toc;
[e,niter] = snorm(N,@(x)(x - A*hifde_sv(F,x)),[],[],1);
[e,niter] = snorm(N,@(x)(x - A*hifde_sv(F,x)),@(x)(x - hifde_sv(F,A*x,'c')));
fprintf('sv: %10.4e / %4d / %10.4e (s)\n',e,niter,t)

if strcmpi(symm,'p')
Expand Down Expand Up @@ -171,7 +171,7 @@ function fd_square5x(n,occ,rank_or_tol,skip,symm)

% run PCG
tic
[Z,~,~,piter] = pcg(@(x)(A*x),X,1e-12,32,@(x)(hifde_sv(F,x)));
[Z,~,~,piter] = pcg(@(x)(A*x),X,1e-12,32,@(x)hifde_sv(F,x));
t = toc;
e1 = norm(Z - Y)/norm(Z);
e2 = norm(X - A*Z)/norm(X);
Expand Down
3 changes: 2 additions & 1 deletion hifie/test/cov_cube1.m
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ function cov_cube1(n,occ,p,rank_or_tol,skip,symm,noise,scale,spdiag)
tic
hifie_sv(F,X);
t = toc;
[e,niter] = snorm(N,@(x)(x - mv(hifie_sv(F,x))),[],[],1);
[e,niter] = snorm(N,@(x)(x - mv(hifie_sv(F,x))), ...
@(x)(x - hifie_sv(F,mv(x),'c')));
fprintf('sv: %10.4e / %4d / %10.4e (s)\n',e,niter,t)

if strcmpi(symm,'p')
Expand Down
3 changes: 2 additions & 1 deletion hifie/test/cov_cube2.m
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ function cov_cube2(n,occ,p,rank_or_tol,skip,symm,noise,scale,spdiag)
tic
hifie_sv(F,X);
t = toc;
[e,niter] = snorm(N,@(x)(x - mv(hifie_sv(F,x))),[],[],1);
[e,niter] = snorm(N,@(x)(x - mv(hifie_sv(F,x))), ...
@(x)(x - hifie_sv(F,mv(x),'c')));
fprintf('sv: %10.4e / %4d / %10.4e (s)\n',e,niter,t)

if strcmpi(symm,'p')
Expand Down
3 changes: 2 additions & 1 deletion hifie/test/cov_square1.m
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ function cov_square1(n,occ,p,rank_or_tol,skip,symm,noise,scale,spdiag)
tic
hifie_sv(F,X);
t = toc;
[e,niter] = snorm(N,@(x)(x - mv(hifie_sv(F,x))),[],[],1);
[e,niter] = snorm(N,@(x)(x - mv(hifie_sv(F,x))), ...
@(x)(x - hifie_sv(F,mv(x),'c')));
fprintf('sv: %10.4e / %4d / %10.4e (s)\n',e,niter,t)

if strcmpi(symm,'p')
Expand Down
3 changes: 2 additions & 1 deletion hifie/test/cov_square2.m
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ function cov_square2(n,occ,p,rank_or_tol,skip,symm,noise,scale,spdiag)
tic
hifie_sv(F,X);
t = toc;
[e,niter] = snorm(N,@(x)(x - mv(hifie_sv(F,x))),[],[],1);
[e,niter] = snorm(N,@(x)(x - mv(hifie_sv(F,x))), ...
@(x)(x - hifie_sv(F,mv(x),'c')));
fprintf('sv: %10.4e / %4d / %10.4e (s)\n',e,niter,t)

if strcmpi(symm,'p')
Expand Down
5 changes: 3 additions & 2 deletions hifie/test/fd_cube.m
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,16 @@ function fd_cube(n,occ,rank_or_tol,skip,symm)
tic
Y = hifie_sv(F,X);
t = toc;
[e,niter] = snorm(N,@(x)(x - A*hifie_sv(F,x)),[],[],1);
[e,niter] = snorm(N,@(x)(x - A*hifie_sv(F,x)), ...
@(x)(x - hifie_sv(F,A*x,'c')));
fprintf('sv: %10.4e / %4d / %10.4e (s)\n',e,niter,t)

% run CG
[~,~,~,iter] = pcg(@(x)(A*x),X,1e-12,128);

% run PCG
tic
[Z,~,~,piter] = pcg(@(x)(A*x),X,1e-12,32,@(x)(hifie_sv(F,x)));
[Z,~,~,piter] = pcg(@(x)(A*x),X,1e-12,32,@(x)hifie_sv(F,x));
t = toc;
e1 = norm(Z - Y)/norm(Z);
e2 = norm(X - A*Z)/norm(X);
Expand Down
5 changes: 3 additions & 2 deletions hifie/test/fd_square.m
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,16 @@ function fd_square(n,occ,rank_or_tol,skip,symm)
tic
Y = hifie_sv(F,X);
t = toc;
[e,niter] = snorm(N,@(x)(x - A*hifie_sv(F,x)),[],[],1);
[e,niter] = snorm(N,@(x)(x - A*hifie_sv(F,x)), ...
@(x)(x - hifie_sv(F,A*x,'c')));
fprintf('sv: %10.4e / %4d / %10.4e (s)\n',e,niter,t)

% run CG
[~,~,~,iter] = pcg(@(x)(A*x),X,1e-12,128);

% run PCG
tic
[Z,~,~,piter] = pcg(@(x)(A*x),X,1e-12,32,@(x)(hifie_sv(F,x)));
[Z,~,~,piter] = pcg(@(x)(A*x),X,1e-12,32,@(x)hifie_sv(F,x));
t = toc;
e1 = norm(Z - Y)/norm(Z);
e2 = norm(X - A*Z)/norm(X);
Expand Down
Loading

0 comments on commit 01641c0

Please sign in to comment.