diff --git a/Eigen/src/Core/BandMatrix.h b/Eigen/src/Core/BandMatrix.h index c2d943c15..dcb0d1386 100644 --- a/Eigen/src/Core/BandMatrix.h +++ b/Eigen/src/Core/BandMatrix.h @@ -273,7 +273,7 @@ class BandMatrixWrapper : public BandMatrixBase EIGEN_STRONG_INLINE Packet16f pblend(const Selector<16>& /*ifPacket*/, const Packet16f& /*thenPacket*/, const Packet16f& /*elsePacket*/) { - assert(false && "To be implemented"); + eigen_assert(false && "To be implemented"); return Packet16f(); } template <> diff --git a/Eigen/src/SVD/BDCSVD.h b/Eigen/src/SVD/BDCSVD.h index 094944263..1b10c0e42 100644 --- a/Eigen/src/SVD/BDCSVD.h +++ b/Eigen/src/SVD/BDCSVD.h @@ -594,9 +594,9 @@ void BDCSVD::divide(Index firstCol, Index lastCol, Index fi } #ifdef EIGEN_BDCSVD_SANITY_CHECKS - assert(m_naiveU.allFinite()); - assert(m_naiveV.allFinite()); - assert(m_computed.allFinite()); + eigen_internal_assert(m_naiveU.allFinite()); + eigen_internal_assert(m_naiveV.allFinite()); + eigen_internal_assert(m_computed.allFinite()); #endif if (m_compU) @@ -633,9 +633,9 @@ void BDCSVD::divide(Index firstCol, Index lastCol, Index fi } #ifdef EIGEN_BDCSVD_SANITY_CHECKS - assert(m_naiveU.allFinite()); - assert(m_naiveV.allFinite()); - assert(m_computed.allFinite()); + eigen_internal_assert(m_naiveU.allFinite()); + eigen_internal_assert(m_naiveV.allFinite()); + eigen_internal_assert(m_computed.allFinite()); #endif m_computed(firstCol + shift, firstCol + shift) = r0; @@ -654,9 +654,9 @@ void BDCSVD::divide(Index firstCol, Index lastCol, Index fi std::cout << "err: " << ((tmp1-tmp2).abs()>1e-12*tmp2.abs()).transpose() << "\n"; static int count = 0; std::cout << "# " << ++count << "\n\n"; - assert((tmp1-tmp2).matrix().norm() < 1e-14*tmp2.matrix().norm()); -// assert(count<681); -// assert(((tmp1-tmp2).abs()<1e-13*tmp2.abs()).all()); + eigen_internal_assert((tmp1-tmp2).matrix().norm() < 1e-14*tmp2.matrix().norm()); +// eigen_internal_assert(count<681); +// eigen_internal_assert(((tmp1-tmp2).abs()<1e-13*tmp2.abs()).all()); #endif // Third part: compute SVD of combined matrix @@ -665,8 +665,8 @@ void BDCSVD::divide(Index firstCol, Index lastCol, Index fi computeSVDofM(firstCol + shift, n, UofSVD, singVals, VofSVD); #ifdef EIGEN_BDCSVD_SANITY_CHECKS - assert(UofSVD.allFinite()); - assert(VofSVD.allFinite()); + eigen_internal_assert(UofSVD.allFinite()); + eigen_internal_assert(VofSVD.allFinite()); #endif if (m_compU) @@ -681,9 +681,9 @@ void BDCSVD::divide(Index firstCol, Index lastCol, Index fi if (m_compV) structured_update(m_naiveV.block(firstRowW, firstColW, n, n), VofSVD, (n+1)/2); #ifdef EIGEN_BDCSVD_SANITY_CHECKS - assert(m_naiveU.allFinite()); - assert(m_naiveV.allFinite()); - assert(m_computed.allFinite()); + eigen_internal_assert(m_naiveU.allFinite()); + eigen_internal_assert(m_naiveV.allFinite()); + eigen_internal_assert(m_computed.allFinite()); #endif m_computed.block(firstCol + shift, firstCol + shift, n, n).setZero(); @@ -754,16 +754,16 @@ void BDCSVD::computeSVDofM(Index firstCol, Index n, MatrixX { std::cout << "\n\n mus: " << mus.head(actual_n).transpose() << "\n\n"; std::cout << " check1 (expect0) : " << ((singVals.array()-(shifts+mus)) / singVals.array()).head(actual_n).transpose() << "\n\n"; - assert((((singVals.array()-(shifts+mus)) / singVals.array()).head(actual_n) >= 0).all()); + eigen_internal_assert((((singVals.array()-(shifts+mus)) / singVals.array()).head(actual_n) >= 0).all()); std::cout << " check2 (>0) : " << ((singVals.array()-diag) / singVals.array()).head(actual_n).transpose() << "\n\n"; - assert((((singVals.array()-diag) / singVals.array()).head(actual_n) >= 0).all()); + eigen_internal_assert((((singVals.array()-diag) / singVals.array()).head(actual_n) >= 0).all()); } #endif #ifdef EIGEN_BDCSVD_SANITY_CHECKS - assert(singVals.allFinite()); - assert(mus.allFinite()); - assert(shifts.allFinite()); + eigen_internal_assert(singVals.allFinite()); + eigen_internal_assert(mus.allFinite()); + eigen_internal_assert(shifts.allFinite()); #endif // Compute zhat @@ -773,7 +773,7 @@ void BDCSVD::computeSVDofM(Index firstCol, Index n, MatrixX #endif #ifdef EIGEN_BDCSVD_SANITY_CHECKS - assert(zhat.allFinite()); + eigen_internal_assert(zhat.allFinite()); #endif computeSingVecs(zhat, diag, perm, singVals, shifts, mus, U, V); @@ -784,13 +784,13 @@ void BDCSVD::computeSVDofM(Index firstCol, Index n, MatrixX #endif #ifdef EIGEN_BDCSVD_SANITY_CHECKS - assert(m_naiveU.allFinite()); - assert(m_naiveV.allFinite()); - assert(m_computed.allFinite()); - assert(U.allFinite()); - assert(V.allFinite()); -// assert((U.transpose() * U - MatrixXr(MatrixXr::Identity(U.cols(),U.cols()))).norm() < 100*NumTraits::epsilon() * n); -// assert((V.transpose() * V - MatrixXr(MatrixXr::Identity(V.cols(),V.cols()))).norm() < 100*NumTraits::epsilon() * n); + eigen_internal_assert(m_naiveU.allFinite()); + eigen_internal_assert(m_naiveV.allFinite()); + eigen_internal_assert(m_computed.allFinite()); + eigen_internal_assert(U.allFinite()); + eigen_internal_assert(V.allFinite()); +// eigen_internal_assert((U.transpose() * U - MatrixXr(MatrixXr::Identity(U.cols(),U.cols()))).norm() < 100*NumTraits::epsilon() * n); +// eigen_internal_assert((V.transpose() * V - MatrixXr(MatrixXr::Identity(V.cols(),V.cols()))).norm() < 100*NumTraits::epsilon() * n); #endif // Because of deflation, the singular values might not be completely sorted. @@ -811,7 +811,7 @@ void BDCSVD::computeSVDofM(Index firstCol, Index n, MatrixX bool singular_values_sorted = (((singVals.segment(1,actual_n-1)-singVals.head(actual_n-1))).array() >= 0).all(); if(!singular_values_sorted) std::cout << "Singular values are not sorted: " << singVals.segment(1,actual_n).transpose() << "\n"; - assert(singular_values_sorted); + eigen_internal_assert(singular_values_sorted); } #endif @@ -966,7 +966,7 @@ void BDCSVD::computeSingVals(const ArrayRef& col0, const Ar RealScalar fZero = secularEq(muZero, col0, diag, perm, diagShifted, shift); #ifdef EIGEN_BDCSVD_SANITY_CHECKS - assert((numext::isfinite)(fZero)); + eigen_internal_assert((numext::isfinite)(fZero)); #endif muPrev = muCur; @@ -1019,11 +1019,11 @@ void BDCSVD::computeSingVals(const ArrayRef& col0, const Ar #ifdef EIGEN_BDCSVD_SANITY_CHECKS if(!(numext::isfinite)(fLeft)) std::cout << "f(" << leftShifted << ") =" << fLeft << " ; " << left << " " << shift << " " << right << "\n"; - assert((numext::isfinite)(fLeft)); + eigen_internal_assert((numext::isfinite)(fLeft)); if(!(numext::isfinite)(fRight)) std::cout << "f(" << rightShifted << ") =" << fRight << " ; " << left << " " << shift << " " << right << "\n"; - // assert((numext::isfinite)(fRight)); + // eigen_internal_assert((numext::isfinite)(fRight)); #endif #ifdef EIGEN_BDCSVD_DEBUG_VERBOSE @@ -1081,8 +1081,8 @@ void BDCSVD::computeSingVals(const ArrayRef& col0, const Ar std::cout << "found " << singVals[k] << " == " << shift << " + " << muCur << " from " << diag(k) << " .. " << diag(k+1) << "\n"; #endif #ifdef EIGEN_BDCSVD_SANITY_CHECKS - assert(k==0 || singVals[k]>=singVals[k-1]); - assert(singVals[k]>=diag(k)); + eigen_internal_assert(k==0 || singVals[k]>=singVals[k-1]); + eigen_internal_assert(singVals[k]>=diag(k)); #endif // perturb singular value slightly if it equals diagonal entry to avoid division by zero later @@ -1123,7 +1123,7 @@ void BDCSVD::perturbCol0(const ArrayRef& col0, const ArrayR std::cout << "prod = " << "(" << singVals(lastIdx) << " + " << dk << ") * (" << mus(lastIdx) << " + (" << shifts(lastIdx) << " - " << dk << "))" << "\n"; std::cout << " = " << singVals(lastIdx) + dk << " * " << mus(lastIdx) + (shifts(lastIdx) - dk) << "\n"; } - assert(prod>=0); + eigen_internal_assert(prod>=0); #endif for(Index l = 0; l::perturbCol0(const ArrayRef& col0, const ArrayR { std::cout << "k=" << k << ", i=" << i << ", l=" << l << ", perm.size()=" << perm.size() << "\n"; } - assert(dk!=Literal(0) || diag(i)!=Literal(0)); + eigen_internal_assert(dk!=Literal(0) || diag(i)!=Literal(0)); #endif prod *= ((singVals(j)+dk) / ((diag(i)+dk))) * ((mus(j)+(shifts(j)-dk)) / ((diag(i)-dk))); #ifdef EIGEN_BDCSVD_SANITY_CHECKS - assert(prod>=0); + eigen_internal_assert(prod>=0); #endif #ifdef EIGEN_BDCSVD_DEBUG_VERBOSE if(i!=k && numext::abs(((singVals(j)+dk)*(mus(j)+(shifts(j)-dk)))/((diag(i)+dk)*(diag(i)-dk)) - 1) > 0.9 ) @@ -1172,7 +1172,7 @@ void BDCSVD::perturbCol0(const ArrayRef& col0, const ArrayR #endif RealScalar tmp = sqrt(prod); #ifdef EIGEN_BDCSVD_SANITY_CHECKS - assert((numext::isfinite)(tmp)); + eigen_internal_assert((numext::isfinite)(tmp)); #endif zhat(k) = col0(k) > Literal(0) ? RealScalar(tmp) : RealScalar(-tmp); } @@ -1309,9 +1309,9 @@ void BDCSVD::deflation(Index firstCol, Index lastCol, Index RealScalar epsilon_coarse = Literal(8) * NumTraits::epsilon() * numext::maxi(col0.cwiseAbs().maxCoeff(), maxDiag); #ifdef EIGEN_BDCSVD_SANITY_CHECKS - assert(m_naiveU.allFinite()); - assert(m_naiveV.allFinite()); - assert(m_computed.allFinite()); + eigen_internal_assert(m_naiveU.allFinite()); + eigen_internal_assert(m_naiveV.allFinite()); + eigen_internal_assert(m_computed.allFinite()); #endif #ifdef EIGEN_BDCSVD_DEBUG_VERBOSE @@ -1348,9 +1348,9 @@ void BDCSVD::deflation(Index firstCol, Index lastCol, Index } #ifdef EIGEN_BDCSVD_SANITY_CHECKS - assert(m_naiveU.allFinite()); - assert(m_naiveV.allFinite()); - assert(m_computed.allFinite()); + eigen_internal_assert(m_naiveU.allFinite()); + eigen_internal_assert(m_naiveV.allFinite()); + eigen_internal_assert(m_computed.allFinite()); #endif #ifdef EIGEN_BDCSVD_DEBUG_VERBOSE std::cout << "to be sorted: " << diag.transpose() << "\n\n"; @@ -1454,13 +1454,13 @@ void BDCSVD::deflation(Index firstCol, Index lastCol, Index #ifdef EIGEN_BDCSVD_SANITY_CHECKS for(Index j=2;j, Device> template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void writeBlock( const TensorBlockDesc& desc, const TensorBlock& block) { - assert(this->m_impl.data() != NULL); + eigen_assert(this->m_impl.data() != NULL); const Index chip_dim = this->m_dim.actualDim(); diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorContractionThreadPool.h b/unsupported/Eigen/CXX11/src/Tensor/TensorContractionThreadPool.h index 1f818ecec..19f664cad 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorContractionThreadPool.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorContractionThreadPool.h @@ -874,7 +874,7 @@ struct TensorEvaluator EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void writeBlock( const TensorBlockDesc& desc, const TensorBlock& block) { - assert(m_data != NULL); + eigen_assert(m_data != NULL); typedef typename TensorBlock::XprType TensorBlockExpr; typedef internal::TensorBlockAssignment EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorBlock block(TensorBlockDesc& desc, TensorBlockScratch& scratch, bool /*root_of_expr_ast*/ = false) const { - assert(m_data != NULL); + eigen_assert(m_data != NULL); return TensorBlock::materialize(m_data, m_dims, desc, scratch); } diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorForcedEval.h b/unsupported/Eigen/CXX11/src/Tensor/TensorForcedEval.h index a17637490..4550fcab0 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorForcedEval.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorForcedEval.h @@ -208,7 +208,7 @@ struct TensorEvaluator, Device> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorBlock block(TensorBlockDesc& desc, TensorBlockScratch& scratch, bool /*root_of_expr_ast*/ = false) const { - assert(m_buffer != NULL); + eigen_assert(m_buffer != NULL); return TensorBlock::materialize(m_buffer, m_impl.dimensions(), desc, scratch); } diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorGpuHipCudaDefines.h b/unsupported/Eigen/CXX11/src/Tensor/TensorGpuHipCudaDefines.h index 82ca999b9..ae79a1d25 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorGpuHipCudaDefines.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorGpuHipCudaDefines.h @@ -93,7 +93,7 @@ // HIPCC do not support the use of assert on the GPU side. #define gpu_assert(COND) #else -#define gpu_assert(COND) assert(COND) +#define gpu_assert(COND) eigen_assert(COND) #endif #endif // gpu_assert diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorIO.h b/unsupported/Eigen/CXX11/src/Tensor/TensorIO.h index 2511d5a97..efda74131 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorIO.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorIO.h @@ -202,7 +202,7 @@ struct TensorPrinter { } } - assert(layout == RowMajor); + eigen_assert(layout == RowMajor); typedef std::conditional_t::value || is_same::value || is_same::value || is_same::value, int, diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorMorphing.h b/unsupported/Eigen/CXX11/src/Tensor/TensorMorphing.h index ea622a555..020571040 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorMorphing.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorMorphing.h @@ -281,7 +281,7 @@ template template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void writeBlock( const TensorBlockDesc& desc, const TensorBlock& block) { - assert(this->m_impl.data() != NULL); + eigen_assert(this->m_impl.data() != NULL); typedef typename TensorBlock::XprType TensorBlockExpr; typedef internal::TensorBlockAssignment< diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorShuffling.h b/unsupported/Eigen/CXX11/src/Tensor/TensorShuffling.h index e50a57022..977263aa5 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorShuffling.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorShuffling.h @@ -256,7 +256,7 @@ struct TensorEvaluator, Device> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorBlock block(TensorBlockDesc& desc, TensorBlockScratch& scratch, bool root_of_expr_ast = false) const { - assert(m_impl.data() != NULL); + eigen_assert(m_impl.data() != NULL); typedef internal::TensorBlockIO TensorBlockIO; diff --git a/unsupported/Eigen/src/MatrixFunctions/MatrixLogarithm.h b/unsupported/Eigen/src/MatrixFunctions/MatrixLogarithm.h index bb778854d..2036fe471 100644 --- a/unsupported/Eigen/src/MatrixFunctions/MatrixLogarithm.h +++ b/unsupported/Eigen/src/MatrixFunctions/MatrixLogarithm.h @@ -136,7 +136,7 @@ void matrix_log_compute_pade(MatrixType& result, const MatrixType& T, int degree typedef typename NumTraits::Real RealScalar; const int minPadeDegree = 3; const int maxPadeDegree = 11; - assert(degree >= minPadeDegree && degree <= maxPadeDegree); + eigen_assert(degree >= minPadeDegree && degree <= maxPadeDegree); // FIXME this creates float-conversion-warnings if these are enabled. // Either manually convert each value, or disable the warning locally const RealScalar nodes[][maxPadeDegree] = { diff --git a/unsupported/Eigen/src/NonLinearOptimization/HybridNonLinearSolver.h b/unsupported/Eigen/src/NonLinearOptimization/HybridNonLinearSolver.h index 7acd01a89..4c3842688 100644 --- a/unsupported/Eigen/src/NonLinearOptimization/HybridNonLinearSolver.h +++ b/unsupported/Eigen/src/NonLinearOptimization/HybridNonLinearSolver.h @@ -430,7 +430,7 @@ HybridNonLinearSolver::solveNumericalDiffOneStep(FVectorType using std::sqrt; using std::abs; - assert(x.size()==n); // check the caller is not cheating us + eigen_assert(x.size()==n); // check the caller is not cheating us Index j; std::vector > v_givens(n), w_givens(n); diff --git a/unsupported/Eigen/src/SpecialFunctions/SpecialFunctionsImpl.h b/unsupported/Eigen/src/SpecialFunctions/SpecialFunctionsImpl.h index 0addd09a3..d85729d88 100644 --- a/unsupported/Eigen/src/SpecialFunctions/SpecialFunctionsImpl.h +++ b/unsupported/Eigen/src/SpecialFunctions/SpecialFunctionsImpl.h @@ -685,11 +685,11 @@ struct igammac_retval { template struct cephes_helper { EIGEN_DEVICE_FUNC - static EIGEN_STRONG_INLINE Scalar machep() { assert(false && "machep not supported for this type"); return 0.0; } + static EIGEN_STRONG_INLINE Scalar machep() { eigen_assert(false && "machep not supported for this type"); return 0.0; } EIGEN_DEVICE_FUNC - static EIGEN_STRONG_INLINE Scalar big() { assert(false && "big not supported for this type"); return 0.0; } + static EIGEN_STRONG_INLINE Scalar big() { eigen_assert(false && "big not supported for this type"); return 0.0; } EIGEN_DEVICE_FUNC - static EIGEN_STRONG_INLINE Scalar biginv() { assert(false && "biginv not supported for this type"); return 0.0; } + static EIGEN_STRONG_INLINE Scalar biginv() { eigen_assert(false && "biginv not supported for this type"); return 0.0; } }; template <>