numpy / numpy/numpy

ENH: Speed up complex-real matrix multiplication

Open
#24,565 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

01 - Enhancement
Dominant language
Python
Stars
32.8k
Forks
12.8k
Avg merge
1d 7h
Merged PRs (30d)
197

Description

Proposed new feature or change:

Given a complex-valued matrix C of size MxN and a real-valued one R of size NxQ it should be possible to perform the C @ R operation between the two matrices using one strided GEMM call, exploiting the contiguous nature of the real and imaginary parts.

I suppose MATLAB is performing something similar as I've noticed a 2x difference in execution time between C * R and (R' * C')'.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating NumPy's matrix-multiplication implementation and its GEMM dispatch for complex-by-real operands. Confirm how the contiguous real and imaginary parts are represented, then benchmark C @ R against the transposed workaround. Done means the operation uses one strided GEMM call while preserving numerical results and improving the reported performance gap.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
performance
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.