42 #include <visp3/core/vpArray2D.h> 43 #include <visp3/core/vpException.h> 63 template <
unsigned int>
65 unsigned int & ,
unsigned int & ,
unsigned int & )
71 unsigned int &Acols,
unsigned int &Brows,
unsigned int &Bcols)
81 unsigned int &Acols,
unsigned int &Brows,
unsigned int &Bcols)
90 unsigned int &Acols,
unsigned int &Brows,
unsigned int &Bcols)
99 unsigned int &Acols,
unsigned int &Brows,
unsigned int &Bcols)
109 unsigned int &Acols,
unsigned int &Brows,
unsigned int &Bcols)
119 unsigned int &Acols,
unsigned int &Brows,
unsigned int &Bcols)
129 unsigned int &Acols,
unsigned int &Brows,
unsigned int &Bcols)
139 unsigned int &Acols,
unsigned int &Brows,
unsigned int &Bcols)
147 template <
unsigned int>
148 inline void GEMM1(
const unsigned int & ,
const unsigned int & ,
const unsigned int & ,
155 inline void GEMM1<0>(
const unsigned int &Arows,
const unsigned int &Brows,
const unsigned int &Bcols,
158 for (
unsigned int r = 0; r < Arows; r++)
159 for (
unsigned int c = 0; c < Bcols; c++) {
161 for (
unsigned int n = 0; n < Brows; n++)
162 sum += A[r][n] * B[n][c] * alpha;
168 inline void GEMM1<1>(
const unsigned int &Arows,
const unsigned int &Brows,
const unsigned int &Bcols,
171 for (
unsigned int r = 0; r < Arows; r++)
172 for (
unsigned int c = 0; c < Bcols; c++) {
174 for (
unsigned int n = 0; n < Brows; n++)
175 sum += A[n][r] * B[n][c] * alpha;
181 inline void GEMM1<2>(
const unsigned int &Arows,
const unsigned int &Brows,
const unsigned int &Bcols,
184 for (
unsigned int r = 0; r < Arows; r++)
185 for (
unsigned int c = 0; c < Bcols; c++) {
187 for (
unsigned int n = 0; n < Brows; n++)
188 sum += A[r][n] * B[c][n] * alpha;
194 inline void GEMM1<3>(
const unsigned int &Arows,
const unsigned int &Brows,
const unsigned int &Bcols,
197 for (
unsigned int r = 0; r < Arows; r++)
198 for (
unsigned int c = 0; c < Bcols; c++) {
200 for (
unsigned int n = 0; n < Brows; n++)
201 sum += A[n][r] * B[c][n] * alpha;
206 template <
unsigned int>
207 inline void GEMM2(
const unsigned int & ,
const unsigned int & ,
const unsigned int & ,
214 inline void GEMM2<0>(
const unsigned int &Arows,
const unsigned int &Brows,
const unsigned int &Bcols,
218 for (
unsigned int r = 0; r < Arows; r++)
219 for (
unsigned int c = 0; c < Bcols; c++) {
221 for (
unsigned int n = 0; n < Brows; n++)
222 sum += A[r][n] * B[n][c] * alpha;
223 D[r][c] = sum + C[r][c] * beta;
228 inline void GEMM2<1>(
const unsigned int &Arows,
const unsigned int &Brows,
const unsigned int &Bcols,
232 for (
unsigned int r = 0; r < Arows; r++)
233 for (
unsigned int c = 0; c < Bcols; c++) {
235 for (
unsigned int n = 0; n < Brows; n++)
236 sum += A[n][r] * B[n][c] * alpha;
237 D[r][c] = sum + C[r][c] * beta;
242 inline void GEMM2<2>(
const unsigned int &Arows,
const unsigned int &Brows,
const unsigned int &Bcols,
246 for (
unsigned int r = 0; r < Arows; r++)
247 for (
unsigned int c = 0; c < Bcols; c++) {
249 for (
unsigned int n = 0; n < Brows; n++)
250 sum += A[r][n] * B[c][n] * alpha;
251 D[r][c] = sum + C[r][c] * beta;
256 inline void GEMM2<3>(
const unsigned int &Arows,
const unsigned int &Brows,
const unsigned int &Bcols,
260 for (
unsigned int r = 0; r < Arows; r++)
261 for (
unsigned int c = 0; c < Bcols; c++) {
263 for (
unsigned int n = 0; n < Brows; n++)
264 sum += A[n][r] * B[c][n] * alpha;
265 D[r][c] = sum + C[r][c] * beta;
270 inline void GEMM2<4>(
const unsigned int &Arows,
const unsigned int &Brows,
const unsigned int &Bcols,
274 for (
unsigned int r = 0; r < Arows; r++)
275 for (
unsigned int c = 0; c < Bcols; c++) {
277 for (
unsigned int n = 0; n < Brows; n++)
278 sum += A[r][n] * B[n][c] * alpha;
279 D[r][c] = sum + C[c][r] * beta;
284 inline void GEMM2<5>(
const unsigned int &Arows,
const unsigned int &Brows,
const unsigned int &Bcols,
288 for (
unsigned int r = 0; r < Arows; r++)
289 for (
unsigned int c = 0; c < Bcols; c++) {
291 for (
unsigned int n = 0; n < Brows; n++)
292 sum += A[n][r] * B[n][c] * alpha;
293 D[r][c] = sum + C[c][r] * beta;
298 inline void GEMM2<6>(
const unsigned int &Arows,
const unsigned int &Brows,
const unsigned int &Bcols,
302 for (
unsigned int r = 0; r < Arows; r++)
303 for (
unsigned int c = 0; c < Bcols; c++) {
305 for (
unsigned int n = 0; n < Brows; n++)
306 sum += A[r][n] * B[c][n] * alpha;
307 D[r][c] = sum + C[c][r] * beta;
312 inline void GEMM2<7>(
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[n][r] * B[c][n] * alpha;
321 D[r][c] = sum + C[c][r] * beta;
325 template <
unsigned int T>
334 GEMMsize<T>(A, B, Arows, Acols, Brows, Bcols);
343 if (Acols != Brows) {
345 Acols, Brows, Bcols));
354 GEMM2<T>(Arows, Brows, Bcols, A, B, alpha, C, beta, D);
356 GEMM1<T>(Arows, Brows, Bcols, A, B, alpha, D);
398 vpTGEMM<0>(A, B, alpha, C, beta, D);
401 vpTGEMM<1>(A, B, alpha, C, beta, D);
404 vpTGEMM<2>(A, B, alpha, C, beta, D);
407 vpTGEMM<3>(A, B, alpha, C, beta, D);
410 vpTGEMM<4>(A, B, alpha, C, beta, D);
413 vpTGEMM<5>(A, B, alpha, C, beta, D);
416 vpTGEMM<6>(A, B, alpha, C, beta, D);
419 vpTGEMM<7>(A, B, alpha, C, beta, D);
void resize(const unsigned int nrows, const unsigned int ncols, const bool flagNullify=true, const bool recopy_=true)
error that can be emited by ViSP classes.
unsigned int getCols() const
unsigned int getRows() 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)
Function not implemented.