From a7ade20d0e10dc55a036f904abbfa9f0db776212 Mon Sep 17 00:00:00 2001 From: Sergey Slotin Date: Mon, 29 Aug 2022 04:25:54 +0300 Subject: [PATCH 1/3] credit Konstantin --- content/english/hpc/_index.md | 1 + 1 file changed, 1 insertion(+) diff --git a/content/english/hpc/_index.md b/content/english/hpc/_index.md index ed71792a..9b6aa606 100644 --- a/content/english/hpc/_index.md +++ b/content/english/hpc/_index.md @@ -276,6 +276,7 @@ The book is largely based on blog posts, research papers, conference talks, and - [Gustavo Duarte](https://manybutfinite.com/) - [Nyaan](https://nyaannyaan.github.io/library/) - [Nayuki](https://www.nayuki.io/category/programming) +- [Konstantin](http://const.me/) - [InstLatX64](https://twitter.com/InstLatX64) - [ridiculous_fish](https://ridiculousfish.com/blog/) - [Z boson](https://stackoverflow.com/users/2542702/z-boson) From 4e00ee7cc5769cd650be6d215e0efacf2f14de51 Mon Sep 17 00:00:00 2001 From: novikov-vladimir <99834014+novikov-vladimir@users.noreply.github.com> Date: Fri, 11 Nov 2022 19:57:50 +0300 Subject: [PATCH 2/3] =?UTF-8?q?=D0=90=D0=B2=D1=82=D0=BE=D0=BC=D0=B0=D1=82?= =?UTF-8?q?=D0=BD=D1=8B=D0=B9=20=D0=BF=D0=B5=D1=80=D0=B5=D1=85=D0=BE=D0=B4?= =?UTF-8?q?=20=D0=B4=D0=BE=D0=BB=D0=B6=D0=B5=D0=BD=20=D0=B2=D0=B5=D1=81?= =?UTF-8?q?=D1=82=D0=B8=20=D0=B2=20=D0=B2=D0=B5=D1=80=D1=88=D0=B8=D0=BD?= =?UTF-8?q?=D1=83,=20=D1=81=D0=BE=D0=BE=D1=82=D0=B2=D0=B5=D1=82=D1=81?= =?UTF-8?q?=D1=82=D0=B2=D1=83=D1=8E=D1=89=D1=83=D1=8E=20=D0=BC=D0=B0=D0=BA?= =?UTF-8?q?=D1=81=D0=B8=D0=BC=D0=B0=D0=BB=D1=8C=D0=BD=D0=BE=D0=BC=D1=83=20?= =?UTF-8?q?=D0=BF=D1=80=D0=B8=D0=BD=D0=B8=D0=BC=D0=B0=D0=B5=D0=BC=D0=BE?= =?UTF-8?q?=D0=BC=D1=83=20=D0=B1=D0=BE=D1=80=D0=BE=D0=BC=20=D1=81=D1=83?= =?UTF-8?q?=D1=84=D1=84=D0=B8=D0=BA=D1=81=D1=83=20(=D0=BD=D0=B5=20=D0=BC?= =?UTF-8?q?=D0=B8=D0=BD=D0=B8=D0=BC=D0=B0=D0=BB=D1=8C=D0=BD=D0=BE=D0=BC?= =?UTF-8?q?=D1=83).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- content/russian/cs/string-structures/aho-corasick.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/content/russian/cs/string-structures/aho-corasick.md b/content/russian/cs/string-structures/aho-corasick.md index 369f5171..2ca1da65 100644 --- a/content/russian/cs/string-structures/aho-corasick.md +++ b/content/russian/cs/string-structures/aho-corasick.md @@ -1,10 +1,11 @@ --- title: Алгоритм Ахо-Корасик authors: -- Сергей Слотин + - Сергей Слотин weight: 2 prerequisites: -- trie + - trie +published: true --- Представим, что мы работаем журналистами в некотором авторитарном государстве, контролирующем СМИ, и в котором время от времени издаются законы, запрещающие упоминать определенные политические события или использовать определенные слова. Как эффективно реализовать подобную цензуру программно? @@ -36,7 +37,7 @@ prerequisites: **Определение.** *Суффиксная ссылка* $l(v)$ ведёт в вершину $u \neq v$, которая соответствует наидлиннейшему принимаемому бором суффиксу $v$. -**Определение.** *Автоматный переход* $\delta(v, c)$ ведёт в вершину, соответствующую минимальному принимаемому бором суффиксу строки $v + c$. +**Определение.** *Автоматный переход* $\delta(v, c)$ ведёт в вершину, соответствующую максимальному принимаемому бором суффиксу строки $v + c$. **Наблюдение.** Если переход и так существует в боре (будем называть такой переход *прямым*), то автоматный переход будет вести туда же. From 0fa54119101693a9670972a3c27657d2ee1c59d1 Mon Sep 17 00:00:00 2001 From: DavideGianessi <118054693+DavideGianessi@users.noreply.github.com> Date: Sat, 12 Nov 2022 12:49:11 +0100 Subject: [PATCH 3/3] typo --- content/english/hpc/number-theory/montgomery.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/content/english/hpc/number-theory/montgomery.md b/content/english/hpc/number-theory/montgomery.md index 669e39ba..0eeef0b0 100644 --- a/content/english/hpc/number-theory/montgomery.md +++ b/content/english/hpc/number-theory/montgomery.md @@ -1,6 +1,7 @@ --- title: Montgomery Multiplication weight: 4 +published: true --- Unsurprisingly, a large fraction of computation in [modular arithmetic](../modular) is often spent on calculating the modulo operation, which is as slow as [general integer division](/hpc/arithmetic/division/) and typically takes 15-20 cycles, depending on the operand size. @@ -287,6 +288,6 @@ int inverse(int _a) { } ``` -While vanilla binary exponentiation with a compiler-generated fast modulo trick requires ~170ns per `inverse` call, this implementation takes ~166ns, going down to ~158s we omit `transform` and `reduce` (a reasonable use case is for `inverse` to be used as a subprocedure in a bigger modular computation). This is a small improvement, but Montgomery multiplication becomes much more advantageous for SIMD applications and larger data types. +While vanilla binary exponentiation with a compiler-generated fast modulo trick requires ~170ns per `inverse` call, this implementation takes ~166ns, going down to ~158ns we omit `transform` and `reduce` (a reasonable use case is for `inverse` to be used as a subprocedure in a bigger modular computation). This is a small improvement, but Montgomery multiplication becomes much more advantageous for SIMD applications and larger data types. **Exercise.** Implement efficient *modular* [matix multiplication](/hpc/algorithms/matmul).