Module: matrixutil¶
22 Functions¶
- hexrd.matrixutil.blockSparseOfMatArray(matArray)[source]¶
Constructs a block diagonal sparse matrix (csc format) from a (p, m, n) ndarray of p (m, n) arrays
...maybe optional args to pick format type?
- hexrd.matrixutil.symmToVecMV(A)[source]¶
convert from symmetric matrix to Mandel-Voigt vector representation (JVB)
- hexrd.matrixutil.vecMVToSymm(A)[source]¶
convert from Mandel-Voigt vector to symmetric matrix representation (JVB)
- hexrd.matrixutil.vecMVCOBMatrix(R)[source]¶
GenerateS array of 6 x 6 basis transformation matrices for the Mandel-Voigt tensor representation in 3-D given by:
- [A] = [[A_11, A_12, A_13],
- [A_12, A_22, A_23], [A_13, A_23, A_33]]
{A} = [A_11, A_22, A_33, sqrt(2)*A_23, sqrt(2)*A_13, sqrt(2)*A_12]
where the operation \(R*A*R.T\) (in tensor notation) is obtained by the matrix-vector product [T]*{A}.
USAGE
T = vecMVCOBMatrix(R)INPUTS
- R is (3, 3) an ndarray representing a change of basis matrix
OUTPUTS
- T is (6, 6), an ndarray of transformation matrices as described above
NOTES
- Compoments of symmetric 4th-rank tensors transform in a manner analogous to symmetric 2nd-rank tensors in full matrix notation.
SEE ALSO
symmToVecMV, vecMVToSymm, quatToMat
- hexrd.matrixutil.nrmlProjOfVecMV(vec)[source]¶
Gives vstacked p x 6 array to To perform n’ * A * n as [N]*{A} for p hstacked input 3-vectors using the Mandel-Voigt convention.
Nvec = normalProjectionOfMV(vec)
*) the input vector array need not be normalized; it is performed in place
- hexrd.matrixutil.rankOneMatrix(vec1, *args)[source]¶
Create rank one matrices (dyadics) from vectors.
r1mat = rankOneMatrix(vec1) r1mat = rankOneMatrix(vec1, vec2)
vec1 is m1 x n, an array of n hstacked m1 vectors vec2 is m2 x n, (optional) another array of n hstacked m2 vectors
- r1mat is n x m1 x m2, an array of n rank one matrices
- formed as c1*c2’ from columns c1 and c2
With one argument, the second vector is taken to the same as the first.
Notes:
- *) This routine loops on the dimension m, assuming this
- is much smaller than the number of points, n.
- hexrd.matrixutil.skew(A)[source]¶
skew-symmetric decomposition of n square (m, m) ndarrays. Result is a (squeezed) (n, m, m) ndarray
- hexrd.matrixutil.symm(A)[source]¶
symmetric decomposition of n square (m, m) ndarrays. Result is a (squeezed) (n, m, m) ndarray.
- hexrd.matrixutil.skewMatrixOfVector(w)[source]¶
given a (3, n) ndarray, w, of n hstacked axial vectors, computes the associated skew matrices and stores them in an (n, 3, 3) ndarray. Result is (3, 3) for w.shape = (3, 1) or (3, ).
See also: vectorOfSkewMatrix
- hexrd.matrixutil.vectorOfSkewMatrix(W)[source]¶
given an (n, 3, 3) or (3, 3) ndarray, W, of n stacked 3x3 skew matrices, computes the associated axial vector(s) and stores them in an (3, n) ndarray. Result always has ndim = 2.
See also: skewMatrixOfVector
- hexrd.matrixutil.uniqueVectors(v, tol=1e-12)[source]¶
Sort vectors and discard duplicates.
USAGE:
uvec = uniqueVectors(vec, tol=1.0e-12)v – tol – (optional) comparison tolerance
- Boyce 2010-03-18
- hexrd.matrixutil.findDuplicateVectors(vec, tol=1e-14, equivPM=False)[source]¶
Find vectors in an array that are equivalent to within a specified tolerance
USAGE:
eqv = DuplicateVectors(vec, *tol)INPUT:
OUTPUT:
- eqv is 1 x p, a list of p equivalence relationships.
NOTES:
Each equivalence relationship is a 1 x q vector of indices that represent the locations of duplicate columns/entries in the array vec. For example:
1 2 2 2 1 2 7 |- vec = | |
- 2 3 5 3 2 3 3 |
eqv = [[1x2 double] [1x3 double]], where
eqv[0] = [0 4] eqv[1] = [1 3 5]