symforce.geo.matrix module¶
- class Matrix(*args, **kwargs)[source]¶
Bases:
Storage
Matrix type that wraps the Sympy Matrix class. Care has been taken to allow this class to create fixed-size child classes like Matrix31. Anytime __new__ is called, the appropriate fixed size class is returned rather than the type of the arguments. The API is meant to parallel the way Eigen’s C++ matrix classes work with dynamic and fixed sizes.
References
https://docs.sympy.org/latest/tutorial/matrices.html https://eigen.tuxfamily.org/dox/group__TutorialMatrixClass.html https://en.wikipedia.org/wiki/Vector_space
Matrix does not implement the group or lie group concepts using instance/class methods directly, because we want it to represent the group R^{NxM}, not GL(n), which leads to the identity and inverse methods being confusingly named. For the group ops and lie group ops, use ops.GroupOps and ops.LieGroupOps respectively, which use the implementation in vector_class_lie_group_ops.py of the R^{NxM} group under matrix addition. For the identity matrix and inverse matrix, see Matrix.eye and Matrix.inv respectively.
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (-1, -1)¶
- static __new__(cls, *args, **kwargs)[source]¶
Beast of a method for creating a Matrix. Handles a variety of construction use cases and always returns a fixed size child class of Matrix rather than Matrix itself. The available construction options depend on whether cls is a fixed size type or not.
Generally modeled after the Eigen interface, but must also support internal use within sympy and symengine which we cannot change.
Examples
Matrix32() # Zero constructed Matrix32
2) Matrix(sm.Matrix([[1, 2], [3, 4]])) # Matrix22 with [1, 2, 3, 4] data 3A) Matrix([[1, 2], [3, 4]]) # Matrix22 with [1, 2, 3, 4] data 3B) Matrix22([1, 2, 3, 4]) # Matrix22 with [1, 2, 3, 4] data (must matched fixed shape) 3C) Matrix([1, 2, 3, 4]) # Matrix41 with [1, 2, 3, 4] data - column vector assumed 4) Matrix(4, 3) # Zero constructed Matrix43 5) Matrix(2, 2, [1, 2, 3, 4]) # Matrix22 with [1, 2, 3, 4] data (first two are shape) 6) Matrix(2, 2, lambda row, col: row + col) # Matrix22 with [0, 1, 1, 2] data 7) Matrix22(1, 2, 3, 4) # Matrix22 with [1, 2, 3, 4] data (must match fixed length)
- Parameters:
args (
Any
) –kwargs (
Any
) –
- Return type:
- property rows: int¶
- Return type:
int
- property cols: int¶
- Return type:
int
- property shape: Tuple[int, int]¶
- Return type:
Tuple
[int
,int
]
- property is_Matrix: bool¶
- Return type:
bool
- classmethod from_storage(vec)[source]¶
Construct from a flat list representation. Opposite of .to_storage().
- Parameters:
cls (_T.Type[MatrixT]) –
vec (_T.Sequence[_T.Scalar]) –
- Return type:
MatrixT
- to_storage()[source]¶
Flat list representation of the underlying storage, length of STORAGE_DIM. This is used purely for plumbing, it is NOT like a tangent space.
- Return type:
List
[float
]
- classmethod from_tangent(vec, epsilon=0.0)[source]¶
- Parameters:
cls (_T.Type[MatrixT]) –
vec (_T.Sequence[_T.Scalar]) –
epsilon (_T.Scalar) –
- Return type:
MatrixT
- classmethod zero()[source]¶
Matrix of zeros.
- Parameters:
cls (_T.Type[MatrixT]) –
- Return type:
MatrixT
- classmethod zeros(rows, cols)[source]¶
Matrix of zeros.
- Parameters:
cls (_T.Type[MatrixT]) –
rows (int) –
cols (int) –
- Return type:
MatrixT
- classmethod one()[source]¶
Matrix of ones.
- Parameters:
cls (_T.Type[MatrixT]) –
- Return type:
MatrixT
- classmethod ones(rows, cols)[source]¶
Matrix of ones.
- Parameters:
cls (_T.Type[MatrixT]) –
rows (int) –
cols (int) –
- Return type:
MatrixT
- classmethod diag(diagonal)[source]¶
Construct a square matrix from the diagonal.
- Parameters:
cls (_T.Type[MatrixT]) –
diagonal (_T.Sequence[_T.Scalar]) –
- Return type:
MatrixT
- classmethod eye(rows=None, cols=None)[source]¶
Construct an identity matrix
If neither rows nor cols is provided, this must be called as a class method on a fixed-size class.
If rows is provided, returns a square identity matrix of shape (rows x rows).
If rows and cols are provided, returns a (rows x cols) matrix, with ones on the diagonal.
- Parameters:
cls (_T.Type[MatrixT]) –
rows (int) –
cols (int) –
- Return type:
MatrixT
- inv(method='LU')[source]¶
Inverse of the matrix.
- Parameters:
self (MatrixT) –
method (str) –
- Return type:
MatrixT
- classmethod symbolic(name, **kwargs)[source]¶
Create with symbols.
- Parameters:
name (str) – Name prefix of the symbols
**kwargs (dict) – Forwarded to sf.Symbol
cls (_T.Type[MatrixT]) –
kwargs (_T.Any) –
- Return type:
MatrixT
- classmethod block_matrix(array)[source]¶
Constructs a matrix from block elements. For example: [[Matrix22(…), Matrix23(…)], [Matrix11(…), Matrix14(…)]] -> Matrix35 with elements equal to given blocks
- simplify(*args, **kwargs)[source]¶
Simplify this expression.
This overrides the sympy implementation because that clobbers the class type.
- Parameters:
args (
Any
) –kwargs (
Any
) –
- Return type:
- limit(*args, **kwargs)[source]¶
Take the limit at z = z0
This overrides the sympy implementation because that clobbers the class type.
- Parameters:
args (
Any
) –kwargs (
Any
) –
- Return type:
- jacobian(X, tangent_space=True)[source]¶
Compute the jacobian with respect to the tangent space of X if tangent_space = True, otherwise returns the jacobian wih respect to the storage elements of X.
- Parameters:
X (
Any
) –tangent_space (
bool
) –
- Return type:
- dot(other)[source]¶
Dot product, also known as inner product. dot only supports mapping 1 x n or n x 1 Matrices to scalars. Note that both matrices must have the same shape.
- Parameters:
other (
Matrix
) –- Return type:
float
- cross(other)[source]¶
Cross product.
- Parameters:
self (MatrixT) –
other (MatrixT) –
- Return type:
Vector3
- squared_norm()[source]¶
Squared norm of a vector, equivalent to the dot product with itself.
- Return type:
float
- norm(epsilon=0.0)[source]¶
Norm of a vector (square root of magnitude).
- Parameters:
epsilon (
float
) –- Return type:
float
- normalized(epsilon=0.0)[source]¶
Returns a unit vector in this direction (divide by norm).
- Parameters:
self (MatrixT) –
epsilon (_T.Scalar) –
- Return type:
MatrixT
- clamp_norm(max_norm, epsilon=0.0)[source]¶
Clamp a vector to the given norm in a safe/differentiable way.
Is _NOT_ safe if max_norm can be negative, or if derivatives are needed w.r.t. max_norm and max_norm can be 0 or small enough that max_squared_norm / squared_norm is truncated to 0 in the particular floating point type being used (e.g. all of these are true if max_norm is optimized)
Currently only L2 norm is supported
- Parameters:
self (MatrixT) –
max_norm (_T.Scalar) –
epsilon (_T.Scalar) –
- Return type:
MatrixT
- multiply_elementwise(rhs)[source]¶
Do the elementwise multiplication between self and rhs, and return the result as a new Matrix
- Parameters:
self (MatrixT) –
rhs (MatrixT) –
- Return type:
MatrixT
- applyfunc(func)[source]¶
Apply a unary operation to every scalar.
- Parameters:
self (MatrixT) –
func (_T.Callable) –
- Return type:
MatrixT
- __getitem__(item)[source]¶
Get a scalar value or submatrix slice.
- Parameters:
item (
Any
) –- Return type:
Any
- __add__(right)[source]¶
Add a scalar or matrix to this matrix.
- Parameters:
self (MatrixT) –
right (_T.Union[_T.Scalar, MatrixT]) –
- Return type:
MatrixT
- __sub__(right)[source]¶
Subtract a scalar or matrix from this matrix.
- Parameters:
self (MatrixT) –
right (_T.Union[_T.Scalar, MatrixT]) –
- Return type:
MatrixT
- compute_AtA(lower_only=False)[source]¶
Compute a symmetric product A.transpose() * A
- Parameters:
lower_only (bool) – If given, only fill the lower half and set upper to zero
- Returns:
Symmetric matrix AtA = self.transpose() * self
- Return type:
(Matrix(N, N))
- __truediv__(right)¶
Divide a matrix by a scalar or a matrix (which takes the inverse).
- static are_parallel(a, b, tolerance)[source]¶
Returns 1 if a and b are parallel within tolerance, and 0 otherwise.
- to_numpy(scalar_type=<class 'numpy.float64'>)[source]¶
Convert to a numpy array.
- Parameters:
scalar_type (
type
) –- Return type:
ndarray
- class Matrix11(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (1, 1)¶
- class Matrix21(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (2, 1)¶
- property x: float¶
The entry self[0, 0]
- Return type:
float
- property y: float¶
The entry self[1, 0]
- Return type:
float
- class Matrix31(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (3, 1)¶
- property x: float¶
The entry self[0, 0]
- Return type:
float
- property y: float¶
The entry self[1, 0]
- Return type:
float
- property z: float¶
The entry self[2, 0]
- Return type:
float
- class Matrix41(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (4, 1)¶
- class Matrix51(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (5, 1)¶
- class Matrix61(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (6, 1)¶
- class Matrix71(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (7, 1)¶
- class Matrix81(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (8, 1)¶
- class Matrix91(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (9, 1)¶
- class Matrix12(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (1, 2)¶
- class Matrix22(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (2, 2)¶
- class Matrix32(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (3, 2)¶
- class Matrix42(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (4, 2)¶
- class Matrix52(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (5, 2)¶
- class Matrix62(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (6, 2)¶
- class Matrix72(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (7, 2)¶
- class Matrix82(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (8, 2)¶
- class Matrix92(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (9, 2)¶
- class Matrix13(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (1, 3)¶
- class Matrix23(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (2, 3)¶
- class Matrix33(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (3, 3)¶
- class Matrix43(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (4, 3)¶
- class Matrix53(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (5, 3)¶
- class Matrix63(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (6, 3)¶
- class Matrix73(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (7, 3)¶
- class Matrix83(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (8, 3)¶
- class Matrix93(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (9, 3)¶
- class Matrix14(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (1, 4)¶
- class Matrix24(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (2, 4)¶
- class Matrix34(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (3, 4)¶
- class Matrix44(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (4, 4)¶
- class Matrix54(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (5, 4)¶
- class Matrix64(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (6, 4)¶
- class Matrix74(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (7, 4)¶
- class Matrix84(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (8, 4)¶
- class Matrix94(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (9, 4)¶
- class Matrix15(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (1, 5)¶
- class Matrix25(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (2, 5)¶
- class Matrix35(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (3, 5)¶
- class Matrix45(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (4, 5)¶
- class Matrix55(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (5, 5)¶
- class Matrix65(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (6, 5)¶
- class Matrix75(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (7, 5)¶
- class Matrix85(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (8, 5)¶
- class Matrix95(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (9, 5)¶
- class Matrix16(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (1, 6)¶
- class Matrix26(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (2, 6)¶
- class Matrix36(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (3, 6)¶
- class Matrix46(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (4, 6)¶
- class Matrix56(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (5, 6)¶
- class Matrix66(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (6, 6)¶
- class Matrix76(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (7, 6)¶
- class Matrix86(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (8, 6)¶
- class Matrix96(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (9, 6)¶
- class Matrix17(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (1, 7)¶
- class Matrix27(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (2, 7)¶
- class Matrix37(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (3, 7)¶
- class Matrix47(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (4, 7)¶
- class Matrix57(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (5, 7)¶
- class Matrix67(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (6, 7)¶
- class Matrix77(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (7, 7)¶
- class Matrix87(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (8, 7)¶
- class Matrix97(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (9, 7)¶
- class Matrix18(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (1, 8)¶
- class Matrix28(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (2, 8)¶
- class Matrix38(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (3, 8)¶
- class Matrix48(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (4, 8)¶
- class Matrix58(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (5, 8)¶
- class Matrix68(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (6, 8)¶
- class Matrix78(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (7, 8)¶
- class Matrix88(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (8, 8)¶
- class Matrix98(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (9, 8)¶
- class Matrix19(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (1, 9)¶
- class Matrix29(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (2, 9)¶
- class Matrix39(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (3, 9)¶
- class Matrix49(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (4, 9)¶
- class Matrix59(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (5, 9)¶
- class Matrix69(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (6, 9)¶
- class Matrix79(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (7, 9)¶
- class Matrix89(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (8, 9)¶
- class Matrix99(*args, **kwargs)[source]¶
Bases:
Matrix
- Parameters:
args (
Any
) –kwargs (
Any
) –
- SHAPE = (9, 9)¶
- matrix_type_from_shape(shape)[source]¶
Return a fixed size matrix type (like Matrix32) given a shape. Either use the statically defined ones or dynamically create a new one if not available.
- Parameters:
shape (
Tuple
[int
,int
]) –- Return type:
Type
[Matrix
]
- I1(rows=None, cols=None)¶
Construct an identity matrix
If neither rows nor cols is provided, this must be called as a class method on a fixed-size class.
If rows is provided, returns a square identity matrix of shape (rows x rows).
If rows and cols are provided, returns a (rows x cols) matrix, with ones on the diagonal.
- Parameters:
cls (_T.Type[MatrixT]) –
rows (int) –
cols (int) –
- Return type:
MatrixT
- I11(rows=None, cols=None)¶
Construct an identity matrix
If neither rows nor cols is provided, this must be called as a class method on a fixed-size class.
If rows is provided, returns a square identity matrix of shape (rows x rows).
If rows and cols are provided, returns a (rows x cols) matrix, with ones on the diagonal.
- Parameters:
cls (_T.Type[MatrixT]) –
rows (int) –
cols (int) –
- Return type:
MatrixT
- I2(rows=None, cols=None)¶
Construct an identity matrix
If neither rows nor cols is provided, this must be called as a class method on a fixed-size class.
If rows is provided, returns a square identity matrix of shape (rows x rows).
If rows and cols are provided, returns a (rows x cols) matrix, with ones on the diagonal.
- Parameters:
cls (_T.Type[MatrixT]) –
rows (int) –
cols (int) –
- Return type:
MatrixT
- I22(rows=None, cols=None)¶
Construct an identity matrix
If neither rows nor cols is provided, this must be called as a class method on a fixed-size class.
If rows is provided, returns a square identity matrix of shape (rows x rows).
If rows and cols are provided, returns a (rows x cols) matrix, with ones on the diagonal.
- Parameters:
cls (_T.Type[MatrixT]) –
rows (int) –
cols (int) –
- Return type:
MatrixT
- I3(rows=None, cols=None)¶
Construct an identity matrix
If neither rows nor cols is provided, this must be called as a class method on a fixed-size class.
If rows is provided, returns a square identity matrix of shape (rows x rows).
If rows and cols are provided, returns a (rows x cols) matrix, with ones on the diagonal.
- Parameters:
cls (_T.Type[MatrixT]) –
rows (int) –
cols (int) –
- Return type:
MatrixT
- I33(rows=None, cols=None)¶
Construct an identity matrix
If neither rows nor cols is provided, this must be called as a class method on a fixed-size class.
If rows is provided, returns a square identity matrix of shape (rows x rows).
If rows and cols are provided, returns a (rows x cols) matrix, with ones on the diagonal.
- Parameters:
cls (_T.Type[MatrixT]) –
rows (int) –
cols (int) –
- Return type:
MatrixT
- I4(rows=None, cols=None)¶
Construct an identity matrix
If neither rows nor cols is provided, this must be called as a class method on a fixed-size class.
If rows is provided, returns a square identity matrix of shape (rows x rows).
If rows and cols are provided, returns a (rows x cols) matrix, with ones on the diagonal.
- Parameters:
cls (_T.Type[MatrixT]) –
rows (int) –
cols (int) –
- Return type:
MatrixT
- I44(rows=None, cols=None)¶
Construct an identity matrix
If neither rows nor cols is provided, this must be called as a class method on a fixed-size class.
If rows is provided, returns a square identity matrix of shape (rows x rows).
If rows and cols are provided, returns a (rows x cols) matrix, with ones on the diagonal.
- Parameters:
cls (_T.Type[MatrixT]) –
rows (int) –
cols (int) –
- Return type:
MatrixT
- I5(rows=None, cols=None)¶
Construct an identity matrix
If neither rows nor cols is provided, this must be called as a class method on a fixed-size class.
If rows is provided, returns a square identity matrix of shape (rows x rows).
If rows and cols are provided, returns a (rows x cols) matrix, with ones on the diagonal.
- Parameters:
cls (_T.Type[MatrixT]) –
rows (int) –
cols (int) –
- Return type:
MatrixT
- I55(rows=None, cols=None)¶
Construct an identity matrix
If neither rows nor cols is provided, this must be called as a class method on a fixed-size class.
If rows is provided, returns a square identity matrix of shape (rows x rows).
If rows and cols are provided, returns a (rows x cols) matrix, with ones on the diagonal.
- Parameters:
cls (_T.Type[MatrixT]) –
rows (int) –
cols (int) –
- Return type:
MatrixT
- I6(rows=None, cols=None)¶
Construct an identity matrix
If neither rows nor cols is provided, this must be called as a class method on a fixed-size class.
If rows is provided, returns a square identity matrix of shape (rows x rows).
If rows and cols are provided, returns a (rows x cols) matrix, with ones on the diagonal.
- Parameters:
cls (_T.Type[MatrixT]) –
rows (int) –
cols (int) –
- Return type:
MatrixT
- I66(rows=None, cols=None)¶
Construct an identity matrix
If neither rows nor cols is provided, this must be called as a class method on a fixed-size class.
If rows is provided, returns a square identity matrix of shape (rows x rows).
If rows and cols are provided, returns a (rows x cols) matrix, with ones on the diagonal.
- Parameters:
cls (_T.Type[MatrixT]) –
rows (int) –
cols (int) –
- Return type:
MatrixT
- I7(rows=None, cols=None)¶
Construct an identity matrix
If neither rows nor cols is provided, this must be called as a class method on a fixed-size class.
If rows is provided, returns a square identity matrix of shape (rows x rows).
If rows and cols are provided, returns a (rows x cols) matrix, with ones on the diagonal.
- Parameters:
cls (_T.Type[MatrixT]) –
rows (int) –
cols (int) –
- Return type:
MatrixT
- I77(rows=None, cols=None)¶
Construct an identity matrix
If neither rows nor cols is provided, this must be called as a class method on a fixed-size class.
If rows is provided, returns a square identity matrix of shape (rows x rows).
If rows and cols are provided, returns a (rows x cols) matrix, with ones on the diagonal.
- Parameters:
cls (_T.Type[MatrixT]) –
rows (int) –
cols (int) –
- Return type:
MatrixT
- I8(rows=None, cols=None)¶
Construct an identity matrix
If neither rows nor cols is provided, this must be called as a class method on a fixed-size class.
If rows is provided, returns a square identity matrix of shape (rows x rows).
If rows and cols are provided, returns a (rows x cols) matrix, with ones on the diagonal.
- Parameters:
cls (_T.Type[MatrixT]) –
rows (int) –
cols (int) –
- Return type:
MatrixT
- I88(rows=None, cols=None)¶
Construct an identity matrix
If neither rows nor cols is provided, this must be called as a class method on a fixed-size class.
If rows is provided, returns a square identity matrix of shape (rows x rows).
If rows and cols are provided, returns a (rows x cols) matrix, with ones on the diagonal.
- Parameters:
cls (_T.Type[MatrixT]) –
rows (int) –
cols (int) –
- Return type:
MatrixT
- I9(rows=None, cols=None)¶
Construct an identity matrix
If neither rows nor cols is provided, this must be called as a class method on a fixed-size class.
If rows is provided, returns a square identity matrix of shape (rows x rows).
If rows and cols are provided, returns a (rows x cols) matrix, with ones on the diagonal.
- Parameters:
cls (_T.Type[MatrixT]) –
rows (int) –
cols (int) –
- Return type:
MatrixT
- I99(rows=None, cols=None)¶
Construct an identity matrix
If neither rows nor cols is provided, this must be called as a class method on a fixed-size class.
If rows is provided, returns a square identity matrix of shape (rows x rows).
If rows and cols are provided, returns a (rows x cols) matrix, with ones on the diagonal.
- Parameters:
cls (_T.Type[MatrixT]) –
rows (int) –
cols (int) –
- Return type:
MatrixT