Skip to content

Commit

Permalink
supports single precision
Browse files Browse the repository at this point in the history
  • Loading branch information
chenxinye committed Nov 20, 2024
1 parent d49cd3e commit aa39d6b
Show file tree
Hide file tree
Showing 26 changed files with 28 additions and 28 deletions.
4 changes: 2 additions & 2 deletions mhodlr/@amphodlr/amphodlr.m
Original file line number Diff line number Diff line change
Expand Up @@ -407,11 +407,11 @@ The diagonal block matrix in HODLR format (access in the next level).

methods(Access=private)
function [U, V] = compress(obj, A)
[U, V] = compress_m(A, obj.method, obj.vareps, obj.trun_norm_tp, obj.issparse);
[U, V] = compress_m(A, obj.method, obj.vareps, obj.issparse, obj.trun_norm_tp);
end

function [U, V] = mp_compress(obj, A)
[U, V] = mp_compress_m(A, obj.method, obj.vareps, obj.trun_norm_tp, obj.issparse);
[U, V] = mp_compress_m(A, obj.method, obj.vareps, obj.issparse, obj.trun_norm_tp);
end

function [sortu, sortIdx] = sort_by_u(obj, u_chain)
Expand Down
2 changes: 1 addition & 1 deletion mhodlr/@amphodlr/hchol.m
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
if isempty(H.D)
R.A11 = hchol(H.A11, oformat);
R12 = htrsl(R.A11.transpose(), H.U1 * H.V2);
[R.U1, R.V2] = compress_m(R12, H.method, H.vareps);
[R.U1, R.V2] = compress_m(R12, H.method, H.vareps, H.issparse);
R.A22 = hchol(fusedma(H.A22, -R12', R12, H.vareps), oformat);
R.U2 = zeros(size(R.U2,1),0);
R.V1 = zeros(0,size(R.V1,2));
Expand Down
2 changes: 1 addition & 1 deletion mhodlr/@amphodlr/htrsl.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

B21 = B.U2*B.V1;
L21 = L.U2*L.V1;
[X.U2, X.V1] = compress_m(htrsl(L.A22, B21 - hdot(L21, X.A11, 'dense')), L.method, L.vareps, obj.issparse);
[X.U2, X.V1] = compress_m(htrsl(L.A22, B21 - hdot(L21, X.A11, 'dense')), L.method, L.vareps, L.issparse);
X.A22 = htrsl(L.A22, hadd(B.A22, L21*X.U1*X.V2, '-'));
else
X.D = mldivide(L.D, B.D);
Expand Down
2 changes: 1 addition & 1 deletion mhodlr/@amphodlr/htrsu.m
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
X.V1 = htrsu(B.V1, U.A11, 1);

U12 = U.U1*U.V2;
[X.U1, X.V2] = compress_m(htrsu(B.U1*B.V2 - hdot(X.A11, U12, 'dense'), U.A22, 1), U.method, U.vareps, obj.issparse);
[X.U1, X.V2] = compress_m(htrsu(B.U1*B.V2 - hdot(X.A11, U12, 'dense'), U.A22, 1), U.method, U.vareps, U.issparse);

X.A22 = htrsu(hadd(B.A22, X.U2*X.V1*U12, '-'), U.A22);
else
Expand Down
2 changes: 1 addition & 1 deletion mhodlr/@amphodlr/mhchol.m
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
if isempty(H.D)
R.A11 = mhchol(H.A11, prec, oformat);
R12 = mhtrsl(R.A11.transpose(), mchop(H.U1 * H.V2));
[R.U1, R.V2] = compress_m(R12, H.method, H.vareps, obj.issparse);
[R.U1, R.V2] = compress_m(R12, H.method, H.vareps, H.issparse);
R.A22 = mhchol(fusedma(H.A22, -R12', R12, H.vareps), prec, oformat);
R.U2 = zeros(size(R.U2,1),0);
R.V1 = zeros(0,size(R.V1,2));
Expand Down
2 changes: 1 addition & 1 deletion mhodlr/@amphodlr/mhtrsl.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

B21 = mchop(B.U2*B.V1);
L21 = mchop(L.U2*L.V1);
[X.U2, X.V1] = mp_compress_m(mhtrsl(L.A22, B21 - hdot(L21, X.A11, 'dense')), L.method, L.vareps, obj.issparse);
[X.U2, X.V1] = mp_compress_m(mhtrsl(L.A22, B21 - hdot(L21, X.A11, 'dense')), L.method, L.vareps, L.issparse);
X.A22 = mhtrsl(L.A22, hadd(B.A22, L21*X.U1*X.V2, '-'));
X = hmchop(X);
else
Expand Down
2 changes: 1 addition & 1 deletion mhodlr/@amphodlr/mhtrsu.m
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
X.V1 = mhtrsu(B.V1, U.A11, 1);

U12 = mchop(U.U1*U.V2);
[X.U1, X.V2] = compress_m(mhtrsu(B.U1*B.V2 - hdot(X.A11, U12, 'dense'), U.A22, 1), U.method, U.vareps, obj.issparse);
[X.U1, X.V2] = compress_m(mhtrsu(B.U1*B.V2 - hdot(X.A11, U12, 'dense'), U.A22, 1), U.method, U.vareps, U.issparse);

X.U1 = mchop(X.U1);
X.V2 = mchop(X.V2);
Expand Down
2 changes: 1 addition & 1 deletion mhodlr/@amphodlr/private/compress_m.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

if nargin == 4
issparse = varargin{1};
norm_type = true;
norm_type = '2';
elseif nargin == 5
issparse = varargin{1};
norm_type = varargin{2};
Expand Down
2 changes: 1 addition & 1 deletion mhodlr/@amphodlr/private/mp_compress_m.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

if nargin == 4
issparse = varargin{1};
norm_type = true;
norm_type = '2';
elseif nargin == 5
issparse = varargin{1};
norm_type = varargin{2};
Expand Down
2 changes: 1 addition & 1 deletion mhodlr/@hodlr/hchol.m
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
if isempty(H.D)
R.A11 = hchol(H.A11, oformat);
R12 = htrsl(R.A11.transpose(), H.U1 * H.V2);
[R.U1, R.V2] = compress_m(R12, H.method, H.vareps);
[R.U1, R.V2] = compress_m(R12, H.method, H.vareps, H.issparse);
R.A22 = hchol(fusedma(H.A22, -R12', R12, H.vareps), oformat);
R.U2 = zeros(size(R.U2,1),0);
R.V1 = zeros(0,size(R.V1,2));
Expand Down
2 changes: 1 addition & 1 deletion mhodlr/@hodlr/hodlr.m
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ The diagonal block matrix in HODLR format (access in the next level).

methods(Access=private)
function [U, V] = compress(obj, A)
[U, V] = compress_m(A, obj.method, obj.vareps, obj.trun_norm_tp, obj.issparse);
[U, V] = compress_m(A, obj.method, obj.vareps, obj.issparse, obj.trun_norm_tp);
end
end

Expand Down
2 changes: 1 addition & 1 deletion mhodlr/@hodlr/htrsl.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

B21 = B.U2*B.V1;
L21 = L.U2*L.V1;
[X.U2, X.V1] = compress_m(htrsl(L.A22, B21 - hdot(L21, X.A11, 'dense')), L.method, L.vareps);
[X.U2, X.V1] = compress_m(htrsl(L.A22, B21 - hdot(L21, X.A11, 'dense')), L.method, L.vareps, L.issparse);
X.A22 = htrsl(L.A22, hadd(B.A22, L21*X.U1*X.V2, '-'));
else
X.D = mldivide(L.D, B.D);
Expand Down
2 changes: 1 addition & 1 deletion mhodlr/@hodlr/htrsu.m
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
X.V1 = htrsu(B.V1, U.A11, 1);

U12 = U.U1*U.V2;
[X.U1, X.V2] = compress_m(htrsu(B.U1*B.V2 - hdot(X.A11, U12, 'dense'), U.A22, 1), U.method, U.vareps);
[X.U1, X.V2] = compress_m(htrsu(B.U1*B.V2 - hdot(X.A11, U12, 'dense'), U.A22, 1), U.method, U.vareps, U.issparse);

X.A22 = htrsu(hadd(B.A22, X.U2*X.V1*U12, '-'), U.A22);
else
Expand Down
2 changes: 1 addition & 1 deletion mhodlr/@hodlr/mhchol.m
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
if isempty(H.D)
R.A11 = mhchol(H.A11, prec, oformat);
R12 = mhtrsl(R.A11.transpose(), mchop(H.U1 * H.V2));
[R.U1, R.V2] = compress_m(R12, H.method, H.vareps, obj.issparse);
[R.U1, R.V2] = compress_m(R12, H.method, H.vareps, H.issparse);
R.A22 = mhchol(fusedma(H.A22, -R12', R12, H.vareps), prec, oformat);
R.U2 = zeros(size(R.U2,1),0);
R.V1 = zeros(0,size(R.V1,2));
Expand Down
2 changes: 1 addition & 1 deletion mhodlr/@hodlr/mhtrsl.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

B21 = mchop(B.U2*B.V1);
L21 = mchop(L.U2*L.V1);
[X.U2, X.V1] = compress_m(mhtrsl(L.A22, B21 - hdot(L21, X.A11, 'dense')), L.method, L.vareps, obj.issparse);
[X.U2, X.V1] = compress_m(mhtrsl(L.A22, B21 - hdot(L21, X.A11, 'dense')), L.method, L.vareps, L.issparse);
X.A22 = mhtrsl(L.A22, hadd(B.A22, L21*X.U1*X.V2, '-'));
X = hmchop(X);
else
Expand Down
2 changes: 1 addition & 1 deletion mhodlr/@hodlr/mhtrsu.m
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
X.V1 = mhtrsu(B.V1, U.A11, 1);

U12 = mchop(U.U1*U.V2);
[X.U1, X.V2] = compress_m(mhtrsu(B.U1*B.V2 - hdot(X.A11, U12, 'dense'), U.A22, 1), U.method, U.vareps);
[X.U1, X.V2] = compress_m(mhtrsu(B.U1*B.V2 - hdot(X.A11, U12, 'dense'), U.A22, 1), U.method, U.vareps, U.issparse);

X.U1 = mchop(X.U1);
X.V2 = mchop(X.V2);
Expand Down
2 changes: 1 addition & 1 deletion mhodlr/@hodlr/private/compress_m.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

if nargin == 4
issparse = varargin{1};
norm_type = true;
norm_type = '2';
elseif nargin == 5
issparse = varargin{1};
norm_type = varargin{2};
Expand Down
2 changes: 1 addition & 1 deletion mhodlr/@mphodlr/hchol.m
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
if isempty(H.D)
R.A11 = hchol(H.A11, oformat);
R12 = htrsl(R.A11.transpose(), H.U1 * H.V2);
[R.U1, R.V2] = compress_m(R12, H.method, H.vareps);
[R.U1, R.V2] = compress_m(R12, H.method, H.vareps, , H.issparse);
R.A22 = hchol(fusedma(H.A22, -R12', R12, H.vareps), oformat);
R.U2 = zeros(size(R.U2,1),0);
R.V1 = zeros(0,size(R.V1,2));
Expand Down
2 changes: 1 addition & 1 deletion mhodlr/@mphodlr/htrsl.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

B21 = B.U2*B.V1;
L21 = L.U2*L.V1;
[X.U2, X.V1] = compress_m(htrsl(L.A22, B21 - hdot(L21, X.A11, 'dense')), L.method, L.vareps);
[X.U2, X.V1] = compress_m(htrsl(L.A22, B21 - hdot(L21, X.A11, 'dense')), L.method, L.vareps, L.issparse);
X.A22 = htrsl(L.A22, hadd(B.A22, L21*X.U1*X.V2, '-'));
else
X.D = mldivide(L.D, B.D);
Expand Down
2 changes: 1 addition & 1 deletion mhodlr/@mphodlr/htrsu.m
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
X.V1 = htrsu(B.V1, U.A11, 1);

U12 = U.U1*U.V2;
[X.U1, X.V2] = compress_m(htrsu(B.U1*B.V2 - hdot(X.A11, U12, 'dense'), U.A22, 1), U.method, U.vareps);
[X.U1, X.V2] = compress_m(htrsu(B.U1*B.V2 - hdot(X.A11, U12, 'dense'), U.A22, 1), U.method, U.vareps, U.issparse);

X.A22 = htrsu(hadd(B.A22, X.U2*X.V1*U12, '-'), U.A22);
else
Expand Down
2 changes: 1 addition & 1 deletion mhodlr/@mphodlr/mhchol.m
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
if isempty(H.D)
R.A11 = mhchol(H.A11, prec, oformat);
R12 = mhtrsl(R.A11.transpose(), mchop(H.U1 * H.V2));
[R.U1, R.V2] = compress_m(R12, H.method, H.vareps);
[R.U1, R.V2] = compress_m(R12, H.method, H.vareps, H.issparse);
R.A22 = mhchol(fusedma(H.A22, -R12', R12, H.vareps), prec, oformat);
R.U2 = zeros(size(R.U2,1),0);
R.V1 = zeros(0,size(R.V1,2));
Expand Down
2 changes: 1 addition & 1 deletion mhodlr/@mphodlr/mhtrsl.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

B21 = mchop(B.U2*B.V1);
L21 = mchop(L.U2*L.V1);
[X.U2, X.V1] = compress_m(mhtrsl(L.A22, B21 - hdot(L21, X.A11, 'dense')), L.method, L.vareps);
[X.U2, X.V1] = compress_m(mhtrsl(L.A22, B21 - hdot(L21, X.A11, 'dense')), L.method, L.vareps, L.issparse);
X.A22 = mhtrsl(L.A22, hadd(B.A22, L21*X.U1*X.V2, '-'));
X = hmchop(X);
else
Expand Down
2 changes: 1 addition & 1 deletion mhodlr/@mphodlr/mhtrsu.m
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
X.V1 = mhtrsu(B.V1, U.A11, 1);

U12 = mchop(U.U1*U.V2);
[X.U1, X.V2] = compress_m(mhtrsu(B.U1*B.V2 - hdot(X.A11, U12, 'dense'), U.A22, 1), U.method, U.vareps);
[X.U1, X.V2] = compress_m(mhtrsu(B.U1*B.V2 - hdot(X.A11, U12, 'dense'), U.A22, 1), U.method, U.vareps, U.issparse);

X.U1 = mchop(X.U1);
X.V2 = mchop(X.V2);
Expand Down
4 changes: 2 additions & 2 deletions mhodlr/@mphodlr/mphodlr.m
Original file line number Diff line number Diff line change
Expand Up @@ -344,11 +344,11 @@ The diagonal block matrix in HODLR format (access in the next level).

methods(Access=private)
function [U, V] = compress(obj, A)
[U, V] = compress_m(A, obj.method, obj.vareps, obj.trun_norm_tp, obj.issparse);
[U, V] = compress_m(A, obj.method, obj.vareps, obj.issparse, obj.trun_norm_tp);
end

function [U, V] = mp_compress(obj, A)
[U, V] = mp_compress_m(A, obj.method, obj.vareps, obj.trun_norm_tp, obj.issparse);
[U, V] = mp_compress_m(A, obj.method, obj.vareps, obj.issparse, obj.trun_norm_tp);
end

function check_exception(obj)
Expand Down
2 changes: 1 addition & 1 deletion mhodlr/@mphodlr/private/compress_m.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

if nargin == 4
issparse = varargin{1};
norm_type = true;
norm_type = '2';
elseif nargin == 5
issparse = varargin{1};
norm_type = varargin{2};
Expand Down
2 changes: 1 addition & 1 deletion mhodlr/@mphodlr/private/mp_compress_m.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

if nargin == 4
issparse = varargin{1};
norm_type = true;
norm_type = '2';
elseif nargin == 5
issparse = varargin{1};
norm_type = varargin{2};
Expand Down

0 comments on commit aa39d6b

Please sign in to comment.