copapy.matrix#
- class copapy.matrix(values)#
Bases:
Generic[TNum]Mathematical matrix class supporting basic operations and interactions with values.
Create a matrix with given values.
- Parameters:
values (
Iterable[Iterable[TypeVar(TNum,int,float) |value[TypeVar(TNum,int,float)]]] |vector[TypeVar(TNum,int,float)]) – iterable of iterable of constant values
- homogenize()#
Convert all elements to copapy values if any element is a copapy value.
- Return type:
matrix[TypeVar(TNum,int,float)]
- map(func)#
Applies a function to each element of the matrix and returns a new matrix.
- Return type:
matrix[TypeVar(U,int,float)]
- property shape: tuple[int, int]#
Return the shape of the matrix as (rows, cols).
- sum()#
Calculate the sum of all elements.
- Return type:
Any
- trace()#
Calculate the trace (sum of diagonal elements).
- Return type:
Any