Skip to content

ENH: scipy.linalg.circulant should allow batching #17344

@thomasahle

Description

@thomasahle

Is your feature request related to a problem? Please describe.

The scipy.linalg.circulant function (and the similar functions for Toeplitz and Hankel matrices) take an (N,) array and returns a (N,N) array.

That means it only allows creating a single circulant matrix per call.

Describe the solution you'd like.

The function(s) should take a (*, N) array and return a (*, N, N) array, allowing the creation of lots of circulant matrices in a single call from Python.

Describe alternatives you've considered.

I could write a Python loop over my batch dimension(s), however that is obviously slow.

I might also be able to roll my own circulant matrix generation using numpy basic blocks. Like is done here using tensorflow: https://stackoverflow.com/questions/63073976 but it seems tricky.

Additional context (e.g. screenshots, GIFs)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions