pyva.data.matrixClasses.DynamicMatrix
- class pyva.data.matrixClasses.DynamicMatrix(data, xdata, excdof, resdof, **kwargs)
Bases:
LinearMatrix
data: 3D matrix or 2D when kwargs are used
xdata:
- __init__(data, xdata, excdof, resdof, **kwargs)
The DynamicMatrix class extends LinearMatrix by difinitions of the row and coloum degrees of freedom (excdof and resdof) as far as the definition for the in-depth axis.
- Parameters:
data (ndarray or LinearMatrix) – 3D matrix or 2D when kwargs are used
xdata (DataAxis) – in depth axis definition e.g. frequency, time.
excdof (DOF) – DOF of excitatin (columns).
resdof (DOF) – DOF of response (rows).
**kwargs (dict) – Arbitrary argument list passed to LinearMatrix constructor.
shape (tuple of int) – (Nrow,Ncol,Ndepth) shape dimension of the 3D matrix
sym (int) – symmetry sym=0,1,2 or 3 for irregular, symmetric, hermitian and diagonal
- Raises:
ValueError – DESCRIPTION.
Examples
import matrixClasses as mC dynmat3D = mC.DynamicMatrix(3Ddata,xdata,resdof) dynmat3Dsym = mc.DynamicMatrix(2Dtriudata,xdata,sym = 1,shape=(3,3,4) )
Methods
Dindex
(iz)Provides 2D matrix of in-depth index iz
H
()Hermitian of linear matrix
HDH
(other)HDH performt the left and right matrix multiplication by the inverse of other from left and right in a numerical stable way using solve
__init__
(data, xdata, excdof, resdof, **kwargs)The DynamicMatrix class extends LinearMatrix by difinitions of the row and coloum degrees of freedom (excdof and resdof) as far as the definition for the in-depth axis.
abs
()Abxolute value of Linear Matrix.
cond
([p])cond of linear matrix
copy
()copy method for LinearMatrix
diag
()Transpose of linear matrix
dot
(other)Dot product method of DynamicMatrix
imag
()inv
()Inverts dynamic matrix
isa
(typestr)Check if self is an insance of typestr
mean
()Calculates the mean value of all coefficients in the matrix
real
()self_dot
(other)Incremental dot product
signal
(irow, icol[, exc_val])create a Signal object from 1-dim parts of the DynamicMatrix
solve
(other)Solve dynamic matrix
spy
([res, iz])Show sparasity of matrix in a graphical way.
sqrt
()square root.
sum
()Calculates the full sum of all coefficients in the matrix
Transpose of linear matrix
zeros
(xdata, excdof, resdof, sym, **kwargs)zeros matrix creator with defined dimension and DOFs
Attributes
Number of columns
Number of matrices
Number of rows
data property method
Property method for excdof
Property method for resdof
Shape of LinearMatrix.
Property method for sym
Property method for symstr
Property method for xdata
- Dindex(iz)
Provides 2D matrix of in-depth index iz
MM.Dindex(iz) == MM.data(:,:,iz)
- Parameters:
iz (int) – index in depth.
- Returns:
2D matrix.
- Return type:
ndarray
- H()
Hermitian of linear matrix
- HDH(other)
HDH performt the left and right matrix multiplication by the inverse of other from left and right in a numerical stable way using solve
- Parameters:
other – NOT inverted matrix D
- Returns:
D^-1 . self . D^-H
- property Ncol
Number of columns
- Returns:
Number of columns.
- Return type:
int
- property Ndepth
Number of matrices
size of third dimension
- Returns:
Number of matrices.
- Return type:
int
- property Nrow
Number of rows
- Returns:
Number of matrix rows.
- Return type:
int
- abs()
Abxolute value of Linear Matrix.
- Returns:
with all absolute value of coefficients.
- Return type:
- cond(p=None)
cond of linear matrix
- copy()
copy method for LinearMatrix
uses deepcopy
- Returns:
Deepcopy instance of LinearMatrix instance.
- Return type:
Linear Matrix
- property data
data property method
The method recreates the 3D data from the efficiently stored 2D data in case of sym in (1,2,3)
- Returns:
3D data.
- Return type:
ndarray
- diag()
Transpose of linear matrix
Returns
- dot(other)
Dot product method of DynamicMatrix
This method allows flexible matrix multiplication. If other is a DynamicMatrix the resdof of other must equal the excdof of self. If other is a Signal all DOFs of the Signal vector must occur in the excdof of self.
- Parameters:
other (DynamicMatrix, Signal) – factor.
- Raises:
ValueError – When xdata or dofs are not consistent.
- Returns:
product.
- Return type:
- inv()
Inverts dynamic matrix
excitation and response dofs are exchanged
- Returns:
inverse(self).
- Return type:
- isa(typestr)
Check if self is an insance of typestr
- Parameters:
typestr (str) – str of classtype.
- Returns:
True if typestr = ‘DynamicMatrix’.
- Return type:
bool
- mean()
Calculates the mean value of all coefficients in the matrix
- self_dot(other)
Incremental dot product
Modifies self
- Parameters:
other (DynamicMatrix) – factor matrix.
- Raises:
ValueError – When xdata or dofs are not consistent.
- Returns:
matrix product.
- Return type:
- property shape
Shape of LinearMatrix.
- Returns:
(Nrow,Ncol,Ndepth) shape vector of Lineax matrix.
- Return type:
tuple
- signal(irow, icol, exc_val=1.0)
create a Signal object from 1-dim parts of the DynamicMatrix
- Parameters:
icol (TYPE) – DESCRIPTION.
irow (TYPE) – DESCRIPTION.
- Return type:
None.
- solve(other)
Solve dynamic matrix
Returns the solutoin of A.x = B with A=self and B=other
Excitation dofs are dofs of the solution. All DOFs of B must be a subset of res_dof of the Dynamic Matrix
- spy(res='mag', iz=0, **kwargs)
Show sparasity of matrix in a graphical way. Uses matplotlib.pyplot.spy
- Parameters:
res – type of result ‘mag’,’real’,’imag’ or ‘phase’
iz – index of z-dimension
kwargs – for passing to matplotlib routine
- sqrt()
square root.
- Returns:
sqrt(self).
- Return type:
- sum()
Calculates the full sum of all coefficients in the matrix
- property sym
Property method for sym
- Returns:
Symmetry identifier.
- Return type:
int
- property symstr
Property method for symstr
- Returns:
Symmetry string.
- Return type:
str
- transpose()
Transpose of linear matrix
Returns
- static zeros(xdata, excdof, resdof, sym, **kwargs)
zeros matrix creator with defined dimension and DOFs
- Parameters:
- Raises:
ValueError – DESCRIPTION.
- Returns:
zero matrix with defined DOFs and symmetry.
- Return type: