pymc-devs / pymc-devs/pytensor

Use contraction path to optimize `pt.nlinalg.matrix_dot`

Open
#961 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement feature request linalg NumPy compatibility
Dominant language
Python
Stars
644
Forks
208
Avg merge
2d 14h
Merged PRs (30d)
16

Description

Description

Right now we have a function pt.nlinalg.matrix_dot that is just a helper for doing repeated dot products. This is similar to but worse than np.linalg.multi_dot, because multi_dot also computes an optimal contraction path, and does the dot products in a smart order.

#722 added optimized contraction path logic, so we could include this into our matrix_dot function. While we're at it, we should rename the function to multi_dot to match the numpy API.

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 pt.nlinalg.matrix_dot and review the optimized contraction path logic added in #722, then compare its intended behavior with np.linalg.multi_dot. Done means matrix_dot uses an optimal contraction path and is renamed to multi_dot to match the NumPy API.

Written by the indexing model from the issue text.

Assessment

Tech stack
numpy, python
Domain
data
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.