clc;clear;close all;

bits_decimal=0:200;
dim=21;

matrix=load('matrix.mat');
matrix=matrix.matrix;


for j=1:dim-1
    for i=j+1:dim
        k=matrix(i,j)/matrix(j,j);
        matrix(i,:)= matrix(i,:)-k*matrix(j,:);
    end
end

matrix=round(matrix);

temp1=zeros([dim,1]);
for i=1:dim;
    temp1(i)=log2(abs(matrix(i,i)));
end

[~,p]=size(bits_decimal);
temp2=zeros([dim,p]);

for j=1:p
    for i=1:dim
        temp2(i,j)=log2_digital(abs(matrix(i,i)),bits_decimal(j));
    end
end

det1=sum(temp1);
det2=sum(temp2);

error=abs(det2-det1)/det1;
