Skip to content

Commit

Permalink
换了katex之后编译pdf速度大大加快
Browse files Browse the repository at this point in the history
  • Loading branch information
sonnyhcl committed Aug 2, 2018
1 parent de4c519 commit f9112c8
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 26 deletions.
4 changes: 2 additions & 2 deletions 03-CORDIC.md
Original file line number Diff line number Diff line change
Expand Up @@ -231,13 +231,13 @@ $$ y = r \sin \theta \quad(3.28)$$

$$ r =\sqrt{x^2 + y^2} \quad(3.29)$$

$$ \theta = \operatorname{atan2}(y, x) \quad(3.30)$$
$$ \theta = atan2(y, x) \quad(3.30)$$

atan2在arctan函数中定义为

$$
\operatorname{atan2}(y, x) =
atan2(y, x) =
\begin{cases}
\arctan(\frac{y}{x}) \quad\quad\quad {if } x > 0 \\
\arctan(\frac{y}{x}) + \pi \quad {if } x < 0 { and } y \ge 0 \\
Expand Down
4 changes: 2 additions & 2 deletions 05-Fast-Fourier-Transform.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ $$
现在让我们来正式推导出这种关系,它提供了一种描述FFT递归结构的通用方法。假设我们正在计算N点FFT。给定输入值g[]的频域值G[]的计算公式为:

$$
G[k] = \displaystyle\sum\limits_{n=0}^{N-1} g[n] \cdot e^{\frac{-j 2 \pi k n}{N}} \text{ for } k = 0,\dots, N-1
G[k] = \displaystyle\sum\limits_{n=0}^{N-1} g[n] \cdot e^{\frac{-j 2 \pi k n}{N}} \text{ for } k = 0, \ldots, N-1
\quad(5.13)
$$
我们可以把这个公式分为两部分,一部分是偶数部分,一部分是奇数部分。
Expand Down Expand Up @@ -206,7 +206,7 @@ $$

为了计算更高频率G[N=2]到G[N-1],让我们推导出相同的方程,但这次使用k=N/2,N/2+ 1,...,N/2-1。因此,我们希望计算:
$$
G[k + N/2] = \displaystyle\sum\limits_{n=0}^{N-1} g[n] \cdot e^{\frac{-j 2 \pi (k + N/2) n}{N}} \text{ for } k = 0, \dots, N/2 - 1\quad(5.18)
G[k + N/2] = \displaystyle\sum\limits_{n=0}^{N-1} g[n] \cdot e^{\frac{-j 2 \pi (k + N/2) n}{N}} \text{ for } k = 0, \ldots, N/2 - 1\quad(5.18)
$$
这类似于具有不同指数的公式5.13,即,我们用公式5.13代替k,其中k+N/2。用我们之前执行的相同变换集,我们可以将它直接移动到等式5.16,但用k+N/2替换k得到
$$
Expand Down
4 changes: 3 additions & 1 deletion 07-Matrix-Multiplication.md
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,10 @@ void blockmatmul(hls::stream<blockvec> &Arows, hls::stream<blockvec> &Bcols,
函数开始部分的**dataflow**directive 实现函数部分之间的流水线,例如**loadA for**循环,**partialsum** 嵌套的**for**循环、**writeoutput for** 循环。使用这个directive可以减少函数**blockmatmul**运行的间隔。但是,代码三个部分中最大运行间隔是最终的限制条件。也就是说,函数**blockmatmul**运行间隔的最大值,我们称之为interval**(blockmatmul)** 是要大约等于interval**(loadA)** ,interval**(partialsum)** ,interval**(writeoutput)** 中的最大值的。
$$
\begin{aligned}
interval\textbf{(blockmatmul)} \geq \\
max(interval\textbf{(loadA)},interval\textbf{(partialsum)}, interval\textbf{(writeoutput)})
max(interval\textbf{(loadA)},interval\textbf{(partialsum)}, interval\textbf{(writeoutput)})
\end{aligned}
\quad(7.5)
$$
Expand Down
2 changes: 1 addition & 1 deletion 08-Prefix-Sum-and-Histogram.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

​前缀和是许多应用中经常使用的运算算子,例如在递推关系、压缩问题、字符串比较、多项式评估、直方图、基数排序和快速排序应用中[[11](./BIBLIOGRAPHY.md#11)] 。为了创建高效的FPGA设计,下面我们对前缀和运算进行重新设计。

​前缀和本来是一序列数字的累加和。若给定一序列输入中$i{n_n}$,前缀和中第n项的值是输入前n项的累加和$$ou{t_n}$$,即$$ou{t_n} = i{n_0} + i{n_1} + i{n_2} + \cdots + i{n_{n - 1}} + i{n_n}$$。以下展示的是前四个输出元素的计算过程。
​前缀和本来是一序列数字的累加和。若给定一序列输入中$$i{n_n}$$,前缀和中第n项的值是输入前n项的累加和$$ou{t_n}$$,即$$ou{t_n} = i{n_0} + i{n_1} + i{n_2} + \cdots + i{n_{n - 1}} + i{n_n}$$。以下展示的是前四个输出元素的计算过程。

$$
\begin{aligned}
Expand Down
28 changes: 14 additions & 14 deletions 11-Huffman-Encoding.md
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ $$
\begin{aligned}
\text{depth(root)} = 0 \\
\forall n! = \text{root}, \text{depth}(n) = \text{depth(parent}(n) + 1) \\
\forall n, \text{child_depth}(n) = \text{depth}(n) + 1
\forall n, \text{child\_depth}(n) = \text{depth}(n) + 1
\end{aligned}
\qquad(11.1)
$$
Expand All @@ -391,8 +391,8 @@ $$
$$
\begin{aligned}
\text{child_depth(root)} = 1 \\
\forall n! = \text{root}, \text{child_depth}(n) = \text{child_depth(parent}(n) + 1)
\text{child\_depth(root)} = 1 \\
\forall n! = \text{root}, \text{child\_depth}(n) = \text{chil\_depth(parent}(n) + 1)
\end{aligned}
\qquad(11.2)
$$
Expand Down Expand Up @@ -601,9 +601,9 @@ process_symbols循环无法进行流水线操作,因为内部do / while循环
编码过程中的最后一步是为每个符号创建码字。 该流程根据Canonical霍夫曼代码的特性,按顺序简单地分配每个符号。第一个特性是具有相同长度前缀的较长的代码比短码有更高的数值。第二个特性是相同长度的代码随着符号值的增加而增加。为了在保持代码简单的同时实现这些属性,确定每个长度的第一个码字是有用的。如果我们知道由码字长度直方图给出的每个长度的码字的数量,则可以使用以下循环来得出结果:
$$
\begin{aligned}
\text{first_codeword}(1) = 0 \\
\forall i>1,\text{firstst_codeword}(i) = \\
(\text{first_codeword}(i-1) + \text{codeword_length_histogram}(i-1))\ll1
&\text{first\_codeword}(1) = 0 \\
&\forall i>1,\text{first\_codeword}(i) = \\
&(\text{first\_codeword}(i-1) + \text{codeword\_length\_histogram}(i-1))\ll1
\end{aligned}
\qquad(11.3)
$$
Expand Down Expand Up @@ -671,21 +671,21 @@ void create_codeword(

$$
\begin{aligned}
\text{bit_length}(1) &= 0 \\
\text{bit_length}(2) &= 3 \\
\text{bit_length}(3) &= 1 \\
\text{bit_length}(4) &= 2
\text{bit\_length}(1) &= 0 \\
\text{bit\_length}(2) &= 3 \\
\text{bit\_length}(3) &= 1 \\
\text{bit\_length}(4) &= 2
\end{aligned}
\qquad(11.4)
$$

使用公式11.3来计算第一个码字的值,我们定义:
$$
\begin{aligned}
\text{first_codeword}(1) &= 0 &= 0b0 \\
\text{first_codeword}(2) &= (0 + 0) \ll 1 &= 0b00 \\
\text{first_codeword}(3) &= (0 + 3) \ll 1 &= 0b110 \\
\text{first_codeword}(4) &= (6 + 1) \ll 1 &= 0b1110
\text{first\_codeword}(1) &= 0 &= 0b0 \\
\text{first\_codeword}(2) &= (0 + 0) \ll 1 &= 0b00 \\
\text{first\_codeword}(3) &= (0 + 3) \ll 1 &= 0b110 \\
\text{first\_codeword}(4) &= (6 + 1) \ll 1 &= 0b1110
\end{aligned}
\qquad(11.5)
$$
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# pp4fpga-cn
# FPGA并行编程
> 以HLS实现信号处理为例
国内鲜有介绍HLS的书,我们希望通过翻译`Parallel Programming for FPGAs`这本书,让更多的人来了解HLS和FPGA开发。

Expand All @@ -16,6 +17,8 @@

- [https://github.com/xupsh/pp4fpgas-cn-hls](https://github.com/xupsh/pp4fpgas-cn-hls)

## 问题反馈
- 如有问题请[在这里(https://github.com/xupsh/pp4fpgas-cn/issues/new)](https://github.com/xupsh/pp4fpgas-cn/issues/new)指正

## Contributor

Expand All @@ -38,7 +41,6 @@ README | [胡成龙@sonnyhcl](https://github.com
11 Huffman Encoding | [杨勇@rowen800](https://github.com/rowen800) |
词汇表 | [李彦晔@Zaoldyeckk](https://github.com/Zaoldyeckk) |
参考文献 | [李彦晔@Zaoldyeckk](https://github.com/Zaoldyeckk) |
排版约定 | [胡成龙@sonnyhcl](https://github.com/sonnyhcl) |

## Reference

Expand Down
5 changes: 1 addition & 4 deletions book.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"plugins": [
"yahei",
"code",
"mathjax@https://github.com/OrgVue/gitbook-plugin-mathjax.git#speech-fix",
"katex",
"splitter",
"github-buttons",
"disqus",
Expand All @@ -31,9 +31,6 @@
"family": "msyh",
"size": 2
},
"mathjax": {
"forceSVG": false
},
"hints": {
"info": "fa fa-info-circle",
"tip": "fa fa-mortar-board",
Expand Down

0 comments on commit f9112c8

Please sign in to comment.