Skip to content

Commit 3dc858e

Browse files
kristoferm94kristoferm94
and
kristoferm94
authored
RF: Rearranging matmul order and using hermitian flag in ICC_rep_anova (#3453)
* np.dot(X.T, T) is Hermitian * Reordering matmul operations * Using @ operator instead of np.dot * removing unneccesary import Co-authored-by: kristoferm94 <email@example.com>
1 parent 8d065ca commit 3dc858e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

nipype/algorithms/icc.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# -*- coding: utf-8 -*-
22
import os
33
import numpy as np
4-
from numpy import ones, kron, mean, eye, hstack, dot, tile
4+
from numpy import ones, kron, mean, eye, hstack, tile
55
from numpy.linalg import pinv
66
import nibabel as nb
77
from ..interfaces.base import (
@@ -114,7 +114,7 @@ def ICC_rep_anova(Y):
114114
X = hstack([x, x0])
115115

116116
# Sum Square Error
117-
predicted_Y = dot(dot(dot(X, pinv(dot(X.T, X))), X.T), Y.flatten("F"))
117+
predicted_Y = X @ (pinv(X.T @ X, hermitian=True) @ (X.T @ Y.flatten("F")))
118118
residuals = Y.flatten("F") - predicted_Y
119119
SSE = (residuals**2).sum()
120120

0 commit comments

Comments
 (0)