* Much better, consistent error msgs when mixing different scalar types:

- in matrix-matrix product, static assert on the two scalar types to be the same.
- Similarly in CwiseBinaryOp. POTENTIALLY CONTROVERSIAL: we don't allow anymore binary
  ops to take two different scalar types. The functors that we defined take two args
  of the same type anyway; also we still allow the return type to be different.
  Again the reason is that different scalar types are incompatible with vectorization.
  Better have the user realize explicitly what mixing different numeric types costs him
  in terms of performance.
  See comment in CwiseBinaryOp constructor.
- This allowed to fix a little mistake in test/regression.cpp, mixing float and double
- Remove redundant semicolon (;) after static asserts
This commit is contained in:
Benoit Jacob
2008-12-03 21:01:55 +00:00
parent 84cc69f0f3
commit c1e2156d8a
22 changed files with 88 additions and 70 deletions

View File

@@ -53,8 +53,8 @@ void makeNoisyCohyperplanarPoints(int numPoints,
// project cur_point onto the hyperplane
Scalar x = - (hyperplane->coeffs().start(size).cwise()*cur_point).sum();
cur_point *= hyperplane->coeffs().coeff(size) / x;
} while( ei_abs(cur_point.norm()) < 0.5
|| ei_abs(cur_point.norm()) > 2.0 );
} while( cur_point.norm() < 0.5
|| cur_point.norm() > 2.0 );
}
// add some noise to these points
@@ -96,7 +96,7 @@ void test_regression()
Vector4d points4d [1000];
Vector4d *points4d_ptrs [1000];
for(int i = 0; i < 1000; i++) points4d_ptrs[i] = &(points4d[i]);
Hyperplane<float,4> coeffs5d;
Hyperplane<double,4> coeffs5d;
makeNoisyCohyperplanarPoints(1000, points4d_ptrs, &coeffs5d, 0.01);
CALL_SUBTEST(check_fitHyperplane(10, points4d_ptrs, coeffs5d, 0.05));
CALL_SUBTEST(check_fitHyperplane(100, points4d_ptrs, coeffs5d, 0.01));