tensor product
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 839
- Forks
- 220
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 14
Description
Summary:
From @betanalpha
C_{ij} = sum{m, n = 1}^{N} A_{imn} B_{jmn}
Description:
In Stan code:
matrix tensor_product(matrix[] A, matrix[] B) {
matrix[size(A), size(B)] C;
for (j in 1:J)
for (i in 1:I)
c[i, j] = sum(A[i] .* B[j]);
return c;
}
with calling:
matrix[M, N] A[I];
matrix[M, N] B[J];
matrix[I, J] C = tensor_product(A, B);
We could write analytic derivatives for sum(matrix .* matrix) to cut down on memory usage. I don't know if we can piggyback on any of the Eigen tensor operations to make it more efficient. Lots of memory blocking issues here in how to do that sum and elementwise product efficiently.
Current Version:
v2.15.0
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names no repository files, tests, or entry points. Start by locating the Stan tensor_product pattern and the relevant Eigen or automatic-differentiation operations; done would require an agreed implementation with analytic derivatives plus evidence that memory use and performance improve.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100