Skip to content

How to LuSolve with Eigen Matrices with AD #234

@ShrutheeshIR

Description

@ShrutheeshIR

I want to solve a linear systems equation AX = b where A is a Eigen::Matrix<AD<double>, Eigen::Dynamic, Eigen::Dynamic>, b and X are vectors Eigen::Matrix<AD<double>, Eigen::Dynamic, 1>.

I try to call the LuSolve function to solve for X as:

double logdet;
const int signed_det = LuSolve(nt, (size_t)1, A, b, X, logdet);

I know that we have to feed the A, b, X as FloatVectors, but I'm having some trouble converting to and from Eigen for CPPAd.

But I get two errors related to this:

deduced conflicting types for parameter 'const FloatVector' ('Eigen::Matrix<CppAD::AD<CppAD::cg<double>, -1, -1>' and 'ADVectorXs' {aka 'Eigen::Matrix<CppAD::AD<CppAD::cg<double>, -1, 1>'})

and when I force them both to be matrices (using hacky code)

convert 'Eigen::DenseCoeffsBase<Eigen::Matrix<CppAD::AD<CppAD::cg<double> >, -1, 1>, 1>::Scalar' {aka 'CppAD::AD<CppAD::cg<double> >'} to 'float'

I'm having some trouble understanding the conversions. Any help to resolve this would be appreciated, thank you

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions