37 #include <visp3/core/vpArray2D.h>
38 #include <visp3/core/vpException.h>
60 template <
unsigned int>
62 unsigned int & ,
unsigned int & ,
unsigned int & )
67 unsigned int &Acols,
unsigned int &Brows,
unsigned int &Bcols)
77 unsigned int &Acols,
unsigned int &Brows,
unsigned int &Bcols)
86 unsigned int &Acols,
unsigned int &Brows,
unsigned int &Bcols)
95 unsigned int &Acols,
unsigned int &Brows,
unsigned int &Bcols)
105 unsigned int &Acols,
unsigned int &Brows,
unsigned int &Bcols)
115 unsigned int &Acols,
unsigned int &Brows,
unsigned int &Bcols)
125 unsigned int &Acols,
unsigned int &Brows,
unsigned int &Bcols)
135 unsigned int &Acols,
unsigned int &Brows,
unsigned int &Bcols)
143 template <
unsigned int>
144 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;
165 inline void GEMM1<1>(
const unsigned int &Arows,
const unsigned int &Brows,
const unsigned int &Bcols,
168 for (
unsigned int r = 0; r < Arows; ++r) {
169 for (
unsigned int c = 0; c < Bcols; ++c) {
171 for (
unsigned int n = 0; n < Brows; ++n) {
172 sum += A[n][r] * B[n][c] * alpha;
180 inline void GEMM1<2>(
const unsigned int &Arows,
const unsigned int &Brows,
const unsigned int &Bcols,
183 for (
unsigned int r = 0; r < Arows; ++r) {
184 for (
unsigned int c = 0; c < Bcols; ++c) {
186 for (
unsigned int n = 0; n < Brows; ++n) {
187 sum += A[r][n] * B[c][n] * alpha;
195 inline void GEMM1<3>(
const unsigned int &Arows,
const unsigned int &Brows,
const unsigned int &Bcols,
198 for (
unsigned int r = 0; r < Arows; ++r) {
199 for (
unsigned int c = 0; c < Bcols; ++c) {
201 for (
unsigned int n = 0; n < Brows; ++n) {
202 sum += A[n][r] * B[c][n] * alpha;
209 template <
unsigned int>
210 inline void GEMM2(
const unsigned int & ,
const unsigned int & ,
const unsigned int & ,
216 inline void GEMM2<0>(
const unsigned int &Arows,
const unsigned int &Brows,
const unsigned int &Bcols,
220 for (
unsigned int r = 0; r < Arows; ++r) {
221 for (
unsigned int c = 0; c < Bcols; ++c) {
223 for (
unsigned int n = 0; n < Brows; ++n) {
224 sum += A[r][n] * B[n][c] * alpha;
226 D[r][c] = sum + (C[r][c] * beta);
232 inline void GEMM2<1>(
const unsigned int &Arows,
const unsigned int &Brows,
const unsigned int &Bcols,
236 for (
unsigned int r = 0; r < Arows; ++r) {
237 for (
unsigned int c = 0; c < Bcols; ++c) {
239 for (
unsigned int n = 0; n < Brows; ++n) {
240 sum += A[n][r] * B[n][c] * alpha;
242 D[r][c] = sum + (C[r][c] * beta);
248 inline void GEMM2<2>(
const unsigned int &Arows,
const unsigned int &Brows,
const unsigned int &Bcols,
252 for (
unsigned int r = 0; r < Arows; ++r) {
253 for (
unsigned int c = 0; c < Bcols; ++c) {
255 for (
unsigned int n = 0; n < Brows; ++n) {
256 sum += A[r][n] * B[c][n] * alpha;
258 D[r][c] = sum + (C[r][c] * beta);
264 inline void GEMM2<3>(
const unsigned int &Arows,
const unsigned int &Brows,
const unsigned int &Bcols,
268 for (
unsigned int r = 0; r < Arows; ++r) {
269 for (
unsigned int c = 0; c < Bcols; ++c) {
271 for (
unsigned int n = 0; n < Brows; ++n) {
272 sum += A[n][r] * B[c][n] * alpha;
274 D[r][c] = sum + (C[r][c] * beta);
280 inline void GEMM2<4>(
const unsigned int &Arows,
const unsigned int &Brows,
const unsigned int &Bcols,
284 for (
unsigned int r = 0; r < Arows; ++r) {
285 for (
unsigned int c = 0; c < Bcols; ++c) {
287 for (
unsigned int n = 0; n < Brows; ++n) {
288 sum += A[r][n] * B[n][c] * alpha;
290 D[r][c] = sum + (C[c][r] * beta);
296 inline void GEMM2<5>(
const unsigned int &Arows,
const unsigned int &Brows,
const unsigned int &Bcols,
300 for (
unsigned int r = 0; r < Arows; ++r) {
301 for (
unsigned int c = 0; c < Bcols; ++c) {
303 for (
unsigned int n = 0; n < Brows; ++n) {
304 sum += A[n][r] * B[n][c] * alpha;
306 D[r][c] = sum + (C[c][r] * beta);
312 inline void GEMM2<6>(
const unsigned int &Arows,
const unsigned int &Brows,
const unsigned int &Bcols,
316 for (
unsigned int r = 0; r < Arows; ++r) {
317 for (
unsigned int c = 0; c < Bcols; ++c) {
319 for (
unsigned int n = 0; n < Brows; ++n) {
320 sum += A[r][n] * B[c][n] * alpha;
322 D[r][c] = sum + (C[c][r] * beta);
328 inline void GEMM2<7>(
const unsigned int &Arows,
const unsigned int &Brows,
const unsigned int &Bcols,
332 for (
unsigned int r = 0; r < Arows; ++r) {
333 for (
unsigned int c = 0; c < Bcols; ++c) {
335 for (
unsigned int n = 0; n < Brows; ++n) {
336 sum += A[n][r] * B[c][n] * alpha;
338 D[r][c] = sum + (C[c][r] * beta);
343 template <
unsigned int T>
352 GEMMsize<T>(A, B, Arows, Acols, Brows, Bcols);
355 if ((Arows != D.getRows()) || (Bcols != D.getCols())) {
356 D.resize(Arows, Bcols);
363 if (Acols != Brows) {
365 Acols, Brows, Bcols));
374 GEMM2<T>(Arows, Brows, Bcols, A, B, alpha, C, beta, D);
377 GEMM1<T>(Arows, Brows, Bcols, A, B, alpha, D);
419 vpTGEMM<0>(A, B, alpha, C, beta, D);
422 vpTGEMM<1>(A, B, alpha, C, beta, D);
425 vpTGEMM<2>(A, B, alpha, C, beta, D);
428 vpTGEMM<3>(A, B, alpha, C, beta, D);
431 vpTGEMM<4>(A, B, alpha, C, beta, D);
434 vpTGEMM<5>(A, B, alpha, C, beta, D);
437 vpTGEMM<6>(A, B, alpha, C, beta, D);
440 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.