dot function
(Shortest import: from brian2 import dot)
- brian2.units.unitsafefunctions.dot(a, b, out=None)
Dot product of two arrays. Specifically,
If both
a
andb
are 1-D arrays, it is inner product of vectors (without complex conjugation).If both
a
andb
are 2-D arrays, it is matrix multiplication, but usingmatmul()
ora @ b
is preferred.If either
a
orb
is 0-D (scalar), it is equivalent tomultiply()
and usingnumpy.multiply(a, b)
ora * b
is preferred.If
a
is an N-D array andb
is a 1-D array, it is a sum product over the last axis ofa
andb
.If
a
is an N-D array andb
is an M-D array (whereM>=2
), it is a sum product over the last axis ofa
and the second-to-last axis ofb
:dot(a, b)[i,j,k,m] = sum(a[i,j,:] * b[k,:,m])
It uses an optimized BLAS library when possible (see
numpy.linalg
).