From c0c3be26ed0093a03316219783992b2bc9f8a226 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Tue, 9 Oct 2018 22:54:54 +0200 Subject: Extend unit tests for partial reductions --- test/vectorwiseop.cpp | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'test/vectorwiseop.cpp') diff --git a/test/vectorwiseop.cpp b/test/vectorwiseop.cpp index 2d7ddbed1..96a9bb0ee 100644 --- a/test/vectorwiseop.cpp +++ b/test/vectorwiseop.cpp @@ -197,11 +197,24 @@ template void vectorwiseop_matrix(const MatrixType& m) VERIFY_RAISES_ASSERT(m1.rowwise() - rowvec.transpose()); } + // ------ partial reductions ------ + // test norm - rrres = m1.colwise().norm(); - VERIFY_IS_APPROX(rrres(c), m1.col(c).norm()); - rcres = m1.rowwise().norm(); - VERIFY_IS_APPROX(rcres(r), m1.row(r).norm()); + #define TEST_PARTIAL_REDUX_BASIC(FUNC,ROW,COL,PREPROCESS) { \ + ROW = m1 PREPROCESS .colwise().FUNC ; \ + for(Index k=0; k()),rowvec,colvec,); VERIFY_IS_APPROX(m1.cwiseAbs().colwise().sum(), m1.colwise().template lpNorm<1>()); VERIFY_IS_APPROX(m1.cwiseAbs().rowwise().sum(), m1.rowwise().template lpNorm<1>()); -- cgit v1.2.3