dmaldona/RLinearAlgebra.jl

Initialized solution is set to dimension of constant vector rather than the number of columns

Closed this issue · 1 comments

vp314 commented

Minimum Working Example

using RLinearAlgebra

A = RLinearAlgebra.generate_matrix(100, 20, 20, 10.0)
x_oracle = randn(20)
b = A * x_oracle

sol = LinearSolver(TypeRPM(SamplerKaczmarzCYC()))
x = solve(sol, A, b)

Output

DimensionMismatch("second dimension of A, 20, does not match length of x, 100")

Source of the Issue

In src/solvers.jl(Line 61 to 64), the initial value of x is set to a zero vector that is the dimension of b, the constant vector:

#Stopping threshold
x_init = copy(b)
x_init .= 0.0

residual = norm(A*x_init - b)

The issue is that the dimension of b (e.g., 100) and the number of columns of A (e.g., 20).

vp314 commented

I was not working on the most recent version of the master branch.