Skip to content

Commit 584244b

Browse files
roll-no-1jakobkogler
authored andcommitted
Made some major changes to All possible scalar products subsection (#330)
1 parent 695b98b commit 584244b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/algebra/fft.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -531,12 +531,13 @@ We have to compute the products of $a$ with every cyclic shift of $b$.
531531
We generate two new arrays of size $2n$:
532532
We reverse $a$ and append $n$ zeros to it.
533533
And we just append $b$ to itself.
534-
When we multiply these two arrays as polynomials, and look at the coefficient $c[n],~ c[n+1],~ c[2n-1]$ of the product $c$, we get:
534+
When we multiply these two arrays as polynomials, and look at the coefficient $c[n-1],~ c[n],~ c[2n-2]$ of the product $c$, we get:
535535
$$c[k] = \sum_{i+j=k} a[i] b[j]$$
536536
And since all the elements $a[i] = 0$ for $i \ge n$:
537537
$$c[k] = \sum_{i=0}^{n-1} a[i] b[k-i]$$
538-
It is easy to see that this sum is just the scalar product of the vector $a$ with the $(k - n - 1)$-th cyclic shift.
538+
It is easy to see that this sum is just the scalar product of the vector $a$ with the $(k - (n - 1))$-th cyclic left shift.
539539
Thus these coefficients are the answer to the problem, and we were still able to obtain it in $O(n \log n)$ time.
540+
Note here that $c[2n-1]$ also gives us the $n$th cyclic shift but that is the same as the $0$th cyclic shift so we don't need to consider that seperately into our answer.
540541
541542
### Two stripes
542543

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy