From 0845a30fc70d29d99f541a19da3aff84afff70b2 Mon Sep 17 00:00:00 2001 From: Sam <40273116+Aweptimum@users.noreply.github.com> Date: Wed, 17 May 2023 08:20:55 -0400 Subject: [PATCH] Rename SVD->isStandardBasisVector to getStandardBasisIndex --- src/LinearAlgebra/Decomposition/SVD.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/LinearAlgebra/Decomposition/SVD.php b/src/LinearAlgebra/Decomposition/SVD.php index 1faed0dbb..e17b4d8b9 100644 --- a/src/LinearAlgebra/Decomposition/SVD.php +++ b/src/LinearAlgebra/Decomposition/SVD.php @@ -215,7 +215,7 @@ private static function diagonalize(NumericMatrix $S): array foreach ($vectors as $i => $vector) { // Each column should contain 1 non-zero element - $j = self::isStandardBasisVector($vector); + $j = self::getStandardBasisIndex($vector); if ($j === -1) { throw new MatrixException("S Matrix in SVD is not orthogonal:\n" . (string) $S); @@ -259,7 +259,7 @@ private static function diagonalize(NumericMatrix $S): array } /** - * Checks that a vector has a single non-zero entry + * Checks that a vector has a single non-zero entry and returns its index * * @param Vector $v * @@ -267,7 +267,7 @@ private static function diagonalize(NumericMatrix $S): array * 1. There are multiple non-zero entries * 2. The vector is a zero vector */ - private static function isStandardBasisVector(Vector $v): int + private static function getStandardBasisIndex(Vector $v): int { if ($v->l2Norm() === 0) { return false; @@ -281,7 +281,7 @@ private static function isStandardBasisVector(Vector $v): int if (!Arithmetic::almostEqual($component, 0)) { if ($index === -1) { $index = $i; - } else { // If we already found a non-zero component, then return false + } else { // If we already found a non-zero component, then return -1 return -1; } }