Skip to content

Instantly share code, notes, and snippets.

@wangleiphy
Created May 1, 2015 18:31
Show Gist options
  • Select an option

  • Save wangleiphy/011137ff957ac4f324eb to your computer and use it in GitHub Desktop.

Select an option

Save wangleiphy/011137ff957ac4f324eb to your computer and use it in GitHub Desktop.
from numpy import bmat, zeros , array , eye , dot
from scipy.linalg import det , expm
B1 = array([[2, 1, 1, 3, 2],
[1, 2, 1, 3, 1],
[2, 3, 1, 2, 2],
[1, 3, 1, 3, 1],
[2, 3, 3, 1, 3]]
)
B2 = array([[3, 3, 2, 2, 3],
[3, 3, 2, 1, 3],
[2, 3, 2, 1, 3],
[3, 3, 3, 2, 2],
[1, 2, 3, 2, 3]]
)
B3 = array([[3, 2, 3, 1, 2],
[2, 2, 2, 3, 3],
[3, 1, 3, 3, 2],
[3, 3, 3, 2, 3],
[3, 2, 1, 2, 1]]
)
A1 = bmat([ [ zeros((5,5), float), B1], [B1.transpose(), zeros((5,5), float) ]])
A2 = bmat([ [ zeros((5,5), float), B2], [B2.transpose(), zeros((5,5), float) ]])
A3 = bmat([ [ zeros((5,5), float), B3], [B3.transpose(), zeros((5,5), float) ]])
print det(eye(10) + dot( dot(expm(A1), expm(A2)), expm(A3) ) )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment