Matrix class
This class describes a block diagram, a collection of blocks and wires that can be “executed”.
- class ansitable.table.ANSIMatrix(style='thin', fmt='{:< 10.3g}', squish=100)[source]
Bases:
object
- __init__(style='thin', fmt='{:< 10.3g}', squish=100)[source]
Create a matrix formatter
- Parameters:
Creates a formatter, or template, for formatting matrices.
from ansitable import ANSIMatrix import numpy as np formatter = ANSIMatrix(style='ascii') m = np.random.rand(4,4) - 0.5 formatter.print(m) + + | 0.23 -0.00542 -0.282 0.229 | | 0.433 0.229 0.489 -0.414 | | 0.0901 -0.351 -0.413 -0.418 | | 0.433 0.233 0.0495 0.000281 | + +
- str(matrix, suffix_super='', suffix_sub='')[source]
Output the table as a string
- Parameters:
- Raises:
ValueError – [description]
- Returns:
ANSI string
- Return type:
suffix_super
is where the transpose, inverse, pseudo-inverse, etc. symbol is shown.suffix_sub
is where the matrix name is typically shown.