-
Couldn't load subscription status.
- Fork 38
Description
Hey all,
seems that the sanity check is using absolute error (difference in results) in checking definition of the vectorspace. When using a large-valued vector, this error is sometimes not achievable due to machine precision.
In my example, the inner products are of the order of 1e8 with a 1e-9 absolute error. This causes the check to fail with the default tolerance of 1e-12.
To me, it makes sense to turn this into a check on relative error (ratio of results) rather than absolute (difference of results) as to avoid machine precision issues.
Line 156 in bbe35c8
| tol = 1e-12 |
Lines 202 to 207 in bbe35c8
| # Check that the inner product of a vector is correct after scalar | |
| # multiplication and vector addition. | |
| vec_add_mult = test_vec * scale_factor + test_vec | |
| if abs( | |
| self.inner_product(vec_add_mult, vec_add_mult) - | |
| vec_copy_mag_sq * (scale_factor + 1) ** 2) > tol: |