chiark
/
gitweb
/
~ianmdlvl
/
nlopt.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
62d394f
)
catch a vector-size mismatch in C++
author
stevenj
<stevenj@alum.mit.edu>
Mon, 5 Apr 2010 07:28:11 +0000
(
03:28
-0400)
committer
stevenj
<stevenj@alum.mit.edu>
Mon, 5 Apr 2010 07:28:11 +0000
(
03:28
-0400)
darcs-hash:
20100405072811
-c8de0-
307c0f8c22e707816cbe2da178b2ff92fc6a596f
.gz
api/nlopt-in.hpp
patch
|
blob
|
history
diff --git
a/api/nlopt-in.hpp
b/api/nlopt-in.hpp
index a4d91440ed5d7b3a979168c92dfacc2f0defd1b5..cc09c44ee9010a488210f610c8b60966a7d551cb 100644
(file)
--- a/
api/nlopt-in.hpp
+++ b/
api/nlopt-in.hpp
@@
-109,6
+109,8
@@
namespace nlopt {
return result(ret);
}
result optimize(std::vector<double> &x, double &opt_f) {
+ if (o && nlopt_get_dimension(o) != x.size())
+ throw std::invalid_argument("dimension mismatch");
return optimize(x.empty() ? NULL : &x[0], opt_f);
}