Skip to content

Instantly share code, notes, and snippets.

@tmmsartor
Created September 18, 2019 14:35
Show Gist options
  • Save tmmsartor/c4102e20eb10a5475ce082eb17f56db7 to your computer and use it in GitHub Desktop.
Save tmmsartor/c4102e20eb10a5475ce082eb17f56db7 to your computer and use it in GitHub Desktop.
from scipy.linalg import blas
import numpy
A = numpy.array([
[1,1],
[0,1]
])
B = numpy.array([
[1,4],
[2,5],
[3,6]
])
# expected results
C1e = numpy.array([
[1.,5.],
[2.,7.],
[3.,9.]
])
C0e = numpy.array([
[5., 7., 9.],
[4., 5., 6.]
])
C0 = blas.dtrmm(1.0, A, B.T, side=0)
C1 = blas.dtrmm(1.0, A, B, side=1)
print("A*B:")
print(C0)
print("Expected:")
print(C0e)
print("\nB*A:")
print(C1)
print("Expected:")
print(C1e)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment