Код: Выделить всё
#ifndef MYSOLVER_H
#define MYSOLVER_H
#include
using Eigen::MatrixXd;
using Eigen::VectorXd;
class mySolver {
private:
/* Result vector.*/
VectorXd result;
public:
VectorXd solve(const MatrixXd&, const VectorXd&);
};
#endif // MYSOLVER_H
Код: Выделить всё
#include "mySolver.h"
#include
using Eigen::MatrixXd;
using Eigen::VectorXd;
VectorXd mySolver::solve(const MatrixXd& A, const VectorXd& b)
{
result = VectorXd::Constant(2,1);
return result;
}
Код: Выделить всё
#ifndef TESTCLASS_H
#define TESTCLASS_H
#include "mySolver.h"
#include
using Eigen::MatrixXd;
using Eigen::VectorXd;
class testClass {
private:
mySolver MySolver;
public:
void run();
};
#endif // TESTCLASS_H
Код: Выделить всё
#include "testClass.h"
#include "mySolver.h"
#include
using Eigen::MatrixXd;
using Eigen::VectorXd;
void testClass::run()
{
MySolver = mySolver();
A = MatrixXd::Constant(2,2,1);
b = VectorXd::Constant(2,1);
p = MySolver.solve(A, b);
}
Подробнее здесь: https://stackoverflow.com/questions/794 ... ass-member
Мобильная версия