8000 TensorProduct is bottleneck · Issue #21 · itsubaki/q · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
8000

TensorProduct is bottleneck #21

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
itsubaki opened this issue May 17, 2022 · 1 comment
Open

TensorProduct is bottleneck #21

itsubaki opened this issue May 17, 2022 · 1 comment
Assignees

Comments

@itsubaki
Copy link
Owner

after

@itsubaki itsubaki self-assigned this May 17, 2022
@itsubaki
Copy link
Owner Author
itsubaki commented May 17, 2022

q/math/matrix/matrix.go

Lines 326 to 349 in bbe3f8c

func (m *Matrix) TensorProduct(n *Matrix) *Matrix {
p, q := m.Dimension()
a, b := n.Dimension()
rows, cols := p*a, q*b
data := make([]complex128, rows*cols)
for i := range p {
for j := range q {
mij := m.At(i, j)
for k := range a {
for l := range b {
row, col := i*a+k, j*b+l
data[row*cols+col] = mij * n.At(k, l)
}
}
}
}
return &Matrix{
Rows: rows,
Cols: cols,
Data: data,
}
}

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

No branches or pull requests

1 participant
0