coercing piranha polynomials into Symengine

40 views
Skip to first unread message

Andrew Corrigan

unread,
Jan 17, 2018, 10:57:12 AM1/17/18
to symengine
I'm in the process of rewriting my Sympy code using Piranha with Symengine to fill in the gaps (Matrices, ...), since as was pointed out in previous discussion it's mostly all just multivariate polynomial manipulation.

1. Right now, I am trying to construct a DenseMatrix in SymEngine, using polynomials that I have derived using Piranha.  How do I convert a Piranha polynomial over to SymEngine?

Plain old assignment doesn't work:

    auto J = Matrix(n_dim, n_dim);


    for(auto i_dim = 0; i_dim < n_dim; ++i_dim)

    {

        for(auto j_dim = 0; j_dim < n_dim; ++j_dim)

        {

            J.get(i_dim,j_dim) = x[i_dim];    // XXX differentiate with respect to c[j_dim]

        }

    }


piranha/install/include/symengine/symengine_rcp.h:182:13: Candidate function not viable: no known conversion from 'const value_type' (aka 'const piranha::polynomial<piranha::mp_rational<1>, piranha::monomial<int, std::__1::integral_constant<unsigned long, 0> > >') to 'const RCP<const SymEngine::Basic>' for 1st argument

2. I think SymEngine only supports univariate piranha polynomials, but when I build SymEngine using Piranha support, I get a bunch of compiler errors, starting with.  Am I supposed to use a specific version of Piranha (I have the most recent of each checked out)?


piranha/symengine/symengine/polys/uintpoly_piranha.h:55:8: error: 

      explicit specialization of non-template struct 'divexact_impl'

struct divexact_impl<SymEngine::integer_class> {

       ^            ~~~~~~~~~~~~~~~~~~~~~~~~~~

Andrew Corrigan

unread,
Jan 17, 2018, 11:01:32 AM1/17/18
to symengine

            J.get(i_dim,j_dim) = x[i_dim];    // XXX differentiate with respect to c[j_dim]


same thing with:

J.set(i_dim, j_dim, x[i_dim]); 
Reply all
Reply to author
Forward
0 new messages