m3sh.linalg.

coc_mat#

coc_mat(A, B, onb=False)#

Change of coordinates matrix.

Compute the change of coordinates matrix \(C\) that maps coordinates of \(\mathbf{x}\) in the representation \(\mathbf{x} = \sum x_i \mathbf{a}_i\) to the coordinates in the representation \(\mathbf{x} = \sum \bar{x}_i \mathbf{b}_i\), i.e.,

\[\begin{split}\left(\begin{array}{c} \bar{x}_1 \\ \vdots \\ \bar{x}_k \end{array}\right) = C \left(\begin{array}{c} x_1 \\ \vdots \\ x_k \end{array}\right).\end{split}\]
Parameters:
A, Bndarray, shape (n, k), n >= k

Basis vectors are given by the columns of A and B. Consequently both matrices must have rank k, i.e., columns are linearly independent. If k < n, column spans of A and B must coincide.

onbbool, optional

Set to True if the columns of B form an orthonormal system.

Returns:
Cndarray, shape (k, k)

Change of coordinates matrix.

Notes

The j-th column \(\mathbf{c}_j\) of \(C\) holds the coordinates of \(\mathbf{a}_j\) with respect to the columns of \(B\):

\[\mathbf{a}_j = \sum_i c_{ij} \mathbf{b}_i,\]

equivalently \(A = BC\). In particular, when the columns of \(B\) form an orthonormal system, the entries of \(C\) are given as \(c_{ij} = \langle \mathbf{b}_i, \mathbf{a}_j \rangle\) which is just the orthogonal projection of \(\mathbf{a}_j\) onto \(\mathbf{b}_i\).