SPReduced_form
PURPOSE 
[nonsing,b] = SPReduced_form(q,qrows,qcols,bcols,neq,b,condn);
SYNOPSIS 
function [nonsing,b] = SPReduced_form(q,qrows,qcols,bcols,neq,condn);
DESCRIPTION 
CROSS-REFERENCE INFORMATION 
This function calls:
This function is called by:
- SPAmalg [b,rts,ia,nexact,nnumeric,lgroots,aimcode] = ...
SOURCE CODE 
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029 function [nonsing,b] = SPReduced_form(q,qrows,qcols,bcols,neq,condn);
0030 b=[];
0031
0032 qs=sparse(q);
0033 left = 1:qcols-qrows;
0034 right = qcols-qrows+1:qcols;
0035 nonsing = rcond(full(qs(:,right))) > condn;
0036 if(nonsing)
0037 qs(:,left) = -qs(:,right)\qs(:,left);
0038 b = qs(1:neq,1:bcols);
0039 b = full(b);
0040 else
0041
0042 themax=max(abs(qs(:,right)),[],2);
0043 oneover = diag(1 ./ themax);
0044 nonsing = rcond(full(oneover *qs(:,right))) > condn;
0045 if(nonsing)
0046 qs(:,left) = -(oneover*qs(:,right))\(oneover*(qs(:,left)));
0047 b = qs(1:neq,1:bcols);
0048 b = full(b);
0049 end
0050 end
0051
Generated on Mon 21-May-2012 02:42:43 by m2html © 2005