| 109 | |
| 110 | template<typename T> |
| 111 | double relEps(array in) { |
| 112 | typedef typename af::dtype_traits<T>::base_type InBaseType; |
| 113 | double fixed_eps = eps<T>(); |
| 114 | double calc_eps = std::numeric_limits<InBaseType>::epsilon() * |
| 115 | std::max(in.dims(0), in.dims(1)) * af::max<double>(in); |
| 116 | // Use the fixed values above if calculated error tolerance is unnecessarily |
| 117 | // too small |
| 118 | return std::max(fixed_eps, calc_eps); |
| 119 | } |
| 120 | |
| 121 | typedef ::testing::Types<float, cfloat, double, cdouble> TestTypes; |
| 122 | TYPED_TEST_SUITE(Pinverse, TestTypes); |