Skip to content

Commit

Permalink
Update deprecated shift to circshift in BISTs for chol() and qr()
Browse files Browse the repository at this point in the history
  • Loading branch information
arungiridhar committed Nov 23, 2023
1 parent 34f3152 commit 3c1fc3e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
20 changes: 10 additions & 10 deletions libinterp/corefcn/chol.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1187,9 +1187,9 @@ Given a Cholesky@tie{}factorization of a real symmetric or complex Hermitian
positive definite matrix @w{@var{A} = @var{R}'*@var{R}}, @var{R}@tie{}upper
triangular, return the Cholesky@tie{}factorization of
@w{@var{A}(p,p)}, where @w{p} is the permutation @*
@code{p = [1:i-1, shift(i:j, 1), j+1:n]} if @w{@var{i} < @var{j}} @*
@code{p = [1:i-1, circshift(i:j, 1), j+1:n]} if @w{@var{i} < @var{j}} @*
or @*
@code{p = [1:j-1, shift(j:i,-1), i+1:n]} if @w{@var{j} < @var{i}}. @*
@code{p = [1:j-1, circshift(j:i,-1), i+1:n]} if @w{@var{j} < @var{i}}. @*
@seealso{chol, cholupdate, cholinsert, choldelete}
@end deftypefn */)
Expand Down Expand Up @@ -1276,13 +1276,13 @@ triangular, return the Cholesky@tie{}factorization of
%!test
%! R = chol (A);
%!
%! i = 1; j = 3; p = [1:i-1, shift(i:j,-1), j+1:4];
%! i = 1; j = 3; p = [1:i-1, circshift(i:j,-1), j+1:4];
%! R1 = cholshift (R, i, j);
%!
%! assert (norm (triu (R1)-R1, Inf), 0);
%! assert (norm (R1'*R1 - A(p,p), Inf), 0, 1e1*eps);
%!
%! j = 1; i = 3; p = [1:j-1, shift(j:i,+1), i+1:4];
%! j = 1; i = 3; p = [1:j-1, circshift(j:i,+1), i+1:4];
%! R1 = cholshift (R, i, j);
%!
%! assert (norm (triu (R1) - R1, Inf), 0);
Expand All @@ -1291,13 +1291,13 @@ triangular, return the Cholesky@tie{}factorization of
%!test
%! R = chol (Ac);
%!
%! i = 1; j = 3; p = [1:i-1, shift(i:j,-1), j+1:4];
%! i = 1; j = 3; p = [1:i-1, circshift(i:j,-1), j+1:4];
%! R1 = cholshift (R, i, j);
%!
%! assert (norm (triu (R1)-R1, Inf), 0);
%! assert (norm (R1'*R1 - Ac(p,p), Inf), 0, 1e1*eps);
%!
%! j = 1; i = 3; p = [1:j-1, shift(j:i,+1), i+1:4];
%! j = 1; i = 3; p = [1:j-1, circshift(j:i,+1), i+1:4];
%! R1 = cholshift (R, i, j);
%!
%! assert (norm (triu (R1)-R1, Inf), 0);
Expand All @@ -1306,13 +1306,13 @@ triangular, return the Cholesky@tie{}factorization of
%!test
%! R = chol (single (A));
%!
%! i = 1; j = 3; p = [1:i-1, shift(i:j,-1), j+1:4];
%! i = 1; j = 3; p = [1:i-1, circshift(i:j,-1), j+1:4];
%! R1 = cholshift (R, i, j);
%!
%! assert (norm (triu (R1)-R1, Inf), 0);
%! assert (norm (R1'*R1 - single (A(p,p)), Inf), 0, 1e1* eps ("single"));
%!
%! j = 1; i = 3; p = [1:j-1, shift(j:i,+1), i+1:4];
%! j = 1; i = 3; p = [1:j-1, circshift(j:i,+1), i+1:4];
%! R1 = cholshift (R, i, j);
%!
%! assert (norm (triu (R1)-R1, Inf), 0);
Expand All @@ -1321,13 +1321,13 @@ triangular, return the Cholesky@tie{}factorization of
%!test
%! R = chol (single (Ac));
%!
%! i = 1; j = 3; p = [1:i-1, shift(i:j,-1), j+1:4];
%! i = 1; j = 3; p = [1:i-1, circshift(i:j,-1), j+1:4];
%! R1 = cholshift (R, i, j);
%!
%! assert (norm (triu (R1)-R1, Inf), 0);
%! assert (norm (R1'*R1 - single (Ac(p,p)), Inf), 0, 1e1* eps ("single"));
%!
%! j = 1; i = 3; p = [1:j-1, shift(j:i,+1), i+1:4];
%! j = 1; i = 3; p = [1:j-1, circshift(j:i,+1), i+1:4];
%! R1 = cholshift (R, i, j);
%!
%! assert (norm (triu (R1)-R1, Inf), 0);
Expand Down
20 changes: 10 additions & 10 deletions libinterp/corefcn/qr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1923,9 +1923,9 @@ Given a QR@tie{}factorization of a real or complex matrix
@w{@var{A} = @var{Q}*@var{R}}, @var{Q}@tie{}unitary and
@var{R}@tie{}upper trapezoidal, return the QR@tie{}factorization
of @w{@var{A}(:,p)}, where @w{p} is the permutation @*
@code{p = [1:i-1, shift(i:j, 1), j+1:n]} if @w{@var{i} < @var{j}} @*
@code{p = [1:i-1, circshift(i:j, 1), j+1:n]} if @w{@var{i} < @var{j}} @*
or @*
@code{p = [1:j-1, shift(j:i,-1), i+1:n]} if @w{@var{j} < @var{i}}. @*
@code{p = [1:j-1, circshift(j:i,-1), i+1:n]} if @w{@var{j} < @var{i}}. @*
@seealso{qr, qrupdate, qrinsert, qrdelete}
@end deftypefn */)
Expand Down Expand Up @@ -2009,15 +2009,15 @@ of @w{@var{A}(:,p)}, where @w{p} is the permutation @*
/*
%!test
%! AA = A.';
%! i = 2; j = 4; p = [1:i-1, shift(i:j,-1), j+1:5];
%! i = 2; j = 4; p = [1:i-1, circshift(i:j,-1), j+1:5];
%!
%! [Q,R] = qr (AA);
%! [Q,R] = qrshift (Q, R, i, j);
%! assert (norm (vec (Q'*Q - eye (3)), Inf), 0, 1e1*eps);
%! assert (norm (vec (triu (R) - R), Inf), 0);
%! assert (norm (vec (Q*R - AA(:,p)), Inf), 0, norm (AA)*1e1*eps);
%!
%! j = 2; i = 4; p = [1:j-1, shift(j:i,+1), i+1:5];
%! j = 2; i = 4; p = [1:j-1, circshift(j:i,+1), i+1:5];
%!
%! [Q,R] = qr (AA);
%! [Q,R] = qrshift (Q, R, i, j);
Expand All @@ -2027,15 +2027,15 @@ of @w{@var{A}(:,p)}, where @w{p} is the permutation @*
%!
%!test
%! AA = Ac.';
%! i = 2; j = 4; p = [1:i-1, shift(i:j,-1), j+1:5];
%! i = 2; j = 4; p = [1:i-1, circshift(i:j,-1), j+1:5];
%!
%! [Q,R] = qr (AA);
%! [Q,R] = qrshift (Q, R, i, j);
%! assert (norm (vec (Q'*Q - eye (3)), Inf), 0, 1e1*eps);
%! assert (norm (vec (triu (R) - R), Inf), 0);
%! assert (norm (vec (Q*R - AA(:,p)), Inf), 0, norm (AA)*1e1*eps);
%!
%! j = 2; i = 4; p = [1:j-1, shift(j:i,+1), i+1:5];
%! j = 2; i = 4; p = [1:j-1, circshift(j:i,+1), i+1:5];
%!
%! [Q,R] = qr (AA);
%! [Q,R] = qrshift (Q, R, i, j);
Expand All @@ -2045,7 +2045,7 @@ of @w{@var{A}(:,p)}, where @w{p} is the permutation @*
%!test
%! AA = single (A).';
%! i = 2; j = 4; p = [1:i-1, shift(i:j,-1), j+1:5];
%! i = 2; j = 4; p = [1:i-1, circshift(i:j,-1), j+1:5];
%!
%! [Q,R] = qr (AA);
%! [Q,R] = qrshift (Q, R, i, j);
Expand All @@ -2055,7 +2055,7 @@ of @w{@var{A}(:,p)}, where @w{p} is the permutation @*
%! assert (norm (vec (Q*R - AA(:,p)), Inf), single (0), ...
%! norm (AA)*1e1 * eps ("single"));
%!
%! j = 2; i = 4; p = [1:j-1, shift(j:i,+1), i+1:5];
%! j = 2; i = 4; p = [1:j-1, circshift(j:i,+1), i+1:5];
%!
%! [Q,R] = qr (AA);
%! [Q,R] = qrshift (Q, R, i, j);
Expand All @@ -2067,7 +2067,7 @@ of @w{@var{A}(:,p)}, where @w{p} is the permutation @*
%!
%!test
%! AA = single (Ac).';
%! i = 2; j = 4; p = [1:i-1, shift(i:j,-1), j+1:5];
%! i = 2; j = 4; p = [1:i-1, circshift(i:j,-1), j+1:5];
%!
%! [Q,R] = qr (AA);
%! [Q,R] = qrshift (Q, R, i, j);
Expand All @@ -2077,7 +2077,7 @@ of @w{@var{A}(:,p)}, where @w{p} is the permutation @*
%! assert (norm (vec (Q*R - AA(:,p)), Inf), single (0), ...
%! norm (AA)*1e1 * eps ("single"));
%!
%! j = 2; i = 4; p = [1:j-1, shift(j:i,+1), i+1:5];
%! j = 2; i = 4; p = [1:j-1, circshift(j:i,+1), i+1:5];
%!
%! [Q,R] = qr (AA);
%! [Q,R] = qrshift (Q, R, i, j);
Expand Down

0 comments on commit 3c1fc3e

Please sign in to comment.