clear all

% Berechnungsmodell (Rechteckquerschnitt):
b  =  1 ; h  =  2 ;                             % Breite und Hoehe des Rechtecks
nb = 30 ; nh = 60 ;                             % nb*nh*8 Dreieckselemente
[ne , nk , xy , km , kr] = TorsnetD6 (b , h , nb , nh) ;
ep = [] ;
bk = zeros (nk,1) ;

drawtorsmod (xy , km , kr , bk) ;

% FEM-Gleichungssystem Ksys*x=fq:
[succ Ksys fq]   = syswbc_m (xy , km , ep , kr , bk) ;

Ks = SymBand2Sparse (Ksys) ;                    % "Sparse matrix"
[m,n]=size(Ks) ;
disp (['Anzahl der Gleichungen: ' , num2str(m)]) ;
spy (Ks) ;
xE = Ks \ fq ;                                  % Matlab-Standard-Solver

xKG = KonjugGrad     (Ks , fq , 1e-6 , m*2) ;
xbicg = bicg         (Ks , fq , 1e-6 , m*2) ;   % Biconjugate gradient
xbicgstab = bicgstab (Ks , fq , 1e-6 , m*2) ;   % Biconjugate gradient stabilized
xcgs = cgs           (Ks , fq , 1e-6 , m*2) ;   % Conjugate gradient squared
xlsqr = lsqr         (Ks , fq , 1e-6 , m*2) ;   % LSQR (Conjugate Gradients on the Normal Equations)
xminres = minres     (Ks , fq , 1e-6 , m*2) ;   % Minimum residual
xpcg = pcg           (Ks , fq , 1e-6 , m*2) ;   % Preconditioned conjugate gradient
xqmr = qmr           (Ks , fq , 1e-6 , m*2) ;   % Quasiminimal residual
xsymmlq = symmlq     (Ks , fq , 1e-6 , m*2) ;   % Symmetric LQ

mm = round (m/2) ;
x = [xE(mm-4:mm+4) xKG(mm-4:mm+4) xbicg(mm-4:mm+4) xbicgstab(mm-4:mm+4) xcgs(mm-4:mm+4) ...
     xlsqr(mm-4:mm+4) xminres(mm-4:mm+4) xpcg(mm-4:mm+4) xqmr(mm-4:mm+4) xsymmlq(mm-4:mm+4)]
disp ('  El.-Verf. KonjugGrad   bicg    bicgstab     cgs      lsqr     minres      pcg       qmr     symmlq') ;