powered by
Solve (A + lam I) x = b
solve_linear_system(A, b, add_to_diag = 0)
The best solution x of this linear system.
x
A symmetric square matrix.
A vector.
One value to add to the diagonal of A (lam). Default is 0.
A <- matrix(rnorm(4), 2); A[1, 2] <- A[2, 1] # should be symmetric x <- rnorm(2) b <- A %*% x x2 <- drop(solve(A, b)) x3 <- solve_linear_system(A, b) rbind(x, x2, x3)
Run the code above in your browser using DataLab