Stylistic changes to matrix.py
# -*- coding: utf-8 -*-
"""
Collection of different utility Matrices
- indicator: One column with an indicator variable for each unique element in vector
+ indicator: indicator variable for each unique element in vector
pairwise_contrast: All n_unique*(n_unique-1)/2 pairwise contrasts
- centering: Centering matrix which, by multiplication, removes the column or row mean
+ centering: Centering matrix which removes the column or row mean
@author: jdiedrichsen
"""
import numpy as np
+
def indicator(index_vector, positive=False):
""" Indicator matrix with one
column per unique element in vector
@@ -60,6 +61,7 @@ def pairwise_contrast(index_vector):
n_row = n_row + 1
return indicator_matrix
+
def centering(size):
""" generates a centering matrix
Args:
