| 179 | |
| 180 | template<typename MatrixType> |
| 181 | void testMapRef(const MatrixType& A) |
| 182 | { |
| 183 | // Test if passing Ref and Map objects is possible |
| 184 | // (Regression test for Bug #1796) |
| 185 | Index size = A.rows(); |
| 186 | MatrixType X; X.setRandom(size, size); |
| 187 | MatrixType Y(size,size); |
| 188 | Ref< MatrixType> R(Y); |
| 189 | Ref<const MatrixType> Rc(X); |
| 190 | Map< MatrixType> M(Y.data(), size, size); |
| 191 | Map<const MatrixType> Mc(X.data(), size, size); |
| 192 | |
| 193 | X = X*X; // make sure sqrt is possible |
| 194 | Y = X.sqrt(); |
| 195 | R = Rc.sqrt(); |
| 196 | M = Mc.sqrt(); |
| 197 | Y = X.exp(); |
| 198 | R = Rc.exp(); |
| 199 | M = Mc.exp(); |
| 200 | X = Y; // make sure log is possible |
| 201 | Y = X.log(); |
| 202 | R = Rc.log(); |
| 203 | M = Mc.log(); |
| 204 | |
| 205 | Y = X.cos() + Rc.cos() + Mc.cos(); |
| 206 | Y = X.sin() + Rc.sin() + Mc.sin(); |
| 207 | |
| 208 | Y = X.cosh() + Rc.cosh() + Mc.cosh(); |
| 209 | Y = X.sinh() + Rc.sinh() + Mc.sinh(); |
| 210 | } |
| 211 | |
| 212 | |
| 213 | EIGEN_DECLARE_TEST(matrix_function) |