% Initialization
fc_amat.init()
% Generate 10^5-by-4-by-4 amat object made up of
% 10^5 symmetric positive definite matrices:
A=fc_amat.random.randnsympd(10^5,4);
% Compute the 10^5 determinants of A
D=det(A); % D: 10^5-by-1-by-1 amat object,  det(A(k))=D(k),    for all k
% Compute the 10^5 LU decompositions of A:
[L,U,P]=lu(A);
E1=abs(L*U-P*A);
fprintf('max of E1 elements: %.6e\n',max(E1(:)))
% Compute the 10^5 Cholesky decompositions of A:
R=chol(A);
E2=abs(R'*R-A);
fprintf('max of E2 elements: %.6e\n',max(E2(:)))
% Solve the 10^5 linear systems: A*X=b
b=ones(4,1); % RHS
X=A\b;   % X: 10^5-by-4-by-1, X(k)=A(k)\b,    for all k
E3=abs(A*X-b);
fprintf('max of E3 elements: %.6e\n',max(E3(:)))
B=fc_amat.random.randn(10^5,4,1); % RHS
Y=A\B;   % Y: 10^5-by-4-by-1, Y(k)=A(k)\B(k), for all k
E4=abs(A*Y-B);
fprintf('max of E4 elements: %.6e\n',max(E4(:)))
whos
Using fc_amat[0.0.3] with fc_tools[0.0.25], fc_bench[0.0.6].
max of E1 elements: 1.421085e-14
max of E2 elements: 2.842171e-14
max of E3 elements: 4.547474e-13
max of E4 elements: 4.165557e-13
  Name           Size                Bytes  Class     Attributes

  A         100000x4x4            12800032  amat                
  B         100000x4x1             3200032  amat                
  D         100000x1x1              800032  amat                
  E1        100000x4x4            12800032  amat                
  E2        100000x4x4            12800032  amat                
  E3        100000x4x1             3200032  amat                
  E4        100000x4x1             3200032  amat                
  L         100000x4x4            12800032  amat                
  P         100000x4x4            12800032  amat                
  R         100000x4x4            12800032  amat                
  U         100000x4x4            12800032  amat                
  X         100000x4x1             3200032  amat                
  Y         100000x4x1             3200032  amat                
  b              4x1                    32  double