Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def bmatrix(a):
- """Returns a LaTeX bmatrix
- :a: numpy array
- :returns: LaTeX bmatrix as a string
- """
- if len(a.shape) > 2:
- raise ValueError('bmatrix can at most display two dimensions')
- lines = str(a).replace('[', '').replace(']', '').splitlines()
- rv = [r'\begin{bmatrix}']
- rv += [' ' + ' & '.join(l.split()) + r'\\' for l in lines]
- rv += [r'\end{bmatrix}']
- return '\n'.join(rv)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement