35 #ifndef SHARK_MODELS_KERNELS_PRODUCTKERNEL_H 36 #define SHARK_MODELS_KERNELS_PRODUCTKERNEL_H 59 template<
class InputType>
94 for(std::size_t i = 0; i != kernels.size(); ++i)
100 {
return "ProductKernel"; }
118 auto const& params = kernel->parameterVector();
119 noalias(subrange(ret,pos, pos + params.size())) = params;
120 pos += params.size();
130 std::size_t numParams = kernel->numberOfParameters();
131 kernel->setParameterVector(subrange(newParameters,pos, pos + numParams));
143 double eval(ConstInputReference x1, ConstInputReference x2)
const{
145 for (std::size_t i=0; i<
m_kernels.size(); i++)
150 void eval(ConstBatchInputReference batchX1, ConstBatchInputReference batchX2, RealMatrix& result)
const{
155 m_kernels[0]->eval(batchX1,batchX2,result);
157 RealMatrix kernelResult(sizeX1,sizeX2);
158 for(std::size_t i = 1; i !=
m_kernels.size(); ++i){
159 m_kernels[i]->eval(batchX1,batchX2,kernelResult);
160 noalias(result) *= kernelResult;
164 void eval(ConstBatchInputReference batchX1, ConstBatchInputReference batchX2, RealMatrix& result,
State& state)
const{
165 eval(batchX1,batchX2,result);
170 for(std::size_t i = 0;i !=
m_kernels.size(); ++i ){
178 for(std::size_t i = 0;i !=
m_kernels.size(); ++i ){
179 ar << const_cast<AbstractKernelFunction<InputType>
const&>(*
m_kernels[i]);