@@ -8,14 +8,14 @@ Supports [libpqxx](https://github.com/jtv/libpqxx)
88
99## Installation
1010
11- Add [ the headers] ( https://github.com/pgvector/pgvector-cpp/tree/v0.2.4 /include ) to your project (supports C++17 and greater).
11+ Add [ the headers] ( https://github.com/pgvector/pgvector-cpp/tree/v0.3.0 /include ) to your project (supports C++20 and greater).
1212
1313There is also support for CMake and FetchContent:
1414
1515``` cmake
1616include(FetchContent)
1717
18- FetchContent_Declare(pgvector GIT_REPOSITORY https://github.com/pgvector/pgvector-cpp.git GIT_TAG v0.2.4 )
18+ FetchContent_Declare(pgvector GIT_REPOSITORY https://github.com/pgvector/pgvector-cpp.git GIT_TAG v0.3.0 )
1919FetchContent_MakeAvailable(pgvector)
2020
2121target_link_libraries(app PRIVATE pgvector::pgvector)
@@ -46,6 +46,8 @@ Include the header
4646#include < pgvector/pqxx.hpp>
4747```
4848
49+ The latest version works libpqxx 8. For libpqxx 7, use version 0.2.4 and [ this readme] ( https://github.com/pgvector/pgvector-cpp/blob/v0.2.4/README.md#libpqxx ) .
50+
4951Enable the extension
5052
5153``` cpp
@@ -99,27 +101,29 @@ pgvector::Vector vec{std::span<const float>{{1, 2, 3}}};
99101Get a ` std::vector `
100102
101103``` cpp
102- std::vector<float > float_vec = static_cast <std::vector< float >>( vec);
104+ const std::vector<float >& values = vec.values( );
103105```
104106
105107### Half Vectors
106108
107109Create a half vector from a ` std::vector `
108110
109111``` cpp
110- pgvector::HalfVector vec{std::vector<float >{1, 2, 3}};
112+ pgvector::HalfVector vec{std::vector< pgvector::Half > {1, 2, 3}};
111113```
112114
115+ Note: `pgvector::Half` is `std::float16_t` or `_Float16` when available, or `float` otherwise
116+
113117Or a span
114118
115119```cpp
116- pgvector::HalfVector vec{std::span<const float >{{1, 2, 3}}};
120+ pgvector::HalfVector vec{std::span<const pgvector::Half >{{1, 2, 3}}};
117121```
118122
119123Get a ` std::vector `
120124
121125``` cpp
122- std::vector<float > float_vec = static_cast <std::vector< float >>( vec);
126+ const std::vector<pgvector::Half>& values = vec.values( );
123127```
124128
125129### Sparse Vectors
0 commit comments