GNU Radio's BLOCKSTREAM Package
matrix.h
Go to the documentation of this file.
1 #ifndef MATRIX_H
2 #define MATRIX_H
3 
4 #include <vector>
5 
6 #ifndef _MSC_VER
7 #ifndef __forceinline
8 #define __forceinline inline __attribute__((always_inline))
9 #endif
10 #endif
11 
12 namespace aff3ct
13 {
14 namespace tools
15 {
16 // ------------------------------------------------------------------------------------------- special function headers
17 
18 // M - INTEGER.
19 // On entry, M specifies the number of rows of the
20 // matrix op( A ) and of the matrix C. M must be
21 // at least zero. Unchanged on exit.
22 
23 // N - INTEGER.
24 // On entry, N specifies the number of columns of the
25 // matrix op( B ) and the number of columns of the
26 // matrix C. N must be at least zero. Unchanged on
27 // exit.
28 
29 // K - INTEGER.
30 // On entry, K specifies the number of columns of the
31 // matrix op( A ) and the number of rows of the matrix
32 // op( B ). K must be at least zero. Unchanged on
33 // exit.
34 
35 // real general matrix multiplication: C = A * B, tB is B transposed, tC is C transposed
36 template <typename T, class AT = std::allocator<T>>
37 __forceinline void rgemm(const int M, const int N, const int K,
38  const std::vector<T,AT> &A,
39  const std::vector<T,AT> &tB,
40  std::vector<T,AT> &tC);
41 
42 template <typename T>
43 __forceinline void rgemm(const int M, const int N, const int K,
44  const T *A,
45  const T *tB,
46  T *tC);
47 
48 // complex general matrix multiplication: C = A * B, tB is B transposed, tC is C transposed
49 template <typename T, class AT = std::allocator<T>>
50 __forceinline void cgemm(const int M, const int N, const int K,
51  const std::vector<T,AT> &A,
52  const std::vector<T,AT> &tB,
53  std::vector<T,AT> &tC);
54 
55 template <typename T>
56 __forceinline void cgemm(const int M, const int N, const int K,
57  const T *A,
58  const T *tB,
59  T *tC);
60 
61 // keep only the real part in C
62 template <typename T, class AT = std::allocator<T>>
63 __forceinline void cgemm_r(const int M, const int N, const int K,
64  const std::vector<T,AT> &A,
65  const std::vector<T,AT> &tB,
66  std::vector<T,AT> &tC);
67 
68 template <typename T>
69 __forceinline void cgemm_r(const int M, const int N, const int K,
70  const T *A,
71  const T *tB,
72  T *tC);
73 
74 // real transpose : B = tA, where A is of size M*N and then B of size N*M
75 template <typename T, class AT = std::allocator<T>>
76 __forceinline void real_transpose(const int M, const int N,
77  const std::vector<T,AT> &A,
78  std::vector<T,AT> &B);
79 
80 template <typename T>
81 __forceinline void real_transpose(const int M, const int N,
82  const T *A,
83  T *B);
84 
85 // complex transpose : B_real = tA_real and B_imag = -tA_imag, where A is of size M*N*2 and then B of size N*M*2
86 // (with both complex elements) : B's elements are the conjugates of A's
87 template <typename T, class AT = std::allocator<T>>
88 __forceinline void complex_transpose(const int M, const int N,
89  const std::vector<T,AT> &A,
90  std::vector<T,AT> &B);
91 
92 template <typename T>
93 __forceinline void complex_transpose(const int M, const int N,
94  const T *A,
95  T *B);
96 }
97 }
98 
99 #include "matrix.hxx"
100 
101 #endif /* MATRIX_H */
constexpr int32_t N()
Definition: mipp.h:431
#define __forceinline
Definition: matrix.h:8
__forceinline void complex_transpose(const int M, const int N, const std::vector< T, AT > &A, std::vector< T, AT > &B)
__forceinline void cgemm_r(const int M, const int N, const int K, const std::vector< T, AT > &A, const std::vector< T, AT > &tB, std::vector< T, AT > &tC)
B_32 B
Definition: types.h:50
__forceinline void real_transpose(const int M, const int N, const std::vector< T, AT > &A, std::vector< T, AT > &B)
__forceinline void rgemm(const int M, const int N, const int K, const std::vector< T, AT > &A, const std::vector< T, AT > &tB, std::vector< T, AT > &tC)
__forceinline void cgemm(const int M, const int N, const int K, const std::vector< T, AT > &A, const std::vector< T, AT > &tB, std::vector< T, AT > &tC)