133 InternalState& s = state.
toState<InternalState>();
137 s.resize(sizeX1,sizeX2,
m_base);
138 result.resize(sizeX1,sizeX2);
140 m_base->
eval(batchX1, batchX2,s.kxy, *s.stateKxy);
149 RealMatrix singleResult(1,1);
150 for(std::size_t i = 0; i != sizeX1;++i){
152 m_base->
eval(singleBatch,singleBatch,singleResult,*s.stateKxx[i]);
153 s.kxx[i] = singleResult(0,0);
156 for(std::size_t j = 0; j != sizeX2;++j){
158 m_base->
eval(singleBatch,singleBatch,singleResult,*s.stateKyy[j]);
159 s.kyy[j] = singleResult(0,0);
161 RealVector sqrtKyy=sqrt(s.kyy);
165 noalias(result) = s.kxy / outer_prod(sqrt(s.kxx),sqrtKyy);
178 RealVector sqrtKyy(sizeX2);
179 for(std::size_t j = 0; j != sizeX2;++j){
183 for(std::size_t i = 0; i != sizeX1;++i){
185 noalias(row(result,i)) = sqrtKxx* row(result,i) / sqrtKyy;
197 RealMatrix
const& coefficients,
202 InternalState
const& s = state.
toState<InternalState>();
206 RealMatrix weights = coefficients / sqrt(outer_prod(s.kxx,s.kyy));
210 noalias(weights) *= s.kxy;
211 RealVector wx = sum(as_rows(weights)) / (2.0 * s.kxx);
212 RealVector wy = sum(as_columns(weights)) / (2.0 * s.kyy);
218 RealVector subGradient(gradient.size());
220 RealMatrix coeff(1,1);
221 for(std::size_t i = 0; i != sizeX1; ++i){
225 gradient -= subGradient;
227 for(std::size_t j = 0; j != sizeX2; ++j){
231 gradient -= subGradient;
244 RealMatrix
const& coefficientsX2,
248 InternalState
const& s = state.
toState<InternalState>();
251 RealMatrix weights = coefficientsX2 / sqrt(outer_prod(s.kxx,s.kyy));
255 noalias(weights) *= s.kxy;
256 RealVector wx = sum(as_rows(weights))/s.kxx;
261 RealMatrix subGradient;
263 RealMatrix coeff(1,1);
264 for(std::size_t i = 0; i != sizeX1; ++i){
268 noalias(row(gradient,i)) -= row(subGradient,0);