[R] Matrix Equation Help?

Spencer Graves spencer.graves at pdf.com
Fri Apr 25 06:21:58 CEST 2003


If n>>m, then solve does not work.  Consider:

 > A <- array(1:6, dim=c(2,3))
 > B <- array(1:4, dim=c(2,2))
 > solve(A, B)
Error in solve.default(A, B) : singular matrix `a' in solve

In this case, we have 6 = 3 x 2 unknowns but only 4 equations.

It raises questions about what you mean by solve.  S-Plus 2000 and 6 
have "ginverse" that will produce an answer.  You can construct such 
using "qr" or "svd".

However, before coding that, I will ask, what do you mean by "solve"?

hth.  spencer graves

Uwe Ligges wrote:
> Feng Zhang wrote:
> 
>> Dear R-listers
>>
>> Now I have a Matrix Equation to solve,
>> A -- m by n matrix, where n>>m, known matrix;
>> X -- n by m unknown matrix;
>> B -- m by m known matrix.
>>
>> So given the equation A*X=B, how to solve X?
> 
> 
> You already mentioned it:
> ?solve
> 
> Uwe Ligges
> 
>> I first tried to take X = inv((A'*A))*A'. But since
>> A'*A is singular, this is no way to go.
>>
>> Please give me some point on this.
>> Thanks
>>
>> Fred
>>
>> ______________________________________________
>> R-help at stat.math.ethz.ch mailing list
>> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> 
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help



More information about the R-help mailing list