From 7e7af228b961983edff3edbf73c013384ab70080 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Wed, 28 May 2025 13:39:02 -0400 Subject: [PATCH 1/4] maths/radix2_fft.py: Fix calculation for Python 3.14 As suggested at: * https://github.com/TheAlgorithms/Python/issues/12729#issuecomment-2878608477 * https://github.com/TheAlgorithms/Python/pull/12710#discussion_r2080117333 @MaximSmolskiy @KirilBangachev @skirpichev Careful review, please. I am just implementing the suggestion, but I do not have any expertise in this area. --- maths/radix2_fft.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maths/radix2_fft.py b/maths/radix2_fft.py index d41dc82d5588..d0d3e3af1df6 100644 --- a/maths/radix2_fft.py +++ b/maths/radix2_fft.py @@ -147,7 +147,7 @@ def __multiply(self): inverce_c = new_inverse_c next_ncol *= 2 # Unpack - inverce_c = [round(x[0].real, 8) + round(x[0].imag, 8) * 1j for x in inverce_c] + inverce_c = [complex(round(x[0].real, 8), round(x[0].imag, 8)) for x in inverce_c] # Remove leading 0's while inverce_c[-1] == 0: From 4d0a53b2bd366ba98281dee25e82310b4c0a6544 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 28 May 2025 17:40:31 +0000 Subject: [PATCH 2/4] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- maths/radix2_fft.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/maths/radix2_fft.py b/maths/radix2_fft.py index d0d3e3af1df6..d7ecf4df489a 100644 --- a/maths/radix2_fft.py +++ b/maths/radix2_fft.py @@ -147,7 +147,9 @@ def __multiply(self): inverce_c = new_inverse_c next_ncol *= 2 # Unpack - inverce_c = [complex(round(x[0].real, 8), round(x[0].imag, 8)) for x in inverce_c] + inverce_c = [ + complex(round(x[0].real, 8), round(x[0].imag, 8)) for x in inverce_c + ] # Remove leading 0's while inverce_c[-1] == 0: From 3495a117e9daac17757fd66b692a25cffa3f8c40 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Wed, 28 May 2025 13:48:25 -0400 Subject: [PATCH 3/4] Change test results --- maths/radix2_fft.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/maths/radix2_fft.py b/maths/radix2_fft.py index d7ecf4df489a..ccd5cdcc0160 100644 --- a/maths/radix2_fft.py +++ b/maths/radix2_fft.py @@ -40,13 +40,13 @@ class FFT: Print product >>> x.product # 2x + 3x^2 + 8x^3 + 4x^4 + 6x^5 - [(-0+0j), (2+0j), (3+0j), (8+0j), (6+0j), (8+0j)] + [(-0-0j), (2+0j), (3-0j), (8-0j), (6+0j), (8+0j)] __str__ test >>> print(x) A = 0*x^0 + 1*x^1 + 2*x^0 + 3*x^2 B = 0*x^2 + 1*x^3 + 2*x^4 - A*B = 0*x^(-0+0j) + 1*x^(2+0j) + 2*x^(3+0j) + 3*x^(8+0j) + 4*x^(6+0j) + 5*x^(8+0j) + A*B = 0*x^(-0-0j) + 1*x^(2+0j) + 2*x^(3-0j) + 3*x^(8-0j) + 4*x^(6+0j) + 5*x^(8+0j) """ def __init__(self, poly_a=None, poly_b=None): From ebd0fed3a94daadee42550bf168a13cfd5116cec Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Wed, 28 May 2025 13:53:12 -0400 Subject: [PATCH 4/4] GitHub Actions: Rename job from build to directory_writer It is confusing to have two jobs named `build`. --- .github/workflows/directory_writer.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/directory_writer.yml b/.github/workflows/directory_writer.yml index 55d89f455a25..3edb5c91a951 100644 --- a/.github/workflows/directory_writer.yml +++ b/.github/workflows/directory_writer.yml @@ -3,7 +3,7 @@ name: directory_writer on: [push] jobs: - build: + directory_writer: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4