sscp¶
- sofia_redux.toolkit.resampling.sscp(matrix, weight=None, normalize=False)[source]¶
Calculate the sum-of-squares-and-cross-products of a matrix.
For the matrix \(A\), calculates \(A^TA\). If weights (\(W\)) are provided.
\[sscp = WA^TAW^T\]Note that the
weight
should only contain the diagonal elements of \(W\), and as such should be a 1-dimensional array.If
normalize=True
:\[sscp = \frac{WA^TAW^T}{trace(W^TW)}\]where \(W = I\), the identity matrix if
weight
is not supplied.- Parameters:
- matrixnumpy.ndarray (M, N)
Input matrix.
- weightnumpy.ndarray (N,), optional
Weights to be applied during sscp.
- normalizebool, optional
If True, scales result as described above. Default is False.
- Returns:
- numpy.ndarray of numpy.float64 (M, M)
Square output array containing the sum-of-squares-and-cross-products matrix.