« MongoDB\BSON\Binary::__construct
MongoDB\BSON\Binary::getData »

MongoDB\BSON\Binary::fromVector

(mongodb >=2.2.0)

MongoDB\BSON\Binary::fromVector — Creates a new binary with subtype MongoDB\BSON\Binary::SUBTYPE_VECTOR from the given array and vector type

説明

final public static function MongoDB\BSON\Binary::fromVector(array $vector, MongoDB\BSON\VectorType $vectorType): MongoDB\BSON\Binary

パラメータ

vector (array)

An array of values representing the vector data. The type of each value must match the type indicated by the vectorType parameter:

  • for MongoDB\BSON\VectorType::Float32, each value must be a float

  • for MongoDB\BSON\VectorType::Int8, each value must be an 8-bit int, i.e. from -127 to 128

  • for MongoDB\BSON\VectorType::PackedBit, each value must be a bool or 1-bit int, i.e. 0 or 1

vectorType (MongoDB\BSON\VectorType)

The vector data type.

戻り値

Returns a new Binary with subtype MongoDB\BSON\Binary::SUBTYPE_VECTOR.

エラー / 例外

参考

関連キーワード:
MongoDB   Binary   vector   type   subtype   VectorType   Creates   binary   given   fromVector   vectorType   construct   getData   mongodb   final   static   values   representing   match   indicated   parameter   Float   float   PackedBit   Throws
関連する関数・ページ:
mongodb-bson-binary.getvectortype   mongodb-bson-binary.toarray   class.mongodb-bson-binary   enum.mongodb-bson-vectortype   mongodb-bson-binary.tostring   mongodb-bson-binary.gettype