Re: [eigen] Cholesky on mapped matrices?

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


Hi Manoj,

On Wed, Jun 9, 2010 at 7:09 PM, Manoj Rajagopalan <rmanoj@xxxxxxxxx> wrote:
> Hi,
>
>   Is it possible to map a region of allocated memory into a square matrix and
> then call llt() and ldlt() on it? A small test program of mine failed. Maybe
> there are tricks to achieve this?

I've been able to do so for a while, calling Eigen code on objects in R's memory

    void my_LDLt(const double *A, const int *n, double *D, double *L) {
      Map<MatrixXd> AA(A, n[0], n[0]);
      LDLT<MatrixXd> AA_factored = AA.ldlt();
      Map<VectorXd>(D,n[0]) = AA_factored.vectorD();
      Map<MatrixXd>(L,n[0],n[0]) = AA_factored.matrixL();
    }

Ben



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/