We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1900745 commit 08d325cCopy full SHA for 08d325c
src/HNSW/Config.php
@@ -82,12 +82,14 @@ public function __construct(
82
if ($M < 2) {
83
throw new \InvalidArgumentException('M must be at least 2.');
84
}
85
- if ($efConstruction < $M) {
86
- throw new \InvalidArgumentException('efConstruction must be ≥ M.');
+ $resolvedM0 = $M0 ?? ($M * 2);
+
87
+ if ($efConstruction < $resolvedM0) {
88
+ throw new \InvalidArgumentException("efConstruction must be ≥ M0 ({$resolvedM0}).");
89
90
91
$this->M = $M;
- $this->M0 = $M0 ?? ($M * 2);
92
+ $this->M0 = $resolvedM0;
93
$this->mL = $mL ?? (1.0 / log($M));
94
$this->efConstruction = $efConstruction;
95
$this->efSearch = $efSearch;
0 commit comments