Skip to content

Commit

Permalink
Updated SparseVector constructor [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
ankane committed Jun 25, 2024
1 parent a5b430d commit 1a0f175
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/SparseVector.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ public function __construct($dimensions, $indices, $values)
if (count($indices) != count($values)) {
throw new \InvalidArgumentException("indices and values must be the same length");
}
$this->dimensions = $dimensions;
$this->indices = $indices;
$this->values = $values;
$this->dimensions = intval($dimensions);
$this->indices = array_map(fn ($v) => intval($v), $indices);
$this->values = array_map(fn ($v) => floatval($v), $values);
}

public static function fromDense($value)
Expand Down

0 comments on commit 1a0f175

Please sign in to comment.