hexrd.matrixutil module
- hexrd.matrixutil.ale3dStrainOutToV(vecds)[source]
convert from vecds representation to symmetry matrix takes 5 components of evecd and the 6th component is lndetv
- 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.findDuplicateVectors_old(vec, tol=2.220446049250313e-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]
- 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.nullSpace(A, tol=2.220446049250313e-14)[source]
computes the null space of the real matrix A
- 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.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.solve_wahba(v, w, weights=None)[source]
take unique vectors 3-vectors v = [[v0], [v1], …, [vn]] in frame 1 that are aligned with vectors w = [[w0], [w1], …, [wn]] in frame 2 and solve for the rotation that takes components in frame 1 to frame 2
minimizes the cost function:
J(R) = 0.5 * sum_{k=1}^{N} a_k * || w_k - R*v_k ||^2
- INPUTS:
v is list-like, where each entry is a length 3 vector w is list-like, where each entry is a length 3 vector
len(v) == len(w)
weights are optional, and must have the same length as v, w
- OUTPUT:
(3, 3) orthognal matrix that takes components in frame 1 to frame 2
- hexrd.matrixutil.symm(A)[source]
symmetric decomposition of n square (m, m) ndarrays. Result is a (squeezed) (n, m, m) ndarray.
- hexrd.matrixutil.symmToVecMV(A, scale=True)[source]
convert from symmetric matrix to Mandel-Voigt vector representation (JVB)
- 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.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