107 SIZE_CHECK(batchX1.size2() == batchX2.size2());
108 std::size_t sizeX1 = batchX1.size1();
109 std::size_t sizeX2 = batchX2.size1();
110 result.resize(sizeX1,sizeX2);
111 noalias(result) = prod(batchX1,trans(batchX2));
117 SIZE_CHECK(batchX1.size2() == batchX2.size2());
118 std::size_t sizeX1 = batchX1.size1();
119 std::size_t sizeX2 = batchX2.size1();
120 result.resize(sizeX1,sizeX2);
123 InternalState& s = state.
toState<InternalState>();
124 s.resize(sizeX1,sizeX2);
127 noalias(s.base) = prod(batchX1,trans(batchX2));
132 noalias(result) = s.base;
134 noalias(s.exponentedProd) = result;
154 RealMatrix
const& coefficientsX2,
159 std::size_t sizeX1 = batchX1.size1();
160 std::size_t sizeX2 = batchX2.size1();
161 gradient.resize(sizeX1,batchX1.size2());
162 InternalState
const& s = state.
toState<InternalState>();
165 SIZE_CHECK(batchX1.size2() == batchX2.size2());
168 SIZE_CHECK(s.exponentedProd.size1() == sizeX1);
169 SIZE_CHECK(s.exponentedProd.size2() == sizeX2);
173 RealMatrix weights = coefficientsX2 * safe_div(s.exponentedProd,s.base,0.0);
177 noalias(gradient) =
m_exponent * prod(weights,batchX2);