Skip to content

Fix print output for radix2 FFT #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 3, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix enumeration order in FFT string representation
  • Loading branch information
alejandroaldas committed Jun 3, 2025
commit a291f1b5c77b75d414867296a8be758b9aea5516
18 changes: 9 additions & 9 deletions maths/radix2_fft.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,15 +157,15 @@ def __multiply(self):

# Overwrite __str__ for print(); Shows A, B and A*B
def __str__(self):
a = "A = " + " + ".join(
f"{coef}*x^{i}" for coef, i in enumerate(self.polyA[: self.len_A])
)
b = "B = " + " + ".join(
f"{coef}*x^{i}" for coef, i in enumerate(self.polyB[: self.len_B])
)
c = "A*B = " + " + ".join(
f"{coef}*x^{i}" for coef, i in enumerate(self.product)
)
a = "A = " + " + ".join(
f"{coef}*x^{i}" for i, coef in enumerate(self.polyA[: self.len_A])
)
b = "B = " + " + ".join(
f"{coef}*x^{i}" for i, coef in enumerate(self.polyB[: self.len_B])
)
c = "A*B = " + " + ".join(
f"{coef}*x^{i}" for i, coef in enumerate(self.product)
)

return f"{a}\n{b}\n{c}"

Expand Down