Home > Software engineering >  Vs cwise c2039 consult problems in class is not a member of the Eigen and 2228/structure/joint
Vs cwise c2039 consult problems in class is not a member of the Eigen and 2228/structure/joint

Time:09-25

# # ifndef KERNELS_H
# define KERNELS_H

#include
#include

The class Kernel
{
Public:
Virtual double Eval (const Eigen: : VectorXd& X1, const Eigen: : VectorXd& X2) const=0;
Virtual double Eval (const Eigen: : VectorXd& Const x)=0;
};

The class LinearKernel: public Kernel
{
Public:
The inline double Eval (const Eigen: : VectorXd& X1, const Eigen: : VectorXd& X2) const
{
Return the x1. Dot (x2);
}

The inline double Eval (const Eigen: : VectorXd& X) const
{
Return x.s quaredNorm ();
}
};

The class GaussianKernel: public Kernel
{
Public:
GaussianKernel (double sigma) : m_sigma (sigma) {}
The inline double Eval (const Eigen: : VectorXd& X1, const Eigen: : VectorXd& X2) const
{
Return exp (- m_sigma * (x1, x2). SquaredNorm ());
}

The inline double Eval (const Eigen: : VectorXd& X) const
{
The return of 1.0;
}

Private:
Double m_sigma;
};

The class IntersectionKernel: public Kernel
{
Public:
The inline double Eval (const Eigen: : VectorXd& X1, const Eigen: : VectorXd& X2) const
{
return x1. Cwise (). Min (x2). The sum ();
}

The inline double Eval (const Eigen: : VectorXd& X) const
{
Return x.s um ();
}
};
The class Chi2Kernel: public Kernel
{
Public:
The inline double Eval (const Eigen: : VectorXd& X1, const Eigen: : VectorXd& X2) const
{
Double the result=0.0;
for (int i=0; i {
Double a=x1 [I];
Double b=x2 [I];
Result +=(a - b) * (a - b)/(0.5 * (a + b) + 1 e - 8).
}
1.0 the result return;
}

The inline double Eval (const Eigen: : VectorXd& X) const
{
The return of 1.0;
}
};

The class MultiKernel: public Kernel
{
Public:
MultiKernel (const STD: : vector & FeatureCounts) :
M_n (kernels. The size ()),
M_norm (1.0/kernels. The size ()),
M_kernels (kernels),
M_counts (featureCounts)
{
}

The inline double Eval (const Eigen: : VectorXd& X1, const Eigen: : VectorXd& X2) const
{
Double sum=0.0;
Int start=0;
for (int i=0; i {
C=m_counts int [I];
The sum +=m_norm * m_kernels [I] - & gt; Eval (x1. Segment (start, c), x2. Segment (start, c));
Start +=c;
}
Return the sum.
}

The inline double Eval (const Eigen: : VectorXd& X) const
{
Double sum=0.0;
Int start=0;
for (int i=0; i {
C=m_counts int [I];
The sum +=m_norm * m_kernels [I] - & gt; Eval (x.s egment (start, c));
Start +=c;
}
Return the sum.
}

Private:
Int m_n;
Double m_norm;
STD: : vectorSTD: : vector M_counts;

};

# endif


Above the blue, there is an error below
Error 1 error C2039: "cwise:" not "Eigen: : MatrixError 4 error C2039: "cwise:" not "Eigen: : MatrixError 2 error C2228: "min" to the left of the must have a class/structure/joint
Mistake 5 error C2228: "min" to the left of the must have a class/structure/joint
Error 3 error C2228: "sum" to the left of the must have a class/structure/joint
Error 6 error C2228: "sum" to the left of the must have a class/structure/joint
Error 7 IntelliSense: class "Eigen: : Matrix"
Consult,,

CodePudding user response:

Beginner's best side will have to guide you as learning is too slow

CodePudding user response:

CwiseMin?
  • Related