solve_linear_system: Solve (A + lam I) x = b

View source: R/RcppExports.R

solve_linear_systemR Documentation

Solve (A + lam I) x = b

Description

Solve (A + lam I) x = b

Usage

solve_linear_system(A, b, add_to_diag = 0)

Arguments

A

A symmetric square matrix.

b

A vector.

add_to_diag

One value to add to the diagonal of A (lam). Default is 0.

Value

The best solution x of this linear system.

Examples

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)


privefl/bigutilsr documentation built on Jan. 27, 2024, 5:33 a.m.