1
$\begingroup$

I have two huge matrices $A$ and $B$. I am trying to find some iterative solvers like bcg or lsqr in Matlab.

I mean if my matrix $A$ is sparse and $n\times n$ and $B$ is a column vector of size $n\times 1$, I can use lsqr and bcg to solve the equation $Ax=B$.

Now suppose I need to solve $XD=C$, so I need to calculate $CD^{-1}$ where both $C$ and $D$ are huge matrices. If I use matlab's C/D operation directly, it consumes lots of memory and crashes. Are there any iterative solvers for this operation instead of using the forward slash operator directly?

  • 0
    How big is a "huge" matrix?2012-10-11
  • 1
    Around 4 million by 4 million2012-10-11
  • 0
    If you can transpose easily, solve $D^TX^T=C^T$ by standard techniques.2012-10-11
  • 0
    But methods like lsqr, bcg require the matrix B in the equation Ax=B to be a column matrix of size nx1. In my case the B matrix will not be a column matrix.So what should I do2012-10-11
  • 2
    Have you tried writing a loop which solves each of the columns of `B` individually? For example `result = sparse(N,N); for i = 1:N; result(:,i) = A\B(:,i); end`.2012-10-11
  • 0
    To elaborate slightly on @ChrisTaylor 's comment, the matrix eqn $XD = C$ can be solved for one row of $X$ using one corresponding row of $C$ at a time. There are iterative approximations for $D^{-1}$ but computationally expensive like $O(n^3)$ per iteration, and even if $D^{-1}$ were handed to us, computing $CD^{-1}$ is also $O(mn^2)$ where $m$ is number of rows in $C$ (equiv. in $X$).2012-10-11
  • 0
    @Chris. Yeah I can use that so that I can solve it for one column of X at a time. But If I have to iterate for thousand of times, it's gonna cost me a lot of time, many hours2012-10-11
  • 0
    @user34790 Have you tried block methods? See [these notes](http://www.mai.liu.se/~akbjo/hels08.pdf) p. 16 onwards for a description with multiple RHS vectors.2012-10-11
  • 0
    If you have the Control Systems toolbox, you might try the following: `X = lyap(zeros(n),D,-C);`2012-10-29
  • 0
    What kind of special structure does $D^T$ have beyond sparsity? Is it symmetric positive definite or anything like that?2012-10-29

3 Answers 3