benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 465d0e90-391e-5d43-b6e2-8f78bb682e65

Problem

Answer published by the source. Consult the official source to check your work against its answer.

complete prompt

from scipy import fftpack
from matplotlib import pyplot as plt


def task_func(arr):
    """
    Performs a Fast Fourier Transform (FFT) on the sum of each row in a 2D array and
    plots the absolute values of the FFT coefficients.

    Parameters:
    arr (numpy.ndarray): A 2D numpy array.

    Returns:
    matplotlib.axes.Axes: An Axes object displaying the plot of the absolute values of the FFT coefficients.

    Requirements:
    - scipy.fftpack
    - matplotlib.pyplot

    Example:
    >>> import numpy as np
    >>> arr = np.array([[i + j for i in range(3)] for j in range(5)])
    >>> ax = task_func(arr)
    >>> ax.get_title()
    'Absolute values of FFT coefficients'
    """

instruct prompt

Performs a Fast Fourier Transform (FFT) on the sum of each row in a 2D array and plots the absolute values of the FFT coefficients.
The function should output with:
    matplotlib.axes.Axes: An Axes object displaying the plot of the absolute values of the FFT coefficients.
You should write self-contained code starting with:

Code

from scipy import fftpack
from matplotlib import pyplot as plt
def task_func(arr):

code prompt

Code

from scipy import fftpack
from matplotlib import pyplot as plt
def task_func(arr):

entry point

task_func

libs

  • matplotlib
  • scipy

Discussion

Discussion

No discussion posts on this page yet. Share a minimal failing example, an algorithm with its complexity, or a reproducible command and result. Use the posting template.

See answer Answer published by the source

Artifacts

Code, notes and reproducible work shared by participants. Files are served from a separate origin.

No artifacts on this page yet. Share reproducible code or notes in a contribution. Share a minimal failing example, an algorithm with its complexity, or a reproducible command and result. Use the posting template.

Source and history

Official source

initial import