-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit a9a02c5
Showing
756 changed files
with
46,198 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.deploy*/ | ||
node_modules/ | ||
public/ | ||
services/*/site/ | ||
db.json | ||
.DS_Store | ||
Thumbs.db | ||
_multiconfig.yml | ||
*.log |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# My-Blog | ||
|
||
这是 [leverimmy](https://github.com/leverimmy) 的个人博客。 | ||
|
||
## 内容 | ||
|
||
- 笔记 | ||
- 课程报告 | ||
- 讲义 | ||
- 随笔 | ||
- 游记 | ||
|
||
## 主题 | ||
|
||
使用的是 [NexT](https://github.com/next-theme/hexo-theme-next) 主题。 | ||
|
||
## LICENSE | ||
|
||
除非另有说明,本仓库的内容采用 [CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/) 许可协议。在遵守许可协议的前提下,您可以自由地分享、修改本文档的内容,但不得用于商业目的。 | ||
|
||
如果您认为文档的部分内容侵犯了您的合法权益,请联系项目维护者,我们会尽快删除相关内容。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
title: "Clever_Jimmy's Blog" | ||
subtitle: '' | ||
description: '' | ||
keywords: null | ||
author: Clever_Jimmy | ||
language: zh-CN | ||
timezone: '' | ||
url: https://leverimmy.top/ | ||
permalink: ':year/:month/:day/:id/' | ||
permalink_defaults: null | ||
pretty_urls: | ||
trailing_index: true | ||
trailing_html: true | ||
source_dir: source | ||
public_dir: public | ||
tag_dir: tags | ||
archive_dir: archives | ||
category_dir: categories | ||
code_dir: downloads/code | ||
i18n_dir: ':lang' | ||
skip_render: README.md | ||
new_post_name: ':title.md' | ||
default_layout: post | ||
titlecase: false | ||
external_link: | ||
enable: true | ||
field: site | ||
exclude: '' | ||
filename_case: 0 | ||
render_drafts: false | ||
post_asset_folder: false | ||
relative_link: false | ||
future: true | ||
highlight: | ||
enable: true | ||
line_number: true | ||
auto_detect: false | ||
tab_replace: '' | ||
wrap: true | ||
hljs: false | ||
exclude_languages: | ||
- mermaid | ||
prismjs: | ||
enable: false | ||
preprocess: true | ||
line_number: true | ||
tab_replace: '' | ||
index_generator: | ||
path: '' | ||
per_page: 10 | ||
order_by: '-date' | ||
default_category: uncategorized | ||
category_map: null | ||
tag_map: null | ||
meta_generator: true | ||
date_format: YYYY-MM-DD | ||
time_format: HH:mm:ss | ||
updated_option: mtime | ||
per_page: 10 | ||
pagination_dir: page | ||
include: null | ||
exclude: null | ||
ignore: null | ||
theme: next | ||
deploy: | ||
type: git | ||
repo: git@47.120.48.46:/home/git/hexo.git | ||
branch: main | ||
extend_dirs: | ||
- services/homework-ans/site | ||
# Extensions | ||
plugins: | ||
hexo-generator-feed | ||
#Feed Atom | ||
feed: | ||
type: atom | ||
path: atom.xml | ||
limit: 20 | ||
hub: | ||
content: | ||
content_limit: 140 | ||
content_limit_delim: ' ' | ||
order_by: -date | ||
rss: /atom.xml | ||
# lazyload: | ||
# enable: true | ||
# onlypost: true | ||
# loadingImg: # eg. ./images/loading.png |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
--- | ||
title: Hello World | ||
--- | ||
Welcome to [Hexo](https://hexo.io/)! This is your very first post. Check [documentation](https://hexo.io/docs/) for more info. If you get any problems when using Hexo, you can find the answer in [troubleshooting](https://hexo.io/docs/troubleshooting.html) or you can ask me on [GitHub](https://github.com/hexojs/hexo/issues). | ||
|
||
## Quick Start | ||
|
||
### Create a new post | ||
|
||
``` bash | ||
$ hexo new "My New Post" | ||
``` | ||
|
||
More info: [Writing](https://hexo.io/docs/writing.html) | ||
|
||
### Run server | ||
|
||
``` bash | ||
$ hexo server | ||
``` | ||
|
||
More info: [Server](https://hexo.io/docs/server.html) | ||
|
||
### Generate static files | ||
|
||
``` bash | ||
$ hexo generate | ||
``` | ||
|
||
More info: [Generating](https://hexo.io/docs/generating.html) | ||
|
||
### Deploy to remote sites | ||
|
||
``` bash | ||
$ hexo deploy | ||
``` | ||
|
||
More info: [Deployment](https://hexo.io/docs/one-command-deployment.html) |
19 changes: 19 additions & 0 deletions
19
drafts/【学习笔记】Introduction-to-Theoretical-Computer-Science.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--- | ||
title: 【学习笔记】Introduction to Theoretical Computer Science | ||
tags: | ||
- 理论计算机科学 | ||
categories: | ||
- 笔记 | ||
mathjax: true | ||
toc: true | ||
date: 2024-03-01 20:14:22 | ||
password: | ||
id: ITCS | ||
--- | ||
|
||
这是 *[Introduction to Theoretical Computer Science](https://introtcs.org/)* 的学习笔记。 | ||
|
||
<!--more--> | ||
|
||
## | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,157 @@ | ||
--- | ||
title: 【学习笔记】Karatsuba 乘法学习笔记 | ||
tags: | ||
- 高精度 | ||
- 分治 | ||
- 技巧 | ||
categories: | ||
- 学习笔记 | ||
mathjax: true | ||
toc: true | ||
date: 2020-05-04 15:40:30 | ||
password: | ||
--- | ||
|
||
上个学期在联赛前听 EternalAlexander 提到了一下这个玄学的算法,现在就学习一下吧。 | ||
|
||
<!--more--> | ||
|
||
### **简介** | ||
|
||
「Karatsuba 乘法」是 1960 年由 Anatolii Alexeevitch Karatsuba 提出的可用于大整数乘法的算法。 | ||
|
||
### **理论推导** | ||
|
||
不妨设我们要相乘的两个数字分别为 $a$ 和 $b$,其乘积,也就是我们要求的数,为 $c$。 | ||
|
||
设 $a = x_1\cdot10^m + x_0, b = y_1\cdot10^m + y_0$,其中 $0 < x_1, x_0, y_1, y_0 < 10^m$,则 | ||
|
||
$\begin{aligned}c = ab & = (x_1\cdot10^m + x_0) \cdot (y_1\cdot10^m + y_0) \\\\ & = (x_1\cdot y_1)10^{2m} + (x_1\cdot y_0 + x_0\cdot y_1)10^m + x_0\cdot y_0\end{aligned}$ | ||
|
||
记 $z_2 = x_1\cdot y_1, z_1 = x_1\cdot y_0 + x_0\cdot y_1, z_0 = x_0\cdot y_0$。 | ||
|
||
**注意到**,$z_1 = (x_1 + x_0)(y_1 + y_0) - z_2 - z_0$。 | ||
|
||
于是我们可以分步计算 $(x_1 + x_0)(y_1 + y_0), z_2, z_0$ 即可。 | ||
|
||
### **时间复杂度** | ||
|
||
我们实质上是把一个 $n \times n$ 的乘法化简为了三个长度更小的乘法。 | ||
|
||
当 $m = \left\lfloor\dfrac{n}{2}\right\rfloor$ 时,有递推式 $T(n) = 3T(\left\lfloor\dfrac{n}{2}\right\rfloor) + O(n)$。 | ||
|
||
不难由主定理得知 $T(n) = \Theta(n^{\log_{2}3}) \approx \Theta(n^{1.585})$ | ||
|
||
### **代码实现** | ||
|
||
这个是 [MUL - Fast Multiplication](http://www.spoj.com/problems/MUL/en/) 的代码。 | ||
|
||
```cpp | ||
#include <bits/stdc++.h> | ||
#define LL long long | ||
#define LOCAL | ||
|
||
namespace io { | ||
template <typename T> inline void read(T & _x) { | ||
int f = 0, ch; _x = 0; | ||
while(!isdigit(ch = getchar())) f |= ch == '-'; | ||
while(isdigit(ch)) _x = _x * 10 + ch - '0', ch = getchar(); | ||
if(f) _x = -_x; | ||
} | ||
template <typename T, typename ... Args> inline void read(T &_f, Args& ... args) { | ||
read(_f), read(args ...); | ||
} | ||
inline void _deal(char ch) { putchar(ch); } | ||
template <typename T> inline void _deal(T _x) { | ||
if (_x < 0) putchar('-'), _x = -_x; | ||
if (_x > 9) _deal(_x / 10); | ||
putchar(_x % 10 + '0'); | ||
} | ||
inline void write() {} | ||
template <typename T, typename ... Args> inline void write(T _f, Args ... args) { | ||
_deal(_f), write(args...); | ||
} | ||
} | ||
|
||
const int N = 1e4 + 5; | ||
|
||
int t, n, m; | ||
int a[N], b[N], c[N << 1]; | ||
char A[N], B[N]; | ||
|
||
int *Kmul(int len, int ra[], int rb[]) { | ||
if(len <= 32) { | ||
int *r = new int[len * 2 + 1](); | ||
for(int i = 0; i <= len; ++i) | ||
for(int j = 0; j <= len; ++j) | ||
r[i + j] += ra[i] * rb[j]; | ||
return r; | ||
} | ||
int hf = len / 2 + 1; | ||
int *r = new int[hf * 4 + 1](); | ||
int *z0, *z1, *z2; | ||
|
||
z0 = Kmul(hf - 1, ra, rb); | ||
z2 = Kmul(len - hf, ra + hf, rb + hf); | ||
|
||
for(int i = 0; i + hf <= len; ++i) ra[i] += ra[i + hf]; | ||
for(int i = 0; i + hf <= len; ++i) rb[i] += rb[i + hf]; | ||
z1 = Kmul(hf - 1, ra, rb); | ||
for(int i = 0; i + hf <= len; ++i) ra[i] -= ra[i + hf]; | ||
for(int i = 0; i + hf <= len; ++i) rb[i] -= rb[i + hf]; | ||
|
||
for(int i = 0; i <= (hf - 1) * 2; ++i) z1[i] -= z0[i]; | ||
for(int i = 0; i <= (len - hf) * 2; ++i) z1[i] -= z2[i]; | ||
|
||
for(int i = 0; i <= (hf - 1) * 2; ++i) r[i] += z0[i]; | ||
for(int i = 0; i <= (hf - 1) * 2; ++i) r[i + hf] += z1[i]; | ||
for(int i = 0; i <= (len - hf) * 2; ++i) r[i + hf * 2] += z2[i]; | ||
|
||
delete[] z0; | ||
delete[] z1; | ||
delete[] z2; | ||
return r; | ||
} | ||
|
||
void Karatsuba(int ra[], int rb[], int rc[]) { | ||
int *r = Kmul(n - 1, ra, rb); | ||
memcpy(rc, r, sizeof(int) * m); | ||
for(int i = 0; i < m - 1; ++i) { | ||
if(rc[i] >= 10) { | ||
rc[i + 1] += rc[i] / 10; | ||
rc[i] %= 10; | ||
} | ||
} | ||
delete[] r; | ||
} | ||
|
||
int main() { | ||
#ifdef LOCAL | ||
freopen("mul.in", "r", stdin); | ||
freopen("mul.out", "w", stdout); | ||
#endif | ||
io::read(t); | ||
while(t--) { | ||
int len1, len2; | ||
scanf("%s %s", A + 1, B + 1); | ||
len1 = strlen(A + 1), len2 = strlen(B + 1); | ||
n = std::max(len1, len2); | ||
for(int i = len1, j = len2, k = 0; k < n; --i, --j, ++k) { | ||
if(i >= 1) a[k] = A[i] - '0'; | ||
else a[k] = 0; | ||
if(j >= 1) b[k] = B[j] - '0'; | ||
else b[k] = 0; | ||
} | ||
/*for(int i = 1; i <= n; ++i) printf("%d", a[i]); | ||
putchar('\n'); | ||
for(int i = 1; i <= n; ++i) printf("%d", b[i]); | ||
putchar('\n');*/ | ||
m = len1 + len2 - 1; | ||
Karatsuba(a, b, c); | ||
while(!c[m - 1] && m > 1) --m; | ||
for(int i = m - 1; i >= 0; --i) io::write(c[i]); | ||
io::write('\n'); | ||
} | ||
return 0; | ||
} | ||
``` |
56 changes: 56 additions & 0 deletions
56
drafts/【学习笔记】Quantum-Computation-and-Quantum-Information.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
--- | ||
title: 【学习笔记】Quantum Computation and Quantum Information | ||
tags: | ||
- 理论计算机科学 | ||
- 量子计算 | ||
categories: | ||
- 笔记 | ||
mathjax: true | ||
toc: true | ||
date: 2024-05-12 20:14:22 | ||
password: | ||
id: QCQI | ||
--- | ||
|
||
这是 *Quantum Computation and Quantum Information* 的学习笔记。 | ||
|
||
<!--more--> | ||
|
||
## Nomenclature and notation | ||
|
||
### Linear Algebra and quantum mechanics | ||
|
||
#### Positive, positive definite, and support | ||
|
||
An operator $A$ is *positive* if $\braket{\psi |A| \psi} \ge 0$ holds for all $\ket{\psi}$. | ||
|
||
An operator $A$ is *positive definite* if $\braket{\psi |A| \psi} > 0$ holds for all $\ket{\psi}$. | ||
|
||
The *support* of an operator is defined to be the vector space orthogonal to its kernel. | ||
|
||
#### The Letter H | ||
|
||
$H$ is for *Hadamard Gate*, which has the matrix representation | ||
$$ | ||
H = \frac{1}{\sqrt{2}}\begin{bmatrix}1 & 1 \\ 1 & -1\end{bmatrix}. | ||
$$ | ||
Or, it could be the *Hamiltonian* for a quantum system. | ||
|
||
### Information theory and probability | ||
|
||
#### Relative Entropy | ||
|
||
The *relative entropy* of a positive operator $A$ **relative to ** another positive operator B is defined as | ||
$$ | ||
S(A \parallel B) = \text{tr}(A \log A) - \text{tr}(B \log B). | ||
$$ | ||
Note that the order of the operators matters. $A$ and $B$ need to be positive because of the $\log$ function. | ||
|
||
### Frequently used quantum gates and circuit symbols | ||
|
||
TBA | ||
|
||
## Fundamental concepts | ||
|
||
### Introduction and overview | ||
|
Oops, something went wrong.