Solver

PURPOSE ^

ICESOLVER - solve the matrix equation AX=B

SYNOPSIS ^

function X=Solver(A,B,solver_type);

DESCRIPTION ^

ICESOLVER - solve the matrix equation AX=B

   Solver AX=B, with Chol, Lu or general solvers from matlab.
   We can use either the LU or the Cholesky decomposition, but the
   Cholesky decomposition is twice as efficient as LU for symmetric
   definite positive matrix

   Usage:
      X=IceSolver(A,B,solver_type);

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function X=Solver(A,B,solver_type);
0002 %ICESOLVER - solve the matrix equation AX=B
0003 %
0004 %   Solver AX=B, with Chol, Lu or general solvers from matlab.
0005 %   We can use either the LU or the Cholesky decomposition, but the
0006 %   Cholesky decomposition is twice as efficient as LU for symmetric
0007 %   definite positive matrix
0008 %
0009 %   Usage:
0010 %      X=IceSolver(A,B,solver_type);
0011 
0012 if strcmpi(solver_type,'lu'),
0013     % Solve by LU decomposition.
0014     [L,U] = lu(A);
0015     X = U\(L\B);
0016 elseif strcmpi(solver_type,'cholesky'),
0017     % Solve by Choleski decomposition.
0018     L = chol(A); X = L\(L'\B);
0019 else
0020     % use matlab's generic solver
0021     X = A\B;
0022 end

Generated on Sun 29-Mar-2009 20:22:55 by m2html © 2003