Clarabel.cpp icon indicating copy to clipboard operation
Clarabel.cpp copied to clipboard

Errors in ZeroConeT and NonNegativeConeT definitions

Open nielsvd opened this issue 4 months ago • 0 comments

I haven't reached the point where I can test whether this causes any faulty behavior, but I found an inconsistency in the definitions of ZeroConeT and NonNegativeConeT. See:

https://github.com/oxfordcontrol/Clarabel.cpp/blob/c3a7b1ef98a047536ae5bfe956680ff8e51ad399/include/cpp/SupportedConeT.h#L115

and

https://github.com/oxfordcontrol/Clarabel.cpp/blob/c3a7b1ef98a047536ae5bfe956680ff8e51ad399/include/cpp/SupportedConeT.h#L128

I suppose it should instead be something like:

template<typename T = double>
struct ZeroConeT : public SupportedConeT<T>
{
  public:
    ZeroConeT(uintptr_t dimension)
    {
        this->tag = SupportedConeT<T>::Tag::ZeroConeT;
        ///old: this->nonnegative_cone_t = { dimension };
        this->zero_cone_t = { dimension };
    }

    uintptr_t dimension() const { return this->zero_cone_t._0; }
};

template<typename T = double>
struct NonnegativeConeT : public SupportedConeT<T>
{
  public:
    NonnegativeConeT(uintptr_t dimension)
    {
        this->tag = SupportedConeT<T>::Tag::NonnegativeConeT;
        ///old: this->zero_cone_t = { dimension };
        this->nonnegative_cone_t = { dimension };
    }

    uintptr_t dimension() const { return this->nonnegative_cone_t._0; }
};

There may be other side effects I haven't had the chance to investigate yet.

Clarabel looks like a great tool. I look forward to testing it! Thanks!

nielsvd avatar Oct 01 '24 11:10 nielsvd