Using juce::Array as a container for Eigen::MatrixXf?

I'm implmenting a linear algebra algorithm for a JUCE processor.

 

There is one version of the algorithm for one channel of data. The processing requires several 2D matrices as class members as well as juce::Array<Eigen::Xf> for some arrays of matrices.

 

The final processor needs to work on four channels of data. There, the processing would require the 2D matrices to be 3D and the juce::Array<Eigen::Xf> to become juce::Array<juce::Array<Eigen::Xf>> to account for the additional channel index.

This feels very ugly to me. I'm also worried if access/read/write will be efficient.

Thoughts if I should go on like this? Any better kind of container? None of the matrices will be larger than 40x40. The Matrices that will be contained inside the juce or double-juce containers would be 5x5 at most.

Thanks.

 

P.S. I've also tried using the Armadillo library for their arma::field and arma::cube classes, but the program turns out to be much slower compared to Eigen.

 

P.P.S  Here's a portion of the class:

class SpikeSorter : public GenericProcessor

{
public:

    SpikeSorter();
    ~SpikeSorter(){ }
    bool checkIfLogIsInf(float  num, float den);

    int P; //column span of the dictionary
    float alpha;
    float kappa0;
    float nu0;
    unsigned int K
    Eigen::MatrixXd phi0;
    float apii;
    float bpii;
    float beta;
    float tau;
    unsigned int Cmax;  //maximum possible number of neurons present
    int curndx; //used to index current location in buffer
    int lookahead; //functionally, it is the size of the buffer
    int range;
    float pii;
    //Array <float> nu;
    Eigen::RowVectorXd nu;
    juce::Array <Eigen::MatrixXd> phi;
    juce::Array <Eigen::MatrixXd> lamclus;
    juce::Array <Eigen::MatrixXd> lamclusinv;
    juce::Array <Eigen::MatrixXd> R;
    juce::Array <Eigen::MatrixXd> Rinv;
    Eigen::MatrixXd Qt;
    Eigen::MatrixXd muu0;
    Eigen::RowVectorXd kappa;
    Eigen::MatrixXd muu;
    Eigen::MatrixXd lambda;
    double logDeterminantOfLambda;
    Eigen::MatrixXd sigma;
    juce::Array<Eigen::MatrixXd> Q;
    //Eigen::MatrixXd Q;
    Eigen::MatrixXd Qinv;
    Eigen::MatrixXd ReducedDictionary; //This is A (PxK)
    Eigen::MatrixXd ReducedDictionaryTranspose;
    Eigen::MatrixXd Qmat;
    Eigen::VectorXd yhat;
    Eigen::VectorXd mhat;
    Eigen::MatrixXd Qhat;
    Eigen::VectorXd xwindLonger;