brainconn.utils.matrix.invert

invert(W, copy=True)[source]

Inverts elementwise the weights in an input connection matrix. In other words, change the from the matrix of internode strengths to the matrix of internode distances.

If copy is not set, this function will modify W in place.

Parameters:
  • W (numpy.ndarray) – weighted connectivity matrix
  • copy (bool) – if True, returns a copy of the matrix. Otherwise, modifies the matrix in place. Default value=True.
Returns:

W – inverted connectivity matrix

Return type:

numpy.ndarray