MCPcopy Create free account
hub / github.com/Meshcapade/difflocks / TransposeOp

Class TransposeOp

extensions/include/cuMat/src/TransposeOp.h:112–182  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

110 */
111template<typename _Derived, bool _Conjugated>
112class TransposeOp : public CwiseOp<TransposeOp<_Derived, _Conjugated>>
113{
114public:
115 typedef CwiseOp<TransposeOp<_Derived, _Conjugated>> Base;
116 using Type = TransposeOp<_Derived, _Conjugated>;
117 CUMAT_PUBLIC_API
118
119 enum
120 {
121 OriginalFlags = internal::traits<_Derived>::Flags,
122 IsMatrix = std::is_same< _Derived, Matrix<Scalar, Columns, Rows, Batches, OriginalFlags> >::value,
123 IsConjugated = _Conjugated && internal::NumTraits<typename internal::traits<_Derived>::Scalar>::IsComplex
124 };
125
126 using Base::size;
127
128protected:
129 const _Derived matrix_;
130
131public:
132 explicit TransposeOp(const MatrixBase<_Derived>& child)
133 : matrix_(child.derived())
134 {}
135
136 __host__ __device__ CUMAT_STRONG_INLINE Index rows() const { return matrix_.cols(); }
137 __host__ __device__ CUMAT_STRONG_INLINE Index cols() const { return matrix_.rows(); }
138 __host__ __device__ CUMAT_STRONG_INLINE Index batches() const { return matrix_.batches(); }
139
140 __device__ CUMAT_STRONG_INLINE Scalar coeff(Index row, Index col, Index batch, Index index) const
141 { //read acces (cwise)
142 Scalar val = matrix_.coeff(col, row, batch, -1);
143 val = internal::TransposeFunctor<Scalar>()(val);
144 val = internal::conjugateCoeff<Scalar, IsConjugated>(val);
145 return val;
146 }
147 __device__ CUMAT_STRONG_INLINE Scalar& coeff(Index row, Index col, Index batch, Index index)
148 { //write acces (cwise)
149 //adjoint not allowed here
150 return matrix_.coeff(col, row, batch, -1);
151 }
152
153 const _Derived& getUnderlyingMatrix() const
154 {
155 return matrix_;
156 }
157
158 //ASSIGNMENT
159 template<typename Derived>
160 CUMAT_STRONG_INLINE Type& operator=(const MatrixBase<Derived>& expr)
161 {
162 CUMAT_ASSERT_ARGUMENT(rows() == expr.rows());
163 CUMAT_ASSERT_ARGUMENT(cols() == expr.cols());
164 CUMAT_ASSERT_ARGUMENT(batches() == expr.batches());
165 internal::Assignment<Type, Derived, AssignmentMode::ASSIGN, internal::DenseDstTag, typename internal::traits<Derived>::SrcTag>
166 ::assign(*this, expr);
167 //expr.template evalTo<Type, AssignmentMode::ASSIGN>(*this);
168 return *this;
169 }

Callers

nothing calls this directly

Calls 8

rowsFunction · 0.70
colsFunction · 0.70
batchesFunction · 0.70
assignFunction · 0.70
coeffMethod · 0.45
rowsMethod · 0.45
colsMethod · 0.45
batchesMethod · 0.45

Tested by

no test coverage detected