37 #include <visp3/core/vpArray2D.h>
38 #include <visp3/core/vpException.h>
58 template <
unsigned int>
60 unsigned int & ,
unsigned int & ,
unsigned int & )
66 unsigned int &Acols,
unsigned int &Brows,
unsigned int &Bcols)
76 unsigned int &Acols,
unsigned int &Brows,
unsigned int &Bcols)
85 unsigned int &Acols,
unsigned int &Brows,
unsigned int &Bcols)
94 unsigned int &Acols,
unsigned int &Brows,
unsigned int &Bcols)
104 unsigned int &Acols,
unsigned int &Brows,
unsigned int &Bcols)
114 unsigned int &Acols,
unsigned int &Brows,
unsigned int &Bcols)
124 unsigned int &Acols,
unsigned int &Brows,
unsigned int &Bcols)
134 unsigned int &Acols,
unsigned int &Brows,
unsigned int &Bcols)
142 template <
unsigned int>
143 inline void GEMM1(
const unsigned int & ,
const unsigned int & ,
const unsigned int & ,
150 inline void GEMM1<0>(
const unsigned int &Arows,
const unsigned int &Brows,
const unsigned int &Bcols,
153 for (
unsigned int r = 0; r < Arows; r++)
154 for (
unsigned int c = 0; c < Bcols; c++) {
156 for (
unsigned int n = 0; n < Brows; n++)
157 sum += A[r][n] * B[n][c] * alpha;
163 inline void GEMM1<1>(
const unsigned int &Arows,
const unsigned int &Brows,
const unsigned int &Bcols,
166 for (
unsigned int r = 0; r < Arows; r++)
167 for (
unsigned int c = 0; c < Bcols; c++) {
169 for (
unsigned int n = 0; n < Brows; n++)
170 sum += A[n][r] * B[n][c] * alpha;
176 inline void GEMM1<2>(
const unsigned int &Arows,
const unsigned int &Brows,
const unsigned int &Bcols,
179 for (
unsigned int r = 0; r < Arows; r++)
180 for (
unsigned int c = 0; c < Bcols; c++) {
182 for (
unsigned int n = 0; n < Brows; n++)
183 sum += A[r][n] * B[c][n] * alpha;
189 inline void GEMM1<3>(
const unsigned int &Arows,
const unsigned int &Brows,
const unsigned int &Bcols,
192 for (
unsigned int r = 0; r < Arows; r++)
193 for (
unsigned int c = 0; c < Bcols; c++) {
195 for (
unsigned int n = 0; n < Brows; n++)
196 sum += A[n][r] * B[c][n] * alpha;
201 template <
unsigned int>
202 inline void GEMM2(
const unsigned int & ,
const unsigned int & ,
const unsigned int & ,
209 inline void GEMM2<0>(
const unsigned int &Arows,
const unsigned int &Brows,
const unsigned int &Bcols,
213 for (
unsigned int r = 0; r < Arows; r++)
214 for (
unsigned int c = 0; c < Bcols; c++) {
216 for (
unsigned int n = 0; n < Brows; n++)
217 sum += A[r][n] * B[n][c] * alpha;
218 D[r][c] = sum + C[r][c] * beta;
223 inline void GEMM2<1>(
const unsigned int &Arows,
const unsigned int &Brows,
const unsigned int &Bcols,
227 for (
unsigned int r = 0; r < Arows; r++)
228 for (
unsigned int c = 0; c < Bcols; c++) {
230 for (
unsigned int n = 0; n < Brows; n++)
231 sum += A[n][r] * B[n][c] * alpha;
232 D[r][c] = sum + C[r][c] * beta;
237 inline void GEMM2<2>(
const unsigned int &Arows,
const unsigned int &Brows,
const unsigned int &Bcols,
241 for (
unsigned int r = 0; r < Arows; r++)
242 for (
unsigned int c = 0; c < Bcols; c++) {
244 for (
unsigned int n = 0; n < Brows; n++)
245 sum += A[r][n] * B[c][n] * alpha;
246 D[r][c] = sum + C[r][c] * beta;
251 inline void GEMM2<3>(
const unsigned int &Arows,
const unsigned int &Brows,
const unsigned int &Bcols,
255 for (
unsigned int r = 0; r < Arows; r++)
256 for (
unsigned int c = 0; c < Bcols; c++) {
258 for (
unsigned int n = 0; n < Brows; n++)
259 sum += A[n][r] * B[c][n] * alpha;
260 D[r][c] = sum + C[r][c] * beta;
265 inline void GEMM2<4>(
const unsigned int &Arows,
const unsigned int &Brows,
const unsigned int &Bcols,
269 for (
unsigned int r = 0; r < Arows; r++)
270 for (
unsigned int c = 0; c < Bcols; c++) {
272 for (
unsigned int n = 0; n < Brows; n++)
273 sum += A[r][n] * B[n][c] * alpha;
274 D[r][c] = sum + C[c][r] * beta;
279 inline void GEMM2<5>(
const unsigned int &Arows,
const unsigned int &Brows,
const unsigned int &Bcols,
283 for (
unsigned int r = 0; r < Arows; r++)
284 for (
unsigned int c = 0; c < Bcols; c++) {
286 for (
unsigned int n = 0; n < Brows; n++)
287 sum += A[n][r] * B[n][c] * alpha;
288 D[r][c] = sum + C[c][r] * beta;
293 inline void GEMM2<6>(
const unsigned int &Arows,
const unsigned int &Brows,
const unsigned int &Bcols,
297 for (
unsigned int r = 0; r < Arows; r++)
298 for (
unsigned int c = 0; c < Bcols; c++) {
300 for (
unsigned int n = 0; n < Brows; n++)
301 sum += A[r][n] * B[c][n] * alpha;
302 D[r][c] = sum + C[c][r] * beta;
307 inline void GEMM2<7>(
const unsigned int &Arows,
const unsigned int &Brows,
const unsigned int &Bcols,
311 for (
unsigned int r = 0; r < Arows; r++)
312 for (
unsigned int c = 0; c < Bcols; c++) {
314 for (
unsigned int n = 0; n < Brows; n++)
315 sum += A[n][r] * B[c][n] * alpha;
316 D[r][c] = sum + C[c][r] * beta;
320 template <
unsigned int T>
329 GEMMsize<T>(A, B, Arows, Acols, Brows, Bcols);
332 if ((Arows != D.getRows()) || (Bcols != D.getCols()))
333 D.resize(Arows, Bcols);
338 if (Acols != Brows) {
340 Acols, Brows, Bcols));
349 GEMM2<T>(Arows, Brows, Bcols, A, B, alpha, C, beta, D);
351 GEMM1<T>(Arows, Brows, Bcols, A, B, alpha, D);
393 vpTGEMM<0>(A, B, alpha, C, beta, D);
396 vpTGEMM<1>(A, B, alpha, C, beta, D);
399 vpTGEMM<2>(A, B, alpha, C, beta, D);
402 vpTGEMM<3>(A, B, alpha, C, beta, D);
405 vpTGEMM<4>(A, B, alpha, C, beta, D);
408 vpTGEMM<5>(A, B, alpha, C, beta, D);
411 vpTGEMM<6>(A, B, alpha, C, beta, D);
414 vpTGEMM<7>(A, B, alpha, C, beta, D);
unsigned int getCols() const
void vpGEMM(const vpArray2D< double > &A, const vpArray2D< double > &B, const double &alpha, const vpArray2D< double > &C, const double &beta, vpArray2D< double > &D, const unsigned int &ops=0)
unsigned int getRows() const
error that can be emitted by ViSP classes.
@ functionNotImplementedError
Function not implemented.
@ dimensionError
Bad dimension.