Skip to content

Vector tensor product - #681

Open
argerlt wants to merge 5 commits into
pyxem:developfrom
argerlt:vector_tensor_product
Open

Vector tensor product#681
argerlt wants to merge 5 commits into
pyxem:developfrom
argerlt:vector_tensor_product

Conversation

@argerlt

@argerlt argerlt commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator

Description of the change

  1. Adds Vector3d.tensor and Vector3d.tensor_outer
  2. Updates test_vector3d.py to better match the class-level organization of other test files and increases overage.

NOTE: this looks like a large update, but 300+ lines are just reformatting existing tests.

I would like to add this to the 0.16 release if possible.

Progress of the PR

Minimal example of the bug fix or new feature

# Using the definition of the tensor product as verification:
a = Vector3d.random()
b = Vector3d.random()
c = Vector3d.random()
abc = np.dot((a.tensor(b)[0]), c.data[0])
bca = (b.dot(c) * a).data
abc_outer = np.dot((a.tensor_outer(b)[0]), c.data[0])

# printing an example
print(a,'\n\n',b,'\n\n',a.tensor(b)[0])

>>> Vector3d (1,)
          [[ 0.8429 -0.3101  0.4398]] 
>>> Vector3d (1,)
           [[0.4767 0.1299 0.8694]] 
>>>  [[ 0.40181049  0.10951157  0.73277669]
          [-0.14782216 -0.04028824 -0.26958139]
          [ 0.20967513  0.05714598  0.38238187]]

For reviewers

  • The PR title is short, concise, and will make sense 1 year later.
  • New functions are imported in corresponding __init__.py.
  • New features, API changes, and deprecations are mentioned in the unreleased
    section in CHANGELOG.rst.
  • Contributor(s) are listed correctly in __credits__ in orix/__init__.py and in
    .zenodo.json.

@argerlt argerlt mentioned this pull request Sep 4, 2026
@argerlt argerlt linked an issue Sep 4, 2026 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Vector tensor product?

1 participant