this could much more succinctly written as np.prod(np.diagonal(B))