From 11f0c1f3c17660b65570f7cfa96badbd4ef29427 Mon Sep 17 00:00:00 2001 From: mcDandy Date: Fri, 21 Aug 2026 18:32:17 +0200 Subject: [PATCH] add full matrix option and fix string math --- more_math/Parser/UnifiedMathVisitor.py | 5 +++-- more_math/StringMathNode.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/more_math/Parser/UnifiedMathVisitor.py b/more_math/Parser/UnifiedMathVisitor.py index 8a3227c..4d6163d 100644 --- a/more_math/Parser/UnifiedMathVisitor.py +++ b/more_math/Parser/UnifiedMathVisitor.py @@ -4686,10 +4686,11 @@ class UnifiedMathVisitor(MathExprVisitor): def visitSvdFunc(self, ctx): """svd(x) - singular value decomposition""" - x = self._promote_to_tensor((yield ctx.expr())) + x = self._promote_to_tensor((yield ctx.expr(0))) + full_matrices = yield ctx.expr(1) if len(ctx.expr()) > 1 else False if x.ndim < 2: raise ValueError(f"{ctx.start.line}:{ctx.start.column}: svd expects at least 2D input, got shape {tuple(x.shape)}") - u, s, vh = torch.linalg.svd(x, full_matrices=True) + u, s, vh = torch.linalg.svd(x, full_matrices=full_matrices) v = vh.mvector_transpose(-2, -1).conj() result = [u, s, v] return result diff --git a/more_math/StringMathNode.py b/more_math/StringMathNode.py index 31235a1..6f071ef 100644 --- a/more_math/StringMathNode.py +++ b/more_math/StringMathNode.py @@ -109,4 +109,4 @@ class StringMathNode(io.ComfyNode): else: stack = stack if remember_stack else copy.deepcopy(stack) - return (result, stack) + return ([result], stack)