From 6e2e966eab9538b27a1e17a174d443daedf95a54 Mon Sep 17 00:00:00 2001 From: Diego Manzanas Date: Tue, 8 Oct 2024 16:17:21 -0500 Subject: [PATCH] Fix lpsolver when matrices empty --- code/nnv/engine/utils/lpsolver.m | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/code/nnv/engine/utils/lpsolver.m b/code/nnv/engine/utils/lpsolver.m index 41c320658..c238c111c 100644 --- a/code/nnv/engine/utils/lpsolver.m +++ b/code/nnv/engine/utils/lpsolver.m @@ -25,6 +25,14 @@ Aeq = gather(Aeq); Beq = gather(Beq); ub = gather(ub); end + if isempty(A) + A = zeros(length(b), 'like', b); + end + + if isempty(f) + f = zeros(length(b),1, 'like', b); + end + dataType = class(f); if strcmp(dataType, "single") || isa(A, "single") % ensure variables are all of type double