Module: matrixutil

22 Functions

hexrd.matrixutil.columnNorm(a)[source]

normalize array of column vectors (hstacked, axis = 0)

hexrd.matrixutil.rowNorm(a)[source]

normalize array of row vectors (vstacked, axis = 1)

hexrd.matrixutil.unitVector(a)[source]

normalize array of column vectors (hstacked, axis = 0)

hexrd.matrixutil.nullSpace(A, tol=1e-14)[source]

computes the null space of the real matrix A

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

  1. R is (3, 3) an ndarray representing a change of basis matrix

OUTPUTS

  1. T is (6, 6), an ndarray of transformation matrices as described above

NOTES

  1. 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.multMatArray(ma1, ma2)[source]

multiply two 3-d arrays of 2-d matrices

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

    1. 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:

  1. vec is n x m, a double array of m horizontally concatenated

    n-dimensional vectors.

*2) tol is 1 x 1, a scalar tolerance. If not specified, the default
tolerance is 1e-14.

*3) set equivPM to True if vec and -vec are to be treated as equivalent

OUTPUT:

  1. 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.normvec(v)[source]
hexrd.matrixutil.normvec3(v)[source]
hexrd.matrixutil.normalized(v)[source]
hexrd.matrixutil.cross(v1, v2)[source]
hexrd.matrixutil.determinant3(mat)[source]