Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a generic property getter that does not require specifying the type #23

Open
fingolfin opened this issue Apr 19, 2023 · 0 comments
Open

Comments

@fingolfin
Copy link
Member

In NormalizInterface we allow this.

Relevant function there is _NmzConePropertyImpl, some code snippets from that:

template <typename Integer>
static Obj _NmzConePropertyImpl(Obj cone, libnormaliz::ConeProperty::Enum p)
{
    Cone<Integer> * C = GET_CONE<Integer>(cone);
    ConeProperties  notComputed;

    SIGNAL_HANDLER_BEGIN
    notComputed = C->compute(ConeProperties(p));
    SIGNAL_HANDLER_END

...
    switch (libnormaliz::output_type(p)) {
    case libnormaliz::OutputType::Matrix:
        return NmzToGAP(C-> getMatrixConePropertyMatrix(p));

    case libnormaliz::OutputType::Vector:
        return NmzToGAP(C->getVectorConeProperty(p));

    case libnormaliz::OutputType::Integer:
        return NmzToGAP(C->getIntegerConeProperty(p));

    case libnormaliz::OutputType::GMPInteger:
        return NmzToGAP(C->getGMPIntegerConeProperty(p));

    case libnormaliz::OutputType::Rational:
        return NmzToGAP(C->getRationalConeProperty(p));

...


    case libnormaliz::OutputType::Complex:
        // more complex data structures are handled below
        break;

    case libnormaliz::OutputType::Void:
        // throw "cone property is input-only";
        return Fail;

    default:
        throw "unsupported output_type";
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant