Fixed B matrix in bidiag2

This commit is contained in:
Joakim Skogholt 2023-05-14 08:24:21 +02:00
parent cec7b0a9d7
commit 76eb148928

View file

@ -60,8 +60,7 @@ Julia version of the bidiag2 MATLAB function in Björck and Indahl (2017)
### Returns:
- beta - Matrix with regression coefficients (including constant term if centre==true)
- W, T, B - Matrices such that X \approx T*B*W'.
B in compact form, use following to create full: B2 = zeros(A,A); B2[diagind(B2)] = B[:,1]; B2[diagind(B2,1)] = B[2:end,2];
- W, B, T - Matrices such that X \approx T*B*W'.
"""
function bidiag2(X, y, A, centre=true)
@ -117,6 +116,8 @@ if centre
beta = [b0; beta];
end
returnvals = beta, W, T, B
B = Bidiagonal(B[:,1], B[1:end-1,2], :U);
returnvals = beta, W, B, T
return returnvals
end