search for: system_of_linear_equ

Displaying 3 results from an estimated 3 matches for "system_of_linear_equ".

2016 Apr 20
0
Solving sparse, singular systems of equations
...; #Error in as(x, "matrix")[i, , drop = drop] : subscript out of boundssolve(qr(A, LAPACK=TRUE),b) Your code is a mess. A singular square system of linear equations has an infinity of solutions if a solution exists at all. How that works you can find here: https://en.wikipedia.org/wiki/System_of_linear_equations in the section "Matrix solutions". For your simple example you can do it like this: library(MASS) Ag <- ginv(A) # pseudoinverse xb <- Ag %*% b # minimum norm solution Aw <- diag(nrow=nrow(Ag)) - Ag %*% A # see the Wikipedia page w <- runif(3) z <- xb + Aw %*% w A...
2016 Apr 20
1
Solving sparse, singular systems of equations
...; #Error in as(x, "matrix")[i, , drop = drop] : subscript out of boundssolve(qr(A, LAPACK=TRUE),b) Your code is a mess. A singular square system of linear equations has an infinity of solutions if a solution exists at all. How that works you can find here: https://en.wikipedia.org/wiki/System_of_linear_equations in the section "Matrix solutions". For your simple example you can do it like this: library(MASS) Ag <- ginv(A)??? # pseudoinverse xb <- Ag %*% b # minimum norm solution Aw <- diag(nrow=nrow(Ag)) - Ag %*% A? # see the Wikipedia page w <- runif(3) z <- xb + Aw %*%...
2016 Apr 20
6
Solving sparse, singular systems of equations
I have a situation in R where I would like to find any x (if one exists) that solves the linear system of equations Ax = b, where A is square, sparse, and singular, and b is a vector. Here is some code that mimics my issue with a relatively simple A and b, along with three other methods of solving this system that I found online, two of which give me an error and one of which succeeds on the