dimanche 28 août 2016

[VS 2015][C++11][Armadillo] Linspace Initialization

hope you can give me some advice on the following. As per title, my current setup is VS2015, C++11, Armadillo.

I have got the class

class MyClass
{

public:
    MyClass();
    virtual ~MyClass();
    arma::vec myVec;
    void MakeVec(int sz);
};

where:

void MyClass::MakeVec(int sz)
{
    myVec = arma::linspace(0.0, 1.0, sz);
}

As far as I can tell this is causing a memory leak detected by the ARMA debug when running the program, i.e. "Debug Assertion Failed - _CrtIsValidHeapPointer(block)".

In the official documentation page they do it only when declaring the variable, but in my case I'd like to make a linspace at runtime. Any suggestions?

Aucun commentaire:

Enregistrer un commentaire