avatar
大数乘法的另类解法# JobHunting - 待字闺中
I*e
1
鉴于曾经有过带去一个菜,居然没人碰又原封不动带回家的经历(当然那次大厨也太多
),这次决定做个色香味俱全的。于是看中了阿树的虾肉卷。可惜量没仔细follow,几
乎卷不上。看看蒸出来胖的难看的样子。还好切完了,漂亮许多。最重要的是,带到朋
友家,全被消灭掉了。谢谢阿树啊...
★ 发自iPhone App: ChineseWeb 7.7
avatar
h*8
2
快速傅里叶变换
int * multiplication(int a[], int b[], int size_a, int size_b)
{
int i, j;
for (i = 0; i < size_a + size_b; ++ i) c[i] = 0;
for (i = 0; i < size_a; ++ i)
for (j = 0; j < size_b; ++ j)
c[i+j] += a[i]*b[j]
return c;
}
It will take n^2 operations.
♥ To reduce that, we can transform the coefficient representation to
sample representation. Then do the multiplication, then transform back.
Sample representation: given {(x_0, y_0), ..., (x_n, y_n)}, there is exactly
one polynomial p of degree n s.t. p(x_i) = y_i for all i. Thus, {(x_0, y_0)
, ..., (x_n, y_n)} can represent a n-degree polynomial.
To multiply two polynomials, just multiply their sample values. If we are
multiply two polynomials of degree n, we need to start with 2n+1 sample
values for each polynomials, since that is how many we need to uniquely
represent the product polynomial. This obvious takes O(n).
If we can choose the sample points carefully (e.g., FFT), we can do the
transformation in O(n \log n). Thus, the whole multiplication takes O(n \log
n).
avatar
I*e
3
成品:

★ 发自iPhone App: ChineseWeb 7.7

【在 I**********e 的大作中提到】
: 鉴于曾经有过带去一个菜,居然没人碰又原封不动带回家的经历(当然那次大厨也太多
: ),这次决定做个色香味俱全的。于是看中了阿树的虾肉卷。可惜量没仔细follow,几
: 乎卷不上。看看蒸出来胖的难看的样子。还好切完了,漂亮许多。最重要的是,带到朋
: 友家,全被消灭掉了。谢谢阿树啊...
: ★ 发自iPhone App: ChineseWeb 7.7

avatar
o*l
4
看上去真不错啊
阿树的方子在哪里?难不难操作?
avatar
I*e
5
It's very simple. If I can do it, everyone can then :)
http://www.treexlx.net/shrimp-roll/

【在 o********l 的大作中提到】
: 看上去真不错啊
: 阿树的方子在哪里?难不难操作?

avatar
o*l
6
thanks!
does seem doable!

【在 I**********e 的大作中提到】
: It's very simple. If I can do it, everyone can then :)
: http://www.treexlx.net/shrimp-roll/

avatar
i*9
7
好看!
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。