Skip to content

Commit 463bb9d

Browse files
committed
update size checks
1 parent 5eecba8 commit 463bb9d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

ocs2_core/src/Types.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ std::string checkSize(int stateDim, int inputDim, const ScalarFunctionQuadraticA
289289
if (data.dfdux.rows() != inputDim) {
290290
errorDescription << dataName << ".dfdux.rows() != " << inputDim << "\n";
291291
}
292-
if (data.dfdux.cols() != stateDim) {
292+
if (data.dfdux.cols() != stateDim && inputDim > 0) {
293293
errorDescription << dataName << ".dfdux.cols() != " << stateDim << "\n";
294294
}
295295

@@ -379,10 +379,10 @@ std::string checkSize(int vectorDim, int stateDim, int inputDim, const VectorFun
379379
if (vectorDim > 0 && data.dfdx.cols() != stateDim) {
380380
errorDescription << dataName << ".dfdx.cols() != " << stateDim << "\n";
381381
}
382-
if (vectorDim > 0 && data.dfdu.rows() != vectorDim) {
382+
if (vectorDim > 0 && inputDim > 0 && data.dfdu.rows() != vectorDim) {
383383
errorDescription << dataName << ".dfdu.rows() != " << vectorDim << "\n";
384384
}
385-
if (vectorDim > 0 && data.dfdu.cols() != inputDim) {
385+
if (vectorDim > 0 && inputDim > 0 && data.dfdu.cols() != inputDim) {
386386
errorDescription << dataName << ".dfdu.cols() != " << inputDim << "\n";
387387
}
388388

0 commit comments

Comments
 (0)