pylint matrix util
@@ -118,6 +118,7 @@ def centering(size):
centering_matrix = np.identity(size) - np.ones(size) / size
return centering_matrix
+
def row_col_indicator_RDM(n_cond):
""" generates a row and column indicator matrix for an RDM vector
@@ -134,8 +135,12 @@ def row_col_indicator_RDM(n_cond):
_row_col_indicator(rowI, colI, n_cond)
return (rowI, colI)
+
def row_col_indicator_G(n_cond):
- """ generates a row and column indicator matrix for a vectorized second moment matrix. The vectorized version has the off-diagonal elements first (like in an RDM), and then appends the diagnoal. You can vectorize a second momement matrix G by
+ """ generates a row and column indicator matrix for a vectorized
+ second moment matrix. The vectorized version has the off-diagonal elements
+ first (like in an RDM), and then appends the diagnoal.
+ You can vectorize a second momement matrix G by
np.diag(rowI@G@colI.T) = np.sum(colI*(rowI@G)),axis=1)
Args:
@@ -153,12 +158,14 @@ def row_col_indicator_G(n_cond):
np.fill_diagonal(colI[-n_cond:, :], 1)
return (rowI, colI)
+
def _row_col_indicator(rowI, colI, n_cond):
- """ Helper function that writes the correct pattern for the row / column indicator matrix
+ """ Helper function that writes the correct pattern for the
+ row / column indicator matrix
Args:
- row_indicator: rowI (numpy.ndarray):
- col_indicator: rowI (numpy.ndarray):
+ row_indicator: rowI (numpy.ndarray)
+ col_indicator: rowI (numpy.ndarray)
n_cond (int): Number of conditions underlying the second moment
"""
j = 0
