Hello 算法 1.0.0b4 C++版Hello 算法 C++ 语言版 靳宇栋(Krahets) Release 1.0.0b4 2023‑07‑26 序 两年前,我在力扣上分享了《剑指 Offer》系列题解,受到了许多朋友的喜爱与支持。在此期间,我回答了众 多读者的评论问题,其中最常见的一个问题是“如何入门学习算法”。我逐渐也对这个问题产生了浓厚的兴 趣。 两眼一抹黑地刷题似乎是最受欢迎的方法,简单直接且有效。然而,刷题就如同玩“扫雷”游戏,自学能力 wangwang105, ZongYangL, shanghai‑Jerry, curly210102, Suremotoo, linzeyan, yi427, boloboloda, huawuque404, 4yDX3906, ZJKung, xb534, siqyka, ZnYang2018, beintentional, luluxia, GaochaoZhu, weibk, dshlstarr, ShiMaRing 45 3.5. 小结 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 4. 数组与链表 50 4.1. 数组 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .0 码力 | 343 页 | 27.39 MB | 1 年前3
Common Package Specification: Getting Build Tools to Talk to Each Otherbuild from source by the user, with that configuration 4. Pass information to the build system so it can locate and use it successfully 4#includeint main(void){ … deflateInit(&defstream metadata: { compiled: 2023-10-01 checksum: … } 91 … … Creates CPS Read CPSZLib Proposal: Lean MVP build: { "includedirs": ["include"], "libdirs": ["lib"], "libs": ["zlib"] }, abi: { dynamic_runtime: 0 码力 | 94 页 | 1.58 MB | 6 月前3
Reflection Based Libraries to Look Forward Toresearch and functional programming Love performance, software abstractions, and clean APIs Why me 4What is reflection Reflection in other languages (Go, Python, Java) Reflection in C++ as per P2996 join(attrs)) result = orig_copy(obj) return result cls.copy = _wrapped_copy 1 2 3 4 5 6 7 8 9 10 11 12 13 14 class MyClass: def __init__(self, x): self.x = x def copy(self): >>> MyClass(2).copy() Calling wrapped copy Attributes: x <__main__.MyClass object at 0x7f1a9 1 2 3 4 5 6 7 8 9 10 11 13GoLang 14Golang is a compiled but duck-typed language Well, structurally typed0 码力 | 118 页 | 14.33 MB | 6 月前3
Dependency Injection in C++C++: A Practical Guide CppCon 2024 September 18, 2024 Pete Muldoon Senior Engineering LeadBloomberg 4 Questions #includeHereWho Am I? Bloomberg 5 • Started using C++ professionally independent of its underlying dependencies 3. Improves the reusability – and so testability - of code. 4. Better long term maintainability of code. Encyclopedia Muldoonica Basic Definitions11 Bloomberg testing ❑ Lack of specificity ❑ More difficult setup / error investigation ❑ Longer feedback loop ❑ Can lean entirely on regression A/B testing Testing without Dependency Injection12 Bloomberg What is the 0 码力 | 106 页 | 1.76 MB | 6 月前3
Hiding Your Implementation Details is Not So Simpleachieved goal doesn’t justify the design compromise. - There may be a solution that meets both needs. 4. Because there are tradeoffs 17 Hiding your Implementation Details, Amir Kirsh @ CppCon, 2024Investigate std::cout << squarepair << std::endl; (doable but not straightforward: http://coliru.stacked-crooked.com/a/4c31320c394bcbb5) 22 Hiding your Implementation Details, Amir Kirsh @ CppCon, 2024 std::pair23 Hiding overloads), a wrong option would be selected at some point. Less options means also less required tests.Be Lean and Mean 41 Hiding your Implementation Details, Amir Kirsh @ CppCon, 2024 1. Keep your API short0 码力 | 145 页 | 2.45 MB | 6 月前3
C++ Exceptions for Smaller FirmwareX X X XMicrocontroller Constraints: Limited Storage & Memory 7 < 1 MB = 33,725 devices >= 1 MB = 4,964 devicesMicrocontroller Constraints: Limited Storage & Memory 8 < 100kB = 31,098 devices >= 100kB arm-none-eabi-g++ -o except.elf except.cpp -std=c++20 -Os -g -fexceptions -frtti -mcpu=cortex-m4 -mfloat-abi=hard -mthumb --specs=nosys.specs --specs=nano.specs --Wl,-T linker.ld Let's start simple 0000800c: 800c: b508 push {r3, lr} 800e: 2004 movs r0, #4 8010: f000 f93c bl 828c <__cxa_allocate_exception> 8014: 2305 movs r3, #5 0 码力 | 237 页 | 6.74 MB | 6 月前3
Object Lifetime: From Start to Finishstd::endl; } ~Foo() { std::cout << "~Foo()" << std::endl; } }; int main() { Foo a; { Foo b; } } 1 2 3 4 5 6 7 8 9 10 11 21 Constructors & Destructorshttps://godbolt.org/z/ffzG8hPT8 struct Foo { Foo() std::endl; } ~Foo() { std::cout << "~Foo()" << std::endl; } }; int main() { Foo a; { Foo b; } } 1 2 3 4 5 6 7 8 9 10 11 22 Constructors & Destructorshttps://godbolt.org/z/ffzG8hPT8 struct Foo { Foo() ~Foo() { std::cout << "~Foo()" << std::endl; } }; int main() { Foo a; // Foo() { Foo b; } } 1 2 3 4 5 6 7 8 9 10 11 23 Constructors & Destructorshttps://godbolt.org/z/ffzG8hPT8 struct Foo { Foo()0 码力 | 214 页 | 9.34 MB | 6 月前3
Data Is All You Need for FusionData is all you need for fusion N 1int x = 4; callee(x); // do work } #include#include #include "benchmark.h" #include "matrix_lib.h" int main(..){ std::vector a; a.reserve(100); cblas_sgemm(....); return 0; } High Performance code is about Hardware Matrix Multiply 2int x = 4; callee(x); // do work } #include #include #include "benchmark.h" #include "matrix_lib k++) { result[i][j] += A[i][k] * B[k][j]; } } } caller: push r4 ; do work mov r0, #4 bl callee pop r4 ; do work callee: 3int x = 4; callee(x); // do work } #include #include 0 码力 | 151 页 | 9.90 MB | 6 月前3
Adventures in SIMD Thinking (Part 1 of 2)__m512i; using msk_512 = uint32_t; ... }Copyright © 2020 Bob Steagall K E W B C O M P U T I N G 4 CppCon 2020 - Adventures in SIMD Thinking Function load_value() KEWB_FORCE_INLINE rf_512 load_value(float load_from(float const* psrc) { return _mm512_loadu_ps(psrc); } m0 m1 m2 m3 m4 m5 m6 m7 m8 m9 m10 m11 m12 m13 m14 m15 m0 m1 m2 m3 m4 m5 m6 m7 m8 m9 m10 m11 m12 m13 m14 m15 psrcCopyright © 2020 Bob Steagall mask) { return _mm512_mask_loadu_ps(_mm512_set1_ps(fill), (__mmask16) mask, psrc); } m0 m1 m2 m3 m4 m5 m6 m7 m8 m9 m10 m11 m12 m13 m14 m15 f f m2 m3 f f m6 m7 f f f f m12 m13 m14 m15 f 0 0 1 1 0 00 码力 | 88 页 | 824.07 KB | 6 月前3
simd: How to Express Inherent Parallelism Efficiently Via Data-Parallel TypesImage Processing Programming Models Outlook Summary std::simd is for you! Matthias Kretz CppCon ’23 4 GSI Helmholtz Center for Heavy Ion ResearchMotivation std::simd Overview Example: Image Processing Programming … unless you don’t care for speed-up measured in factors not percentages Matthias Kretz CppCon ’23 4 GSI Helmholtz Center for Heavy Ion ResearchMotivation std::simd Overview Example: Image Processing Programming the same work in less time x0 + a x1 + a x2 + a x3 + a x4 + a x5 + a x6 + a x7 + a x8 + a x9 + a · · · Time x0 + a x1 + a x2 + a x3 + a x4 + a x5 + a x6 + a x7 + a x8 + a x9 + a · · · · ·0 码力 | 160 页 | 8.82 MB | 6 月前3
共 397 条
- 1
- 2
- 3
- 4
- 5
- 6
- 40
相关搜索词
Hello算法1.00b4C++CommonPackageSpecificationGettingBuildToolstoTalkEachOtherReflectionBasedLibrariesLookForwardToDependencyInjectioninHidingYourImplementationDetailsisNotSoSimpleExceptionsforSmallerFirmwareObjectLifetimeFromStartFinishDataIsAllYouNeedFusionAdventuresSIMDThinkingPartofsimdHowExpressInherentParallelismEfficientlyViaParallelTypes













