diff --git a/src/variousRegressionFunctions.jl b/src/variousRegressionFunctions.jl index fd931fe..29032a8 100644 --- a/src/variousRegressionFunctions.jl +++ b/src/variousRegressionFunctions.jl @@ -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) @@ -116,7 +115,9 @@ if centre b0 = my .- mX * beta beta = [b0; beta]; end + +B = Bidiagonal(B[:,1], B[1:end-1,2], :U); -returnvals = beta, W, T, B +returnvals = beta, W, B, T return returnvals end \ No newline at end of file