itsubaki/q

Speeding up matrix product

Closed this issue · 1 comments

Maybe matrix product can be accelerated by goroutine

If the number of qubits is 10 or more, it may be faster.

cd pkg/math/vector; go test --bench . --benchmem
goos: linux
goarch: amd64
pkg: github.com/itsubaki/q/pkg/math/vector
BenchmarkApplyN12-2              	      25	  43987232 ns/op	  252528 B/op	      16 allocs/op
BenchmarkApplyConcurrencyN12-2   	      42	  26417367 ns/op	   66059 B/op	       4 allocs/op
PASS
ok  	github.com/itsubaki/q/pkg/math/vector	3.838s
cd pkg/math/matrix; go test --bench . --benchmem
goos: linux
goarch: amd64
pkg: github.com/itsubaki/q/pkg/math/matrix
BenchmarkApplyN8-2                      	      14	  87501415 ns/op	 2105334 B/op	    2313 allocs/op
BenchmarkApplyConcurrencyN8-2           	      28	  47447189 ns/op	 3152886 B/op	     518 allocs/op
BenchmarkTensorProductN6-2              	       5	 238025962 ns/op	1034706931 B/op	   65552 allocs/op
BenchmarkTensorProductConcurrencyN6-2   	       7	 159443992 ns/op	1034357014 B/op	   65549 allocs/op
PASS
ok  	github.com/itsubaki/q/pkg/math/matrix	6.992s