numpy / numpy/numpy

ENH: Skew symmetric/matrix cross product function

Open
#24,687 11 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Proposed new feature or change:

Dynamicists frequently use the matrix representation of the cross product (https://en.m.wikipedia.org/wiki/Cross_product#Conversion_to_matrix_multiplication), and the lack of a skew symmetric operator in NumPy is a frequent source of annoyance.

I propose either adding a skew function to linalg that returns the skew symmetric matrix of a vector np.cross(a, np.identity(a.shape[0]) * -1) (from https://stackoverflow.com/questions/66707295/numpy-cross-product-matrix-function), or more radically, making the second argument b of np.cross optional and have np.cross(a) return the matrix representation of [a x]. For the latter, would need to consider the interaction with other kwargs and different input shapes.

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 reviewing the proposed linalg skew function and the alternative np.cross(a) API, including their interaction with existing kwargs and different input shapes. The issue mentions no implementation files or tests; done would require a settled API direction before implementation and validation can be scoped.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.