Operators and Keywords

C++ API

# pcg.m File Reference

## Functions

endif if (nargin< 5||isempty(m1)) exist_m1=0
if (nargout > 5) T
if (isnumeric(a)) r
endif resvec (1, 1)
while (resvec(iter-1, 1) > tol *resvec(1, 1)&&iter< maxit) if(exist_m1) if(isnumeric(m1)) y
endif if (exist_m2) if(isnumeric(m2)) z
resvec (iter-1, 2)
if (alpha<=0.0) matrix_positive_definite
id w ()
if(nargout > 5 &&iter > 2) T(iter-1 sqrt (beta) beta]./oldalpha
endif resvec (iter, 1)
warning ("pcg: eigenvalue estimate failed: iteration converged too fast.")
endif if (exist_m1) if(isnumeric(m1)) y
if (iter >=maxit-2) flag

## Variables

function [x, flag, relres, iter, resvec, eigest]
else x = x0
else exist_m1 = 1
else exist_m2 = 1
endif preconditioned_residual_out = false
endif matrix_positive_definite = true
p = zeros (size (b))
oldtau = 1
else r = b - feval (a, x, varargin{:})
alpha = 1
iter = 2
else y = feval (m1, r, varargin{:})
else z = feval (m2, y, varargin{:})
endif tau = z' * r
beta = tau / oldtau
else w = feval (a, p, varargin{:})
endif oldalpha = alpha
l = eig (T)
eigest = [min(l), max(l)]
else resvec = resvec(:,1)
endif flag = 0
relres = resvec (iter-1,1) ./ resvec(1,1)

## Function Documentation

 if ( iter >=maxit- 2 )

 endif if ( exist_m1 )

 if ( alpha<=0. 0 )

 endif if ( exist_m2 )

 if ( isnumeric(a) )

 if ( nargout , 5 )

 endif if ( ) ` [pure virtual]`

 endif resvec ( iter , 1 )

 resvec ( iter- 1, 2 )

 endif resvec ( 1 , 1 )

 if (nargout > 5 && iter > 2) T(iter-1 sqrt ( beta )

 id w ( ) ` [virtual]`

 warning ( "pcg: eigenvalue estimate failed: iteration converged too fast." )

 while ( resvec(iter-1, 1) )

## Variable Documentation

 alpha = 1

 beta = tau / oldtau

 endif else eigest = [min(l), max(l)]

 else exist_m1 = 1

 else exist_m2 = 1

 endif flag = 0

 function[x, flag, relres, iter, resvec, eigest]

Initial value:

``` pcg (a, b, tol, maxit, m1, m2, x0, varargin)

if (nargin < 7 || isempty (x0))
x = zeros (size (b))
```

 iter = 2

 l = eig (T)

 endif matrix_positive_definite = true

 oldtau = 1

 p = zeros (size (b))

 preconditioned_residual_out = false

 else r = b - feval (a, x, varargin{:})

 relres = resvec (iter-1,1) ./ resvec(1,1)

 endif resvec = resvec(:,1)

 endif tau = z' * r

 else w = feval (a, p, varargin{:})

 else x = x0

 endif else y = feval (m1, r, varargin{:})

 endif else z = feval (m2, y, varargin{:})