MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / transpose_conj

Function transpose_conj

src/backend/cpu/kernel/transpose.hpp:105–133  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

103
104template<typename T>
105void transpose_conj(Param<T> output, CParam<T> input) {
106 const af::dim4 odims = output.dims();
107 const af::dim4 ostrides = output.strides();
108 const af::dim4 istrides = input.strides();
109
110 T *out = output.get();
111 T const *const in = input.get();
112
113 for (dim_t l = 0; l < odims[3]; ++l) {
114 for (dim_t k = 0; k < odims[2]; ++k) {
115 // Outermost loop handles batch mode
116 // if input has no data along third dimension
117 // this loop runs only once
118
119 for (dim_t j = 0; j < odims[1]; ++j) {
120 for (dim_t i = 0; i < odims[0]; ++i) {
121 // calculate array indices based on offsets and strides
122 // the helper getIdx takes care of indices
123 const dim_t inIdx = getIdx(istrides, j, i, k, l);
124 const dim_t outIdx = getIdx(ostrides, i, j, k, l);
125 out[outIdx] = getConjugate(in[inIdx]);
126 }
127 }
128 // outData and inData pointers doesn't need to be
129 // offset as the getIdx function is taking care
130 // of the batch parameter
131 }
132 }
133}
134
135template<typename T>
136void transpose(Param<T> out, CParam<T> in, const bool conjugate) {

Callers

nothing calls this directly

Calls 5

getIdxFunction · 0.85
getConjugateFunction · 0.70
dimsMethod · 0.45
stridesMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected