Skip to content

Commit e9e6ba1

Browse files
committed
Fix typo bug in dimension checking in set_params() for quadratic costs.
1 parent d70d8b0 commit e9e6ba1

4 files changed

Lines changed: 8 additions & 5 deletions

File tree

CHANGES.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ Change history for MP-Opt-Model
55
since version 5.0
66
-----------------
77

8+
#### 10/21/25
9+
- Fix typo bug in dimension checking in `set_params()` for quadratic costs.
10+
811
#### 10/3/25
912
- Avoid error displaying `mp.opt_model` object when variable was added
1013
with a sparse dimension argument.

lib/+mp/sm_quad_cost.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -523,9 +523,9 @@
523523
[Mc, Nc] = size(p.c);
524524
Nk = length(p.k);
525525
nx = max([MH Mc Nk]);
526-
if NH == 1 || (isempty(p.H) && (Nk > 1 || k == 0))
526+
if NH == 1 || (isempty(p.H) && (Nk ~= 1 || p.k == 0))
527527
%% H is a column vector (cost is element-wise, i.e. a vector)
528-
%% OR H is empty and k is either a vector or zero
528+
%% OR H is empty and k is either a vector, empty, or zero
529529
N = nx;
530530
else %% H is a square matrix (cost is a scalar)
531531
N = 1;

lib/+mp/sm_quad_cost_legacy.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -514,9 +514,9 @@
514514
[Mc, Nc] = size(p.c);
515515
Nk = length(p.k);
516516
nx = max([MQ Mc Nk]);
517-
if NQ == 1 || (isempty(p.Q) && (Nk > 1 || k == 0))
517+
if NQ == 1 || (isempty(p.Q) && (Nk ~= 1 || p.k == 0))
518518
%% Q is a column vector (cost is element-wise, i.e. a vector)
519-
%% OR Q is empty and k is either a vector or zero
519+
%% OR Q is empty and k is either a vector, empty, or zero
520520
N = nx;
521521
else %% Q is a square matrix (cost is a scalar)
522522
N = 1;

lib/mpomver.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
v = struct( 'Name', 'MP-Opt-Model', ...
2727
'Version', '5.0.1-dev', ...
2828
'Release', '', ...
29-
'Date', '25-Sep-2025' );
29+
'Date', '21-Oct-2025' );
3030
if nargout > 0
3131
if nargin > 0
3232
rv = v;

0 commit comments

Comments
 (0)