Au Units
37.5Unit symbol APIs (e.g., literals) Functions UDLs meters(3.0) 3.0_m 38Unit symbol APIs (e.g., literals) Functions UDLs meters(3.0) 3.0_m (meters / second)(8.0) 8.0_mps // New manual definition Functions UDLs meters(3.0) 3.0_m (meters / second)(8.0) 8.0_mps // New manual definition 😞 meters(3.0f) ??? 38.2Unit symbol APIs (e.g., literals) Functions UDLs meters(3.0) 3.0_m (meters / second)(8 0_mps // New manual definition 😞 meters(3.0f) ??? meters(dist_m) ??? 38.3Unit symbol APIs (e.g., literals) Functions UDLs Unit Symbols meters(3.0) 3.0_m 3.0 * m (meters / second)(8.0) 8.0_mps //0 码力 | 191 页 | 22.37 MB | 5 月前3Linear Algebra with The Eigen Cpp Library
MatrixXd mtx { {1.0, 2.0, 3.0}, {4.0, 5.0, 6.0}, {7.0, 8.0, 9.0}, {10.0, 11.0, 12.0} }; MatrixXd mtx{4, 3}; // 4 rows, 3 columns mtx << 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0; MatrixXd mtx{2, 2}; // 0-index as is the case in C++ generally: mtx(0, 0) = 3.0; mtx(1, 0) = 2.5; mtx(0, 1) = -1.0; mtx(1, 1) = mtx3(1, 0) + mtx3(0, 1); // Similar for Vector Eigen::MatrixXd; MatrixXd A { {1.0, 2.0, 3.0}, {1.5, 2.5, 3.5}, {4.0, 5.0, 6.0}, {4.5, 5.5, 6.5}, {7.0, 8.0, 9.0} }; MatrixXd B { {1.0, 2.0, 3.0, 4.0, 5.0}, {1.5, 2.5, 3.5, 40 码力 | 35 页 | 1.10 MB | 5 月前3A Long Journey of Changing std::sort Implementation at Scale
sort {3.0, NaN, 4.0}? 63Can we sort {3.0, NaN, 4.0}? No 63.1Can we sort {3.0, NaN, 4.0}? No NaN thinks it is equal to 3.0 and 4.0 63.2Can we sort {NaN, 3.0, NaN}? 64Can we sort {NaN, 3.0, NaN}? Yes 64.1Can we sort {NaN, 3.0, NaN}? Yes All elements are equal 64.2WHAT ARE WE CHANGING? 65WHAT ARE WE CHANGING? A�er these cleanups we can change to any sort 65.1WHAT ARE WE CHANGING? A�er0 码力 | 182 页 | 7.65 MB | 5 月前3Improving Our Safety With a Quantities and Units Library
the following equation? Pint 82print(1 * ureg.hertz + 1 * ureg.becquerel + 1 * ureg.baud) 3.0 hertz auto res = 1 * Hz + 1 * Bq + 1 * Bd; CppCon 2024: Improving our safety with a quantities and the following equation? Pint 82print(1 * ureg.hertz + 1 * ureg.becquerel + 1 * ureg.baud) 3.0 hertz print(1 * ureg.becquerel + 1 * ureg.hertz + 1 * ureg.baud) auto res = 1 * Hz + 1 * Bq 82print(1 * ureg.hertz + 1 * ureg.becquerel + 1 * ureg.baud) 3.0 hertz print(1 * ureg.becquerel + 1 * ureg.hertz + 1 * ureg.baud) 3.0 becquerel auto res = 1 * Hz + 1 * Bq + 1 * Bd; CppCon 2024:0 码力 | 207 页 | 6.93 MB | 5 月前3Back to Basics: C++ Templates - Part 2
void Main() 14 { 15 int a = 2; 16 int b = 1; 17 18 printf(”%d\n”, equal(a, b)); 19 20 double d = 3.0; 21 double f = 4.0; 22 23 printf(”%d\n”, equal(d, f)); 24 } Andreas Fertig v1.0 B2B: C++ Templates void Main() 16 { 17 int a = 2; 18 int b = 1; 19 20 printf(”%d\n”, equal(a, b)); 21 22 double d = 3.0; 23 double f = 4.0; 24 25 printf(”%d\n”, equal(d, f)); 26 } Andreas Fertig v1.0 B2B: C++ Templates void Main() 18 { 19 int a = 2; 20 int b = 1; 21 22 printf(”%d\n”, equal(a, b)); 23 24 double d = 3.0; 25 double f = 4.0; 26 27 printf(”%d\n”, equal(d, f)); 28 } Andreas Fertig v1.0 B2B: C++ Templates0 码力 | 12 页 | 787.22 KB | 5 月前3Vectorizing a CFD Code With std::simd Supplemented by Transparent Loading and Storing
templateT LogMean(const T &val1, const T &val2) { // ... if (u < thres) twoF = 2.0 + u * (2.0 / 3.0 + u * (0.4 + 2.0 / 7.0 * u)); else twoF = log(zeta) / f; // ... } template T LogMean(const const T &val2) { // ... auto mask = u < thres; if (stdx::any_of(mask)) twoF = 2.0 + u * (2.0 / 3.0 + u * (0.4 + 2.0 / 7.0 * u)); if (!stdx::all_of(mask)) where(!mask, twoF) = log(zeta) / f; // template T LogMean(const T &val1, const T &val2) { // ... if (u < thres) twoF = 2.0 + u * (2.0 / 3.0 + u * (0.4 + 2.0 / 7.0 * u)); else twoF = log(zeta) / f; // ... } template T LogMean(const 0 码力 | 58 页 | 2.68 MB | 5 月前3A New Dragon in the Den: Fast Conversion From Floating-Point Numbers
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0What's the output? Options: Quiz double x = 1.0 / 3.0; std::print("{}", x); https://godbolt.org/z/G9j5aj8zY 0.3 (a) 0.3333333333333333 (b) One third (d) (e) None of the aboveWhat's the output? Options: Quiz double x = 1.0 / 3.0; std::print("{}", x); https://godbolt.org/z/G9j5aj8zY 0.3 (a) 0.3333333333333333 (b) One third (d) (e) None of the aboveWhat's the output? Options: Quiz double x = 1.0 / 3.0; std::print("{}", x); https://godbolt.org/z/G9j5aj8zY float x = 1.f / 3.f; std::print("{}"0 码力 | 171 页 | 6.42 MB | 5 月前3LLVM's Realtime Safety Revolution: Tools for Modern Mission Critical Systems
; ... } void process() { __rtsan::ScopedEnabler rtsan{}; auto x = std::make_unique(3.0f); } // CMakeLists.txt target_link_libraries(helloWorld PRIVATE libclang_rt.rtsan_osx_dynamic .. } void process() { __rtsan::ScopedSanitizeRealtime ssr; auto x = std::make_unique (3.0f); } // CMakeLists.txt target_link_libraries(helloWorld PRIVATE libclang_rt.rtsan_osx_dynamic .. } void process() { __rtsan::ScopedSanitizeRealtime ssr; auto x = std::make_unique (3.0f); } // CMakeLists.txt target_link_libraries(helloWorld PRIVATE libclang_rt.rtsan_osx_dynamic 0 码力 | 153 页 | 1.38 MB | 5 月前3Back to Basics: C++ Templates - Part 1
void Main() 14 { 15 int a = 2; 16 int b = 1; 17 18 printf(”%d\n”, equal(a, b)); 19 20 double d = 3.0; 21 double f = 4.0; 22 23 printf(”%d\n”, equal(d, f)); 24 } Andreas Fertig v1.0 B2B: C++ Templates CamingoCode by Jan Fromm licensed under Creative Commons CC BYND, Version 3.0 http://creativecommons.org/licenses/bynd/3.0/ Andreas Fertig v1.0 B2B: C++ Templates 31 References [1] MUSSER D. R. and0 码力 | 17 页 | 817.47 KB | 5 月前3Fast and small C++
CamingoCode by Jan Fromm licensed under Creative Commons CC BY-ND, Version 3.0 http://creativecommons.org/licenses/by-nd/3.0/ Andreas Fertig v1.0 Fast and small C++ 26 References [1] ORMROD N., “Cppcon0 码力 | 17 页 | 790.91 KB | 5 月前3
共 104 条
- 1
- 2
- 3
- 4
- 5
- 6
- 11
相关搜索词
AuUnitsLinearAlgebrawithTheEigenCppLibraryLongJourneyofChangingstdsortImplementationatScaleImprovingOurSafetyWithQuantitiesandBacktoBasicsC++TemplatesPartVectorizingCFDCodesimdSupplementedbyTransparentLoadingStoringNewDragonintheDenFastConversionFromFloatingPointNumbersLLVMRealtimeRevolutionToolsforModernMissionCriticalSystemssmall