'Using Templated Eigen Matrices in Class
I want to create a class that uses matrices whose types and sizes are determined by the user during the constructor call. I tried to use a class template whose arguments are then used to instantiate everything in the class members, but I'm getting errors.
What is the best way to accomplish this?
Here is my erroring code:
#pragma once
#include "Arduino.h"
#include "eigen.h"
#include <Eigen/LU>
#include <Eigen/Geometry>
using namespace Eigen;
template<typename type, static const int _numMeas, static const int _numStates>
class pf
{
public:
pf(const Matrix<type, _numMeas, _numMeas>& _R, const Matrix<type, _numStates, _numStates>& _Q)
{
};
private:
int numMeas = _numMeas;
int numStates = _numStates;
Matrix<type, _numMeas, _numMeas> R;
Matrix<type, _numStates, _numStates> Q;
};
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
