Copy disabled (too large)
Download .txt
Showing preview only (11,214K chars total). Download the full file to get everything.
Repository: alibaba/zvec
Branch: main
Commit: b49833bf56a0
Files: 988
Total size: 10.5 MB
Directory structure:
gitextract_w52102_2/
├── .clang-format
├── .git/
│ ├── HEAD
│ ├── config
│ ├── description
│ ├── hooks/
│ │ ├── applypatch-msg.sample
│ │ ├── commit-msg.sample
│ │ ├── fsmonitor-watchman.sample
│ │ ├── post-update.sample
│ │ ├── pre-applypatch.sample
│ │ ├── pre-commit.sample
│ │ ├── pre-merge-commit.sample
│ │ ├── pre-push.sample
│ │ ├── pre-rebase.sample
│ │ ├── pre-receive.sample
│ │ ├── prepare-commit-msg.sample
│ │ ├── push-to-checkout.sample
│ │ ├── sendemail-validate.sample
│ │ └── update.sample
│ ├── index
│ ├── info/
│ │ └── exclude
│ ├── logs/
│ │ ├── HEAD
│ │ └── refs/
│ │ ├── heads/
│ │ │ └── main
│ │ └── remotes/
│ │ └── origin/
│ │ └── HEAD
│ ├── objects/
│ │ └── pack/
│ │ ├── pack-2b5e15ebe928a592991dc24c7ae7e8dc9e3500dc.idx
│ │ ├── pack-2b5e15ebe928a592991dc24c7ae7e8dc9e3500dc.pack
│ │ ├── pack-2b5e15ebe928a592991dc24c7ae7e8dc9e3500dc.promisor
│ │ └── pack-2b5e15ebe928a592991dc24c7ae7e8dc9e3500dc.rev
│ ├── packed-refs
│ ├── refs/
│ │ ├── heads/
│ │ │ └── main
│ │ └── remotes/
│ │ └── origin/
│ │ └── HEAD
│ └── shallow
├── .github/
│ ├── ISSUE_TEMPLATE/
│ │ ├── benchmark.yml
│ │ ├── bug_report.yml
│ │ ├── config.yml
│ │ ├── enhancement.yml
│ │ ├── feature_request.yml
│ │ ├── integration.yml
│ │ └── profiling.yml
│ ├── codecov.yml
│ ├── dependabot.yml
│ └── workflows/
│ ├── 01-ci-pipeline.yml
│ ├── 02-lint-check.yml
│ ├── 03-macos-linux-build.yml
│ ├── 04-android-build.yml
│ ├── _build_wheel_job.yml
│ ├── build_test_wheel.yml
│ ├── build_wheel.yml
│ ├── continuous_bench.yml
│ ├── docker/
│ │ └── Dockerfile.linux_x64_glibc228
│ ├── nightly_coverage.yml
│ └── scripts/
│ └── run_vdb.sh
├── .gitignore
├── .gitmodules
├── CMakeLists.txt
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── cmake/
│ ├── bazel.cmake
│ ├── option.cmake
│ └── utils.cmake
├── examples/
│ └── c++/
│ ├── CMakeLists.txt
│ ├── ailego/
│ │ └── main.cc
│ ├── core/
│ │ └── main.cc
│ └── db/
│ └── main.cc
├── pyproject.toml
├── python/
│ ├── tests/
│ │ ├── detail/
│ │ │ ├── distance_helper.py
│ │ │ ├── doc_helper.py
│ │ │ ├── fixture_helper.py
│ │ │ ├── params_helper.py
│ │ │ ├── support_helper.py
│ │ │ ├── test_collection_concurrency.py
│ │ │ ├── test_collection_create_and_open.py
│ │ │ ├── test_collection_ddl.py
│ │ │ ├── test_collection_dml.py
│ │ │ ├── test_collection_dql.py
│ │ │ ├── test_collection_exception.py
│ │ │ ├── test_collection_open.py
│ │ │ ├── test_collection_recall.py
│ │ │ └── test_db_config.py
│ │ ├── test_collection.py
│ │ ├── test_collection_hnsw_rabitq.py
│ │ ├── test_convert.py
│ │ ├── test_doc.py
│ │ ├── test_embedding.py
│ │ ├── test_params.py
│ │ ├── test_query_executor.py
│ │ ├── test_reranker.py
│ │ ├── test_schema.py
│ │ ├── test_typing.py
│ │ └── test_util.py
│ └── zvec/
│ ├── __init__.py
│ ├── __init__.pyi
│ ├── common/
│ │ ├── __init__.py
│ │ └── constants.py
│ ├── executor/
│ │ ├── __init__.py
│ │ └── query_executor.py
│ ├── extension/
│ │ ├── __init__.py
│ │ ├── bm25_embedding_function.py
│ │ ├── embedding_function.py
│ │ ├── http_embedding_function.py
│ │ ├── jina_embedding_function.py
│ │ ├── jina_function.py
│ │ ├── multi_vector_reranker.py
│ │ ├── openai_embedding_function.py
│ │ ├── openai_function.py
│ │ ├── qwen_embedding_function.py
│ │ ├── qwen_function.py
│ │ ├── qwen_rerank_function.py
│ │ ├── rerank_function.py
│ │ ├── sentence_transformer_embedding_function.py
│ │ ├── sentence_transformer_function.py
│ │ └── sentence_transformer_rerank_function.py
│ ├── model/
│ │ ├── __init__.py
│ │ ├── collection.py
│ │ ├── convert.py
│ │ ├── doc.py
│ │ ├── param/
│ │ │ ├── __init__.py
│ │ │ ├── __init__.pyi
│ │ │ └── vector_query.py
│ │ └── schema/
│ │ ├── __init__.py
│ │ ├── __init__.pyi
│ │ ├── collection_schema.py
│ │ └── field_schema.py
│ ├── py.typed
│ ├── tool/
│ │ ├── __init__.py
│ │ └── util.py
│ ├── typing/
│ │ ├── __init__.py
│ │ ├── __init__.pyi
│ │ └── enum.py
│ └── zvec.py
├── scripts/
│ ├── README.md
│ ├── build_android.sh
│ └── gcov.sh
├── src/
│ ├── CMakeLists.txt
│ ├── ailego/
│ │ ├── CMakeLists.txt
│ │ ├── algorithm/
│ │ │ ├── binary_quantizer.cc
│ │ │ ├── binary_quantizer.h
│ │ │ ├── integer_quantizer.cc
│ │ │ ├── integer_quantizer.h
│ │ │ ├── kmeans.h
│ │ │ └── lloyd_cluster.h
│ │ ├── buffer/
│ │ │ ├── buffer_manager.cc
│ │ │ └── buffer_pool.cc
│ │ ├── container/
│ │ │ ├── bitmap.cc
│ │ │ ├── bitmap.h
│ │ │ ├── bloom_filter.h
│ │ │ ├── params.cc
│ │ │ ├── reservoir.h
│ │ │ └── vector_array.h
│ │ ├── encoding/
│ │ │ └── json/
│ │ │ └── mod_json.c
│ │ ├── hash/
│ │ │ └── crc32c.cc
│ │ ├── internal/
│ │ │ ├── cpu_features.cc
│ │ │ └── cpu_features.h
│ │ ├── io/
│ │ │ ├── file.cc
│ │ │ ├── file_lock.cc
│ │ │ ├── file_lock.h
│ │ │ └── file_writer.h
│ │ ├── logger/
│ │ │ └── logger.cc
│ │ ├── math/
│ │ │ ├── cosine_distance_matrix.h
│ │ │ ├── distance.h
│ │ │ ├── distance_matrix.h
│ │ │ ├── distance_matrix_accum_fp16.i
│ │ │ ├── distance_matrix_accum_fp32.i
│ │ │ ├── distance_matrix_accum_int4.i
│ │ │ ├── distance_matrix_accum_int8.i
│ │ │ ├── distance_matrix_euclidean_utility.i
│ │ │ ├── distance_matrix_fp16.i
│ │ │ ├── distance_matrix_fp32.i
│ │ │ ├── distance_matrix_inner_product_utility.i
│ │ │ ├── distance_matrix_int32.i
│ │ │ ├── distance_matrix_int64.i
│ │ │ ├── distance_matrix_mips_utility.i
│ │ │ ├── distance_matrix_popcnt.i
│ │ │ ├── distance_utility.h
│ │ │ ├── euclidean_distance_matrix.h
│ │ │ ├── euclidean_distance_matrix_fp16_avx.cc
│ │ │ ├── euclidean_distance_matrix_fp16_avx512.cc
│ │ │ ├── euclidean_distance_matrix_fp16_avx512fp16.cc
│ │ │ ├── euclidean_distance_matrix_fp16_dispatch.cc
│ │ │ ├── euclidean_distance_matrix_fp16_neon.cc
│ │ │ ├── euclidean_distance_matrix_fp32_avx.cc
│ │ │ ├── euclidean_distance_matrix_fp32_avx512.cc
│ │ │ ├── euclidean_distance_matrix_fp32_dispatch.cc
│ │ │ ├── euclidean_distance_matrix_fp32_neon.cc
│ │ │ ├── euclidean_distance_matrix_fp32_sse.cc
│ │ │ ├── euclidean_distance_matrix_int4_avx2.cc
│ │ │ ├── euclidean_distance_matrix_int4_dispatch.cc
│ │ │ ├── euclidean_distance_matrix_int4_sse.cc
│ │ │ ├── euclidean_distance_matrix_int8_avx2.cc
│ │ │ ├── euclidean_distance_matrix_int8_dispatch.cc
│ │ │ ├── euclidean_distance_matrix_int8_sse.cc
│ │ │ ├── euclidean_distance_matrix_scalar.cc
│ │ │ ├── hamming_distance_matrix.cc
│ │ │ ├── hamming_distance_matrix.h
│ │ │ ├── inner_product_matrix.h
│ │ │ ├── inner_product_matrix_fp16_avx.cc
│ │ │ ├── inner_product_matrix_fp16_avx512.cc
│ │ │ ├── inner_product_matrix_fp16_avx512fp16.cc
│ │ │ ├── inner_product_matrix_fp16_dispatch.cc
│ │ │ ├── inner_product_matrix_fp16_neon.cc
│ │ │ ├── inner_product_matrix_fp32_avx.cc
│ │ │ ├── inner_product_matrix_fp32_avx512.cc
│ │ │ ├── inner_product_matrix_fp32_dispatch.cc
│ │ │ ├── inner_product_matrix_fp32_neon.cc
│ │ │ ├── inner_product_matrix_fp32_sse.cc
│ │ │ ├── inner_product_matrix_int4_avx2.cc
│ │ │ ├── inner_product_matrix_int4_dispatch.cc
│ │ │ ├── inner_product_matrix_int4_sse.cc
│ │ │ ├── inner_product_matrix_int8_avx2.cc
│ │ │ ├── inner_product_matrix_int8_dispatch.cc
│ │ │ ├── inner_product_matrix_int8_sse.cc
│ │ │ ├── inner_product_matrix_scalar.cc
│ │ │ ├── matrix_define.i
│ │ │ ├── matrix_utility.i
│ │ │ ├── mips_euclidean_distance_matrix.h
│ │ │ ├── mips_euclidean_distance_matrix_fp16_avx.cc
│ │ │ ├── mips_euclidean_distance_matrix_fp16_avx512.cc
│ │ │ ├── mips_euclidean_distance_matrix_fp16_dispatch.cc
│ │ │ ├── mips_euclidean_distance_matrix_fp16_neon.cc
│ │ │ ├── mips_euclidean_distance_matrix_fp32_avx.cc
│ │ │ ├── mips_euclidean_distance_matrix_fp32_avx512.cc
│ │ │ ├── mips_euclidean_distance_matrix_fp32_dispatch.cc
│ │ │ ├── mips_euclidean_distance_matrix_fp32_neon.cc
│ │ │ ├── mips_euclidean_distance_matrix_fp32_sse.cc
│ │ │ ├── mips_euclidean_distance_matrix_int4_avx2.cc
│ │ │ ├── mips_euclidean_distance_matrix_int4_dispatch.cc
│ │ │ ├── mips_euclidean_distance_matrix_int4_sse.cc
│ │ │ ├── mips_euclidean_distance_matrix_int8_avx2.cc
│ │ │ ├── mips_euclidean_distance_matrix_int8_dispatch.cc
│ │ │ ├── mips_euclidean_distance_matrix_int8_sse.cc
│ │ │ ├── mips_euclidean_distance_matrix_scalar.cc
│ │ │ ├── norm1_matrix.h
│ │ │ ├── norm1_matrix_fp16.cc
│ │ │ ├── norm1_matrix_fp32.cc
│ │ │ ├── norm2_matrix.h
│ │ │ ├── norm2_matrix_fp16.cc
│ │ │ ├── norm2_matrix_fp32.cc
│ │ │ ├── norm_matrix.h
│ │ │ ├── norm_matrix_fp16.i
│ │ │ ├── norm_matrix_fp32.i
│ │ │ ├── normalizer.cc
│ │ │ └── normalizer.h
│ │ ├── math_batch/
│ │ │ ├── cosine_distance_batch.h
│ │ │ ├── distance_batch.h
│ │ │ ├── inner_product_distance_batch.h
│ │ │ ├── inner_product_distance_batch_dispatch.cc
│ │ │ ├── inner_product_distance_batch_impl_fp16_avx2.cc
│ │ │ ├── inner_product_distance_batch_impl_fp16_avx512.cc
│ │ │ ├── inner_product_distance_batch_impl_fp16_avx512fp16.cc
│ │ │ ├── inner_product_distance_batch_impl_fp32_avx2.cc
│ │ │ ├── inner_product_distance_batch_impl_int8_avx2.cc
│ │ │ └── inner_product_distance_batch_impl_int8_avx512fp16.cc
│ │ ├── parallel/
│ │ │ ├── lock.h
│ │ │ ├── multi_thread_list.h
│ │ │ ├── semaphore.h
│ │ │ └── thread_pool.cc
│ │ ├── pattern/
│ │ │ ├── defer.h
│ │ │ └── scope_guard.h
│ │ ├── utility/
│ │ │ ├── bit_string_helper.h
│ │ │ ├── bitset_helper.cc
│ │ │ ├── bitset_helper.h
│ │ │ ├── concurrency_helper.cc
│ │ │ ├── concurrency_helper.h
│ │ │ ├── dl_helper.cc
│ │ │ ├── dl_helper.h
│ │ │ ├── file_helper.cc
│ │ │ ├── float_helper.cc
│ │ │ ├── math_helper.h
│ │ │ ├── matrix_helper.h
│ │ │ ├── memory_helper.cc
│ │ │ ├── memory_helper.h
│ │ │ ├── string_helper.cc
│ │ │ └── time_helper.cc
│ │ ├── version.cc
│ │ ├── version.h
│ │ └── version.i
│ ├── binding/
│ │ ├── CMakeLists.txt
│ │ └── python/
│ │ ├── CMakeLists.txt
│ │ ├── binding.cc
│ │ ├── exports.mac
│ │ ├── include/
│ │ │ ├── python_collection.h
│ │ │ ├── python_config.h
│ │ │ ├── python_doc.h
│ │ │ ├── python_param.h
│ │ │ ├── python_schema.h
│ │ │ └── python_type.h
│ │ ├── model/
│ │ │ ├── common/
│ │ │ │ └── python_config.cc
│ │ │ ├── param/
│ │ │ │ └── python_param.cc
│ │ │ ├── python_collection.cc
│ │ │ ├── python_doc.cc
│ │ │ └── schema/
│ │ │ └── python_schema.cc
│ │ └── typing/
│ │ └── python_type.cc
│ ├── core/
│ │ ├── CMakeLists.txt
│ │ ├── algorithm/
│ │ │ ├── CMakeLists.txt
│ │ │ ├── cluster/
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ ├── cluster_params.h
│ │ │ │ ├── kmeans_cluster.cc
│ │ │ │ ├── linear_seeker.cc
│ │ │ │ ├── linear_seeker.h
│ │ │ │ ├── opt_kmeans_cluster.cc
│ │ │ │ ├── seeker.h
│ │ │ │ ├── stratified_cluster.cc
│ │ │ │ ├── stratified_cluster_trainer.cc
│ │ │ │ ├── stratified_cluster_trainer.h
│ │ │ │ └── vector_mean.h
│ │ │ ├── flat/
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ ├── flat_builder.cc
│ │ │ │ ├── flat_builder.h
│ │ │ │ ├── flat_distance_matrix.h
│ │ │ │ ├── flat_index_format.h
│ │ │ │ ├── flat_searcher.cc
│ │ │ │ ├── flat_searcher.h
│ │ │ │ ├── flat_searcher_context.h
│ │ │ │ ├── flat_searcher_provider.h
│ │ │ │ ├── flat_streamer.cc
│ │ │ │ ├── flat_streamer.h
│ │ │ │ ├── flat_streamer_context.h
│ │ │ │ ├── flat_streamer_dumper.h
│ │ │ │ ├── flat_streamer_entity.cc
│ │ │ │ ├── flat_streamer_entity.h
│ │ │ │ ├── flat_streamer_provider.h
│ │ │ │ └── flat_utility.h
│ │ │ ├── flat_sparse/
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ ├── flat_sparse_builder.cc
│ │ │ │ ├── flat_sparse_builder.h
│ │ │ │ ├── flat_sparse_context.cc
│ │ │ │ ├── flat_sparse_context.h
│ │ │ │ ├── flat_sparse_entity.h
│ │ │ │ ├── flat_sparse_index_format.h
│ │ │ │ ├── flat_sparse_provider.h
│ │ │ │ ├── flat_sparse_search.h
│ │ │ │ ├── flat_sparse_searcher.cc
│ │ │ │ ├── flat_sparse_searcher.h
│ │ │ │ ├── flat_sparse_searcher_entity.cc
│ │ │ │ ├── flat_sparse_searcher_entity.h
│ │ │ │ ├── flat_sparse_streamer.cc
│ │ │ │ ├── flat_sparse_streamer.h
│ │ │ │ ├── flat_sparse_streamer_entity.cc
│ │ │ │ ├── flat_sparse_streamer_entity.h
│ │ │ │ └── flat_sparse_utility.h
│ │ │ ├── hnsw/
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ ├── hnsw_algorithm.cc
│ │ │ │ ├── hnsw_algorithm.h
│ │ │ │ ├── hnsw_builder.cc
│ │ │ │ ├── hnsw_builder.h
│ │ │ │ ├── hnsw_builder_entity.cc
│ │ │ │ ├── hnsw_builder_entity.h
│ │ │ │ ├── hnsw_chunk.cc
│ │ │ │ ├── hnsw_chunk.h
│ │ │ │ ├── hnsw_context.cc
│ │ │ │ ├── hnsw_context.h
│ │ │ │ ├── hnsw_dist_calculator.h
│ │ │ │ ├── hnsw_entity.cc
│ │ │ │ ├── hnsw_entity.h
│ │ │ │ ├── hnsw_index_hash.h
│ │ │ │ ├── hnsw_index_provider.h
│ │ │ │ ├── hnsw_params.h
│ │ │ │ ├── hnsw_searcher.cc
│ │ │ │ ├── hnsw_searcher.h
│ │ │ │ ├── hnsw_searcher_entity.cc
│ │ │ │ ├── hnsw_searcher_entity.h
│ │ │ │ ├── hnsw_streamer.cc
│ │ │ │ ├── hnsw_streamer.h
│ │ │ │ ├── hnsw_streamer_entity.cc
│ │ │ │ └── hnsw_streamer_entity.h
│ │ │ ├── hnsw_rabitq/
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ ├── hnsw_rabitq_algorithm.cc
│ │ │ │ ├── hnsw_rabitq_algorithm.h
│ │ │ │ ├── hnsw_rabitq_builder.cc
│ │ │ │ ├── hnsw_rabitq_builder.h
│ │ │ │ ├── hnsw_rabitq_builder_entity.cc
│ │ │ │ ├── hnsw_rabitq_builder_entity.h
│ │ │ │ ├── hnsw_rabitq_chunk.cc
│ │ │ │ ├── hnsw_rabitq_chunk.h
│ │ │ │ ├── hnsw_rabitq_context.cc
│ │ │ │ ├── hnsw_rabitq_context.h
│ │ │ │ ├── hnsw_rabitq_dist_calculator.cc
│ │ │ │ ├── hnsw_rabitq_dist_calculator.h
│ │ │ │ ├── hnsw_rabitq_entity.cc
│ │ │ │ ├── hnsw_rabitq_entity.h
│ │ │ │ ├── hnsw_rabitq_index_hash.h
│ │ │ │ ├── hnsw_rabitq_index_provider.h
│ │ │ │ ├── hnsw_rabitq_params.h
│ │ │ │ ├── hnsw_rabitq_query_algorithm.cc
│ │ │ │ ├── hnsw_rabitq_query_algorithm.h
│ │ │ │ ├── hnsw_rabitq_query_entity.h
│ │ │ │ ├── hnsw_rabitq_register.cc
│ │ │ │ ├── hnsw_rabitq_searcher.cc
│ │ │ │ ├── hnsw_rabitq_searcher.h
│ │ │ │ ├── hnsw_rabitq_searcher_entity.cc
│ │ │ │ ├── hnsw_rabitq_searcher_entity.h
│ │ │ │ ├── hnsw_rabitq_streamer.cc
│ │ │ │ ├── hnsw_rabitq_streamer.h
│ │ │ │ ├── hnsw_rabitq_streamer_entity.cc
│ │ │ │ ├── hnsw_rabitq_streamer_entity.h
│ │ │ │ ├── rabitq_converter.cc
│ │ │ │ ├── rabitq_converter.h
│ │ │ │ ├── rabitq_params.h
│ │ │ │ ├── rabitq_reformer.cc
│ │ │ │ ├── rabitq_reformer.h
│ │ │ │ ├── rabitq_utils.cc
│ │ │ │ └── rabitq_utils.h
│ │ │ ├── hnsw_sparse/
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ ├── hnsw_sparse_algorithm.cc
│ │ │ │ ├── hnsw_sparse_algorithm.h
│ │ │ │ ├── hnsw_sparse_builder.cc
│ │ │ │ ├── hnsw_sparse_builder.h
│ │ │ │ ├── hnsw_sparse_builder_entity.cc
│ │ │ │ ├── hnsw_sparse_builder_entity.h
│ │ │ │ ├── hnsw_sparse_chunk.cc
│ │ │ │ ├── hnsw_sparse_chunk.h
│ │ │ │ ├── hnsw_sparse_context.cc
│ │ │ │ ├── hnsw_sparse_context.h
│ │ │ │ ├── hnsw_sparse_dist_calculator.h
│ │ │ │ ├── hnsw_sparse_entity.cc
│ │ │ │ ├── hnsw_sparse_entity.h
│ │ │ │ ├── hnsw_sparse_index_hash.h
│ │ │ │ ├── hnsw_sparse_index_provider.h
│ │ │ │ ├── hnsw_sparse_params.h
│ │ │ │ ├── hnsw_sparse_searcher.cc
│ │ │ │ ├── hnsw_sparse_searcher.h
│ │ │ │ ├── hnsw_sparse_searcher_entity.cc
│ │ │ │ ├── hnsw_sparse_searcher_entity.h
│ │ │ │ ├── hnsw_sparse_streamer.cc
│ │ │ │ ├── hnsw_sparse_streamer.h
│ │ │ │ ├── hnsw_sparse_streamer_entity.cc
│ │ │ │ └── hnsw_sparse_streamer_entity.h
│ │ │ └── ivf/
│ │ │ ├── CMakeLists.txt
│ │ │ ├── ivf_builder.cc
│ │ │ ├── ivf_builder.h
│ │ │ ├── ivf_centroid_index.cc
│ │ │ ├── ivf_centroid_index.h
│ │ │ ├── ivf_distance_calculator.cc
│ │ │ ├── ivf_distance_calculator.h
│ │ │ ├── ivf_dumper.cc
│ │ │ ├── ivf_dumper.h
│ │ │ ├── ivf_entity.cc
│ │ │ ├── ivf_entity.h
│ │ │ ├── ivf_index_format.h
│ │ │ ├── ivf_index_provider.h
│ │ │ ├── ivf_params.h
│ │ │ ├── ivf_searcher.cc
│ │ │ ├── ivf_searcher.h
│ │ │ ├── ivf_searcher_context.h
│ │ │ ├── ivf_streamer.cc
│ │ │ ├── ivf_streamer.h
│ │ │ └── ivf_utility.h
│ │ ├── framework/
│ │ │ ├── CMakeLists.txt
│ │ │ ├── index_cluster.cc
│ │ │ ├── index_context.cc
│ │ │ ├── index_converter.cc
│ │ │ ├── index_error.cc
│ │ │ ├── index_factory.cc
│ │ │ ├── index_flow.cc
│ │ │ ├── index_helper.cc
│ │ │ ├── index_logger.cc
│ │ │ ├── index_mapping.cc
│ │ │ ├── index_meta.cc
│ │ │ ├── index_plugin.cc
│ │ │ └── index_version.cc
│ │ ├── interface/
│ │ │ ├── CMakeLists.txt
│ │ │ ├── index.cc
│ │ │ ├── index_factory.cc
│ │ │ ├── index_param.cc
│ │ │ ├── indexes/
│ │ │ │ ├── flat_index.cc
│ │ │ │ ├── hnsw_index.cc
│ │ │ │ ├── hnsw_rabitq_index.cc
│ │ │ │ └── ivf_index.cc
│ │ │ └── utils/
│ │ │ └── utils.h
│ │ ├── metric/
│ │ │ ├── CMakeLists.txt
│ │ │ ├── cosine_metric.cc
│ │ │ ├── euclidean_metric.cc
│ │ │ ├── hamming_metric.cc
│ │ │ ├── inner_product_metric.cc
│ │ │ ├── metric_params.h
│ │ │ ├── mips_euclidean_metric.cc
│ │ │ ├── quantized_integer_metric.cc
│ │ │ ├── quantized_integer_metric_batch.h
│ │ │ └── quantized_integer_metric_matrix.h
│ │ ├── mixed_reducer/
│ │ │ ├── CMakeLists.txt
│ │ │ ├── mixed_reducer_params.h
│ │ │ ├── mixed_streamer_reducer.cc
│ │ │ └── mixed_streamer_reducer.h
│ │ ├── quantizer/
│ │ │ ├── CMakeLists.txt
│ │ │ ├── binary_converter.cc
│ │ │ ├── binary_reformer.cc
│ │ │ ├── cosine_converter.cc
│ │ │ ├── cosine_reformer.cc
│ │ │ ├── half_float_converter.cc
│ │ │ ├── half_float_reformer.cc
│ │ │ ├── integer_quantizer_converter.cc
│ │ │ ├── integer_quantizer_reformer.cc
│ │ │ ├── mips_converter.cc
│ │ │ ├── mips_reformer.cc
│ │ │ ├── quantizer_params.h
│ │ │ └── record_quantizer.h
│ │ └── utility/
│ │ ├── CMakeLists.txt
│ │ ├── basic_refiner.cc
│ │ ├── buffer_storage.cc
│ │ ├── file_dumper.cc
│ │ ├── file_read_storage.cc
│ │ ├── memory_dumper.cc
│ │ ├── memory_read_storage.cc
│ │ ├── mmap_file_read_storage.cc
│ │ ├── mmap_file_storage.cc
│ │ ├── sparse_utility.h
│ │ ├── utility_params.h
│ │ └── visit_filter.h
│ ├── db/
│ │ ├── CMakeLists.txt
│ │ ├── collection.cc
│ │ ├── common/
│ │ │ ├── CMakeLists.txt
│ │ │ ├── cgroup_util.cc
│ │ │ ├── cgroup_util.h
│ │ │ ├── concurrent_roaring_bitmap.cc
│ │ │ ├── concurrent_roaring_bitmap.h
│ │ │ ├── config.cc
│ │ │ ├── constants.h
│ │ │ ├── error_code.cc
│ │ │ ├── error_code.h
│ │ │ ├── file_helper.cc
│ │ │ ├── file_helper.h
│ │ │ ├── global_resource.cc
│ │ │ ├── global_resource.h
│ │ │ ├── glogger.h
│ │ │ ├── logger.h
│ │ │ ├── profiler.h
│ │ │ ├── rocbsdb_context.cc
│ │ │ ├── rocksdb_context.h
│ │ │ ├── status.cc
│ │ │ ├── typedef.h
│ │ │ ├── utils.cc
│ │ │ └── utils.h
│ │ ├── index/
│ │ │ ├── CMakeLists.txt
│ │ │ ├── column/
│ │ │ │ ├── column_indexer.h
│ │ │ │ ├── common/
│ │ │ │ │ └── index_results.h
│ │ │ │ ├── inverted_column/
│ │ │ │ │ ├── inverted_codec.h
│ │ │ │ │ ├── inverted_column_indexer.h
│ │ │ │ │ ├── inverted_column_indexer_search.cc
│ │ │ │ │ ├── inverted_column_indexer_util.cc
│ │ │ │ │ ├── inverted_column_indexer_write.cc
│ │ │ │ │ ├── inverted_doc_range.h
│ │ │ │ │ ├── inverted_indexer.cc
│ │ │ │ │ ├── inverted_indexer.h
│ │ │ │ │ ├── inverted_rocksdb_merger.h
│ │ │ │ │ └── inverted_search_result.h
│ │ │ │ └── vector_column/
│ │ │ │ ├── combined_vector_column_indexer.cc
│ │ │ │ ├── combined_vector_column_indexer.h
│ │ │ │ ├── engine_helper.hpp
│ │ │ │ ├── vector_column_indexer.cc
│ │ │ │ ├── vector_column_indexer.h
│ │ │ │ ├── vector_column_params.h
│ │ │ │ └── vector_index_results.h
│ │ │ ├── common/
│ │ │ │ ├── delete_store.h
│ │ │ │ ├── doc.cc
│ │ │ │ ├── id_map.cc
│ │ │ │ ├── id_map.h
│ │ │ │ ├── index_filter.h
│ │ │ │ ├── index_params.cc
│ │ │ │ ├── meta.h
│ │ │ │ ├── proto_converter.cc
│ │ │ │ ├── proto_converter.h
│ │ │ │ ├── schema.cc
│ │ │ │ ├── stats.cc
│ │ │ │ ├── type_helper.cc
│ │ │ │ ├── type_helper.h
│ │ │ │ ├── version_manager.cc
│ │ │ │ └── version_manager.h
│ │ │ ├── segment/
│ │ │ │ ├── column_merging_reader.cc
│ │ │ │ ├── column_merging_reader.h
│ │ │ │ ├── segment.cc
│ │ │ │ ├── segment.h
│ │ │ │ ├── segment_helper.cc
│ │ │ │ ├── segment_helper.h
│ │ │ │ ├── segment_manager.cc
│ │ │ │ ├── segment_manager.h
│ │ │ │ ├── sql_expr_parser.cc
│ │ │ │ └── sql_expr_parser.h
│ │ │ └── storage/
│ │ │ ├── arrow_ipc_writer.cc
│ │ │ ├── arrow_ipc_writer.h
│ │ │ ├── base_forward_store.h
│ │ │ ├── bufferpool_forward_store.cc
│ │ │ ├── bufferpool_forward_store.h
│ │ │ ├── chunked_file_writer.cc
│ │ │ ├── chunked_file_writer.h
│ │ │ ├── forward_writer.cc
│ │ │ ├── forward_writer.h
│ │ │ ├── lazy_record_batch_reader.h
│ │ │ ├── memory_forward_store.cc
│ │ │ ├── memory_forward_store.h
│ │ │ ├── mmap_forward_store.cc
│ │ │ ├── mmap_forward_store.h
│ │ │ ├── parquet_writer.cc
│ │ │ ├── parquet_writer.h
│ │ │ ├── store_helper.h
│ │ │ └── wal/
│ │ │ ├── local_wal_file.cc
│ │ │ ├── local_wal_file.h
│ │ │ ├── wal_file.cc
│ │ │ └── wal_file.h
│ │ ├── proto/
│ │ │ └── zvec.proto
│ │ └── sqlengine/
│ │ ├── CMakeLists.txt
│ │ ├── analyzer/
│ │ │ ├── query_analyzer.cc
│ │ │ ├── query_analyzer.h
│ │ │ ├── query_field_info.cc
│ │ │ ├── query_field_info.h
│ │ │ ├── query_info.cc
│ │ │ ├── query_info.h
│ │ │ ├── query_info_helper.cc
│ │ │ ├── query_info_helper.h
│ │ │ ├── query_node.cc
│ │ │ ├── query_node.h
│ │ │ ├── query_node_walker.cc
│ │ │ ├── query_node_walker.h
│ │ │ ├── query_orderby_info.cc
│ │ │ ├── query_orderby_info.h
│ │ │ ├── simple_rewriter.cc
│ │ │ └── simple_rewriter.h
│ │ ├── antlr/
│ │ │ ├── SQLLexer.g4
│ │ │ ├── SQLParser.g4
│ │ │ ├── gen/
│ │ │ │ ├── SQLLexer.cc
│ │ │ │ ├── SQLLexer.h
│ │ │ │ ├── SQLLexer.interp
│ │ │ │ ├── SQLLexer.tokens
│ │ │ │ ├── SQLParser.cc
│ │ │ │ ├── SQLParser.h
│ │ │ │ ├── SQLParser.interp
│ │ │ │ ├── SQLParser.tokens
│ │ │ │ ├── SQLParserBaseListener.cc
│ │ │ │ ├── SQLParserBaseListener.h
│ │ │ │ ├── SQLParserListener.cc
│ │ │ │ └── SQLParserListener.h
│ │ │ └── gen_parser.sh
│ │ ├── common/
│ │ │ ├── generic_node.h
│ │ │ ├── group_by.h
│ │ │ ├── util.cc
│ │ │ └── util.h
│ │ ├── parser/
│ │ │ ├── base_info.h
│ │ │ ├── case_changing_charstream.h
│ │ │ ├── error_verbose_listener.h
│ │ │ ├── node.cc
│ │ │ ├── node.h
│ │ │ ├── orderby_elem_info.h
│ │ │ ├── query_parser.cc
│ │ │ ├── query_parser.h
│ │ │ ├── select_info.cc
│ │ │ ├── select_info.h
│ │ │ ├── selected_elem_info.cc
│ │ │ ├── selected_elem_info.h
│ │ │ ├── sql_info.cc
│ │ │ ├── sql_info.h
│ │ │ ├── sql_info_helper.cc
│ │ │ ├── sql_info_helper.h
│ │ │ ├── zvec_cached_sql_parser.cc
│ │ │ ├── zvec_cached_sql_parser.h
│ │ │ ├── zvec_parser.cc
│ │ │ ├── zvec_parser.h
│ │ │ ├── zvec_sql_parser.cc
│ │ │ └── zvec_sql_parser.h
│ │ ├── planner/
│ │ │ ├── doc_filter.cc
│ │ │ ├── doc_filter.h
│ │ │ ├── invert_recall_node.cc
│ │ │ ├── invert_recall_node.h
│ │ │ ├── invert_search.cc
│ │ │ ├── invert_search.h
│ │ │ ├── op_register.cc
│ │ │ ├── op_register.h
│ │ │ ├── ops/
│ │ │ │ ├── check_not_filtered_op.cc
│ │ │ │ ├── check_not_filtered_op.h
│ │ │ │ ├── contain_op.cc
│ │ │ │ ├── contain_op.h
│ │ │ │ ├── fetch_vector_op.cc
│ │ │ │ └── fetch_vector_op.h
│ │ │ ├── optimizer.cc
│ │ │ ├── optimizer.h
│ │ │ ├── plan_info.cc
│ │ │ ├── plan_info.h
│ │ │ ├── query_planner.cc
│ │ │ ├── query_planner.h
│ │ │ ├── segment_node.cc
│ │ │ ├── segment_node.h
│ │ │ ├── vector_recall_node.cc
│ │ │ └── vector_recall_node.h
│ │ ├── sqlengine.cc
│ │ ├── sqlengine.h
│ │ ├── sqlengine_impl.cc
│ │ └── sqlengine_impl.h
│ ├── include/
│ │ └── zvec/
│ │ ├── ailego/
│ │ │ ├── buffer/
│ │ │ │ ├── buffer_manager.h
│ │ │ │ ├── buffer_pool.h
│ │ │ │ └── concurrentqueue.h
│ │ │ ├── container/
│ │ │ │ ├── blob.h
│ │ │ │ ├── cube.h
│ │ │ │ ├── heap.h
│ │ │ │ ├── hypercube.h
│ │ │ │ ├── params.h
│ │ │ │ └── vector.h
│ │ │ ├── encoding/
│ │ │ │ ├── json/
│ │ │ │ │ ├── mod_json.h
│ │ │ │ │ └── mod_json_plus.h
│ │ │ │ └── json.h
│ │ │ ├── hash/
│ │ │ │ ├── crc32c.h
│ │ │ │ └── jump_hash.h
│ │ │ ├── internal/
│ │ │ │ └── platform.h
│ │ │ ├── io/
│ │ │ │ ├── file.h
│ │ │ │ └── mmap_file.h
│ │ │ ├── logger/
│ │ │ │ └── logger.h
│ │ │ ├── math_batch/
│ │ │ │ └── utils.h
│ │ │ ├── parallel/
│ │ │ │ ├── thread_pool.h
│ │ │ │ └── thread_queue.h
│ │ │ ├── pattern/
│ │ │ │ ├── closure.h
│ │ │ │ ├── expected.hpp
│ │ │ │ ├── factory.h
│ │ │ │ └── singleton.h
│ │ │ ├── string/
│ │ │ │ ├── string_concat_helper.h
│ │ │ │ └── string_view.h
│ │ │ └── utility/
│ │ │ ├── file_helper.h
│ │ │ ├── float_helper.h
│ │ │ ├── string_helper.h
│ │ │ ├── string_helper_impl.h
│ │ │ ├── time_helper.h
│ │ │ └── type_helper.h
│ │ ├── core/
│ │ │ ├── framework/
│ │ │ │ ├── index_builder.h
│ │ │ │ ├── index_bundle.h
│ │ │ │ ├── index_cluster.h
│ │ │ │ ├── index_context.h
│ │ │ │ ├── index_converter.h
│ │ │ │ ├── index_document.h
│ │ │ │ ├── index_dumper.h
│ │ │ │ ├── index_error.h
│ │ │ │ ├── index_factory.h
│ │ │ │ ├── index_features.h
│ │ │ │ ├── index_filter.h
│ │ │ │ ├── index_flow.h
│ │ │ │ ├── index_format.h
│ │ │ │ ├── index_framework.h
│ │ │ │ ├── index_groupby.h
│ │ │ │ ├── index_helper.h
│ │ │ │ ├── index_holder.h
│ │ │ │ ├── index_logger.h
│ │ │ │ ├── index_mapping.h
│ │ │ │ ├── index_memory.h
│ │ │ │ ├── index_meta.h
│ │ │ │ ├── index_metric.h
│ │ │ │ ├── index_module.h
│ │ │ │ ├── index_packer.h
│ │ │ │ ├── index_plugin.h
│ │ │ │ ├── index_provider.h
│ │ │ │ ├── index_reducer.h
│ │ │ │ ├── index_refiner.h
│ │ │ │ ├── index_reformer.h
│ │ │ │ ├── index_runner.h
│ │ │ │ ├── index_searcher.h
│ │ │ │ ├── index_segment_storage.h
│ │ │ │ ├── index_stats.h
│ │ │ │ ├── index_storage.h
│ │ │ │ ├── index_streamer.h
│ │ │ │ ├── index_threads.h
│ │ │ │ ├── index_trainer.h
│ │ │ │ ├── index_unpacker.h
│ │ │ │ └── index_version.h
│ │ │ └── interface/
│ │ │ ├── constants.h
│ │ │ ├── index.h
│ │ │ ├── index_factory.h
│ │ │ ├── index_param.h
│ │ │ └── index_param_builders.h
│ │ ├── db/
│ │ │ ├── collection.h
│ │ │ ├── config.h
│ │ │ ├── doc.h
│ │ │ ├── index_params.h
│ │ │ ├── options.h
│ │ │ ├── query_params.h
│ │ │ ├── schema.h
│ │ │ ├── stats.h
│ │ │ ├── status.h
│ │ │ └── type.h
│ │ └── turbo/
│ │ └── turbo.h
│ └── turbo/
│ ├── CMakeLists.txt
│ ├── avx512_vnni/
│ │ └── record_quantized_int8/
│ │ ├── common.h
│ │ ├── cosine.cc
│ │ ├── cosine.h
│ │ ├── squared_euclidean.cc
│ │ └── squared_euclidean.h
│ └── turbo.cc
├── tests/
│ ├── CMakeLists.txt
│ ├── ailego/
│ │ ├── CMakeLists.txt
│ │ ├── algorithm/
│ │ │ ├── integer_quantizer_test.cc
│ │ │ └── kmeans_test.cc
│ │ ├── buffer/
│ │ │ └── buffer_manager_test.cc
│ │ ├── container/
│ │ │ ├── bitmap_test.cc
│ │ │ ├── blob_test.cc
│ │ │ ├── bloom_filter_test.cc
│ │ │ ├── cube_test.cc
│ │ │ ├── heap_test.cc
│ │ │ ├── hypercube_test.cc
│ │ │ ├── params_test.cc
│ │ │ ├── reservoir_test.cc
│ │ │ ├── vector_array_test.cc
│ │ │ └── vector_test.cc
│ │ ├── encoding/
│ │ │ └── json_parse_test.cc
│ │ ├── hash/
│ │ │ ├── crc32c_test.cc
│ │ │ └── jump_hash_test.cc
│ │ ├── internal/
│ │ │ └── cpu_features_test.cc
│ │ ├── io/
│ │ │ ├── file_lock_test.cc
│ │ │ ├── file_test.cc
│ │ │ └── mmap_file_test.cc
│ │ ├── logger/
│ │ │ └── logger_test.cc
│ │ ├── math/
│ │ │ ├── cosine_distance_matrix_fp16_test.cc
│ │ │ ├── cosine_distance_matrix_fp32_test.cc
│ │ │ ├── cosine_distance_matrix_int8_test.cc
│ │ │ ├── euclidean_distance_matrix_fp16_test.cc
│ │ │ ├── euclidean_distance_matrix_fp32_test.cc
│ │ │ ├── euclidean_distance_matrix_int4_test.cc
│ │ │ ├── euclidean_distance_matrix_int8_test.cc
│ │ │ ├── hamming_distance_matrix_test.cc
│ │ │ ├── inner_product_matrix_fp16_test.cc
│ │ │ ├── inner_product_matrix_fp32_test.cc
│ │ │ ├── inner_product_matrix_int4_test.cc
│ │ │ ├── inner_product_matrix_int8_test.cc
│ │ │ ├── mips_euclidean_distance_matrix_fp16_test.cc
│ │ │ ├── mips_euclidean_distance_matrix_fp32_test.cc
│ │ │ ├── mips_euclidean_distance_matrix_int4_test.cc
│ │ │ ├── mips_euclidean_distance_matrix_int8_test.cc
│ │ │ ├── norm_matrix_fp16_test.cc
│ │ │ ├── norm_matrix_fp32_test.cc
│ │ │ ├── norm_matrix_int4_test.cc
│ │ │ ├── norm_matrix_int8_test.cc
│ │ │ └── normalizer_test.cc
│ │ ├── parallel/
│ │ │ ├── lock_test.cc
│ │ │ ├── multi_thread_list_test.cc
│ │ │ ├── semaphore_test.cc
│ │ │ ├── thread_pool_test.cc
│ │ │ └── thread_queue_test.cc
│ │ ├── pattern/
│ │ │ ├── closure_test.cc
│ │ │ ├── factory_test.cc
│ │ │ ├── scope_guard_test.cc
│ │ │ └── singleton_test.cc
│ │ ├── utility/
│ │ │ ├── bit_string_helper_test.cc
│ │ │ ├── bitset_helper_test.cc
│ │ │ ├── dl_helper_test.cc
│ │ │ ├── float_helper_test.cc
│ │ │ ├── matrix_helper_test.cc
│ │ │ ├── memory_helper_test.cc
│ │ │ ├── string_helper_test.cc
│ │ │ ├── time_helper_test.cc
│ │ │ └── type_helper_test.cc
│ │ └── version_test.cc
│ ├── core/
│ │ ├── CMakeLists.txt
│ │ ├── algorithm/
│ │ │ ├── CMakeLists.txt
│ │ │ ├── cluster/
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ ├── kmeans_cluster_test.cc
│ │ │ │ └── opt_kmeans_cluster_test.cc
│ │ │ ├── flat/
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ ├── flat_builder_test.cc
│ │ │ │ ├── flat_searcher_test.cpp
│ │ │ │ ├── flat_streamer_buffer_test.cc
│ │ │ │ ├── flat_streamer_buffer_time_test.cc
│ │ │ │ └── flat_streamer_test.cc
│ │ │ ├── flat_sparse/
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ ├── flat_sparse_builder_test.cc
│ │ │ │ ├── flat_sparse_searcher_test.cc
│ │ │ │ ├── flat_sparse_streamer_buffer_test.cc
│ │ │ │ └── flat_sparse_streamer_test.cc
│ │ │ ├── hnsw/
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ ├── hnsw_builder_test.cc
│ │ │ │ ├── hnsw_searcher_test.cpp
│ │ │ │ ├── hnsw_streamer_buffer_test.cc
│ │ │ │ └── hnsw_streamer_test.cc
│ │ │ ├── hnsw_rabitq/
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ ├── hnsw_rabitq_builder_test.cc
│ │ │ │ ├── hnsw_rabitq_searcher_test.cc
│ │ │ │ └── hnsw_rabitq_streamer_test.cc
│ │ │ ├── hnsw_sparse/
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ ├── hnsw_sparse_builder_test.cc
│ │ │ │ ├── hnsw_sparse_searcher_test.cpp
│ │ │ │ ├── hnsw_sparse_streamer_buffer_test.cpp
│ │ │ │ └── hnsw_sparse_streamer_test.cc
│ │ │ └── ivf/
│ │ │ ├── CMakeLists.txt
│ │ │ ├── ivf_builder_test.cc
│ │ │ └── ivf_searcher_test.cc
│ │ ├── framework/
│ │ │ └── CMakeLists.txt
│ │ ├── interface/
│ │ │ ├── CMakeLists.txt
│ │ │ └── index_interface_test.cc
│ │ ├── metric/
│ │ │ ├── CMakeLists.txt
│ │ │ ├── cosine_metric_test.cc
│ │ │ ├── euclidean_metric_test.cc
│ │ │ ├── hamming_metric_test.cc
│ │ │ ├── inner_product_metric_test.cc
│ │ │ └── quantized_integer_metric_test.cc
│ │ ├── quantizer/
│ │ │ ├── CMakeLists.txt
│ │ │ ├── half_float_reformer_test.cc
│ │ │ └── integer_quantizer_reformer_test.cc
│ │ └── utility/
│ │ ├── CMakeLists.txt
│ │ ├── buffer_storage_test.cpp
│ │ ├── file_dumper_test.cc
│ │ ├── memory_dumper_test.cc
│ │ ├── mmap_file_container_test.cc
│ │ └── mmap_file_storage_test.cpp
│ └── db/
│ ├── CMakeLists.txt
│ ├── collection_test.cc
│ ├── common/
│ │ ├── CMakeLists.txt
│ │ ├── config_test.cc
│ │ └── status_test.cc
│ ├── crash_recovery/
│ │ ├── CMakeLists.txt
│ │ ├── data_generator.cc
│ │ ├── utility.h
│ │ └── write_recovery_test.cc
│ ├── index/
│ │ ├── CMakeLists.txt
│ │ ├── column/
│ │ │ ├── inverted_column/
│ │ │ │ ├── inverted_column_indexer_array_numbers_test.cc
│ │ │ │ ├── inverted_column_indexer_bool_test.cc
│ │ │ │ ├── inverted_column_indexer_cyclic_numbers_test.cc
│ │ │ │ ├── inverted_column_indexer_sequential_numbers_test.cc
│ │ │ │ ├── inverted_column_indexer_string_test.cc
│ │ │ │ └── inverted_indexer_util_test.cc
│ │ │ └── vector_column_indexer_test.cc
│ │ ├── common/
│ │ │ ├── db_proto_converter_test.cc
│ │ │ ├── db_type_helper_test.cc
│ │ │ ├── doc_test.cc
│ │ │ ├── index_params_test.cc
│ │ │ ├── meta_test.cc
│ │ │ ├── query_params_test.cc
│ │ │ ├── schema_test.cc
│ │ │ └── version_manager_test.cc
│ │ ├── segment/
│ │ │ ├── column_merging_reader_test.cc
│ │ │ ├── segment_helper_test.cc
│ │ │ ├── segment_test.cc
│ │ │ ├── sql_expr_parser_test.cc
│ │ │ └── sql_expr_validator_test.cc
│ │ ├── storage/
│ │ │ ├── arrow_ipc_writer_test.cc
│ │ │ ├── bufferpool_store_test.cc
│ │ │ ├── mem_store_test.cc
│ │ │ ├── mmap_store_test.cc
│ │ │ ├── parquet_writer_test.cc
│ │ │ └── wal_file_test.cc
│ │ └── utils/
│ │ ├── utils.cc
│ │ └── utils.h
│ └── sqlengine/
│ ├── CMakeLists.txt
│ ├── contain_test.cc
│ ├── forward_recall_test.cc
│ ├── invert_recall_test.cc
│ ├── like_test.cc
│ ├── mock_segment.h
│ ├── optimizer_test.cc
│ ├── query_info_test.cc
│ ├── recall_base.h
│ ├── simple_rewriter_test.cc
│ ├── sqlengine_test.cc
│ ├── test_helper.h
│ └── vector_recall_test.cc
├── thirdparty/
│ ├── CMakeLists.txt
│ ├── CRoaring/
│ │ └── CMakeLists.txt
│ ├── RaBitQ-Library/
│ │ └── CMakeLists.txt
│ ├── antlr/
│ │ ├── CMakeLists.txt
│ │ └── antlr4.patch
│ ├── arrow/
│ │ ├── CMakeLists.txt
│ │ ├── arrow.android.patch
│ │ └── arrow.patch
│ ├── gflags/
│ │ └── CMakeLists.txt
│ ├── glog/
│ │ ├── CMakeLists.txt
│ │ ├── glog.android.patch
│ │ └── glog.patch
│ ├── googletest/
│ │ └── CMakeLists.txt
│ ├── lz4/
│ │ └── CMakeLists.txt
│ ├── magic_enum/
│ │ └── CMakeLists.txt
│ ├── protobuf/
│ │ └── CMakeLists.txt
│ ├── rocksdb/
│ │ ├── CMakeLists.txt
│ │ └── rocksdb.android.patch
│ ├── sparsehash/
│ │ ├── CMakeLists.txt
│ │ └── sparseconfig.h
│ └── yaml-cpp/
│ └── CMakeLists.txt
└── tools/
├── CMakeLists.txt
└── core/
├── CMakeLists.txt
├── README.md
├── bench.cc
├── bench_original.cc
├── bench_result.h
├── convert_cohere_parquet.py
├── filter_result_cache.h
├── flow.h
├── helper.h
├── index_meta_helper.h
├── local_builder.cc
├── local_builder_original.cc
├── meta_segment_common.h
├── recall.cc
├── recall_original.cc
├── txt2vecs.cc
├── txt_input_reader.h
├── vecs_common.h
├── vecs_index_holder.h
└── vecs_reader.h
================================================
FILE CONTENTS
================================================
================================================
FILE: .clang-format
================================================
# http://clang.llvm.org/docs/ClangFormatStyleOptions.html
# Defines the Google C++ style for automatic reformatting.
BasedOnStyle: Google
MaxEmptyLinesToKeep: 2
DerivePointerAlignment: false
PointerAlignment: Right
AllowShortFunctionsOnASingleLine: Empty
IncludeBlocks: Merge
IncludeCategories:
- Regex: '^<linux/[0-9A-Za-z]+'
Priority: 100
- Regex: '^<mach/[0-9A-Za-z]+'
Priority: 101
- Regex: '^<mach-o/[0-9A-Za-z]+'
Priority: 102
- Regex: '^<sys/[0-9A-Za-z]+'
Priority: 103
- Regex: '^<[0-9A-Za-z]+\.h>$'
Priority: 200
- Regex: '^<[0-9A-Za-z_]+>$'
Priority: 201
- Regex: '^<[0-9A-Za-z_]+\.[0-9A-Za-z]+>$'
Priority: 202
- Regex: '^<[0-9A-Za-z_]+/[0-9A-Za-z]+'
Priority: 203
- Regex: '^\"[0-9A-Za-z_]+/[0-9A-Za-z]+'
Priority: 300
- Regex: '^\"[0-9A-Za-z_]+\.[0-9A-Za-z]+\"$'
Priority: 301
- Regex: '.*'
Priority: 1000
================================================
FILE: .git/HEAD
================================================
ref: refs/heads/main
================================================
FILE: .git/config
================================================
[core]
repositoryformatversion = 1
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
url = https://github.com/alibaba/zvec
tagOpt = --no-tags
fetch = +refs/heads/main:refs/remotes/origin/main
promisor = true
partialclonefilter = blob:limit=1048576
[branch "main"]
remote = origin
merge = refs/heads/main
================================================
FILE: .git/description
================================================
Unnamed repository; edit this file 'description' to name the repository.
================================================
FILE: .git/hooks/applypatch-msg.sample
================================================
#!/bin/sh
#
# An example hook script to check the commit log message taken by
# applypatch from an e-mail message.
#
# The hook should exit with non-zero status after issuing an
# appropriate message if it wants to stop the commit. The hook is
# allowed to edit the commit message file.
#
# To enable this hook, rename this file to "applypatch-msg".
. git-sh-setup
commitmsg="$(git rev-parse --git-path hooks/commit-msg)"
test -x "$commitmsg" && exec "$commitmsg" ${1+"$@"}
:
================================================
FILE: .git/hooks/commit-msg.sample
================================================
#!/bin/sh
#
# An example hook script to check the commit log message.
# Called by "git commit" with one argument, the name of the file
# that has the commit message. The hook should exit with non-zero
# status after issuing an appropriate message if it wants to stop the
# commit. The hook is allowed to edit the commit message file.
#
# To enable this hook, rename this file to "commit-msg".
# Uncomment the below to add a Signed-off-by line to the message.
# Doing this in a hook is a bad idea in general, but the prepare-commit-msg
# hook is more suited to it.
#
# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"
# This example catches duplicate Signed-off-by lines.
test "" = "$(grep '^Signed-off-by: ' "$1" |
sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || {
echo >&2 Duplicate Signed-off-by lines.
exit 1
}
================================================
FILE: .git/hooks/fsmonitor-watchman.sample
================================================
#!/usr/bin/perl
use strict;
use warnings;
use IPC::Open2;
# An example hook script to integrate Watchman
# (https://facebook.github.io/watchman/) with git to speed up detecting
# new and modified files.
#
# The hook is passed a version (currently 2) and last update token
# formatted as a string and outputs to stdout a new update token and
# all files that have been modified since the update token. Paths must
# be relative to the root of the working tree and separated by a single NUL.
#
# To enable this hook, rename this file to "query-watchman" and set
# 'git config core.fsmonitor .git/hooks/query-watchman'
#
my ($version, $last_update_token) = @ARGV;
# Uncomment for debugging
# print STDERR "$0 $version $last_update_token\n";
# Check the hook interface version
if ($version ne 2) {
die "Unsupported query-fsmonitor hook version '$version'.\n" .
"Falling back to scanning...\n";
}
my $git_work_tree = get_working_dir();
my $retry = 1;
my $json_pkg;
eval {
require JSON::XS;
$json_pkg = "JSON::XS";
1;
} or do {
require JSON::PP;
$json_pkg = "JSON::PP";
};
launch_watchman();
sub launch_watchman {
my $o = watchman_query();
if (is_work_tree_watched($o)) {
output_result($o->{clock}, @{$o->{files}});
}
}
sub output_result {
my ($clockid, @files) = @_;
# Uncomment for debugging watchman output
# open (my $fh, ">", ".git/watchman-output.out");
# binmode $fh, ":utf8";
# print $fh "$clockid\n@files\n";
# close $fh;
binmode STDOUT, ":utf8";
print $clockid;
print "\0";
local $, = "\0";
print @files;
}
sub watchman_clock {
my $response = qx/watchman clock "$git_work_tree"/;
die "Failed to get clock id on '$git_work_tree'.\n" .
"Falling back to scanning...\n" if $? != 0;
return $json_pkg->new->utf8->decode($response);
}
sub watchman_query {
my $pid = open2(\*CHLD_OUT, \*CHLD_IN, 'watchman -j --no-pretty')
or die "open2() failed: $!\n" .
"Falling back to scanning...\n";
# In the query expression below we're asking for names of files that
# changed since $last_update_token but not from the .git folder.
#
# To accomplish this, we're using the "since" generator to use the
# recency index to select candidate nodes and "fields" to limit the
# output to file names only. Then we're using the "expression" term to
# further constrain the results.
my $last_update_line = "";
if (substr($last_update_token, 0, 1) eq "c") {
$last_update_token = "\"$last_update_token\"";
$last_update_line = qq[\n"since": $last_update_token,];
}
my $query = <<" END";
["query", "$git_work_tree", {$last_update_line
"fields": ["name"],
"expression": ["not", ["dirname", ".git"]]
}]
END
# Uncomment for debugging the watchman query
# open (my $fh, ">", ".git/watchman-query.json");
# print $fh $query;
# close $fh;
print CHLD_IN $query;
close CHLD_IN;
my $response = do {local $/; <CHLD_OUT>};
# Uncomment for debugging the watch response
# open ($fh, ">", ".git/watchman-response.json");
# print $fh $response;
# close $fh;
die "Watchman: command returned no output.\n" .
"Falling back to scanning...\n" if $response eq "";
die "Watchman: command returned invalid output: $response\n" .
"Falling back to scanning...\n" unless $response =~ /^\{/;
return $json_pkg->new->utf8->decode($response);
}
sub is_work_tree_watched {
my ($output) = @_;
my $error = $output->{error};
if ($retry > 0 and $error and $error =~ m/unable to resolve root .* directory (.*) is not watched/) {
$retry--;
my $response = qx/watchman watch "$git_work_tree"/;
die "Failed to make watchman watch '$git_work_tree'.\n" .
"Falling back to scanning...\n" if $? != 0;
$output = $json_pkg->new->utf8->decode($response);
$error = $output->{error};
die "Watchman: $error.\n" .
"Falling back to scanning...\n" if $error;
# Uncomment for debugging watchman output
# open (my $fh, ">", ".git/watchman-output.out");
# close $fh;
# Watchman will always return all files on the first query so
# return the fast "everything is dirty" flag to git and do the
# Watchman query just to get it over with now so we won't pay
# the cost in git to look up each individual file.
my $o = watchman_clock();
$error = $output->{error};
die "Watchman: $error.\n" .
"Falling back to scanning...\n" if $error;
output_result($o->{clock}, ("/"));
$last_update_token = $o->{clock};
eval { launch_watchman() };
return 0;
}
die "Watchman: $error.\n" .
"Falling back to scanning...\n" if $error;
return 1;
}
sub get_working_dir {
my $working_dir;
if ($^O =~ 'msys' || $^O =~ 'cygwin') {
$working_dir = Win32::GetCwd();
$working_dir =~ tr/\\/\//;
} else {
require Cwd;
$working_dir = Cwd::cwd();
}
return $working_dir;
}
================================================
FILE: .git/hooks/post-update.sample
================================================
#!/bin/sh
#
# An example hook script to prepare a packed repository for use over
# dumb transports.
#
# To enable this hook, rename this file to "post-update".
exec git update-server-info
================================================
FILE: .git/hooks/pre-applypatch.sample
================================================
#!/bin/sh
#
# An example hook script to verify what is about to be committed
# by applypatch from an e-mail message.
#
# The hook should exit with non-zero status after issuing an
# appropriate message if it wants to stop the commit.
#
# To enable this hook, rename this file to "pre-applypatch".
. git-sh-setup
precommit="$(git rev-parse --git-path hooks/pre-commit)"
test -x "$precommit" && exec "$precommit" ${1+"$@"}
:
================================================
FILE: .git/hooks/pre-commit.sample
================================================
#!/bin/sh
#
# An example hook script to verify what is about to be committed.
# Called by "git commit" with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message if
# it wants to stop the commit.
#
# To enable this hook, rename this file to "pre-commit".
if git rev-parse --verify HEAD >/dev/null 2>&1
then
against=HEAD
else
# Initial commit: diff against an empty tree object
against=$(git hash-object -t tree /dev/null)
fi
# If you want to allow non-ASCII filenames set this variable to true.
allownonascii=$(git config --type=bool hooks.allownonascii)
# Redirect output to stderr.
exec 1>&2
# Cross platform projects tend to avoid non-ASCII filenames; prevent
# them from being added to the repository. We exploit the fact that the
# printable range starts at the space character and ends with tilde.
if [ "$allownonascii" != "true" ] &&
# Note that the use of brackets around a tr range is ok here, (it's
# even required, for portability to Solaris 10's /usr/bin/tr), since
# the square bracket bytes happen to fall in the designated range.
test $(git diff-index --cached --name-only --diff-filter=A -z $against |
LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0
then
cat <<\EOF
Error: Attempt to add a non-ASCII file name.
This can cause problems if you want to work with people on other platforms.
To be portable it is advisable to rename the file.
If you know what you are doing you can disable this check using:
git config hooks.allownonascii true
EOF
exit 1
fi
# If there are whitespace errors, print the offending file names and fail.
exec git diff-index --check --cached $against --
================================================
FILE: .git/hooks/pre-merge-commit.sample
================================================
#!/bin/sh
#
# An example hook script to verify what is about to be committed.
# Called by "git merge" with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message to
# stderr if it wants to stop the merge commit.
#
# To enable this hook, rename this file to "pre-merge-commit".
. git-sh-setup
test -x "$GIT_DIR/hooks/pre-commit" &&
exec "$GIT_DIR/hooks/pre-commit"
:
================================================
FILE: .git/hooks/pre-push.sample
================================================
#!/bin/sh
# An example hook script to verify what is about to be pushed. Called by "git
# push" after it has checked the remote status, but before anything has been
# pushed. If this script exits with a non-zero status nothing will be pushed.
#
# This hook is called with the following parameters:
#
# $1 -- Name of the remote to which the push is being done
# $2 -- URL to which the push is being done
#
# If pushing without using a named remote those arguments will be equal.
#
# Information about the commits which are being pushed is supplied as lines to
# the standard input in the form:
#
# <local ref> <local oid> <remote ref> <remote oid>
#
# This sample shows how to prevent push of commits where the log message starts
# with "WIP" (work in progress).
remote="$1"
url="$2"
zero=$(git hash-object --stdin </dev/null | tr '[0-9a-f]' '0')
while read local_ref local_oid remote_ref remote_oid
do
if test "$local_oid" = "$zero"
then
# Handle delete
:
else
if test "$remote_oid" = "$zero"
then
# New branch, examine all commits
range="$local_oid"
else
# Update to existing branch, examine new commits
range="$remote_oid..$local_oid"
fi
# Check for WIP commit
commit=$(git rev-list -n 1 --grep '^WIP' "$range")
if test -n "$commit"
then
echo >&2 "Found WIP commit in $local_ref, not pushing"
exit 1
fi
fi
done
exit 0
================================================
FILE: .git/hooks/pre-rebase.sample
================================================
#!/bin/sh
#
# Copyright (c) 2006, 2008 Junio C Hamano
#
# The "pre-rebase" hook is run just before "git rebase" starts doing
# its job, and can prevent the command from running by exiting with
# non-zero status.
#
# The hook is called with the following parameters:
#
# $1 -- the upstream the series was forked from.
# $2 -- the branch being rebased (or empty when rebasing the current branch).
#
# This sample shows how to prevent topic branches that are already
# merged to 'next' branch from getting rebased, because allowing it
# would result in rebasing already published history.
publish=next
basebranch="$1"
if test "$#" = 2
then
topic="refs/heads/$2"
else
topic=`git symbolic-ref HEAD` ||
exit 0 ;# we do not interrupt rebasing detached HEAD
fi
case "$topic" in
refs/heads/??/*)
;;
*)
exit 0 ;# we do not interrupt others.
;;
esac
# Now we are dealing with a topic branch being rebased
# on top of master. Is it OK to rebase it?
# Does the topic really exist?
git show-ref -q "$topic" || {
echo >&2 "No such branch $topic"
exit 1
}
# Is topic fully merged to master?
not_in_master=`git rev-list --pretty=oneline ^master "$topic"`
if test -z "$not_in_master"
then
echo >&2 "$topic is fully merged to master; better remove it."
exit 1 ;# we could allow it, but there is no point.
fi
# Is topic ever merged to next? If so you should not be rebasing it.
only_next_1=`git rev-list ^master "^$topic" ${publish} | sort`
only_next_2=`git rev-list ^master ${publish} | sort`
if test "$only_next_1" = "$only_next_2"
then
not_in_topic=`git rev-list "^$topic" master`
if test -z "$not_in_topic"
then
echo >&2 "$topic is already up to date with master"
exit 1 ;# we could allow it, but there is no point.
else
exit 0
fi
else
not_in_next=`git rev-list --pretty=oneline ^${publish} "$topic"`
/usr/bin/perl -e '
my $topic = $ARGV[0];
my $msg = "* $topic has commits already merged to public branch:\n";
my (%not_in_next) = map {
/^([0-9a-f]+) /;
($1 => 1);
} split(/\n/, $ARGV[1]);
for my $elem (map {
/^([0-9a-f]+) (.*)$/;
[$1 => $2];
} split(/\n/, $ARGV[2])) {
if (!exists $not_in_next{$elem->[0]}) {
if ($msg) {
print STDERR $msg;
undef $msg;
}
print STDERR " $elem->[1]\n";
}
}
' "$topic" "$not_in_next" "$not_in_master"
exit 1
fi
<<\DOC_END
This sample hook safeguards topic branches that have been
published from being rewound.
The workflow assumed here is:
* Once a topic branch forks from "master", "master" is never
merged into it again (either directly or indirectly).
* Once a topic branch is fully cooked and merged into "master",
it is deleted. If you need to build on top of it to correct
earlier mistakes, a new topic branch is created by forking at
the tip of the "master". This is not strictly necessary, but
it makes it easier to keep your history simple.
* Whenever you need to test or publish your changes to topic
branches, merge them into "next" branch.
The script, being an example, hardcodes the publish branch name
to be "next", but it is trivial to make it configurable via
$GIT_DIR/config mechanism.
With this workflow, you would want to know:
(1) ... if a topic branch has ever been merged to "next". Young
topic branches can have stupid mistakes you would rather
clean up before publishing, and things that have not been
merged into other branches can be easily rebased without
affecting other people. But once it is published, you would
not want to rewind it.
(2) ... if a topic branch has been fully merged to "master".
Then you can delete it. More importantly, you should not
build on top of it -- other people may already want to
change things related to the topic as patches against your
"master", so if you need further changes, it is better to
fork the topic (perhaps with the same name) afresh from the
tip of "master".
Let's look at this example:
o---o---o---o---o---o---o---o---o---o "next"
/ / / /
/ a---a---b A / /
/ / / /
/ / c---c---c---c B /
/ / / \ /
/ / / b---b C \ /
/ / / / \ /
---o---o---o---o---o---o---o---o---o---o---o "master"
A, B and C are topic branches.
* A has one fix since it was merged up to "next".
* B has finished. It has been fully merged up to "master" and "next",
and is ready to be deleted.
* C has not merged to "next" at all.
We would want to allow C to be rebased, refuse A, and encourage
B to be deleted.
To compute (1):
git rev-list ^master ^topic next
git rev-list ^master next
if these match, topic has not merged in next at all.
To compute (2):
git rev-list master..topic
if this is empty, it is fully merged to "master".
DOC_END
================================================
FILE: .git/hooks/pre-receive.sample
================================================
#!/bin/sh
#
# An example hook script to make use of push options.
# The example simply echoes all push options that start with 'echoback='
# and rejects all pushes when the "reject" push option is used.
#
# To enable this hook, rename this file to "pre-receive".
if test -n "$GIT_PUSH_OPTION_COUNT"
then
i=0
while test "$i" -lt "$GIT_PUSH_OPTION_COUNT"
do
eval "value=\$GIT_PUSH_OPTION_$i"
case "$value" in
echoback=*)
echo "echo from the pre-receive-hook: ${value#*=}" >&2
;;
reject)
exit 1
esac
i=$((i + 1))
done
fi
================================================
FILE: .git/hooks/prepare-commit-msg.sample
================================================
#!/bin/sh
#
# An example hook script to prepare the commit log message.
# Called by "git commit" with the name of the file that has the
# commit message, followed by the description of the commit
# message's source. The hook's purpose is to edit the commit
# message file. If the hook fails with a non-zero status,
# the commit is aborted.
#
# To enable this hook, rename this file to "prepare-commit-msg".
# This hook includes three examples. The first one removes the
# "# Please enter the commit message..." help message.
#
# The second includes the output of "git diff --name-status -r"
# into the message, just before the "git status" output. It is
# commented because it doesn't cope with --amend or with squashed
# commits.
#
# The third example adds a Signed-off-by line to the message, that can
# still be edited. This is rarely a good idea.
COMMIT_MSG_FILE=$1
COMMIT_SOURCE=$2
SHA1=$3
/usr/bin/perl -i.bak -ne 'print unless(m/^. Please enter the commit message/..m/^#$/)' "$COMMIT_MSG_FILE"
# case "$COMMIT_SOURCE,$SHA1" in
# ,|template,)
# /usr/bin/perl -i.bak -pe '
# print "\n" . `git diff --cached --name-status -r`
# if /^#/ && $first++ == 0' "$COMMIT_MSG_FILE" ;;
# *) ;;
# esac
# SOB=$(git var GIT_COMMITTER_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
# git interpret-trailers --in-place --trailer "$SOB" "$COMMIT_MSG_FILE"
# if test -z "$COMMIT_SOURCE"
# then
# /usr/bin/perl -i.bak -pe 'print "\n" if !$first_line++' "$COMMIT_MSG_FILE"
# fi
================================================
FILE: .git/hooks/push-to-checkout.sample
================================================
#!/bin/sh
# An example hook script to update a checked-out tree on a git push.
#
# This hook is invoked by git-receive-pack(1) when it reacts to git
# push and updates reference(s) in its repository, and when the push
# tries to update the branch that is currently checked out and the
# receive.denyCurrentBranch configuration variable is set to
# updateInstead.
#
# By default, such a push is refused if the working tree and the index
# of the remote repository has any difference from the currently
# checked out commit; when both the working tree and the index match
# the current commit, they are updated to match the newly pushed tip
# of the branch. This hook is to be used to override the default
# behaviour; however the code below reimplements the default behaviour
# as a starting point for convenient modification.
#
# The hook receives the commit with which the tip of the current
# branch is going to be updated:
commit=$1
# It can exit with a non-zero status to refuse the push (when it does
# so, it must not modify the index or the working tree).
die () {
echo >&2 "$*"
exit 1
}
# Or it can make any necessary changes to the working tree and to the
# index to bring them to the desired state when the tip of the current
# branch is updated to the new commit, and exit with a zero status.
#
# For example, the hook can simply run git read-tree -u -m HEAD "$1"
# in order to emulate git fetch that is run in the reverse direction
# with git push, as the two-tree form of git read-tree -u -m is
# essentially the same as git switch or git checkout that switches
# branches while keeping the local changes in the working tree that do
# not interfere with the difference between the branches.
# The below is a more-or-less exact translation to shell of the C code
# for the default behaviour for git's push-to-checkout hook defined in
# the push_to_deploy() function in builtin/receive-pack.c.
#
# Note that the hook will be executed from the repository directory,
# not from the working tree, so if you want to perform operations on
# the working tree, you will have to adapt your code accordingly, e.g.
# by adding "cd .." or using relative paths.
if ! git update-index -q --ignore-submodules --refresh
then
die "Up-to-date check failed"
fi
if ! git diff-files --quiet --ignore-submodules --
then
die "Working directory has unstaged changes"
fi
# This is a rough translation of:
#
# head_has_history() ? "HEAD" : EMPTY_TREE_SHA1_HEX
if git cat-file -e HEAD 2>/dev/null
then
head=HEAD
else
head=$(git hash-object -t tree --stdin </dev/null)
fi
if ! git diff-index --quiet --cached --ignore-submodules $head --
then
die "Working directory has staged changes"
fi
if ! git read-tree -u -m "$commit"
then
die "Could not update working tree to new HEAD"
fi
================================================
FILE: .git/hooks/sendemail-validate.sample
================================================
#!/bin/sh
# An example hook script to validate a patch (and/or patch series) before
# sending it via email.
#
# The hook should exit with non-zero status after issuing an appropriate
# message if it wants to prevent the email(s) from being sent.
#
# To enable this hook, rename this file to "sendemail-validate".
#
# By default, it will only check that the patch(es) can be applied on top of
# the default upstream branch without conflicts in a secondary worktree. After
# validation (successful or not) of the last patch of a series, the worktree
# will be deleted.
#
# The following config variables can be set to change the default remote and
# remote ref that are used to apply the patches against:
#
# sendemail.validateRemote (default: origin)
# sendemail.validateRemoteRef (default: HEAD)
#
# Replace the TODO placeholders with appropriate checks according to your
# needs.
validate_cover_letter () {
file="$1"
# TODO: Replace with appropriate checks (e.g. spell checking).
true
}
validate_patch () {
file="$1"
# Ensure that the patch applies without conflicts.
git am -3 "$file" || return
# TODO: Replace with appropriate checks for this patch
# (e.g. checkpatch.pl).
true
}
validate_series () {
# TODO: Replace with appropriate checks for the whole series
# (e.g. quick build, coding style checks, etc.).
true
}
# main -------------------------------------------------------------------------
if test "$GIT_SENDEMAIL_FILE_COUNTER" = 1
then
remote=$(git config --default origin --get sendemail.validateRemote) &&
ref=$(git config --default HEAD --get sendemail.validateRemoteRef) &&
worktree=$(mktemp --tmpdir -d sendemail-validate.XXXXXXX) &&
git worktree add -fd --checkout "$worktree" "refs/remotes/$remote/$ref" &&
git config --replace-all sendemail.validateWorktree "$worktree"
else
worktree=$(git config --get sendemail.validateWorktree)
fi || {
echo "sendemail-validate: error: failed to prepare worktree" >&2
exit 1
}
unset GIT_DIR GIT_WORK_TREE
cd "$worktree" &&
if grep -q "^diff --git " "$1"
then
validate_patch "$1"
else
validate_cover_letter "$1"
fi &&
if test "$GIT_SENDEMAIL_FILE_COUNTER" = "$GIT_SENDEMAIL_FILE_TOTAL"
then
git config --unset-all sendemail.validateWorktree &&
trap 'git worktree remove -ff "$worktree"' EXIT &&
validate_series
fi
================================================
FILE: .git/hooks/update.sample
================================================
#!/bin/sh
#
# An example hook script to block unannotated tags from entering.
# Called by "git receive-pack" with arguments: refname sha1-old sha1-new
#
# To enable this hook, rename this file to "update".
#
# Config
# ------
# hooks.allowunannotated
# This boolean sets whether unannotated tags will be allowed into the
# repository. By default they won't be.
# hooks.allowdeletetag
# This boolean sets whether deleting tags will be allowed in the
# repository. By default they won't be.
# hooks.allowmodifytag
# This boolean sets whether a tag may be modified after creation. By default
# it won't be.
# hooks.allowdeletebranch
# This boolean sets whether deleting branches will be allowed in the
# repository. By default they won't be.
# hooks.denycreatebranch
# This boolean sets whether remotely creating branches will be denied
# in the repository. By default this is allowed.
#
# --- Command line
refname="$1"
oldrev="$2"
newrev="$3"
# --- Safety check
if [ -z "$GIT_DIR" ]; then
echo "Don't run this script from the command line." >&2
echo " (if you want, you could supply GIT_DIR then run" >&2
echo " $0 <ref> <oldrev> <newrev>)" >&2
exit 1
fi
if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then
echo "usage: $0 <ref> <oldrev> <newrev>" >&2
exit 1
fi
# --- Config
allowunannotated=$(git config --type=bool hooks.allowunannotated)
allowdeletebranch=$(git config --type=bool hooks.allowdeletebranch)
denycreatebranch=$(git config --type=bool hooks.denycreatebranch)
allowdeletetag=$(git config --type=bool hooks.allowdeletetag)
allowmodifytag=$(git config --type=bool hooks.allowmodifytag)
# check for no description
projectdesc=$(sed -e '1q' "$GIT_DIR/description")
case "$projectdesc" in
"Unnamed repository"* | "")
echo "*** Project description file hasn't been set" >&2
exit 1
;;
esac
# --- Check types
# if $newrev is 0000...0000, it's a commit to delete a ref.
zero=$(git hash-object --stdin </dev/null | tr '[0-9a-f]' '0')
if [ "$newrev" = "$zero" ]; then
newrev_type=delete
else
newrev_type=$(git cat-file -t $newrev)
fi
case "$refname","$newrev_type" in
refs/tags/*,commit)
# un-annotated tag
short_refname=${refname##refs/tags/}
if [ "$allowunannotated" != "true" ]; then
echo "*** The un-annotated tag, $short_refname, is not allowed in this repository" >&2
echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2
exit 1
fi
;;
refs/tags/*,delete)
# delete tag
if [ "$allowdeletetag" != "true" ]; then
echo "*** Deleting a tag is not allowed in this repository" >&2
exit 1
fi
;;
refs/tags/*,tag)
# annotated tag
if [ "$allowmodifytag" != "true" ] && git rev-parse $refname > /dev/null 2>&1
then
echo "*** Tag '$refname' already exists." >&2
echo "*** Modifying a tag is not allowed in this repository." >&2
exit 1
fi
;;
refs/heads/*,commit)
# branch
if [ "$oldrev" = "$zero" -a "$denycreatebranch" = "true" ]; then
echo "*** Creating a branch is not allowed in this repository" >&2
exit 1
fi
;;
refs/heads/*,delete)
# delete branch
if [ "$allowdeletebranch" != "true" ]; then
echo "*** Deleting a branch is not allowed in this repository" >&2
exit 1
fi
;;
refs/remotes/*,commit)
# tracking branch
;;
refs/remotes/*,delete)
# delete tracking branch
if [ "$allowdeletebranch" != "true" ]; then
echo "*** Deleting a tracking branch is not allowed in this repository" >&2
exit 1
fi
;;
*)
# Anything else (is there anything else?)
echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2
exit 1
;;
esac
# --- Finished
exit 0
================================================
FILE: .git/info/exclude
================================================
# git ls-files --others --exclude-from=.git/info/exclude
# Lines that start with '#' are comments.
# For a project mostly in C, the following would be a good set of
# exclude patterns (uncomment them if you want to use them):
# *.[oa]
# *~
================================================
FILE: .git/logs/HEAD
================================================
0000000000000000000000000000000000000000 b49833bf56a0e102b8ac1ff95ed7766545f5bd1e appuser <appuser@6f4aff7aca96.(none)> 1774064477 +0000 clone: from https://github.com/alibaba/zvec
================================================
FILE: .git/logs/refs/heads/main
================================================
0000000000000000000000000000000000000000 b49833bf56a0e102b8ac1ff95ed7766545f5bd1e appuser <appuser@6f4aff7aca96.(none)> 1774064477 +0000 clone: from https://github.com/alibaba/zvec
================================================
FILE: .git/logs/refs/remotes/origin/HEAD
================================================
0000000000000000000000000000000000000000 b49833bf56a0e102b8ac1ff95ed7766545f5bd1e appuser <appuser@6f4aff7aca96.(none)> 1774064477 +0000 clone: from https://github.com/alibaba/zvec
================================================
FILE: .git/objects/pack/pack-2b5e15ebe928a592991dc24c7ae7e8dc9e3500dc.promisor
================================================
b49833bf56a0e102b8ac1ff95ed7766545f5bd1e refs/heads/main
================================================
FILE: .git/packed-refs
================================================
# pack-refs with: peeled fully-peeled sorted
b49833bf56a0e102b8ac1ff95ed7766545f5bd1e refs/remotes/origin/main
================================================
FILE: .git/refs/heads/main
================================================
b49833bf56a0e102b8ac1ff95ed7766545f5bd1e
================================================
FILE: .git/refs/remotes/origin/HEAD
================================================
ref: refs/remotes/origin/main
================================================
FILE: .git/shallow
================================================
b49833bf56a0e102b8ac1ff95ed7766545f5bd1e
================================================
FILE: .github/ISSUE_TEMPLATE/benchmark.yml
================================================
name: Benchmarking
description: Add, update, or fix benchmark cases for zvec
title: "[Benchmark]: "
labels: ["benchmark"]
body:
- type: markdown
attributes:
value: |
Use this for benchmark-related work: new test cases, CI integration, or performance regression tracking.
- type: input
id: benchmark_type
attributes:
label: Benchmark Type
description: e.g., filtered search, batch insert, recall@k, ARM64 vs x86
validations:
required: true
- type: textarea
id: goal
attributes:
label: Goal
description: What performance aspect are you measuring or improving?
validations:
required: true
- type: textarea
id: methodology
attributes:
label: Methodology
description: Dataset, query size, hardware, metrics (latency, throughput, memory)
validations:
required: true
- type: textarea
id: baseline
attributes:
label: Baseline (if applicable)
description: Current performance numbers or competing systems for comparison.
validations:
required: false
- type: textarea
id: ci_integration
attributes:
label: CI Integration Plan
description: Should this run in CI? How often?
validations:
required: false
================================================
FILE: .github/ISSUE_TEMPLATE/bug_report.yml
================================================
name: Bug Report
description: Report a bug or unexpected behavior (e.g., crash, incorrect vector query, memory leak)
title: "[Bug]: "
labels: ["bug", "triage"]
body:
- type: markdown
attributes:
value: |
Thank you for reporting! Please provide detailed info so we can reproduce and fix it quickly.
- type: textarea
id: description
attributes:
label: Description
description: What happened? What did you expect?
placeholder: |
e.g. "Query with vector field crashes when using Zvec Python API"
validations:
required: true
- type: textarea
id: steps_to_reproduce
attributes:
label: Steps to Reproduce
description: Exact steps to trigger the issue (code snippets welcome)
placeholder: |
1. Build Zvec with CMake (Debug/Release)
2. Run Python script: `python test.py`
3. Call `collection.query(VectorQuery())`
4. Process segfaults / hangs / returns wrong results
render: python
validations:
required: true
- type: textarea
id: logs_or_trace
attributes:
label: Logs / Stack Trace
description: Paste relevant logs, LLDB/GDB backtrace, or CI failures
placeholder: |
Thread 1 "python" received signal SIGSEGV, Segmentation fault.
0x0000000104a2c3f0 in std::__1::shared_ptr<...>::...
render: shell
validations:
required: false
- type: input
id: os
attributes:
label: Operating System
placeholder: macOS 14 (M1), Ubuntu 22.04, Windows 11 (WSL2)
validations:
required: true
- type: input
id: build_env
attributes:
label: Build & Runtime Environment
description: Compiler, CMake, Python, key dependencies
placeholder: |
clang 15.0.0, CMake 4.1.2, Python 3.11.9, magic_enum v0.9.7 (via git submodule)
validations:
required: true
- type: checkboxes
id: additional_context
attributes:
label: Additional Context
options:
- label: I've checked `git status` — no uncommitted submodule changes
- label: I built with `CMAKE_BUILD_TYPE=Debug`
- label: This occurs with or without `COVERAGE=ON`
- label: The issue involves Python ↔ C++ integration (pybind11)
================================================
FILE: .github/ISSUE_TEMPLATE/config.yml
================================================
blank_issues_enabled: false
contact_links:
- name: Documentation
url: https://zvec.org/en/
about: Check the quickstart, build guide, and API docs first.
- name: Python API Examples
url: https://zvec.org/en/docs/quickstart/
about: See working usage examples.
================================================
FILE: .github/ISSUE_TEMPLATE/enhancement.yml
================================================
name: Enhancement
description: Improve an existing feature or component
title: "[Enhance]: "
labels: ["enhancement"]
body:
- type: markdown
attributes:
value: |
This template is for improving existing functionality (e.g., performance, usability, robustness).
- type: input
id: component
attributes:
label: Affected Component
description: e.g., HNSW index, buffer manager, Python API
validations:
required: true
- type: textarea
id: current
attributes:
label: Current Behavior
description: What is the current state and its limitations?
validations:
required: true
- type: textarea
id: desired
attributes:
label: Desired Improvement
description: What should be improved and how?
validations:
required: true
- type: textarea
id: impact
attributes:
label: Impact
description: How will this benefit users? (e.g., faster queries, lower memory, easier integration)
validations:
required: true
================================================
FILE: .github/ISSUE_TEMPLATE/feature_request.yml
================================================
name: Feature Request
description: Suggest a new feature or improvement (e.g., better memory control, new query option)
title: "[Feature]: "
labels: ["feature"]
body:
- type: markdown
attributes:
value: |
Thanks for your idea! Help us understand the motivation and scope.
- type: textarea
id: problem_or_motivation
attributes:
label: Problem / Motivation
description: What problem does this solve? Why is it needed?
placeholder: |
e.g. "Current vector queries don't allow filtering by metadata + distance threshold at once"
validations:
required: true
- type: textarea
id: proposed_solution
attributes:
label: Proposed Solution
description: How should it work? API sketch or pseudocode welcome.
placeholder: |
Add `filter=` and `max_distance=` args to `Zvec.query()`:
```python
results = db.query(vector, filter="category == 'A'", max_distance=0.5)
```
render: python
validations:
required: false
- type: textarea
id: alternatives
attributes:
label: Alternatives Considered
description: Are there workarounds? Why not use them?
validations:
required: false
- type: dropdown
id: impact_area
attributes:
label: Affected Area
multiple: true
options:
- label: C++ Core (storage, indexing)
- label: Python API / Bindings
- label: Build System (CMake, Homebrew pkg)
- label: Testing / CI / Coverage
- label: Documentation
validations:
required: false
================================================
FILE: .github/ISSUE_TEMPLATE/integration.yml
================================================
name: Ecosystem Integration
description: Integrate zvec with external frameworks (e.g., LangChain, LlamaIndex)
title: "[Integration]: "
labels: ["integration"]
body:
- type: input
id: framework
attributes:
label: Target Framework
description: e.g., LangChain, LlamaIndex, Haystack
validations:
required: true
- type: textarea
id: motivation
attributes:
label: Motivation
description: Why integrate with this framework? Who benefits?
validations:
required: true
- type: textarea
id: interface
attributes:
label: Required Interface
description: What adapter or interface must be implemented? (e.g., VectorStore base class)
validations:
required: true
- type: textarea
id: reference
attributes:
label: Reference Implementations
description: Links to similar integrations in other vector DBs.
validations:
required: false
================================================
FILE: .github/ISSUE_TEMPLATE/profiling.yml
================================================
name: Profiling / Investigation
description: Profile performance, compatibility, or behavior in a specific scenario
title: "[Profile]: "
labels: ["profile"]
body:
- type: markdown
attributes:
value: |
Use this for tasks like performance profiling, architecture compatibility checks, or feasibility studies.
- type: input
id: scenario
attributes:
label: Target Scenario
description: e.g., ARM64 deployment, high-concurrency load, large dataset ingestion
validations:
required: true
- type: textarea
id: objective
attributes:
label: Objective
description: What do you want to learn or validate?
validations:
required: true
- type: textarea
id: methodology
attributes:
label: Proposed Methodology
description: How will you conduct the investigation? (tools, metrics, test data)
validations:
required: true
- type: textarea
id: expected_outcome
attributes:
label: Expected Outcome
description: What deliverables are expected? (e.g., report, optimization PR, benchmark results)
validations:
required: true
================================================
FILE: .github/codecov.yml
================================================
codecov:
require_ci_to_pass: true
coverage:
precision: 2
round: down
range: "60...75"
status:
project:
default: false
patch:
default: false
parsers:
gcov:
branch_detection:
conditional: true
loop: true
method: false
macro: false
comment:
require_changes: false
layout: "reach,diff,flags,tree"
behavior: default
ignore:
- "thirdparty/"
- "tests/"
================================================
FILE: .github/dependabot.yml
================================================
version: 2
updates:
# GitHub Actions dependencies
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
day: "monday"
time: "02:00"
timezone: "Asia/Shanghai"
labels:
- "dependencies"
- "github-actions"
commit-message:
prefix: "ci"
include: "scope"
open-pull-requests-limit: 5
================================================
FILE: .github/workflows/01-ci-pipeline.yml
================================================
name: Main
on:
push:
branches: [ "main" ]
paths-ignore:
- '**.md'
merge_group:
pull_request:
branches: [ "main" ]
paths-ignore:
- '**.md'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref || '' }}-${{ github.base_ref || '' }}-${{ github.ref != 'refs/heads/main' || github.sha }}
cancel-in-progress: true
permissions:
contents: read
jobs:
# Code quality checks (fast, run first)
lint:
uses: ./.github/workflows/02-lint-check.yml
# Main build and test matrix
build-and-test-macos-arm64:
name: Build & Test (macos-arm64)
needs: lint
uses: ./.github/workflows/03-macos-linux-build.yml
with:
platform: macos-arm64
os: macos-15
build-and-test-linux-arm64:
name: Build & Test (linux-arm64)
needs: lint
uses: ./.github/workflows/03-macos-linux-build.yml
with:
platform: linux-arm64
os: ubuntu-24.04-arm
build-and-test-linux-x64:
name: Build & Test (linux-x64)
needs: lint
uses: ./.github/workflows/03-macos-linux-build.yml
with:
platform: linux-x64
os: ubuntu-24.04
build-android:
name: Build & Test (android)
needs: lint
uses: ./.github/workflows/04-android-build.yml
================================================
FILE: .github/workflows/02-lint-check.yml
================================================
name: Lint
on:
workflow_call:
jobs:
lint:
name: Code Quality Checks
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.10'
cache: 'pip'
cache-dependency-path: 'pyproject.toml'
- name: Install linting tools
run: |
python -m pip install --upgrade pip \
ruff==v0.14.4 \
clang-format==18.1.8
shell: bash
- name: Run Ruff Linter
run: python -m ruff check .
shell: bash
- name: Run Ruff Formatter Check
run: python -m ruff format --check .
shell: bash
- name: Run clang-format Check
run: |
CPP_FILES=$(find . -type f \( -name "*.cpp" -o -name "*.h" -o -name "*.hpp" -o -name "*.cc" -o -name "*.cxx" \) \
! -path "./build/*" \
! -path "./tests/*" \
! -path "./scripts/*" \
! -path "./python/*" \
! -path "./thirdparty/*" \
! -path "./.git/*")
if [ -z "$CPP_FILES" ]; then
echo "No C++ files found to check."
exit 0
fi
clang-format --dry-run --Werror $CPP_FILES
shell: bash
================================================
FILE: .github/workflows/03-macos-linux-build.yml
================================================
name: MacOS & Linux Build
on:
workflow_call:
inputs:
platform:
description: 'Platform identifier'
required: true
type: string
os:
description: 'GitHub Actions runner OS'
required: true
type: string
permissions:
contents: read
jobs:
# Build and test matrix (parallel execution)
build-and-test:
name: Build & Test (${{ inputs.platform }})
runs-on: ${{ inputs.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ${{ inputs.os }}
platform: ${{ inputs.platform }}
arch_flag: "" # Use appropriate architecture
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
submodules: recursive
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.10'
cache: 'pip'
cache-dependency-path: 'pyproject.toml'
- name: Set up environment variables
run: |
# Set number of processors for parallel builds
if [[ "${{ matrix.platform }}" == "macos-arm64" ]]; then
NPROC=$(sysctl -n hw.ncpu 2>/dev/null || echo 2)
else
NPROC=$(nproc 2>/dev/null || echo 2)
fi
echo "NPROC=$NPROC" >> $GITHUB_ENV
echo "Using $NPROC parallel jobs for builds"
# Add Python user base bin to PATH for pip-installed CLI tools
echo "$(python -c 'import site; print(site.USER_BASE)')/bin" >> $GITHUB_PATH
shell: bash
- name: Install dependencies
run: |
python -m pip install --upgrade pip \
pybind11==3.0 \
cmake==3.30.0 \
ninja==1.11.1 \
pytest \
scikit-build-core \
setuptools_scm
shell: bash
- name: Build from source
run: |
cd "$GITHUB_WORKSPACE"
CMAKE_GENERATOR="Unix Makefiles" \
CMAKE_BUILD_PARALLEL_LEVEL="$NPROC" \
python -m pip install -v . \
--no-build-isolation \
--config-settings='cmake.define.BUILD_TOOLS="ON"' \
${{ matrix.arch_flag }}
shell: bash
- name: Run C++ Tests
run: |
cd "$GITHUB_WORKSPACE/build"
make unittest -j$NPROC
shell: bash
- name: Run Python Tests
run: |
cd "$GITHUB_WORKSPACE"
python -m pytest python/tests/
shell: bash
- name: Run C++ Examples
run: |
cd "$GITHUB_WORKSPACE/examples/c++"
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make -j $NPROC
./db-example
./core-example
./ailego-example
shell: bash
================================================
FILE: .github/workflows/04-android-build.yml
================================================
name: Android Cross Build
on:
workflow_call:
permissions:
contents: read
jobs:
build-android:
# sdkmanager and other Android tools are x86‑only; ARM runners fail with exit code 1
# switch back to an x86 image so the setup-android action can install the SDK
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
abi: [x86_64]
api: [21]
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Cache dependencies
uses: actions/cache@v5
with:
path: |
~/.ccache
key: ${{ runner.os }}-dependencies-cache-${{ hashFiles('**/CMakeLists.txt', 'thirdparty/**') }}-stl-fix
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
cmake ninja-build git ca-certificates python3 \
build-essential make ccache
- name: Setup Java 17
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: '17'
- name: Setup Android SDK
uses: android-actions/setup-android@v3
- name: Install NDK (side by side)
shell: bash
run: |
sdkmanager "ndk;26.1.10909125"
- name: Cache host protoc build
uses: actions/cache@v5
with:
path: build-host
key: ${{ runner.os }}-host-protoc-${{ hashFiles('src/**', 'CMakeLists.txt') }}-stl-fix
restore-keys: |
${{ runner.os }}-host-protoc-
- name: Use host env to compile protoc
shell: bash
run: |
git submodule update --init
if [ ! -d "build-host" ]; then
export CCACHE_BASEDIR="$GITHUB_WORKSPACE"
export CCACHE_NOHASHDIR=1
export CCACHE_SLOPPINESS=clang_index_store,file_stat_matches,include_file_mtime,locale,time_macros
cmake -S . -B build-host -G Ninja \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
cmake --build build-host --target protoc --parallel
else
echo "Using cached host protoc build"
fi
- name: Cache Android build
uses: actions/cache@v5
with:
path: build-android-${{ matrix.abi }}
key: ${{ runner.os }}-android-build-${{ matrix.abi }}-${{ hashFiles('src/**', 'CMakeLists.txt', 'cmake/**', 'thirdparty/**') }}-stl-fix-3
- name: Configure and Build
shell: bash
run: |
git submodule foreach --recursive 'git stash --include-untracked'
export ANDROID_SDK_ROOT="$ANDROID_HOME"
export ANDROID_NDK_HOME="$ANDROID_SDK_ROOT/ndk/26.1.10909125"
export CCACHE_BASEDIR="$GITHUB_WORKSPACE"
export CCACHE_NOHASHDIR=1
export CCACHE_SLOPPINESS=clang_index_store,file_stat_matches,include_file_mtime,locale,time_macros
if [ ! -d "build-android-${{ matrix.abi }}" ]; then
cmake -S . -B build-android-${{ matrix.abi }} -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_TOOLCHAIN_FILE="$ANDROID_NDK_HOME/build/cmake/android.toolchain.cmake" \
-DANDROID_ABI=${{ matrix.abi }} \
-DANDROID_PLATFORM=android-${{ matrix.api }} \
-DANDROID_STL=c++_static \
-DBUILD_PYTHON_BINDINGS=OFF \
-DENABLE_NATIVE=OFF \
-DAUTO_DETECT_ARCH=OFF \
-DBUILD_TOOLS=OFF \
-DGLOBAL_CC_PROTOBUF_PROTOC="$GITHUB_WORKSPACE/build-host/bin/protoc" \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_VERBOSE_MAKEFILE=ON
cmake --build build-android-${{ matrix.abi }} --parallel --verbose
else
echo "Using cached Android build directory"
fi
- name: Cache examples build
uses: actions/cache@v5
with:
path: examples/c++/build-android-examples-${{ matrix.abi }}
key: ${{ runner.os }}-examples-build-${{ matrix.abi }}-${{ hashFiles('examples/c++/**', 'CMakeLists.txt', 'src/**') }}-stl-fix-3
- name: Build examples
shell: bash
run: |
export ANDROID_SDK_ROOT="$ANDROID_HOME"
export ANDROID_NDK_HOME="$ANDROID_SDK_ROOT/ndk/26.1.10909125"
if [ ! -d "examples/c++/build-android-examples-${{ matrix.abi }}" ]; then
cmake -S examples/c++ -B examples/c++/build-android-examples-${{ matrix.abi }} -G Ninja \
-DCMAKE_TOOLCHAIN_FILE="$ANDROID_NDK_HOME/build/cmake/android.toolchain.cmake" \
-DANDROID_ABI=${{ matrix.abi }} \
-DANDROID_PLATFORM=android-${{ matrix.api }} \
-DANDROID_STL=c++_static \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON \
-DHOST_BUILD_DIR="build-android-${{ matrix.abi }}" \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
cmake --build examples/c++/build-android-examples-${{ matrix.abi }} --parallel
else
echo "Using cached examples build"
fi
- name: Run on Android emulator (arm64) and verify
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api }}
arch: ${{ matrix.abi }}
# target: google_apis
# emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -netdelay none -netspeed full
# disable-animations: true
script: |
adb wait-for-device
echo "Device ABI:"
adb shell getprop ro.product.cpu.abi
adb shell getprop ro.product.cpu.abilist
echo "=== CPU ISA / Instruction Set Support ==="
echo "--- /proc/cpuinfo flags ---"
adb shell 'cat /proc/cpuinfo | grep -E "^(Features|flags)"'
echo "Checking binary sizes:"
ls -lah examples/c++/build-android-examples-${{ matrix.abi }}/
# Push executables to device
adb push examples/c++/build-android-examples-${{ matrix.abi }}/ailego-example /data/local/tmp/
adb push examples/c++/build-android-examples-${{ matrix.abi }}/core-example /data/local/tmp/
adb push examples/c++/build-android-examples-${{ matrix.abi }}/db-example /data/local/tmp/
adb shell chmod 755 /data/local/tmp/ailego-example
adb shell chmod 755 /data/local/tmp/core-example
adb shell chmod 755 /data/local/tmp/db-example
echo "File info on device:"
adb shell ls -la /data/local/tmp/ailego-example
adb shell ls -la /data/local/tmp/core-example
adb shell ls -la /data/local/tmp/db-example
echo "Running ailego example:"
adb shell 'cd /data/local/tmp && ./ailego-example'
echo "Running core example:"
adb shell 'cd /data/local/tmp && ./core-example'
echo "Running db example:"
adb shell 'cd /data/local/tmp && ./db-example'
================================================
FILE: .github/workflows/_build_wheel_job.yml
================================================
name: "(Reusable) Build, Publish and Smoke-test a Wheel"
on:
workflow_call:
inputs:
runner:
description: "GitHub Actions runner label"
required: true
type: string
pypi_repository_url:
description: "PyPI repository URL (empty string means official PyPI)"
required: false
type: string
default: ""
secrets:
PYPI_API_TOKEN:
required: true
jobs:
build_publish_test:
name: Build / publish / smoke-test on ${{ inputs.runner }}
runs-on: ${{ inputs.runner }}
permissions:
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
submodules: recursive
- name: Set up Python (for cibuildwheel controller)
uses: actions/setup-python@v6
with:
python-version: '3.11'
- name: Install cibuildwheel
run: |
pip install --upgrade pip
pip install cibuildwheel==3.4.0
- name: Build wheels using cibuildwheel
run: |
python -m cibuildwheel --output-dir wheelhouse
# Save list of built wheels for publishing
ls wheelhouse/*.whl | tee $GITHUB_STEP_SUMMARY
echo "wheels=$(ls wheelhouse/*.whl | tr '\n' ' ')" >> $GITHUB_ENV
- name: Publish to PyPI
if: success() && github.event_name == 'workflow_dispatch'
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
TWINE_REPOSITORY_URL: ${{ inputs.pypi_repository_url }}
run: |
pip install twine
twine upload --skip-existing --verbose wheelhouse/*.whl
- name: Smoke test from PyPI
if: success() && github.event_name == 'workflow_dispatch'
shell: bash
env:
PYPI_REPOSITORY_URL: ${{ inputs.pypi_repository_url }}
run: |
# Extract version from wheel filename (e.g. zvec-0.2.1.dev24-cp311-...whl -> 0.2.1.dev24)
WHEEL_FILE=$(ls wheelhouse/zvec-*.whl | head -1)
ZVEC_VERSION=$(basename "$WHEEL_FILE" | sed 's/zvec-\([^-]*\)-.*/\1/')
# Build index-url flags: use TestPyPI when repository URL is set, otherwise official PyPI
if [ -n "$PYPI_REPOSITORY_URL" ]; then
INDEX_FLAGS="--index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/"
echo "Waiting for zvec==$ZVEC_VERSION to become available on TestPyPI..."
else
INDEX_FLAGS=""
echo "Waiting for zvec==$ZVEC_VERSION to become available on PyPI..."
fi
# Poll until the version is available (max 5 minutes)
FOUND=0
for i in $(seq 1 30); do
if pip install $INDEX_FLAGS --dry-run "zvec==$ZVEC_VERSION" > /dev/null 2>&1; then
echo "Version $ZVEC_VERSION is available."
FOUND=1
break
fi
echo "Attempt $i/30: not yet available, retrying in 10s..."
sleep 10
done
if [ "$FOUND" -eq 0 ]; then
echo "ERROR: Timed out (5 min) waiting for zvec==$ZVEC_VERSION on PyPI. Aborting smoke test."
exit 1
fi
# Create a clean venv and install
python -m venv test_env
source test_env/bin/activate
pip install --upgrade pip
pip install $INDEX_FLAGS "zvec==$ZVEC_VERSION"
pip install --upgrade pip
pip install $INDEX_FLAGS "zvec==$ZVEC_VERSION"
# Run a simple smoke test
python -c "import zvec; print('Import OK:', zvec.__version__)"
================================================
FILE: .github/workflows/build_test_wheel.yml
================================================
name: Build Test PyPi Wheels
on:
workflow_dispatch:
permissions:
contents: read
jobs:
build_wheels_linux_x64:
name: Build wheels on ubuntu-24.04 (x64) for TestPyPi
uses: ./.github/workflows/_build_wheel_job.yml
with:
runner: ubuntu-24.04
pypi_repository_url: https://test.pypi.org/legacy/
secrets:
PYPI_API_TOKEN: ${{ secrets.TEST_PYPI_API_TOKEN }}
build_wheels_linux_arm64:
name: Build wheels on ubuntu-24.04-arm (arm64) for TestPyPi
uses: ./.github/workflows/_build_wheel_job.yml
with:
runner: ubuntu-24.04-arm
pypi_repository_url: https://test.pypi.org/legacy/
secrets:
PYPI_API_TOKEN: ${{ secrets.TEST_PYPI_API_TOKEN }}
build_wheels_macos_arm64:
name: Build wheels on macos-15 (arm64) for TestPyPi
uses: ./.github/workflows/_build_wheel_job.yml
with:
runner: macos-15
pypi_repository_url: https://test.pypi.org/legacy/
secrets:
PYPI_API_TOKEN: ${{ secrets.TEST_PYPI_API_TOKEN }}
================================================
FILE: .github/workflows/build_wheel.yml
================================================
name: Build Wheels
on:
workflow_dispatch:
permissions:
contents: read
jobs:
build_wheels_linux_x64:
name: Build wheels on ubuntu-24.04 (x64) for PyPi
uses: ./.github/workflows/_build_wheel_job.yml
with:
runner: ubuntu-24.04
secrets:
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
build_wheels_linux_arm64:
name: Build wheels on ubuntu-24.04-arm (arm64) for PyPi
uses: ./.github/workflows/_build_wheel_job.yml
with:
runner: ubuntu-24.04-arm
secrets:
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
build_wheels_macos_arm64:
name: Build wheels on macos-15 (arm64) for PyPi
uses: ./.github/workflows/_build_wheel_job.yml
with:
runner: macos-15
secrets:
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
================================================
FILE: .github/workflows/continuous_bench.yml
================================================
name: Continuous Benchmark
on:
push:
branches: [ "main", "ci/continuous_bench_squash" ]
paths-ignore:
- '**.md'
workflow_dispatch:
concurrency:
group: cb-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
benchmark:
runs-on: vdbbench
steps:
- uses: actions/checkout@v6
- name: Run VectorDBBench
env:
DATABASE_URL: ${{ secrets.DATABASE_URL }}
run: |
bash .github/workflows/scripts/run_vdb.sh
================================================
FILE: .github/workflows/docker/Dockerfile.linux_x64_glibc228
================================================
# =============================================================================
# Dockerfile.linux_x64_glibc228
# Purpose: Ubuntu 18.10 gcc-9 + glibc 2.28 + CMake 3.30.0 + PyBind11 build environment
# Warning: ubuntu:18.10 is EOL; use only for glibc 2.28 compatibility testing.
# =============================================================================
# Use official Ubuntu 18.10 (Cosmic Cuttlefish)
# glibc version: 2.28 (confirmed via `ldd --version`)
FROM ubuntu:18.10
# Replace Ubuntu mirror with old-releases.ubuntu.com for older glibc compatibility
RUN sed -i 's|http://\(.*\)/ubuntu|http://old-releases.ubuntu.com/ubuntu|g' /etc/apt/sources.list && \
sed -i 's|http://security.ubuntu.com/ubuntu|http://old-releases.ubuntu.com/ubuntu|g' /etc/apt/sources.list
# Add Ubuntu 20.04 (focal) repo for GCC 9 ONLY
RUN echo "deb http://archive.ubuntu.com/ubuntu/ focal main universe" >> /etc/apt/sources.list && \
echo "deb http://security.ubuntu.com/ubuntu/ focal-security main universe" >> /etc/apt/sources.list
# Prevent interactive prompts & set non-root user
ENV DEBIAN_FRONTEND=noninteractive \
TZ=Etc/UTC
# Create non-root user for safety (optional but recommended)
RUN useradd -m -u 1000 builder && \
mkdir -p /workspace && chown builder:builder /workspace
# Install base system dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential \
gcc-9 g++-9 \
ninja-build git curl ca-certificates vim wget lcov gnupg clang-format-18\
rsync lsb-release \
uuid-dev zlib1g-dev libssl-dev libffi-dev \
pybind11-dev && \
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 90 \
--slave /usr/bin/g++ g++ /usr/bin/g++-9 && \
rm -rf /var/lib/apt/lists/*
# Install Miniforge (Conda) as root, then assign to builder
ENV MINIFORGE_VERSION="latest"
ENV MINIFORGE_HOME="/opt/miniforge3"
RUN curl -sSL "https://github.com/conda-forge/miniforge/releases/${MINIFORGE_VERSION}/download/Miniforge3-Linux-x86_64.sh" -o miniforge.sh && \
bash miniforge.sh -b -p ${MINIFORGE_HOME} && \
rm miniforge.sh && \
chown -R builder:builder ${MINIFORGE_HOME}
# Switch to non-root user
USER builder
ENV PATH="${MINIFORGE_HOME}/bin:${PATH}"
WORKDIR /workspace
# Create conda envs for supported Python versions
RUN conda create -n py310 python=3.10 -y && \
conda create -n py311 python=3.11 -y && \
conda create -n py312 python=3.12 -y
RUN conda clean --all -f -y
# Install CMake 3.30.0 from Kitware official binary
# Ref: https://github.com/Kitware/CMake/releases/tag/v3.30.0
RUN mkdir -p /tmp/cmake && cd /tmp/cmake && \
curl -sSL -o cmake.tar.gz \
"https://github.com/Kitware/CMake/releases/download/v3.30.0/cmake-3.30.0-linux-x86_64.tar.gz" && \
tar -xzf cmake.tar.gz --strip-components=1 -C /tmp/cmake && \
mkdir -p /home/builder/.local && \
mv * /home/builder/.local/ && \
chown -R builder:builder /home/builder/.local && \
rm -rf /tmp/cmake
# Add CMake to PATH
ENV PATH="/home/builder/.local/bin:${PATH}"
# Verify installations
RUN cmake --version && \
conda info && \
conda env list && \
python --version && \
gcc --version && \
ldd --version | head -n1
# Final setup
WORKDIR /workspace
================================================
FILE: .github/workflows/nightly_coverage.yml
================================================
name: Nightly Coverage Report
on:
schedule:
# Runs daily at 00:00 CST (China Standard Time) = 16:00 UTC
- cron: '0 16 * * *'
workflow_dispatch:
permissions:
contents: read
jobs:
coverage:
name: Nightly Coverage Report
runs-on: ubuntu-24.04
strategy:
matrix:
python-version: ['3.10']
fail-fast: false
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
ref: main # Always use main for nightly
submodules: recursive
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: 'pyproject.toml'
- name: Set up environment variables
run: |
# Set number of processors for parallel builds
NPROC=$(nproc 2>/dev/null || echo 2)
echo "NPROC=$NPROC" >> $GITHUB_ENV
echo "Using $NPROC parallel jobs for builds"
# Add Python user base bin to PATH for pip-installed CLI tools
echo "$(python -c 'import site; print(site.USER_BASE)')/bin" >> $GITHUB_PATH
shell: bash
- name: Install dependencies
run: |
python -m pip install --upgrade pip \
cmake==3.30.0 \
ninja==1.11.1 \
pytest \
pytest-cov \
scikit-build-core \
setuptools_scm
shell: bash
- name: Build with COVERAGE config
run: |
cd "$GITHUB_WORKSPACE"
CMAKE_GENERATOR="Unix Makefiles" \
CMAKE_BUILD_PARALLEL_LEVEL="$NPROC" \
python -m pip install -v . \
--no-build-isolation \
--config-settings="cmake.build-type=COVERAGE" \
--config-settings='cmake.define.ENABLE_ZEN3="ON"'
shell: bash
- name: Run Python Tests with Coverage
run: |
cd "$GITHUB_WORKSPACE"
python -m pytest python/tests/ --cov=zvec --cov-report=xml
shell: bash
- name: Run C++ Tests and Generate Coverage
run: |
cd "$GITHUB_WORKSPACE/build"
make unittest -j$NPROC
cd "$GITHUB_WORKSPACE"
# Ensure gcov.sh is executable
chmod +x scripts/gcov.sh
bash scripts/gcov.sh -k
shell: bash
- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v5
with:
files: ./proxima-zvec-filtered.lcov.info,./coverage.xml
flags: python,cpp,nightly
name: nightly-linux-py${{ matrix.python-version }}
token: ${{ secrets.CODECOV_TOKEN }}
================================================
FILE: .github/workflows/scripts/run_vdb.sh
================================================
set -e
QUANTIZE_TYPE_LIST="int8 int4 fp16 fp32"
CASE_TYPE_LIST="Performance768D1M Performance768D10M Performance1536D500K" # respectively test cosine, ip # Performance960D1M l2 metrics
LOG_FILE="bench.log"
DATE=$(date +%Y-%m-%d_%H-%M-%S)
NPROC=$(nproc 2>/dev/null || getconf _NPROCESSORS_ONLN 2>/dev/null || echo 2)
# COMMIT_ID = branch-date-sha
COMMIT_ID=${GITHUB_REF_NAME}-"$DATE"-$(echo ${GITHUB_WORKFLOW_SHA} | cut -c1-8)
COMMIT_ID=$(echo "$COMMIT_ID" | sed 's/\//_/g')
echo "COMMIT_ID: $COMMIT_ID"
echo "GITHUB_WORKFLOW_SHA: $GITHUB_WORKFLOW_SHA"
echo "workspace: $GITHUB_WORKSPACE"
DB_LABEL_PREFIX="Zvec16c64g-$COMMIT_ID"
# install zvec
git submodule update --init
# for debug
#cd ..
#export SKBUILD_BUILD_DIR="$GITHUB_WORKSPACE/../build"
pwd
python3 -m venv .venv
source .venv/bin/activate
pip install cmake ninja psycopg2-binary loguru fire
pip install -e /opt/VectorDBBench
CMAKE_GENERATOR="Unix Makefiles" \
CMAKE_BUILD_PARALLEL_LEVEL="$NPROC" \
pip install -v "$GITHUB_WORKSPACE"
for CASE_TYPE in $CASE_TYPE_LIST; do
echo "Running VectorDBBench for $CASE_TYPE"
DATASET_DESC=""
if [ "$CASE_TYPE" == "Performance768D1M" ]; then
DATASET_DESC="Performance768D1M - Cohere Cosine"
elif [ "$CASE_TYPE" == "Performance768D10M" ]; then
DATASET_DESC="Performance768D10M - Cohere Cosine"
else
DATASET_DESC="Performance1536D500K - OpenAI IP"
fi
for QUANTIZE_TYPE in $QUANTIZE_TYPE_LIST; do
DB_LABEL="$DB_LABEL_PREFIX-$CASE_TYPE-$QUANTIZE_TYPE"
echo "Running VectorDBBench for $DB_LABEL"
VDB_PARAMS="--path ${DB_LABEL} --db-label ${DB_LABEL} --case-type ${CASE_TYPE} --num-concurrency 12,14,16,18,20"
if [ "$CASE_TYPE" == "Performance768D1M" ]; then
VDB_PARAMS="${VDB_PARAMS} --m 15 --ef-search 180"
elif [ "$CASE_TYPE" == "Performance768D10M" ]; then
VDB_PARAMS="${VDB_PARAMS} --m 50 --ef-search 118 --is-using-refiner"
else #Performance1536D500K using default params + refiner to monitor performance degradation
VDB_PARAMS="${VDB_PARAMS} --m 50 --ef-search 100 --is-using-refiner"
fi
if [ "$QUANTIZE_TYPE" == "fp32" ]; then
vectordbbench zvec ${VDB_PARAMS} 2>&1 | tee $LOG_FILE
else
vectordbbench zvec ${VDB_PARAMS} --quantize-type "${QUANTIZE_TYPE}" 2>&1 | tee $LOG_FILE
fi
RESULT_JSON_PATH=$(grep -o "/opt/VectorDBBench/.*\.json" $LOG_FILE)
QPS=$(jq -r '.results[0].metrics.qps' "$RESULT_JSON_PATH")
RECALL=$(jq -r '.results[0].metrics.recall' "$RESULT_JSON_PATH")
LATENCY_P99=$(jq -r '.results[0].metrics.serial_latency_p99' "$RESULT_JSON_PATH")
LOAD_DURATION=$(jq -r '.results[0].metrics.load_duration' "$RESULT_JSON_PATH")
#quote the var to avoid space in the label
label_list="case_type=\"${CASE_TYPE}\",dataset_desc=\"${DATASET_DESC}\",db_label=\"${DB_LABEL}\",commit=\"${COMMIT_ID}\",date=\"${DATE}\",quantize_type=\"${QUANTIZE_TYPE}\""
# replace `/` with `_` in label_list
label_list=$(echo "$label_list" | sed 's/\//_/g')
cat <<EOF > prom_metrics.txt
# TYPE vdb_bench_qps gauge
vdb_bench_qps{$label_list} $QPS
# TYPE vdb_bench_recall gauge
vdb_bench_recall{$label_list} $RECALL
# TYPE vdb_bench_latency_p99 gauge
vdb_bench_latency_p99{$label_list} $LATENCY_P99
# TYPE vdb_bench_load_duration gauge
vdb_bench_load_duration{$label_list} $LOAD_DURATION
EOF
echo "prom_metrics:"
cat prom_metrics.txt
curl --data-binary @prom_metrics.txt "http://47.93.34.27:9091/metrics/job/benchmarks-${CASE_TYPE}/case_type/${CASE_TYPE}/quantize_type/${QUANTIZE_TYPE}" -v
done
done
================================================
FILE: .gitignore
================================================
.*
*~
bazel-*
build*
bin/*
lib/*
var/*
venv*
tests/integration/conf/*
tests/de_integration/conf/*
**/__pycache__/*
tests/bench/log/*
tests/integration/integration
tests/integration/log
tests/integration/*.log
tests/de_integration/log
tests/de_integration/*.log
!.git*
!.clang-format
!.circleci
!.drone.yml
sdk/python/dist/
compile_commands.json
dist
html
*.lcov.info
# Dependencies
/node_modules
# Production
/build
# Generated files
.docusaurus
.cache-loader
# Misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
npm-debug.log*
yarn-debug.log*
yarn-error.log*
allure-*
!build_android.sh
================================================
FILE: .gitmodules
================================================
[submodule "thirdparty/googletest/googletest-1.10.0"]
path = thirdparty/googletest/googletest-1.10.0
url = https://github.com/google/googletest.git
[submodule "thirdparty/sparsehash/sparsehash-2.0.4"]
path = thirdparty/sparsehash/sparsehash-2.0.4
url = https://github.com/sparsehash/sparsehash.git
ignore = untracked
[submodule "thirdparty/gflags/gflags-2.2.2"]
path = thirdparty/gflags/gflags-2.2.2
url = https://github.com/gflags/gflags.git
[submodule "thirdparty/rocksdb/rocksdb-8.1.1"]
path = thirdparty/rocksdb/rocksdb-8.1.1
url = https://github.com/facebook/rocksdb.git
ignore = all
[submodule "thirdparty/yaml-cpp/yaml-cpp-0.6.3"]
path = thirdparty/yaml-cpp/yaml-cpp-0.6.3
url = https://github.com/jbeder/yaml-cpp.git
[submodule "thirdparty/arrow/apache-arrow-21.0.0"]
path = thirdparty/arrow/apache-arrow-21.0.0
url = https://github.com/apache/arrow.git
ignore = all
[submodule "thirdparty/CRoaring/CRoaring-2.0.4"]
path = thirdparty/CRoaring/CRoaring-2.0.4
url = https://github.com/RoaringBitmap/CRoaring.git
[submodule "thirdparty/glog/glog-0.5.0"]
path = thirdparty/glog/glog-0.5.0
url = https://github.com/google/glog.git
ignore = all
[submodule "thirdparty/protobuf/protobuf-3.21.12"]
path = thirdparty/protobuf/protobuf-3.21.12
url = https://github.com/protocolbuffers/protobuf.git
[submodule "thirdparty/lz4/lz4-1.9.4"]
path = thirdparty/lz4/lz4-1.9.4
url = https://github.com/lz4/lz4.git
[submodule "thirdparty/antlr/antlr4"]
path = thirdparty/antlr/antlr4
url = https://github.com/antlr/antlr4.git
ignore = all
[submodule "thirdparty/magic_enum/magic_enum-0.9.7"]
path = thirdparty/magic_enum/magic_enum-0.9.7
url = https://github.com/Neargye/magic_enum.git
ignore = all
[submodule "thirdparty/RaBitQ-Library/RaBitQ-Library-0.1"]
path = thirdparty/RaBitQ-Library/RaBitQ-Library-0.1
url = https://github.com/VectorDB-NTU/RaBitQ-Library.git
================================================
FILE: CMakeLists.txt
================================================
cmake_minimum_required(VERSION 3.13)
cmake_policy(SET CMP0077 NEW)
project(zvec)
set(CC_CXX_STANDARD 17)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror=return-type")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror=return-type")
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--no-as-needed")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-as-needed")
endif()
if(NOT DEFINED PROJECT_ROOT_DIR OR NOT PROJECT_ROOT_DIR)
set(PROJECT_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE PATH "Root directory of the project" FORCE)
endif()
message(STATUS "PROJECT_ROOT_DIR = ${PROJECT_ROOT_DIR}")
include(${PROJECT_ROOT_DIR}/cmake/bazel.cmake)
include(${PROJECT_ROOT_DIR}/cmake/option.cmake)
if(NOT ANDROID AND AUTO_DETECT_ARCH AND CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|i686|i386|x64")
setup_compiler_march_for_x86(MATH_MARCH_FLAG_SSE MATH_MARCH_FLAG_AVX2 MATH_MARCH_FLAG_AVX512 MATH_MARCH_FLAG_AVX512FP16)
message(STATUS "best compiler march, sse: " ${MATH_MARCH_FLAG_SSE} ", avx2: " ${MATH_MARCH_FLAG_AVX2} ", avx512: " ${MATH_MARCH_FLAG_AVX512} ", avx512fp16: " ${MATH_MARCH_FLAG_AVX512FP16})
endif()
include_directories(${PROJECT_ROOT_DIR}/src/include)
include_directories(${PROJECT_ROOT_DIR}/src)
option(BUILD_PYTHON_BINDINGS "Build Python bindings using pybind11" OFF)
message(STATUS "BUILD_PYTHON_BINDINGS:${BUILD_PYTHON_BINDINGS}")
option(BUILD_TOOLS "Build tools" ON)
message(STATUS "BUILD_TOOLS:${BUILD_TOOLS}")
option(RABITQ_ENABLE_AVX512 "Compile RaBitQ with AVX-512 support" OFF)
if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|amd64|AMD64" AND NOT ANDROID)
include(CheckCCompilerFlag)
check_c_compiler_flag("-mavx2" COMPILER_SUPPORTS_AVX2)
check_c_compiler_flag("-mavx512f -mavx512bw -mavx512vl" COMPILER_SUPPORTS_AVX512)
if(COMPILER_SUPPORTS_AVX2 OR COMPILER_SUPPORTS_AVX512)
set(RABITQ_SUPPORTED ON)
add_definitions(-DRABITQ_SUPPORTED=1)
if(RABITQ_ENABLE_AVX512 AND COMPILER_SUPPORTS_AVX512)
add_definitions(-DRABITQ_COMPILED_AVX512=1)
set(RABITQ_ARCH_FLAG "${MATH_MARCH_FLAG_AVX512}")
else()
set(RABITQ_ARCH_FLAG "${MATH_MARCH_FLAG_AVX2}")
endif()
else()
set(RABITQ_SUPPORTED OFF)
add_definitions(-DRABITQ_SUPPORTED=0)
message(STATUS "RaBitQ support disabled - compiler does not support AVX2 or AVX-512")
endif()
else()
set(RABITQ_SUPPORTED OFF)
add_definitions(-DRABITQ_SUPPORTED=0)
message(STATUS "RaBitQ support disabled - only supported on Linux x86_64")
endif()
message(STATUS "RABITQ_ARCH_FLAG: ${RABITQ_ARCH_FLAG}")
option(USE_OSS_MIRROR "Use OSS mirror for faster third-party downloads" OFF)
if(DEFINED ENV{USE_OSS_MIRROR} AND NOT "$ENV{USE_OSS_MIRROR}" STREQUAL "")
set(USE_OSS_MIRROR "$ENV{USE_OSS_MIRROR}" CACHE BOOL "Use OSS mirror for faster third-party downloads" FORCE)
endif()
message(STATUS "USE_OSS_MIRROR:${USE_OSS_MIRROR}")
cc_directory(thirdparty)
cc_directories(src)
cc_directories(tests)
if(BUILD_TOOLS)
cc_directories(tools)
endif()
git_version(GIT_SRCS_VER ${PROJECT_ROOT_DIR})
set(CPACK_PACKAGE_VERSION ${GIT_SRCS_VER})
set(CPACK_PACKAGE_NAME zvec)
include(CPack)
if(BUILD_PYTHON_BINDINGS)
if(APPLE)
set(CMAKE_STRIP "")
message(STATUS "Disabled strip on macOS to preserve code signature")
endif()
include(GNUInstallDirs)
if(DEFINED SKBUILD_PLATLIB_DIR)
set(ZVEC_PY_INSTALL_DIR "${SKBUILD_PLATLIB_DIR}")
elseif(DEFINED Python_SITEARCH)
set(ZVEC_PY_INSTALL_DIR "${Python_SITEARCH}")
else()
set(ZVEC_PY_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}")
endif()
message(STATUS "Zvec install path: ${ZVEC_PY_INSTALL_DIR}")
install(TARGETS _zvec LIBRARY DESTINATION ${ZVEC_PY_INSTALL_DIR})
endif()
================================================
FILE: CODE_OF_CONDUCT.md
================================================
# Zvec Code of Conduct
## Our Pledge
We pledge to foster an open, respectful, and harassment-free environment for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, education, socioeconomic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
## Expected Behavior
- Use welcoming and inclusive language
- Respect differing viewpoints and experiences
- Gracefully accept constructive criticism
- Focus on what is best for the community
- Show empathy and kindness toward others
## Unacceptable Behavior
- Harassment, intimidation, or discriminatory conduct
- Trolling, insulting, or derogatory comments
- Public or private harassment
- Publishing others’ private information without consent
- Any conduct that would reasonably be considered inappropriate in a professional setting
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team
at **zvec@alibaba-inc.com** (replace with your contact). All complaints will be reviewed and investigated promptly
and fairly.
The project team is obligated to respect the privacy and security of the reporter.
Consequences may include:
- A formal warning
- Temporary or permanent ban from project spaces
- Removal of contributions (e.g. comments, PRs)
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.1, available at
https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
[homepage]: https://www.contributor-covenant.org
================================================
FILE: CONTRIBUTING.md
================================================
# Contributing to Zvec
First off, thank you for considering contributing to Zvec! 🙌
Whether you're reporting a bug, proposing a feature, improving documentation, or submitting code — every contribution helps make Zvec better.
## Code of Conduct
By participating, you agree to abide by our [Code of Conduct](CODE_OF_CONDUCT.md). Please be respectful, collaborative, and inclusive.
---
## Development Setup
### Prerequisites
- Python 3.10 - 3.12
- CMake ≥ 3.26, < 4.0 (`cmake --version`)
- A C++17-compatible compiler (e.g., `g++-11+`, `clang++`, Apple Clang on macOS)
### Clone & Initialize
```bash
git clone --recursive https://github.com/alibaba/zvec.git
cd zvec
```
> 💡 **Tip**
> - Forgot `--recursive`? Run:
> ```bash
> git submodule update --init --recursive
> ```
> - Set up pre-commit hooks:
> ```bash
> pip install pre-commit && pre-commit install
> ```
### Build from Source (Editable Install)
```bash
pip install -e ".[dev]"
# This installs dev dependencies (pytest, ruff, etc.) and builds the C++ extension in-place
```
> ✅ Verify:
> ```bash
> python -c "import zvec; print('Success!')"
> ```
---
## Testing
### Run All Tests
```bash
pytest python/tests/ -v
```
### Run with Coverage (Debug/CI)
```bash
pytest python/tests/ --cov=zvec --cov-report=term-missing
```
> 🔎 See full rules in `[tool.ruff]` section of `pyproject.toml`.
---
## Build Customization
You can control build behavior via environment variables or `pyproject.toml`:
| Option | How to Set | Description |
|--------|------------|-------------|
| **Build Type** | `CMAKE_BUILD_TYPE=Debug` | `Debug`, `Release`, or `Coverage` (for gcov/lcov) |
| **Generator** | `CMAKE_GENERATOR="Unix Makefiles"` | Default: `Ninja`; use Make if preferred |
| **AVX-512** | `ENABLE_SKYLAKE_AVX512=ON` | Enable AVX-512 optimizations (x86_64 only) |
Example (Debug + Make):
```bash
CMAKE_BUILD_TYPE=Debug CMAKE_GENERATOR="Unix Makefiles" pip install -v .
```
---
## Submitting Changes
1. Fork the repo and create a feature branch (`feat/...`, `fix/...`, `docs/...`)
2. Write clear commit messages (e.g., `fix(query): handle null vector in dense_fp32`)
3. Ensure tests pass & linter is clean
4. Open a Pull Request to `main`
5. Link related issue (e.g., `Closes #123`)
✅ **PRs should include**:
- Test coverage for new behavior
- Updates to documentation (if applicable)
- Reasoning behind non-obvious design choices
---
## Documentation
- User guides: `docs/` (built with MkDocs)
- API reference: generated from docstrings (follow [Google style](https://google.github.io/styleguide/pyguide.html#38-comments-and-docstrings))
- Build & deploy: `mkdocs serve` / `mkdocs build`
---
## Need Help
- Browse [existing issues](https://github.com/alibaba/zvec/issues)
- For sensitive/security issues: email `zvec@alibaba-inc.com`
---
✨ Thanks again for being part of Zvec!
================================================
FILE: LICENSE
================================================
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
================================================
FILE: README.md
================================================
<div align="center">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://zvec.oss-cn-hongkong.aliyuncs.com/logo/github_log_2.svg" />
<img src="https://zvec.oss-cn-hongkong.aliyuncs.com/logo/github_logo_1.svg" width="400" alt="zvec logo" />
</picture>
</div>
<p align="center">
<a href="https://codecov.io/github/alibaba/zvec"><img src="https://codecov.io/github/alibaba/zvec/graph/badge.svg?token=O81CT45B66" alt="Code Coverage"/></a>
<a href="https://github.com/alibaba/zvec/actions/workflows/01-ci-pipeline.yml"><img src="https://github.com/alibaba/zvec/actions/workflows/01-ci-pipeline.yml/badge.svg?branch=main" alt="Main"/></a>
<a href="https://github.com/alibaba/zvec/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-Apache%202.0-blue.svg" alt="License"/></a>
<a href="https://pypi.org/project/zvec/"><img src="https://img.shields.io/pypi/v/zvec.svg" alt="PyPI Release"/></a>
<a href="https://pypi.org/project/zvec/"><img src="https://img.shields.io/pypi/pyversions/zvec.svg" alt="Python Versions"/></a>
<a href="https://www.npmjs.com/package/@zvec/zvec"><img src="https://img.shields.io/npm/v/@zvec/zvec.svg" alt="npm Release"/></a>
</p>
<p align="center">
<a href="https://trendshift.io/repositories/20830" target="_blank"><img src="https://trendshift.io/api/badge/repositories/20830" alt="alibaba%2Fzvec | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
</p>
<p align="center">
<a href="https://zvec.org/en/docs/quickstart/">🚀 <strong>Quickstart</strong> </a> |
<a href="https://zvec.org/en/">🏠 <strong>Home</strong> </a> |
<a href="https://zvec.org/en/docs/">📚 <strong>Docs</strong> </a> |
<a href="https://zvec.org/en/docs/benchmarks/">📊 <strong>Benchmarks</strong> </a> |
<a href="https://deepwiki.com/alibaba/zvec">🔎 <strong>DeepWiki</strong> </a> |
<a href="https://discord.gg/rKddFBBu9z">🎮 <strong>Discord</strong> </a>
</p>
**Zvec** is an open-source, in-process vector database — lightweight, lightning-fast, and designed to embed directly into applications. Built on **Proxima** (Alibaba's battle-tested vector search engine), it delivers production-grade, low-latency, scalable similarity search with minimal setup.
## 💫 Features
- **Blazing Fast**: Searches billions of vectors in milliseconds.
- **Simple, Just Works**: [Install](#-installation) and start searching in seconds. No servers, no config, no fuss.
- **Dense + Sparse Vectors**: Work with both dense and sparse embeddings, with native support for multi-vector queries in a single call.
- **Hybrid Search**: Combine semantic similarity with structured filters for precise results.
- **Runs Anywhere**: As an in-process library, Zvec runs wherever your code runs — notebooks, servers, CLI tools, or even edge devices.
## 📦 Installation
### [Python](https://pypi.org/project/zvec/)
**Requirements**: Python 3.10 - 3.12
```bash
pip install zvec
```
### [Node.js](https://www.npmjs.com/package/@zvec/zvec)
```bash
npm install @zvec/zvec
```
### ✅ Supported Platforms
- Linux (x86_64, ARM64)
- macOS (ARM64)
### 🛠️ Building from Source
If you prefer to build Zvec from source, please check the [Building from Source](https://zvec.org/en/docs/build/) guide.
## ⚡ One-Minute Example
```python
import zvec
# Define collection schema
schema = zvec.CollectionSchema(
name="example",
vectors=zvec.VectorSchema("embedding", zvec.DataType.VECTOR_FP32, 4),
)
# Create collection
collection = zvec.create_and_open(path="./zvec_example", schema=schema)
# Insert documents
collection.insert([
zvec.Doc(id="doc_1", vectors={"embedding": [0.1, 0.2, 0.3, 0.4]}),
zvec.Doc(id="doc_2", vectors={"embedding": [0.2, 0.3, 0.4, 0.1]}),
])
# Search by vector similarity
results = collection.query(
zvec.VectorQuery("embedding", vector=[0.4, 0.3, 0.3, 0.1]),
topk=10
)
# Results: list of {'id': str, 'score': float, ...}, sorted by relevance
print(results)
```
## 📈 Performance at Scale
Zvec delivers exceptional speed and efficiency, making it ideal for demanding production workloads.
<img src="https://zvec.oss-cn-hongkong.aliyuncs.com/qps_10M.svg" width="800" alt="Zvec Performance Benchmarks" />
For detailed benchmark methodology, configurations, and complete results, please see our [Benchmarks documentation](https://zvec.org/en/docs/benchmarks/).
## 🤝 Join Our Community
<div align="center">
Stay updated and get support — scan or click:
<div align="center">
| 💬 DingTalk | 📱 WeChat | 🎮 Discord |
|:---:|:---:|:---:|
| <img src="https://zvec.oss-cn-hongkong.aliyuncs.com/qrcode/dingding.png" width="150"/> | <img src="https://zvec.oss-cn-hongkong.aliyuncs.com/qrcode/wechat.png?v=3" width="150"/> | [](https://discord.gg/rKddFBBu9z) |
| Scan to join | Scan to join | Click to join |
</div>
</div>
## ❤️ Contributing
We welcome and appreciate contributions from the community! Whether you're fixing a bug, adding a feature, or improving documentation, your help makes Zvec better for everyone.
Check out our [Contributing Guide](./CONTRIBUTING.md) to get started!
================================================
FILE: cmake/bazel.cmake
================================================
##
## The following functions used by user's CMakeLists.txt:
##
## 1. Functions for C/C++
##
## 1.1. Add a subdirectory to the build
## cc_directory(<source_dir> [binary_dir])
##
## 1.2. Add subdirectories to the build
## cc_directories(<source_dir1> [source_dir2 ...])
##
## 1.3. Build a C/C++ static or shared library
## cc_library(
## NAME <name>
## [STATIC] [SHARED] [STRICT] [ALWAYS_LINK] [EXCLUDE] [PACKED] [SRCS_NO_GLOB]
## SRCS <file1> [file2 ...]
## [INCS dir1 ...]
## [PUBINCS public_dir1 ...]
## [DEFS DEF1=1 ...]
## [LIBS lib1 ...]
## [CFLAGS flag1 ...]
## [CXXFLAGS flag1 ...]
## [LDFLAGS flag1 ...]
## [DEPS target1 ...]
## [PACKED_EXCLUDES pattern1 ...]
## [VERSION <version>]
## )
##
## 1.4. Build a C/C++ executable program
## cc_binary(
## NAME <name>
## [STRICT] [PACKED]
## SRCS <file1> [file2 ...]
## [INCS dir1 ...]
## [DEFS DEF1=1 ...]
## [LIBS lib1 ...]
## [CFLAGS flag1 ...]
## [CXXFLAGS flag1 ...]
## [LDFLAGS flag1 ...]
## [DEPS target1 ...]
## [VERSION <version>]
## )
##
## 1.5. Build a C/C++ executable test program
## cc_test(
## NAME <name>
## [STRICT]
## SRCS <file1> [file2 ...]
## [INCS dir1 ...]
## [DEFS DEF1=1 ...]
## [LIBS lib1 ...]
## [CFLAGS flag1 ...]
## [CXXFLAGS flag1 ...]
## [LDFLAGS flag1 ...]
## [DEPS target1 ...]
## [ARGS args1 ...]
## [VERSION <version>]
## )
##
## 1.6. Add existing test cases to a test suite
## cc_test_suite(<suite_name> [test_name ...])
##
## 1.7. Import a C/C++ static or shared library
## cc_import(
## NAME <name>
## [STATIC | SHARED] [PACKED]
## PATH <file>
## [INCS dir1 ...]
## [PUBINCS public_dir1 ...]
## [DEPS target1 ...]
## [IMPLIB <file>]
## [PACKED_EXCLUDES pattern1 ...]
## )
##
## 1.8. Import a C/C++ interface library
## cc_interface(
## NAME <name>
## [PACKED]
## [INCS dir1 ...]
## [PUBINCS public_dir1 ...]
## [DEPS target1 ...]
## [PACKED_EXCLUDES pattern1 ...]
## )
##
## 1.9. Build a C/C++ executable google test program
## cc_gtest(
## NAME <name>
## [STRICT]
## SRCS <file1> [file2 ...]
## [INCS dir1 ...]
## [DEFS DEF1=1 ...]
## [LIBS lib1 ...]
## [CFLAGS flag1 ...]
## [CXXFLAGS flag1 ...]
## [LDFLAGS flag1 ...]
## [DEPS target1 ...]
## [ARGS args1 ...]
## [VERSION <version>]
## )
##
## 1.10. Build a C/C++ executable google mock program
## cc_gmock(
## NAME <name>
## [STRICT]
## SRCS <file1> [file2 ...]
## [INCS dir1 ...]
## [DEFS DEF1=1 ...]
## [LIBS lib1 ...]
## [CFLAGS flag1 ...]
## [CXXFLAGS flag1 ...]
## [LDFLAGS flag1 ...]
## [DEPS target1 ...]
## [ARGS args1 ...]
## [VERSION <version>]
## )
##
## 1.11. Build a C++ protobuf static or shared library
## cc_proto_library(
## NAME <name>
## [STATIC] [SHARED] [STRICT] [EXCLUDE] [PACKED]
## SRCS <file1.proto> [file2.proto ...]
## [PROTOROOT path]
## [CXXFLAGS flag1 ...]
## [LDFLAGS flag1 ...]
## [DEPS target1 ...]
## [VERSION <version>]
## [PROTOBUF_VERSION <Protobuf version>]
## )
##
## 2. Functions for CUDA
##
## 2.1. Add a subdirectory to the build
## cuda_directory(<source_dir> [binary_dir])
##
## 2.2. Add subdirectories to the build
## cuda_directories(<source_dir1> [source_dir2 ...])
##
## 2.3. Build a CUDA static or shared library
## cuda_library(
## NAME <name>
## [STATIC] [SHARED] [STRICT] [ALWAYS_LINK] [EXCLUDE] [PACKED]
## SRCS <file1> [file2 ...]
## [INCS dir1 ...]
## [PUBINCS public_dir1 ...]
## [DEFS DEF1=1 ...]
## [LIBS lib1 ...]
## [CFLAGS flag1 ...]
## [CXXFLAGS flag1 ...]
## [CUDAFLAGS flag1 ...]
## [LDFLAGS flag1 ...]
## [DEPS target1 ...]
## [PACKED_EXCLUDES pattern1 ...]
## [VERSION <version>]
## )
##
## 2.4. Build a CUDA executable program
## cuda_binary(
## NAME <name>
## [STRICT] [PACKED]
## SRCS <file1> [file2 ...]
## [INCS dir1 ...]
## [DEFS DEF1=1 ...]
## [LIBS lib1 ...]
## [CFLAGS flag1 ...]
## [CXXFLAGS flag1 ...]
## [CUDAFLAGS flag1 ...]
## [LDFLAGS flag1 ...]
## [DEPS target1 ...]
## [VERSION <version>]
## )
##
## 2.5. Build a CUDA executable test program
## cuda_test(
## NAME <name>
## [STRICT]
## SRCS <file1> [file2 ...]
## [INCS dir1 ...]
## [DEFS DEF1=1 ...]
## [LIBS lib1 ...]
## [CFLAGS flag1 ...]
## [CXXFLAGS flag1 ...]
## [CUDAFLAGS flag1 ...]
## [LDFLAGS flag1 ...]
## [DEPS target1 ...]
## [ARGS args1 ...]
## [VERSION <version>]
## )
##
## 2.6. Add existing test cases to a test suite
## cuda_test_suite(<suite_name> [test_name ...])
##
## 2.7. Import a C/C++/CUDA static or shared library
## cuda_import(
## NAME <name>
## [STATIC | SHARED] [PACKED]
## PATH <file>
## [INCS dir1 ...]
## [PUBINCS public_dir1 ...]
## [DEPS target1 ...]
## [IMPLIB <file>]
## [PACKED_EXCLUDES pattern1 ...]
## )
##
## 2.8. Import a C/C++/CUDA interface library
## cuda_interface(
## NAME <name>
## [PACKED]
## [INCS dir1 ...]
## [PUBINCS public_dir1 ...]
## [DEPS target1 ...]
## [PACKED_EXCLUDES pattern1 ...]
## )
##
## 2.9. Build a CUDA executable google test program
## cuda_gtest(
## NAME <name>
## [STRICT]
## SRCS <file1> [file2 ...]
## [INCS dir1 ...]
## [DEFS DEF1=1 ...]
## [LIBS lib1 ...]
## [CFLAGS flag1 ...]
## [CXXFLAGS flag1 ...]
## [CUDAFLAGS flag1 ...]
## [LDFLAGS flag1 ...]
## [DEPS target1 ...]
## [ARGS args1 ...]
## [VERSION <version>]
## )
##
## 2.10. Build a CUDA executable google mock program
## cuda_gmock(
## NAME <name>
## [STRICT]
## SRCS <file1> [file2 ...]
## [INCS dir1 ...]
## [DEFS DEF1=1 ...]
## [LIBS lib1 ...]
## [CFLAGS flag1 ...]
## [CXXFLAGS flag1 ...]
## [CUDAFLAGS flag1 ...]
## [LDFLAGS flag1 ...]
## [DEPS target1 ...]
## [ARGS args1 ...]
## [VERSION <version>]
## )
##
## 3. Utility functions
##
## 3.1. Download a git repository
## git_repository(
## NAME <name>
## URL <url>
## [TAG <tag>]
## [PATH <local path>]
## )
##
## 3.2. Download a hg repository
## hg_repository(
## NAME <name>
## URL <url>
## [TAG <tag>]
## [PATH <local path>]
## )
##
## 3.3. Download a svn repository
## svn_repository(
## NAME <name>
## URL <url>
## [REV <rev>]
## [PATH <local path>]
## )
##
## 3.4. Download a http archive
## http_archive(
## NAME <name>
## URL <url>
## [SHA256 <sha256 value> | SHA1 <sha1 value> | MD5 <md5 value>]
## [PATH <local path>]
## )
##
## 3.5. Retrieve a version string from GIT
## git_version(
## <result variable>
## <repository path>
## )
##
## 3.6. Retrieve a version string from HG
## hg_version(
## <result variable>
## <repository path>
## )
##
## 3.7. Retrieve a version string from SVN
## svn_version(
## <result variable>
## <repository path>
## )
##
cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
include(CMakeParseArguments)
# Using AppleClang instead of Clang (Compiler id)
if(POLICY CMP0025)
cmake_policy(SET CMP0025 NEW)
endif()
# Enable unit testing
enable_testing()
# Add unittest target
if(NOT TARGET unittest)
add_custom_target(
unittest
COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure
--build-config $<CONFIGURATION>
)
endif()
# Directories of target output
if(NOT CMAKE_ARCHIVE_OUTPUT_DIRECTORY)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
endif()
if(NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
endif()
if(NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
endif()
# RPATH settings
set(CMAKE_MACOSX_RPATH ON)
if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(CMAKE_SKIP_BUILD_RPATH ON)
set(CMAKE_BUILD_WITH_INSTALL_RPATH ON)
if(${CMAKE_SIZEOF_VOID_P} EQUAL "8")
set(CMAKE_INSTALL_RPATH "$ORIGIN/../lib64:$ORIGIN/../lib:$ORIGIN")
else()
set(CMAKE_INSTALL_RPATH "$ORIGIN/../lib:$ORIGIN")
endif()
else()
set(CMAKE_INSTALL_RPATH "@loader_path/../lib:@loader_path")
endif()
# Define standard installation directories
if(NOT CMAKE_INSTALL_LIBDIR)
set(CMAKE_INSTALL_LIBDIR lib)
endif()
if(NOT CMAKE_INSTALL_BINDIR)
set(CMAKE_INSTALL_BINDIR bin)
endif()
if(NOT CMAKE_INSTALL_INCDIR)
set(CMAKE_INSTALL_INCDIR include)
endif()
if(NOT CMAKE_INSTALL_ETCDIR)
set(CMAKE_INSTALL_ETCDIR etc)
endif()
# Generates a compile_commands.json
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
if(APPLE OR ANDROID)
option(CLANG_USE_LIBCXX "Use libc++ instead of libstdc++" ON)
else()
option(CLANG_USE_LIBCXX "Use libc++ instead of libstdc++" OFF)
endif()
set(CLANG_STDLIB_OPTION "")
if(CLANG_USE_LIBCXX)
set(CLANG_STDLIB_OPTION "-stdlib=libc++")
else()
set(CLANG_STDLIB_OPTION "-stdlib=libstdc++")
endif()
if(NOT MSVC)
# Use color in diagnostics
set(
_COMPILER_FLAGS
"$<$<C_COMPILER_ID:Clang>:-fcolor-diagnostics;${CLANG_STDLIB_OPTION}>"
"$<$<C_COMPILER_ID:AppleClang>:-fcolor-diagnostics>"
"$<$<C_COMPILER_ID:GNU>:-fdiagnostics-color=always>"
)
add_compile_options(
"$<$<COMPILE_LANGUAGE:C>:${_COMPILER_FLAGS}>"
"$<$<COMPILE_LANGUAGE:CXX>:${_COMPILER_FLAGS}>"
)
unset(_COMPILER_FLAGS)
else()
# Replace the default compiling flags
set(
_COMPILER_FLAGS
CMAKE_CXX_FLAGS
CMAKE_CXX_FLAGS_DEBUG
CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_RELWITHDEBINFO
CMAKE_CXX_FLAGS_MINSIZEREL
CMAKE_C_FLAGS
CMAKE_C_FLAGS_DEBUG
CMAKE_C_FLAGS_RELEASE
CMAKE_C_FLAGS_RELWITHDEBINFO
CMAKE_C_FLAGS_MINSIZEREL
)
foreach(COMPILER_FLAG ${_COMPILER_FLAGS})
string(REPLACE "/MT" "/MD" ${COMPILER_FLAG} "${${COMPILER_FLAG}}")
string(REGEX REPLACE "/W[0-9]" "" ${COMPILER_FLAG} "${${COMPILER_FLAG}}")
endforeach()
unset(_COMPILER_FLAGS)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
# Build shared library as default
set(BUILD_SHARED_LIBS ON)
endif()
set(CMAKE_C_FLAGS_ASAN ${CMAKE_C_FLAGS_DEBUG})
set(CMAKE_CXX_FLAGS_ASAN ${CMAKE_CXX_FLAGS_DEBUG})
set(CMAKE_EXE_LINKER_FLAGS_ASAN ${CMAKE_EXE_LINKER_FLAGS_DEBUG})
set(CMAKE_SHARED_LINKER_FLAGS_ASAN ${CMAKE_SHARED_LINKER_FLAGS_DEBUG})
set(CMAKE_STATIC_LINKER_FLAGS_ASAN ${CMAKE_STATIC_LINKER_FLAGS_DEBUG})
set(CMAKE_MODULE_LINKER_FLAGS_ASAN ${CMAKE_MODULE_LINKER_FLAGS_DEBUG})
set(CMAKE_C_FLAGS_COVERAGE ${CMAKE_C_FLAGS_DEBUG})
set(CMAKE_CXX_FLAGS_COVERAGE ${CMAKE_CXX_FLAGS_DEBUG})
set(CMAKE_EXE_LINKER_FLAGS_COVERAGE ${CMAKE_EXE_LINKER_FLAGS_DEBUG})
set(CMAKE_SHARED_LINKER_FLAGS_COVERAGE ${CMAKE_SHARED_LINKER_FLAGS_DEBUG})
set(CMAKE_STATIC_LINKER_FLAGS_COVERAGE ${CMAKE_STATIC_LINKER_FLAGS_DEBUG})
set(CMAKE_MODULE_LINKER_FLAGS_COVERAGE ${CMAKE_MODULE_LINKER_FLAGS_DEBUG})
# C/C++ ASAN compile flags
set(
BAZEL_CC_ASAN_COMPILE_FLAGS
"$<$<CONFIG:ASAN>:$<$<CXX_COMPILER_ID:Clang>:-fsanitize=address>>"
"$<$<CONFIG:ASAN>:$<$<CXX_COMPILER_ID:AppleClang>:-fsanitize=address>>"
"$<$<CONFIG:ASAN>:$<$<CXX_COMPILER_ID:GNU>:-fsanitize=address>>"
"$<$<CONFIG:ASAN>:$<$<CXX_COMPILER_ID:MSVC>:/fsanitize=address>>"
)
# C/C++ COVERAGE compile flags
set(
BAZEL_CC_COVERAGE_COMPILE_FLAGS
"$<$<CONFIG:COVERAGE>:$<$<CXX_COMPILER_ID:Clang>:--coverage>>"
"$<$<CONFIG:COVERAGE>:$<$<CXX_COMPILER_ID:AppleClang>:--coverage>>"
"$<$<CONFIG:COVERAGE>:$<$<CXX_COMPILER_ID:GNU>:--coverage>>"
)
# C/C++ strict compile flags
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 7.0)
set(
BAZEL_CC_STRICT_COMPILE_FLAGS
"$<$<CXX_COMPILER_ID:Clang>:-Wall;-Wextra;-Wshadow>"
"$<$<CXX_COMPILER_ID:AppleClang>:-Wall;-Wextra;-Wshadow>"
"$<$<CXX_COMPILER_ID:GNU>:-Wall;-Wextra;-Wshadow-local;-Wno-misleading-indentation>"
"$<$<CXX_COMPILER_ID:MSVC>:/W4>"
${BAZEL_CC_ASAN_COMPILE_FLAGS}
${BAZEL_CC_COVERAGE_COMPILE_FLAGS}
)
else()
set(
BAZEL_CC_STRICT_COMPILE_FLAGS
"$<$<CXX_COMPILER_ID:Clang>:-Wall;-Wextra;-Wshadow>"
"$<$<CXX_COMPILER_ID:AppleClang>:-Wall;-Wextra;-Wshadow>"
"$<$<CXX_COMPILER_ID:GNU>:-Wall;-Wextra;-Wshadow;-Wno-misleading-indentation>"
"$<$<CXX_COMPILER_ID:MSVC>:/W4>"
${BAZEL_CC_ASAN_COMPILE_FLAGS}
${BAZEL_CC_COVERAGE_COMPILE_FLAGS}
)
endif()
# C/C++ strict link flags
set(
BAZEL_CC_STRICT_LINK_FLAGS
"$<$<CXX_COMPILER_ID:Clang>:${CLANG_STDLIB_OPTION}>"
${BAZEL_CC_ASAN_COMPILE_FLAGS}
${BAZEL_CC_COVERAGE_COMPILE_FLAGS}
)
# C/C++ unstrict compile flags
set(
BAZEL_CC_UNSTRICT_COMPILE_FLAGS
"$<$<CXX_COMPILER_ID:Clang>:-Wall>"
"$<$<CXX_COMPILER_ID:AppleClang>:-Wall>"
"$<$<CXX_COMPILER_ID:GNU>:-Wall>"
"$<$<CXX_COMPILER_ID:MSVC>:/W3>"
${BAZEL_CC_ASAN_COMPILE_FLAGS}
${BAZEL_CC_COVERAGE_COMPILE_FLAGS}
)
# C/C++ unstrict link flags
set(
BAZEL_CC_UNSTRICT_LINK_FLAGS
"$<$<CXX_COMPILER_ID:Clang>:${CLANG_STDLIB_OPTION}>"
${BAZEL_CC_ASAN_COMPILE_FLAGS}
${BAZEL_CC_COVERAGE_COMPILE_FLAGS}
)
# CUDA strict compile flags
set(
BAZEL_CUDA_STRICT_COMPILE_FLAGS
"$<$<COMPILE_LANGUAGE:C>:$<$<C_COMPILER_ID:Clang>:-Wall;-Wextra;-Wshadow>>"
"$<$<COMPILE_LANGUAGE:C>:$<$<C_COMPILER_ID:AppleClang>:-Wall;-Wextra;-Wshadow>>"
"$<$<COMPILE_LANGUAGE:C>:$<$<C_COMPILER_ID:GNU>:-Wall;-Wextra;-Wshadow>>"
"$<$<COMPILE_LANGUAGE:C>:$<$<C_COMPILER_ID:MSVC>:/W4>>"
"$<$<COMPILE_LANGUAGE:CXX>:$<$<CXX_COMPILER_ID:Clang>:-Wall;-Wextra;-Wshadow>>"
"$<$<COMPILE_LANGUAGE:CXX>:$<$<CXX_COMPILER_ID:AppleClang>:-Wall;-Wextra;-Wshadow>>"
"$<$<COMPILE_LANGUAGE:CXX>:$<$<CXX_COMPILER_ID:GNU>:-Wall;-Wextra;-Wshadow>>"
"$<$<COMPILE_LANGUAGE:CXX>:$<$<CXX_COMPILER_ID:MSVC>:/W4>>"
"$<$<CONFIG:DEBUG>:$<$<COMPILE_LANGUAGE:CUDA>:-G>>"
)
# CUDA strict link flags
set(BAZEL_CUDA_STRICT_LINK_FLAGS "")
# CUDA unstrict compile flags
set(
BAZEL_CUDA_UNSTRICT_COMPILE_FLAGS
"$<$<COMPILE_LANGUAGE:C>:$<$<C_COMPILER_ID:Clang>:-Wall>>"
"$<$<COMPILE_LANGUAGE:C>:$<$<C_COMPILER_ID:AppleClang>:-Wall>>"
"$<$<COMPILE_LANGUAGE:C>:$<$<C_COMPILER_ID:GNU>:-Wall>>"
"$<$<COMPILE_LANGUAGE:C>:$<$<C_COMPILER_ID:MSVC>:/W3>>"
"$<$<COMPILE_LANGUAGE:CXX>:$<$<CXX_COMPILER_ID:Clang>:-Wall>>"
"$<$<COMPILE_LANGUAGE:CXX>:$<$<CXX_COMPILER_ID:AppleClang>:-Wall>>"
"$<$<COMPILE_LANGUAGE:CXX>:$<$<CXX_COMPILER_ID:GNU>:-Wall>>"
"$<$<COMPILE_LANGUAGE:CXX>:$<$<CXX_COMPILER_ID:MSVC>:/W3>>"
"$<$<CONFIG:DEBUG>:$<$<COMPILE_LANGUAGE:CUDA>:-G>>"
)
# CUDA unstrict link flags
set(BAZEL_CUDA_UNSTRICT_LINK_FLAGS "")
## Find workspace directory
function(_find_workspace_directory _RESULT)
# Find Workspace.cmake folder
set(_CURRENT_WORKSPACE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
get_filename_component(
_PARENT_WORKSPACE_DIR ${_CURRENT_WORKSPACE_DIR} DIRECTORY
)
while(NOT ("${_CURRENT_WORKSPACE_DIR}" STREQUAL "${_PARENT_WORKSPACE_DIR}"))
if(EXISTS "${_CURRENT_WORKSPACE_DIR}/Workspace.cmake")
set(${_RESULT} ${_CURRENT_WORKSPACE_DIR} PARENT_SCOPE)
message(STATUS "Found workspace at ${${_RESULT}}")
break()
endif()
# Find next parent folder
set(_CURRENT_WORKSPACE_DIR ${_PARENT_WORKSPACE_DIR})
get_filename_component(
_PARENT_WORKSPACE_DIR ${_CURRENT_WORKSPACE_DIR} DIRECTORY
)
endwhile()
endfunction()
## Retrieve absolute paths
function(_absolute_paths _RESULT)
foreach(FILEPATH ${ARGN})
if(NOT IS_ABSOLUTE ${FILEPATH})
get_filename_component(FILEPATH ${FILEPATH} ABSOLUTE)
endif()
list(APPEND FILEPATHS ${FILEPATH})
endforeach()
set(${_RESULT} "${FILEPATHS}" PARENT_SCOPE)
endfunction()
## Add both shared and static library
macro(_add_library _NAME _OPTION)
add_library(${_NAME}_objects OBJECT ${_OPTION} ${ARGN})
add_library(
${_NAME}_static STATIC ${_OPTION} $<TARGET_OBJECTS:${_NAME}_objects>
)
add_library(
${_NAME} SHARED ${_OPTION} $<TARGET_OBJECTS:${_NAME}_objects>
)
add_dependencies(${_NAME} ${_NAME}_static)
if(NOT MSVC)
set_property(TARGET ${_NAME}_static PROPERTY OUTPUT_NAME ${_NAME})
endif()
endmacro()
## Link dependencies
function(_targets_link_dependencies _NAME)
foreach(LIB ${ARGN})
if(TARGET ${LIB})
list(APPEND LIBS_DEPS ${LIB})
list(
APPEND LIBS_INCS
"$<TARGET_PROPERTY:${LIB},INTERFACE_INCLUDE_DIRECTORIES>"
)
endif()
endforeach()
if(LIBS_DEPS)
add_dependencies(${_NAME} ${LIBS_DEPS})
target_include_directories(${_NAME} PRIVATE "${LIBS_INCS}")
endif()
endfunction()
## Link libraries
function(_target_link_libraries _NAME)
function(_collect_always_link_libs LIB_LIST RESULT_VAR)
if(NOT _COLLECT_ALWAYS_LINK_VISITED)
set(_COLLECT_ALWAYS_LINK_VISITED "" PARENT_SCOPE)
endif()
set(LOCAL_RESULT "")
foreach(LIB ${LIB_LIST})
if(NOT TARGET ${LIB})
continue()
endif()
list(FIND _COLLECT_ALWAYS_LINK_VISITED ${LIB} ALREADY_VISITED)
if(NOT ALREADY_VISITED EQUAL -1)
continue()
endif()
list(APPEND _COLLECT_ALWAYS_LINK_VISITED ${LIB})
set(_COLLECT_ALWAYS_LINK_VISITED "${_COLLECT_ALWAYS_LINK_VISITED}" PARENT_SCOPE)
get_target_property(ALWAYS_LINK ${LIB} ALWAYS_LINK)
if(ALWAYS_LINK)
list(APPEND LOCAL_RESULT ${LIB})
endif()
get_target_property(DEP_LIBS ${LIB} INTERFACE_LINK_LIBRARIES)
if(DEP_LIBS)
_collect_always_link_libs("${DEP_LIBS}" DEP_ALWAYS_LINK_LIBS)
list(APPEND LOCAL_RESULT ${DEP_ALWAYS_LINK_LIBS})
endif()
get_target_property(LINK_LIBS ${LIB} LINK_LIBRARIES)
if(LINK_LIBS)
_collect_always_link_libs("${LINK_LIBS}" LINK_ALWAYS_LINK_LIBS)
list(APPEND LOCAL_RESULT ${LINK_ALWAYS_LINK_LIBS})
endif()
endforeach()
list(REMOVE_DUPLICATES LOCAL_RESULT)
set(${RESULT_VAR} "${LOCAL_RESULT}" PARENT_SCOPE)
endfunction()
_collect_always_link_libs("${ARGN}" ALL_ALWAYS_LINK_LIBS)
set(ALL_LIBS_TO_PROCESS ${ARGN})
foreach(ALWAYS_LIB ${ALL_ALWAYS_LINK_LIBS})
list(FIND ARGN ${ALWAYS_LIB} FOUND_INDEX)
if(FOUND_INDEX EQUAL -1)
list(APPEND ALL_LIBS_TO_PROCESS ${ALWAYS_LIB})
endif()
endforeach()
list(REMOVE_DUPLICATES ALL_LIBS_TO_PROCESS)
foreach(LIB ${ALL_LIBS_TO_PROCESS})
if(NOT TARGET ${LIB})
list(APPEND LINK_LIBS ${LIB})
continue()
endif()
list(FIND ALL_ALWAYS_LINK_LIBS ${LIB} IS_ALWAYS_LINK)
if(IS_ALWAYS_LINK EQUAL -1)
list(APPEND LINK_LIBS ${LIB})
continue()
endif()
if(NOT MSVC)
if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
list(APPEND LINK_LIBS -Wl,--whole-archive ${LIB} -Wl,--no-whole-archive)
else()
list(APPEND LINK_LIBS -Wl,-force_load ${LIB})
endif()
else()
# Microsoft Visual C++
list(APPEND LINK_LIBS /WHOLEARCHIVE:$<TARGET_FILE:${LIB}>)
get_target_property(OTHER_LINK_LIBS ${LIB} INTERFACE_LINK_LIBRARIES)
if(OTHER_LINK_LIBS)
foreach(OTHER_LIB ${OTHER_LINK_LIBS})
list(FIND ALL_LIBS_TO_PROCESS ${OTHER_LIB} FOUND_INDEX)
if(FOUND_INDEX EQUAL -1)
list(APPEND LINK_LIBS ${OTHER_LIB})
endif()
endforeach()
endif()
list(APPEND LIBS_DEPS ${LIB})
list(
APPEND LIBS_INCS
"$<TARGET_PROPERTY:${LIB},INTERFACE_INCLUDE_DIRECTORIES>"
)
endif()
endforeach()
target_link_libraries(${_NAME} ${LINK_LIBS})
if(LIBS_DEPS)
add_dependencies(${_NAME} ${LIBS_DEPS})
target_include_directories(${_NAME} PRIVATE "${LIBS_INCS}")
endif()
endfunction()
## Add a subdirectory to the build
function(cc_directory)
add_subdirectory(${ARGN})
endfunction()
## Add subdirectories to the build
function(cc_directories)
foreach(SRC_DIR ${ARGN})
add_subdirectory(${SRC_DIR})
endforeach()
endfunction()
## Set the properties of target
function(_cc_target_properties)
cmake_parse_arguments(
CC_ARGS "STRICT;ALWAYS_LINK" "NAME;VERSION;C_STANDARD;CXX_STANDARD"
"INCS;PUBINCS;DEFS;LIBS;CFLAGS;CXXFLAGS;LDFLAGS;DEPS" ${ARGN}
)
if(NOT CC_ARGS_NAME)
message(FATAL_ERROR "No target name privated.")
endif()
get_target_property(TARGET_TYPE ${CC_ARGS_NAME} TYPE)
if(("${TARGET_TYPE}" STREQUAL "SHARED_LIBRARY") OR
("${TARGET_TYPE}" STREQUAL "STATIC_LIBRARY") OR
("${TARGET_TYPE}" STREQUAL "EXECUTABLE"))
set(TARGET_LINKABLE TRUE)
endif()
if(CC_ARGS_ALWAYS_LINK)
if(("${TARGET_TYPE}" STREQUAL "STATIC_LIBRARY") OR
("${TARGET_TYPE}" STREQUAL "OBJECT_LIBRARY"))
set_property(TARGET ${CC_ARGS_NAME} PROPERTY ALWAYS_LINK TRUE)
endif()
endif()
# Set the warning level of compiling
if(CC_ARGS_STRICT)
target_compile_options(
${CC_ARGS_NAME} PRIVATE "${BAZEL_CC_STRICT_COMPILE_FLAGS}"
)
if(TARGET_LINKABLE)
target_link_libraries(${CC_ARGS_NAME} "${BAZEL_CC_STRICT_LINK_FLAGS}")
endif()
else()
target_compile_options(
${CC_ARGS_NAME} PRIVATE "${BAZEL_CC_UNSTRICT_COMPILE_FLAGS}"
)
if(TARGET_LINKABLE)
target_link_libraries(${CC_ARGS_NAME} "${BAZEL_CC_UNSTRICT_LINK_FLAGS}")
endif()
endif()
if(CC_ARGS_DEFS)
target_compile_definitions(${CC_ARGS_NAME} PRIVATE "${CC_ARGS_DEFS}")
endif()
if(CC_ARGS_CFLAGS OR CC_ARGS_CXXFLAGS)
target_compile_options(
${CC_ARGS_NAME} PRIVATE
"$<$<COMPILE_LANGUAGE:C>:${CC_ARGS_CFLAGS}>"
"$<$<COMPILE_LANGUAGE:CXX>:${CC_ARGS_CXXFLAGS}>"
)
endif()
if(CC_ARGS_LDFLAGS)
string(REPLACE ";" " " CC_ARGS_LDFLAGS "${CC_ARGS_LDFLAGS}")
set_property(
TARGET ${CC_ARGS_NAME} PROPERTY LINK_FLAGS "${CC_ARGS_LDFLAGS}"
)
endif()
if(CC_ARGS_INCS)
_absolute_paths(INC_DIRS ${CC_ARGS_INCS})
target_include_directories(${CC_ARGS_NAME} PRIVATE "${INC_DIRS}")
endif()
if(BAZEL_WORKSPACE_DIR)
target_include_directories(${CC_ARGS_NAME} PRIVATE "${BAZEL_WORKSPACE_DIR}")
endif()
if(CC_ARGS_PUBINCS)
_absolute_paths(INC_DIRS ${CC_ARGS_PUBINCS})
target_include_directories(${CC_ARGS_NAME} PUBLIC "${INC_DIRS}")
endif()
if(CC_ARGS_LIBS)
if(NOT TARGET_LINKABLE)
_targets_link_dependencies(${CC_ARGS_NAME} ${CC_ARGS_LIBS})
else()
if ("${TARGET_TYPE}" STREQUAL "EXECUTABLE")
_target_link_libraries(${CC_ARGS_NAME} "${CC_ARGS_LIBS}")
else()
target_link_libraries(${CC_ARGS_NAME} "${CC_ARGS_LIBS}")
endif()
endif()
endif()
if(CC_ARGS_DEPS)
add_dependencies(${CC_ARGS_NAME} "${CC_ARGS_DEPS}")
endif()
if(CC_ARGS_VERSION)
set_property(
TARGET ${CC_ARGS_NAME} PROPERTY VERSION "${CC_ARGS_VERSION}"
)
endif()
if(NOT CC_C_STANDARD)
set(CC_C_STANDARD 99)
endif()
if(NOT CC_CXX_STANDARD)
set(CC_CXX_STANDARD 11)
endif()
set_target_properties(
${CC_ARGS_NAME} PROPERTIES DEFINE_SYMBOL ""
C_STANDARD ${CC_C_STANDARD} CXX_STANDARD ${CC_CXX_STANDARD}
C_STANDARD_REQUIRED ON C_EXTENSIONS ON
CXX_STANDARD_REQUIRED ON CXX_EXTENSIONS OFF
WINDOWS_EXPORT_ALL_SYMBOLS ON
)
endfunction()
## Build a C/C++ static or shared library
function(cc_library)
cmake_parse_arguments(
CC_ARGS
"STATIC;SHARED;EXCLUDE;PACKED;SRCS_NO_GLOB"
"NAME;VERSION"
"SRCS;INCS;PUBINCS;DEFS;LIBS;CFLAGS;CXXFLAGS;LDFLAGS;DEPS;PACKED_EXCLUDES"
${ARGN}
)
if(NOT CC_ARGS_NAME)
message(FATAL_ERROR "No target name provided.")
endif()
if(CC_ARGS_SRCS_NO_GLOB)
set(SOURCE_FILES ${CC_ARGS_SRCS})
if(NOT SOURCE_FILES)
message(FATAL_ERROR "No source files provided for ${CC_ARGS_NAME} (SRCS_NO_GLOB mode).")
endif()
else()
set(SOURCE_FILES "")
foreach(_src IN LISTS CC_ARGS_SRCS)
if(IS_ABSOLUTE "${_src}" OR NOT "${_src}" MATCHES "[*?]")
list(APPEND SOURCE_FILES "${_src}")
else()
file(GLOB _globbed_srcs ${_src})
list(APPEND SOURCE_FILES ${_globbed_srcs})
endif()
endforeach()
if(NOT SOURCE_FILES)
message(FATAL_ERROR "No source files found for ${CC_ARGS_NAME} after globbing.")
endif()
endif()
if(CC_ARGS_VERSION)
string(REPLACE "-" "_" MACRO_PREFIX "${CC_ARGS_NAME}")
list(APPEND CC_ARGS_DEFS ${MACRO_PREFIX}_VERSION="${CC_ARGS_VERSION}")
endif()
if(CC_ARGS_EXCLUDE)
set(EXCLUDE_OPTION EXCLUDE_FROM_ALL)
endif()
if(CC_ARGS_SHARED AND CC_ARGS_STATIC)
_add_library(${CC_ARGS_NAME} "${EXCLUDE_OPTION}" ${SOURCE_FILES})
elseif(CC_ARGS_SHARED)
add_library(${CC_ARGS_NAME} SHARED ${EXCLUDE_OPTION} ${SOURCE_FILES})
elseif(CC_ARGS_STATIC)
add_library(${CC_ARGS_NAME} STATIC ${EXCLUDE_OPTION} ${SOURCE_FILES})
else()
add_library(${CC_ARGS_NAME} ${EXCLUDE_OPTION} ${SOURCE_FILES})
endif()
if(TARGET ${CC_ARGS_NAME}_objects)
_cc_target_properties(
NAME "${CC_ARGS_NAME}_objects"
INCS "${CC_ARGS_INCS};${CC_ARGS_PUBINCS}"
DEFS "${CC_ARGS_DEFS}"
LIBS "${CC_ARGS_LIBS}"
CFLAGS "${CC_ARGS_CFLAGS}"
CXXFLAGS "${CC_ARGS_CXXFLAGS}"
LDFLAGS "${CC_ARGS_LDFLAGS}"
DEPS "${CC_ARGS_DEPS}"
"${CC_ARGS_UNPARSED_ARGUMENTS}"
)
endif()
if(TARGET ${CC_ARGS_NAME}_static)
_cc_target_properties(
NAME "${CC_ARGS_NAME}_static"
INCS "${CC_ARGS_INCS}"
PUBINCS "${CC_ARGS_PUBINCS}"
DEFS "${CC_ARGS_DEFS}"
LIBS "${CC_ARGS_LIBS}"
CFLAGS "${CC_ARGS_CFLAGS}"
CXXFLAGS "${CC_ARGS_CXXFLAGS}"
LDFLAGS "${CC_ARGS_LDFLAGS}"
DEPS "${CC_ARGS_DEPS}"
"${CC_ARGS_UNPARSED_ARGUMENTS}"
)
if(CC_ARGS_PACKED)
install(
TARGETS ${CC_ARGS_NAME}_static
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
)
endif()
endif()
_cc_target_properties(
NAME "${CC_ARGS_NAME}"
INCS "${CC_ARGS_INCS}"
PUBINCS "${CC_ARGS_PUBINCS}"
DEFS "${CC_ARGS_DEFS}"
LIBS "${CC_ARGS_LIBS}"
CFLAGS "${CC_ARGS_CFLAGS}"
CXXFLAGS "${CC_ARGS_CXXFLAGS}"
LDFLAGS "${CC_ARGS_LDFLAGS}"
DEPS "${CC_ARGS_DEPS}"
VERSION "${CC_ARGS_VERSION}"
"${CC_ARGS_UNPARSED_ARGUMENTS}"
)
if(CC_ARGS_PACKED)
install(
TARGETS ${CC_ARGS_NAME}
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
)
if(CC_ARGS_PUBINCS)
foreach(PACKED_EXCLUDE ${CC_ARGS_PACKED_EXCLUDES})
list(APPEND PATTERN_EXCLUDES "PATTERN;${PACKED_EXCLUDE};EXCLUDE")
endforeach()
install(
DIRECTORY ${CC_ARGS_PUBINCS} DESTINATION ${CMAKE_INSTALL_INCDIR}
FILES_MATCHING PATTERN "*.h" PATTERN "*.hpp" PATTERN "*.hxx"
${PATTERN_EXCLUDES}
)
endif()
endif()
endfunction()
## Build a C/C++ executable program
function(cc_binary)
cmake_parse_arguments(
CC_ARGS "PACKED" "NAME;VERSION"
"SRCS;INCS;DEFS;LIBS;CFLAGS;CXXFLAGS;LDFLAGS;DEPS" ${ARGN}
)
if(NOT CC_ARGS_NAME)
message(FATAL_ERROR "No target name privated.")
endif()
file(GLOB CC_ARGS_SRCS ${CC_ARGS_SRCS})
if(NOT CC_ARGS_SRCS)
message(FATAL_ERROR "No source files found of ${CC_ARGS_NAME}.")
endif()
if(CC_ARGS_VERSION)
string(REPLACE "-" "_" MACRO_PREFIX "${CC_ARGS_NAME}")
list(APPEND CC_ARGS_DEFS ${MACRO_PREFIX}_VERSION="${CC_ARGS_VERSION}")
endif()
add_executable(${CC_ARGS_NAME} ${CC_ARGS_SRCS})
if(CC_ARGS_PACKED)
install(
TARGETS ${CC_ARGS_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
)
endif()
_cc_target_properties(
NAME "${CC_ARGS_NAME}"
INCS "${CC_ARGS_INCS}"
DEFS "${CC_ARGS_DEFS}"
LIBS "${CC_ARGS_LIBS}"
CFLAGS "${CC_ARGS_CFLAGS}"
CXXFLAGS "${CC_ARGS_CXXFLAGS}"
LDFLAGS "${CC_ARGS_LDFLAGS}"
DEPS "${CC_ARGS_DEPS}"
VERSION "${CC_ARGS_VERSION}"
"${CC_ARGS_UNPARSED_ARGUMENTS}"
)
endfunction()
## Build a C/C++ executable test program
function(cc_test)
cmake_parse_arguments(
CC_ARGS "" "NAME;VERSION"
"SRCS;INCS;DEFS;LIBS;CFLAGS;CXXFLAGS;LDFLAGS;DEPS;ARGS" ${ARGN}
)
if(NOT CC_ARGS_NAME)
message(FATAL_ERROR "No target name privated.")
endif()
file(GLOB CC_ARGS_SRCS ${CC_ARGS_SRCS})
if(NOT CC_ARGS_SRCS)
message(FATAL_ERROR "No source files found of ${CC_ARGS_NAME}.")
endif()
if(CC_ARGS_VERSION)
string(REPLACE "-" "_" MACRO_PREFIX "${CC_ARGS_NAME}")
list(APPEND CC_ARGS_DEFS ${MACRO_PREFIX}_VERSION="${CC_ARGS_VERSION}")
endif()
add_executable(${CC_ARGS_NAME} EXCLUDE_FROM_ALL ${CC_ARGS_SRCS})
_cc_target_properties(
NAME "${CC_ARGS_NAME}"
INCS "${CC_ARGS_INCS}"
DEFS "${CC_ARGS_DEFS}"
LIBS "${CC_ARGS_LIBS}"
CFLAGS "${CC_ARGS_CFLAGS}"
CXXFLAGS "${CC_ARGS_CXXFLAGS}"
LDFLAGS "${CC_ARGS_LDFLAGS}"
DEPS "${CC_ARGS_DEPS}"
"${CC_ARGS_UNPARSED_ARGUMENTS}"
)
add_dependencies(unittest ${CC_ARGS_NAME})
add_custom_target(
unittest.${CC_ARGS_NAME}
COMMAND $<TARGET_FILE:${CC_ARGS_NAME}> "${CC_ARGS_ARGS}"
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
DEPENDS ${CC_ARGS_NAME}
)
add_test(
NAME ${CC_ARGS_NAME}
COMMAND $<TARGET_FILE:${CC_ARGS_NAME}> "${CC_ARGS_ARGS}"
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
)
endfunction()
## Add existing test cases to a test suite
function(cc_test_suite _NAME)
if(NOT TARGET unittest.${_NAME})
add_custom_target(unittest.${_NAME} COMMAND "")
endif()
foreach(TEST_TARGET ${ARGN})
list(APPEND TEST_TARGETS unittest.${TEST_TARGET})
endforeach()
if(TEST_TARGETS)
add_dependencies(unittest.${_NAME} ${TEST_TARGETS})
endif()
endfunction()
## Import a C/C++ static or shared library
function(cc_import)
cmake_parse_arguments(
CC_ARGS "STATIC;SHARED;PACKED"
"NAME;PATH;IMPLIB" "INCS;PUBINCS;DEPS;PACKED_EXCLUDES" ${ARGN}
)
if(NOT CC_ARGS_NAME)
message(FATAL_ERROR "No target name privated.")
endif()
file(GLOB CC_ARGS_PATH ${CC_ARGS_PATH})
if(NOT CC_ARGS_PATH)
message(FATAL_ERROR "No imported target file found of ${CC_ARGS_NAME}.")
endif()
if(MSVC AND CC_ARGS_SHARED AND NOT CC_ARGS_IMPLIB)
string(REGEX REPLACE
".[Dd][Ll][Ll]$" ".lib" CC_ARGS_IMPLIB ${CC_ARGS_PATH}
)
endif()
if(CC_ARGS_SHARED)
add_library(${CC_ARGS_NAME} SHARED IMPORTED GLOBAL)
elseif(CC_ARGS_STATIC)
add_library(${CC_ARGS_NAME} STATIC IMPORTED GLOBAL)
else()
add_library(${CC_ARGS_NAME} UNKNOWN IMPORTED GLOBAL)
endif()
set_property(
TARGET ${CC_ARGS_NAME} PROPERTY IMPORTED_LOCATION ${CC_ARGS_PATH}
)
if(MSVC AND CC_ARGS_SHARED)
set_property(
TARGET ${CC_ARGS_NAME} PROPERTY IMPORTED_IMPLIB ${CC_ARGS_IMPLIB}
)
endif()
if(CC_ARGS_INCS)
_absolute_paths(INC_DIRS ${CC_ARGS_INCS})
foreach(INC_DIR ${INC_DIRS})
set_property(
TARGET ${CC_ARGS_NAME} APPEND PROPERTY
INTERFACE_INCLUDE_DIRECTORIES "${INC_DIR}"
)
endforeach()
endif()
if(CC_ARGS_PUBINCS)
_absolute_paths(INC_DIRS ${CC_ARGS_PUBINCS})
foreach(INC_DIR ${INC_DIRS})
set_property(
TARGET ${CC_ARGS_NAME} APPEND PROPERTY
INTERFACE_INCLUDE_DIRECTORIES "${INC_DIR}"
)
endforeach()
endif()
if(CC_ARGS_DEPS)
add_dependencies(${CC_ARGS_NAME} "${CC_ARGS_DEPS}")
endif()
if(CC_ARGS_PACKED)
install(
TARGETS ${CC_ARGS_NAME}
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
)
if(CC_ARGS_PUBINCS)
foreach(PACKED_EXCLUDE ${CC_ARGS_PACKED_EXCLUDES})
list(APPEND PATTERN_EXCLUDES "PATTERN;${PACKED_EXCLUDE};EXCLUDE")
endforeach()
install(
DIRECTORY ${CC_ARGS_PUBINCS} DESTINATION ${CMAKE_INSTALL_INCDIR}
FILES_MATCHING PATTERN "*.h" PATTERN "*.hpp" PATTERN "*.hxx"
${PATTERN_EXCLUDES}
)
endif()
endif()
endfunction()
## Import a C/C++ interface library
function(cc_interface)
cmake_parse_arguments(
CC_ARGS "PACKED" "NAME" "INCS;PUBINCS;DEPS;PACKED_EXCLUDES" ${ARGN}
)
if(NOT CC_ARGS_NAME)
message(FATAL_ERROR "No target name privated.")
endif()
add_library(${CC_ARGS_NAME} INTERFACE GLOBAL)
if(CC_ARGS_INCS)
_absolute_paths(INC_DIRS ${CC_ARGS_INCS})
target_include_directories(${CC_ARGS_NAME} INTERFACE "${INC_DIRS}")
endif()
if(CC_ARGS_PUBINCS)
_absolute_paths(INC_DIRS ${CC_ARGS_PUBINCS})
target_include_directories(${CC_ARGS_NAME} INTERFACE "${INC_DIRS}")
endif()
if(CC_ARGS_DEPS)
add_dependencies(${CC_ARGS_NAME} "${CC_ARGS_DEPS}")
endif()
if(CC_ARGS_PACKED AND CC_ARGS_PUBINCS)
foreach(PACKED_EXCLUDE ${CC_ARGS_PACKED_EXCLUDES})
list(APPEND PATTERN_EXCLUDES "PATTERN;${PACKED_EXCLUDE};EXCLUDE")
endforeach()
install(
DIRECTORY ${CC_ARGS_PUBINCS} DESTINATION ${CMAKE_INSTALL_INCDIR}
FILES_MATCHING PATTERN "*.h" PATTERN "*.hpp" PATTERN "*.hxx"
${PATTERN_EXCLUDES}
)
endif()
endfunction()
## Find gtest library
function(_find_gtest)
if(DEFINED FIND_GTEST_LIBS AND DEFINED FIND_GTEST_INCS)
return()
endif()
if(NOT TARGET gtest OR NOT TARGET gtest_main)
# Find gtest using 'find_package'
find_package(GTest REQUIRED)
set(
FIND_GTEST_INCS "${GTEST_INCLUDE_DIRS}"
CACHE STRING "GTest includes"
)
set(
FIND_GTEST_LIBS "${GTEST_BOTH_LIBRARIES}"
CACHE STRING "GTest libraries"
)
else()
# Find gtest using target names
set(FIND_GTEST_INCS "" CACHE STRING "GTest includes")
set(FIND_GTEST_LIBS "gtest;gtest_main" CACHE STRING "GTest libraries")
endif()
endfunction()
## Build a C/C++ executable google test program
function(cc_gtest)
cmake_parse_arguments(
CC_ARGS "" "NAME;VERSION"
"SRCS;INCS;DEFS;LIBS;CFLAGS;CXXFLAGS;LDFLAGS;DEPS;ARGS" ${ARGN}
)
_find_gtest()
cc_test(
NAME "${CC_ARGS_NAME}"
VERSION "${CC_ARGS_VERSION}"
SRCS "${CC_ARGS_SRCS}"
INCS "${CC_ARGS_INCS};${FIND_GTEST_INCS}"
DEFS "${CC_ARGS_DEFS}"
LIBS "${CC_ARGS_LIBS};${FIND_GTEST_LIBS}"
CFLAGS "${CC_ARGS_CFLAGS}"
CXXFLAGS "${CC_ARGS_CXXFLAGS}"
LDFLAGS "${CC_ARGS_LDFLAGS}"
DEPS "${CC_ARGS_DEPS}"
ARGS "${CC_ARGS_ARGS}"
)
endfunction()
## Find gmock library
function(_find_gmock)
if(DEFINED FIND_GMOCK_LIBS AND DEFINED FIND_GMOCK_INCS)
return()
endif()
if(NOT TARGET gmock OR NOT TARGET gmock_main)
# Find gmock/gtest using 'find_package'
find_package(GMock REQUIRED)
find_package(GTest REQUIRED)
set(
FIND_GMOCK_INCS "${GMOCK_INCLUDE_DIRS};${GTEST_INCLUDE_DIRS}"
CACHE STRING "GMock includes"
)
set(
FIND_GMOCK_LIBS "${GMOCK_BOTH_LIBRARIES};${GTEST_LIBRARIES}"
CACHE STRING "GMock libraries"
)
else()
# Find gmock using target names
set(FIND_GMOCK_INCS "" CACHE STRING "GMock includes")
set(FIND_GMOCK_LIBS "gmock;gmock_main" CACHE STRING "GMock libraries")
endif()
endfunction()
## Build a C/C++ executable google mock program
function(cc_gmock)
cmake_parse_arguments(
CC_ARGS "" "NAME;VERSION"
"SRCS;INCS;DEFS;LIBS;CFLAGS;CXXFLAGS;LDFLAGS;DEPS;ARGS" ${ARGN}
)
_find_gmock()
cc_test(
NAME "${CC_ARGS_NAME}"
VERSION "${CC_ARGS_VERSION}"
SRCS "${CC_ARGS_SRCS}"
INCS "${CC_ARGS_INCS};${FIND_GMOCK_INCS}"
DEFS "${CC_ARGS_DEFS}"
LIBS "${CC_ARGS_LIBS};${FIND_GMOCK_LIBS}"
CFLAGS "${CC_ARGS_CFLAGS}"
CXXFLAGS "${CC_ARGS_CXXFLAGS}"
LDFLAGS "${CC_ARGS_LDFLAGS}"
DEPS "${CC_ARGS_DEPS}"
ARGS "${CC_ARGS_ARGS}"
)
endfunction()
## Find protobuf library
function(_find_protobuf _VERSION)
if(DEFINED CC_PROTOBUF_PROTOC_${_VERSION})
return()
endif()
# Find protobuf using 'find_package'
if(NOT TARGET protoc OR NOT TARGET libprotobuf)
find_package(Protobuf ${_VERSION} REQUIRED)
set(
CC_PROTOBUF_PROTOC_${_VERSION}
"${PROTOBUF_PROTOC_EXECUTABLE}" CACHE PATH "Protobuf compiler"
)
set(
CC_PROTOBUF_INCS_${_VERSION}
"${PROTOBUF_INCLUDE_DIRS}" CACHE STRING "Protobuf includes"
)
set(
CC_PROTOBUF_LIBS_${_VERSION}
"${PROTOBUF_LIBRARIES}" CACHE STRING "Protobuf libraries"
)
return()
endif()
# Find protobuf using target names
get_target_property(protoc_VERSION protoc VERSION)
get_target_property(libprotobuf_VERSION libprotobuf VERSION)
if(_VERSION)
if(${protoc_VERSION} VERSION_LESS ${_VERSION})
message(
FATAL_ERROR
"The 'protoc' version is ${protoc_VERSION}, less than ${_VERSION}."
)
endif()
if(${libprotobuf_VERSION} VERSION_LESS ${_VERSION})
message(
FATAL_ERROR
"The 'libprotobuf' version is ${libprotobuf_VERSION}, "
"less than ${_VERSION}."
)
endif()
endif()
message(STATUS "Found binary 'protoc ${protoc_VERSION}'")
message(STATUS "Found library 'libprotobuf ${libprotobuf_VERSION}'")
set(
CC_PROTOBUF_PROTOC_${_VERSION}
"$<TARGET_FILE:protoc>" CACHE PATH "Protobuf compiler"
)
get_target_property(protoc_SOURCE_DIR protoc SOURCE_DIR)
get_filename_component(protoc_INCLUDE_DIR ${protoc_SOURCE_DIR}/../src ABSOLUTE)
set(
CC_PROTOBUF_INCS_${_VERSION}
"${protoc_INCLUDE_DIR}" CACHE STRING "Protobuf includes"
)
set(
CC_PROTOBUF_LIBS_${_VERSION} libprotobuf CACHE STRING "Protobuf libraries"
)
endfunction()
## Build a C++ protobuf static or shared library
function(cc_proto_library)
cmake_parse_arguments(
CC_ARGS "STATIC;SHARED;EXCLUDE;PACKED"
"NAME;VERSION;PROTOROOT;PROTOBUF_VERSION"
"SRCS;CXXFLAGS;LDFLAGS;DEPS" ${ARGN}
)
_find_protobuf("${CC_ARGS_PROTOBUF_VERSION}")
set(CC_PROTOBUF_PROTOC ${CC_PROTOBUF_PROTOC_${CC_ARGS_PROTOBUF_VERSION}})
if(DEFINED GLOBAL_CC_PROTOBUF_PROTOC)
set(CC_PROTOBUF_PROTOC ${GLOBAL_CC_PROTOBUF_PROTOC})
endif()
set(CC_PROTOBUF_INCS ${CC_PROTOBUF_INCS_${CC_ARGS_PROTOBUF_VERSION}})
set(CC_PROTOBUF_LIBS ${CC_PROTOBUF_LIBS_${CC_ARGS_PROTOBUF_VERSION}})
if(NOT CC_ARGS_NAME)
message(FATAL_ERROR "No target name privated.")
endif()
file(GLOB CC_ARGS_SRCS ${CC_ARGS_SRCS})
if(NOT CC_ARGS_SRCS)
message(FATAL_ERROR "No source files found of ${CC_ARGS_NAME}.")
endif()
if(CC_ARGS_VERSION)
string(REPLACE "-" "_" MACRO_PREFIX "${CC_ARGS_NAME}")
list(APPEND CC_ARGS_DEFS ${MACRO_PREFIX}_VERSION="${CC_ARGS_VERSION}")
endif()
if(CC_ARGS_EXCLUDE)
set(EXCLUDE_OPTION EXCLUDE_FROM_ALL)
endif()
set(PROTO_ROOT ${CMAKE_CURRENT_SOURCE_DIR})
if(CC_ARGS_PROTOROOT)
get_filename_component(PROTO_ROOT ${CC_ARGS_PROTOROOT} ABSOLUTE)
endif()
# Compile proto files to C++ sources
set(CPP_OUTPATH "${CMAKE_CURRENT_BINARY_DIR}")
foreach(PROTO_FILE ${CC_ARGS_SRCS})
get_filename_component(PROTO_FILE ${PROTO_FILE} ABSOLUTE)
if(NOT ${PROTO_FILE} MATCHES "\\.proto$$")
message(FATAL_ERROR "Unrecognized proto file ${PROTOFILE}")
endif()
if(NOT ${PROTO_FILE} MATCHES "^${PROTO_ROOT}")
message(FATAL_ERROR "'${PROTO_FILE}' NOT IN '${PROTO_ROOT}'")
endif()
string(
REGEX REPLACE "^${PROTO_ROOT}(/?)" "" ROOT_CLEANED_FILE ${PROTO_FILE}
)
string(REGEX REPLACE "\\.proto$$" "" EXT_CLEANED_FILE ${ROOT_CLEANED_FILE})
set(CPP_FILE "${CPP_OUTPATH}/${EXT_CLEANED_FILE}.pb.cc")
set(HDR_FILE "${CPP_OUTPATH}/${EXT_CLEANED_FILE}.pb.h")
set(INJ_FILE "${CPP_OUTPATH}/${EXT_CLEANED_FILE}.pb.cmake")
file(RELATIVE_PATH REL_CPP_FILE ${CMAKE_BINARY_DIR} ${CPP_FILE})
set(INJECTED_SCRIPT
"foreach(SRC ${EXT_CLEANED_FILE}.pb.cc ${EXT_CLEANED_FILE}.pb.h)\n"
" file(READ \$\{SRC\} SRC_CODE)\n"
" file(REMOVE \$\{SRC\})\n"
" file(APPEND \$\{SRC\} \"#ifdef __GNUC__\\n\")\n"
" file(APPEND \$\{SRC\} \"#pragma GCC diagnostic push\\n\")\n"
" file(APPEND \$\{SRC\} \"#pragma GCC diagnostic ignored \\\"-Wshadow\\\"\\n\")\n"
" file(APPEND \$\{SRC\} \"#pragma GCC diagnostic ignored \\\"-Wunused-parameter\\\"\\n\")\n"
" file(APPEND \$\{SRC\} \"#endif\\n\\n\")\n"
" file(APPEND \$\{SRC\} \"\$\{SRC_CODE\}\")\n"
" file(APPEND \$\{SRC\} \"\\n#ifdef __GNUC__\\n\")\n"
" file(APPEND \$\{SRC\} \"#pragma GCC diagnostic pop\\n\")\n"
" file(APPEND \$\{SRC\} \"#endif\\n\")\n"
"endforeach()\n"
)
file(WRITE "${INJ_FILE}" ${INJECTED_SCRIPT})
add_custom_command(
OUTPUT "${CPP_FILE}" "${HDR_FILE}"
# COMMAND ${CMAKE_COMMAND} -E make_directory ${CPP_OUTPATH}
COMMAND ${CC_PROTOBUF_PROTOC}
--cpp_out "${CPP_OUTPATH}" --python_out "${CPP_OUTPATH}"
--proto_path "${PROTO_ROOT}" --proto_path "${CC_PROTOBUF_INCS}" "${PROTO_FILE}"
COMMAND ${CMAKE_COMMAND} -P "${INJ_FILE}"
DEPENDS "${PROTO_FILE}"
COMMENT "Generating CXX source ${REL_CPP_FILE}"
VERBATIM
)
list(APPEND CC_SRCS "${CPP_FILE}" "${HDR_FILE}")
endforeach()
# Compile C++ sources
if(CC_ARGS_SHARED AND CC_ARGS_STATIC)
_add_library(${CC_ARGS_NAME} "${EXCLUDE_OPTION}" "${CC_SRCS}")
elseif(CC_ARGS_SHARED)
add_library(${CC_ARGS_NAME} SHARED ${EXCLUDE_OPTION} ${CC_SRCS})
elseif(CC_ARGS_STATIC)
add_library(${CC_ARGS_NAME} STATIC ${EXCLUDE_OPTION} ${CC_SRCS})
else()
add_library(${CC_ARGS_NAME} ${EXCLUDE_OPTION} ${CC_SRCS})
endif()
if(TARGET ${CC_ARGS_NAME}_objects)
_cc_target_properties(
NAME "${CC_ARGS_NAME}_objects"
INCS "${CPP_OUTPATH};${CC_PROTOBUF_INCS}"
LIBS "${CC_PROTOBUF_LIBS}"
CXXFLAGS "${CC_ARGS_CXXFLAGS}"
LDFLAGS "${CC_ARGS_LDFLAGS}"
DEPS "${CC_ARGS_DEPS}"
"${CC_ARGS_UNPARSED_ARGUMENTS}"
)
endif()
if(TARGET ${CC_ARGS_NAME}_static)
_cc_target_properties(
NAME "${CC_ARGS_NAME}_static"
PUBINCS "${CPP_OUTPATH};${CC_PROTOBUF_INCS}"
LIBS "${CC_PROTOBUF_LIBS}"
CXXFLAGS "${CC_ARGS_CXXFLAGS}"
LDFLAGS "${CC_ARGS_LDFLAGS}"
DEPS "${CC_ARGS_DEPS}"
"${CC_ARGS_UNPARSED_ARGUMENTS}"
)
if(CC_ARGS_PACKED)
install(
TARGETS ${CC_ARGS_NAME}_static
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
)
endif()
endif()
_cc_target_properties(
NAME "${CC_ARGS_NAME}"
PUBINCS "${CPP_OUTPATH};${CC_PROTOBUF_INCS}"
LIBS "${CC_PROTOBUF_LIBS}"
CXXFLAGS "${CC_ARGS_CXXFLAGS}"
LDFLAGS "${CC_ARGS_LDFLAGS}"
DEPS "${CC_ARGS_DEPS}"
VERSION "${CC_ARGS_VERSION}"
"${CC_ARGS_UNPARSED_ARGUMENTS}"
)
if(CC_ARGS_PACKED)
install(
TARGETS ${CC_ARGS_NAME}
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
)
endif()
endfunction()
## Add a subdirectory to the build
function(cuda_directory)
if(NOT CMAKE_CUDA_COMPILER)
message(FATAL_ERROR "No CUDA language supported.")
endif()
cc_directory(${ARGN})
endfunction()
## Add subdirectories to the build
function(cuda_directories)
if(NOT CMAKE_CUDA_COMPILER)
message(FATAL_ERROR "No CUDA language supported.")
endif()
cc_directories(${ARGN})
endfunction()
## Set the properties of cuda target
function(_cuda_target_properties)
cmake_parse_arguments(
CUDA_ARGS "STRICT;ALWAYS_LINK" "NAME;VERSION;C_STANDARD;CXX_STANDARD"
"INCS;PUBINCS;DEFS;LIBS;CFLAGS;CXXFLAGS;CUDAFLAGS;LDFLAGS;DEPS" ${ARGN}
)
if(NOT CUDA_ARGS_NAME)
message(FATAL_ERROR "No target name privated.")
endif()
get_target_property(TARGET_TYPE ${CUDA_ARGS_NAME} TYPE)
if(("${TARGET_TYPE}" STREQUAL "SHARED_LIBRARY") OR
("${TARGET_TYPE}" STREQUAL "STATIC_LIBRARY") OR
("${TARGET_TYPE}" STREQUAL "EXECUTABLE"))
set(TARGET_LINKABLE TRUE)
endif()
if(CUDA_ARGS_ALWAYS_LINK)
if(("${TARGET_TYPE}" STREQUAL "STATIC_LIBRARY") OR
("${TARGET_TYPE}" STREQUAL "OBJECT_LIBRARY"))
set_property(TARGET ${CUDA_ARGS_NAME} PROPERTY ALWAYS_LINK TRUE)
endif()
endif()
# Set the warning level of compiling
if(CUDA_ARGS_STRICT)
target_compile_options(
${CUDA_ARGS_NAME} PRIVATE "${BAZEL_CUDA_STRICT_COMPILE_FLAGS}"
)
if(TARGET_LINKABLE)
target_link_libraries(
${CUDA_ARGS_NAME} "${BAZEL_CUDA_STRICT_LINK_FLAGS}"
)
endif()
else()
target_compile_options(
${CUDA_ARGS_NAME} PRIVATE "${BAZEL_CUDA_UNSTRICT_COMPILE_FLAGS}"
)
if(TARGET_LINKABLE)
target_link_libraries(
${CUDA_ARGS_NAME} "${BAZEL_CUDA_UNSTRICT_LINK_FLAGS}"
)
endif()
endif()
target_compile_options(
${CUDA_ARGS_NAME} PRIVATE
"$<$<COMPILE_LANGUAGE:CUDA>:-ccbin=${CMAKE_CXX_COMPILER}>"
)
if(CUDA_ARGS_DEFS)
target_compile_definitions(${CUDA_ARGS_NAME} PRIVATE "${CUDA_ARGS_DEFS}")
endif()
if(CUDA_ARGS_CFLAGS OR CUDA_ARGS_CXXFLAGS OR CUDA_ARGS_CUDAFLAGS)
target_compile_options(
${CUDA_ARGS_NAME} PRIVATE
"$<$<COMPILE_LANGUAGE:C>:${CUDA_ARGS_CFLAGS}>"
"$<$<COMPILE_LANGUAGE:CXX>:${CUDA_ARGS_CXXFLAGS}>"
"$<$<COMPILE_LANGUAGE:CUDA>:${CUDA_ARGS_CUDAFLAGS}>"
)
endif()
if(CUDA_ARGS_LDFLAGS)
string(REPLACE ";" " " CUDA_ARGS_LDFLAGS "${CUDA_ARGS_LDFLAGS}")
set_property(
TARGET ${CUDA_ARGS_NAME} PROPERTY LINK_FLAGS "${CUDA_ARGS_LDFLAGS}"
)
endif()
if(CUDA_ARGS_INCS)
_absolute_paths(INC_DIRS ${CUDA_ARGS_INCS})
target_include_directories(${CUDA_ARGS_NAME} PRIVATE "${INC_DIRS}")
endif()
target_include_directories(
${CUDA_ARGS_NAME} PRIVATE "${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES}"
)
if(BAZEL_WORKSPACE_DIR)
target_include_directories(
${CUDA_ARGS_NAME} PRIVATE "${BAZEL_WORKSPACE_DIR}"
)
endif()
if(CUDA_ARGS_PUBINCS)
_absolute_paths(INC_DIRS ${CUDA_ARGS_PUBINCS})
target_include_directories(${CUDA_ARGS_NAME} PUBLIC "${INC_DIRS}")
endif()
if(CUDA_ARGS_LIBS)
if(NOT TARGET_LINKABLE)
_targets_link_dependencies(${CUDA_ARGS_NAME} ${CUDA_ARGS_LIBS})
else()
if ("${TARGET_TYPE}" STREQUAL "EXECUTABLE")
_target_link_libraries(${CUDA_ARGS_NAME} "${CUDA_ARGS_LIBS}")
else()
target_link_libraries(${CUDA_ARGS_NAME} "${CUDA_ARGS_LIBS}")
endif()
endif()
endif()
if(CUDA_ARGS_DEPS)
add_dependencies(${CUDA_ARGS_NAME} "${CUDA_ARGS_DEPS}")
endif()
if(CUDA_ARGS_VERSION)
set_property(
TARGET ${CUDA_ARGS_NAME} PROPERTY VERSION "${CUDA_ARGS_VERSION}"
)
endif()
if(NOT CUDA_C_STANDARD)
set(CUDA_C_STANDARD 99)
endif()
if(NOT CUDA_CXX_STANDARD)
set(CUDA_CXX_STANDARD 11)
endif()
set_target_properties(
${CUDA_ARGS_NAME} PROPERTIES DEFINE_SYMBOL ""
C_STANDARD ${CUDA_C_STANDARD} CXX_STANDARD ${CUDA_CXX_STANDARD}
C_STANDARD_REQUIRED ON C_EXTENSIONS ON
CXX_STANDARD_REQUIRED ON CXX_EXTENSIONS OFF
CUDA_STANDARD 11 CUDA_STANDARD_REQUIRED ON CUDA_EXTENSIONS OFF
WINDOWS_EXPORT_ALL_SYMBOLS ON
)
endfunction()
## Build a CUDA static or shared library
function(cuda_library)
if(NOT CMAKE_CUDA_COMPILER)
message(FATAL_ERROR "No CUDA language supported.")
endif()
cmake_parse_arguments(
CUDA_ARGS "STATIC;SHARED;EXCLUDE;PACKED" "NAME;VERSION"
"SRCS;INCS;PUBINCS;DEFS;LIBS;CFLAGS;CXXFLAGS;CUDAFLAGS;LDFLAGS;DEPS;PACKED_EXCS"
${ARGN}
)
if(NOT CUDA_ARGS_NAME)
message(FATAL_ERROR "No target name privated.")
endif()
file(GLOB CUDA_ARGS_SRCS ${CUDA_ARGS_SRCS})
if(NOT CUDA_ARGS_SRCS)
message(FATAL_ERROR "No source files found of ${CUDA_ARGS_NAME}.")
endif()
if(CUDA_ARGS_VERSION)
string(REPLACE "-" "_" MACRO_PREFIX "${CUDA_ARGS_NAME}")
list(APPEND CUDA_ARGS_DEFS ${MACRO_PREFIX}_VERSION="${CUDA_ARGS_VERSION}")
endif()
if(CUDA_ARGS_EXCLUDE)
set(EXCLUDE_OPTION EXCLUDE_FROM_ALL)
endif()
if(CUDA_ARGS_SHARED AND CUDA_ARGS_STATIC)
_add_library(${CUDA_ARGS_NAME} "${EXCLUDE_OPTION}" "${CUDA_ARGS_SRCS}")
elseif(CUDA_ARGS_SHARED)
add_library(${CUDA_ARGS_NAME} SHARED ${EXCLUDE_OPTION} ${CUDA_ARGS_SRCS})
elseif(CUDA_ARGS_STATIC)
add_library(${CUDA_ARGS_NAME} STATIC ${EXCLUDE_OPTION} ${CUDA_ARGS_SRCS})
else()
add_library(${CUDA_ARGS_NAME} ${EXCLUDE_OPTION} ${CUDA_ARGS_SRCS})
endif()
if(TARGET ${CUDA_ARGS_NAME}_objects)
_cuda_target_properties(
NAME "${CUDA_ARGS_NAME}_objects"
INCS "${CUDA_ARGS_INCS};${CUDA_ARGS_PUBINCS}"
DEFS "${CUDA_ARGS_DEFS}"
LIBS "${CUDA_ARGS_LIBS}"
CFLAGS "${CUDA_ARGS_CFLAGS}"
CXXFLAGS "${CUDA_ARGS_CXXFLAGS}"
CUDAFLAGS "${CUDA_ARGS_CUDAFLAGS}"
LDFLAGS "${CUDA_ARGS_LDFLAGS}"
DEPS "${CUDA_ARGS_DEPS}"
"${CUDA_ARGS_UNPARSED_ARGUMENTS}"
)
endif()
if(TARGET ${CUDA_ARGS_NAME}_static)
_cuda_target_properties(
NAME "${CUDA_ARGS_NAME}_static"
INCS "${CUDA_ARGS_INCS}"
PUBINCS "${CUDA_ARGS_PUBINCS}"
DEFS "${CUDA_ARGS_DEFS}"
LIBS "${CUDA_ARGS_LIBS}"
CFLAGS "${CUDA_ARGS_CFLAGS}"
CXXFLAGS "${CUDA_ARGS_CXXFLAGS}"
CUDAFLAGS "${CUDA_ARGS_CUDAFLAGS}"
LDFLAGS "${CUDA_ARGS_LDFLAGS}"
DEPS "${CUDA_ARGS_DEPS}"
"${CUDA_ARGS_UNPARSED_ARGUMENTS}"
)
if(CUDA_ARGS_PACKED)
install(
TARGETS ${CUDA_ARGS_NAME}_static
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
)
endif()
endif()
_cuda_target_properties(
NAME "${CUDA_ARGS_NAME}"
INCS "${CUDA_ARGS_INCS}"
PUBINCS "${CUDA_ARGS_PUBINCS}"
DEFS "${CUDA_ARGS_DEFS}"
LIBS "${CUDA_ARGS_LIBS}"
CFLAGS "${CUDA_ARGS_CFLAGS}"
CXXFLAGS "${CUDA_ARGS_CXXFLAGS}"
CUDAFLAGS "${CUDA_ARGS_CUDAFLAGS}"
LDFLAGS "${CUDA_ARGS_LDFLAGS}"
DEPS "${CUDA_ARGS_DEPS}"
VERSION "${CUDA_ARGS_VERSION}"
"${CUDA_ARGS_UNPARSED_ARGUMENTS}"
)
if(CUDA_ARGS_PACKED)
install(
TARGETS ${CUDA_ARGS_NAME}
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
)
if(CUDA_ARGS_PUBINCS)
foreach(PACKED_EXCLUDE ${CUDA_ARGS_PACKED_IGORNES})
list(APPEND PATTERN_EXCLUDES "PATTERN;${PACKED_EXCLUDE};EXCLUDE")
endforeach()
install(
DIRECTORY ${CUDA_ARGS_PUBINCS} DESTINATION ${CMAKE_INSTALL_INCDIR}
FILES_MATCHING PATTERN "*.h" PATTERN "*.hpp"
PATTERN "*.hxx" PATTERN "*.cuh"
${PATTERN_EXCLUDES}
)
endif()
endif()
endfunction()
## Build a CUDA executable program
function(cuda_binary)
if(NOT CMAKE_CUDA_COMPILER)
message(FATAL_ERROR "No CUDA language supported.")
endif()
cmake_parse_arguments(
CUDA_ARGS "PACKED" "NAME;VERSION"
"SRCS;INCS;DEFS;LIBS;CFLAGS;CXXFLAGS;CUDAFLAGS;LDFLAGS;DEPS" ${ARGN}
)
if(NOT CUDA_ARGS_NAME)
message(FATAL_ERROR "No target name privated.")
endif()
file(GLOB CUDA_ARGS_SRCS ${CUDA_ARGS_SRCS})
if(NOT CUDA_ARGS_SRCS)
message(FATAL_ERROR "No source files found of ${CUDA_ARGS_NAME}.")
endif()
if(CUDA_ARGS_VERSION)
string(REPLACE "-" "_" MACRO_PREFIX "${CUDA_ARGS_NAME}")
list(APPEND CUDA_ARGS_DEFS ${MACRO_PREFIX}_VERSION="${CUDA_ARGS_VERSION}")
endif()
add_executable(${CUDA_ARGS_NAME} ${CUDA_ARGS_SRCS})
if(CUDA_ARGS_PACKED)
install(
TARGETS ${CUDA_ARGS_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
)
endif()
_cuda_target_properties(
NAME "${CUDA_ARGS_NAME}"
INCS "${CUDA_ARGS_INCS}"
DEFS "${CUDA_ARGS_DEFS}"
LIBS "${CUDA_ARGS_LIBS}"
CFLAGS "${CUDA_ARGS_CFLAGS}"
CXXFLAGS "${CUDA_ARGS_CXXFLAGS}"
CUDAFLAGS "${CUDA_ARGS_CUDAFLAGS}"
LDFLAGS "${CUDA_ARGS_LDFLAGS}"
DEPS "${CUDA_ARGS_DEPS}"
VERSION "${CUDA_ARGS_VERSION}"
"${CUDA_ARGS_UNPARSED_ARGUMENTS}"
)
endfunction()
## Build a CUDA executable test program
function(cuda_test)
if(NOT CMAKE_CUDA_COMPILER)
message(FATAL_ERROR "No CUDA language supported.")
endif()
cmake_parse_arguments(
CUDA_ARGS "" "NAME;VERSION"
"SRCS;INCS;DEFS;LIBS;CFLAGS;CXXFLAGS;CUDAFLAGS;LDFLAGS;DEPS;ARGS" ${ARGN}
)
if(NOT CUDA_ARGS_NAME)
message(FATAL_ERROR "No target name privated.")
endif()
file(GLOB CUDA_ARGS_SRCS ${CUDA_ARGS_SRCS})
if(NOT CUDA_ARGS_SRCS)
message(FATAL_ERROR "No source files found of ${CUDA_ARGS_NAME}.")
endif()
if(CUDA_ARGS_VERSION)
string(REPLACE "-" "_" MACRO_PREFIX "${CUDA_ARGS_NAME}")
list(APPEND CUDA_ARGS_DEFS ${MACRO_PREFIX}_VERSION="${CUDA_ARGS_VERSION}")
endif()
add_executable(${CUDA_ARGS_NAME} EXCLUDE_FROM_ALL ${CUDA_ARGS_SRCS})
_cuda_target_properties(
NAME "${CUDA_ARGS_NAME}"
INCS "${CUDA_ARGS_INCS}"
DEFS "${CUDA_ARGS_DEFS}"
LIBS "${CUDA_ARGS_LIBS}"
CFLAGS "${CUDA_ARGS_CFLAGS}"
CXXFLAGS "${CUDA_ARGS_CXXFLAGS}"
CUDAFLAGS "${CUDA_ARGS_CUDAFLAGS}"
LDFLAGS "${CUDA_ARGS_LDFLAGS}"
DEPS "${CUDA_ARGS_DEPS}"
"${CUDA_ARGS_UNPARSED_ARGUMENTS}"
)
add_dependencies(unittest ${CUDA_ARGS_NAME})
add_custom_target(
unittest.${CUDA_ARGS_NAME}
COMMAND $<TARGET_FILE:${CUDA_ARGS_NAME}> "${CUDA_ARGS_ARGS}"
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
DEPENDS ${CUDA_ARGS_NAME}
)
add_test(
NAME ${CUDA_ARGS_NAME}
COMMAND $<TARGET_FILE:${CUDA_ARGS_NAME}> "${CUDA_ARGS_ARGS}"
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
)
endfunction()
## Add existing test cases to a test suite
function(cuda_test_suite)
if(NOT CMAKE_CUDA_COMPILER)
message(FATAL_ERROR "No CUDA language supported.")
endif()
cc_test_suite(${ARGN})
endfunction()
## Import a C/C++/CUDA static or shared library
function(cuda_import)
if(NOT CMAKE_CUDA_COMPILER)
message(FATAL_ERROR "No CUDA language supported.")
endif()
cmake_parse_arguments(
CUDA_ARGS "STATIC;SHARED;PACKED"
"NAME;PATH;IMPLIB" "INCS;PUBINCS;DEPS;PACKED_EXCLUDES" ${ARGN}
)
if(NOT CUDA_ARGS_NAME)
message(FATAL_ERROR "No target name privated.")
endif()
file(GLOB CUDA_ARGS_PATH ${CUDA_ARGS_PATH})
if(NOT CUDA_ARGS_PATH)
message(FATAL_ERROR "No imported target file found of ${CUDA_ARGS_NAME}.")
endif()
if(MSVC AND CUDA_ARGS_SHARED AND NOT CUDA_ARGS_IMPLIB)
string(REGEX REPLACE
".[Dd][Ll][Ll]$" ".lib" CUDA_ARGS_IMPLIB ${CUDA_ARGS_PATH}
)
endif()
if(CUDA_ARGS_SHARED)
add_library(${CUDA_ARGS_NAME} SHARED IMPORTED GLOBAL)
elseif(CUDA_ARGS_STATIC)
add_library(${CUDA_ARGS_NAME} STATIC IMPORTED GLOBAL)
else()
add_library(${CUDA_ARGS_NAME} UNKNOWN IMPORTED GLOBAL)
endif()
set_property(
TARGET ${CUDA_ARGS_NAME} PROPERTY IMPORTED_LOCATION ${CUDA_ARGS_PATH}
)
if(MSVC AND CUDA_ARGS_SHARED)
set_property(
TARGET ${CUDA_ARGS_NAME} PROPERTY IMPORTED_IMPLIB ${CUDA_ARGS_IMPLIB}
)
endif()
if(CUDA_ARGS_INCS)
_absolute_paths(INC_DIRS ${CUDA_ARGS_INCS})
foreach(INC_DIR ${INC_DIRS})
set_property(
TARGET ${CUDA_ARGS_NAME} APPEND PROPERTY
INTERFACE_INCLUDE_DIRECTORIES "${INC_DIR}"
)
endforeach()
endif()
if(CUDA_ARGS_PUBINCS)
_absolute_paths(INC_DIRS ${CUDA_ARGS_PUBINCS})
foreach(INC_DIR ${INC_DIRS})
set_property(
TARGET ${CUDA_ARGS_NAME} APPEND PROPERTY
INTERFACE_INCLUDE_DIRECTORIES "${INC_DIR}"
)
endforeach()
endif()
if(CUDA_ARGS_DEPS)
add_dependencies(${CUDA_ARGS_NAME} "${CUDA_ARGS_DEPS}")
endif()
if(CUDA_ARGS_PACKED)
install(
TARGETS ${CUDA_ARGS_NAME}
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
)
if(CUDA_ARGS_PUBINCS)
foreach(PACKED_EXCLUDE ${CUDA_ARGS_PACKED_EXCLUDES})
list(APPEND PATTERN_EXCLUDES "PATTERN;${PACKED_EXCLUDE};EXCLUDE")
endforeach()
install(
DIRECTORY ${CUDA_ARGS_PUBINCS} DESTINATION ${CMAKE_INSTALL_INCDIR}
FILES_MATCHING PATTERN "*.h" PATTERN "*.hpp"
PATTERN "*.hxx" PATTERN "*.cuh"
${PATTERN_EXCLUDES}
)
endif()
endif()
endfunction()
## Import a C/C++/CUDA interface library
function(cuda_interface)
if(NOT CMAKE_CUDA_COMPILER)
message(FATAL_ERROR "No CUDA language supported.")
endif()
cmake_parse_arguments(
CUDA_ARGS "PACKED" "NAME" "INCS;PUBINCS;DEPS;PACKED_EXCLUDES" ${ARGN}
)
if(NOT CUDA_ARGS_NAME)
message(FATAL_ERROR "No target name privated.")
endif()
add_library(${CUDA_ARGS_NAME} INTERFACE GLOBAL)
if(CUDA_ARGS_INCS)
_absolute_paths(INC_DIRS ${CUDA_ARGS_INCS})
target_include_directories(${CUDA_ARGS_NAME} INTERFACE "${INC_DIRS}")
endif()
if(CUDA_ARGS_PUBINCS)
_absolute_paths(INC_DIRS ${CUDA_ARGS_PUBINCS})
target_include_directories(${CUDA_ARGS_NAME} INTERFACE "${INC_DIRS}")
endif()
if(CUDA_ARGS_DEPS)
add_dependencies(${CUDA_ARGS_NAME} "${CUDA_ARGS_DEPS}")
endif()
if(CUDA_ARGS_PACKED AND CUDA_ARGS_PUBINCS)
foreach(PACKED_EXCLUDE ${CUDA_ARGS_PACKED_EXCLUDES})
list(APPEND PATTERN_EXCLUDES "PATTERN;${PACKED_EXCLUDE};EXCLUDE")
endforeach()
install(
DIRECTORY ${CUDA_ARGS_PUBINCS} DESTINATION ${CMAKE_INSTALL_INCDIR}
FILES_MATCHING PATTERN "*.h" PATTERN "*.hpp"
PATTERN "*.hxx" PATTERN "*.cuh"
${PATTERN_EXCLUDES}
)
endif()
endfunction()
## Build a C/C++/CUDA executable google test program
function(cuda_gtest)
cmake_parse_arguments(
CUDA_ARGS "" "NAME;VERSION"
"SRCS;INCS;DEFS;LIBS;CFLAGS;CXXFLAGS;CUDAFLAGS;LDFLAGS;DEPS;ARGS" ${ARGN}
)
_find_gtest()
cuda_test(
NAME "${CUDA_ARGS_NAME}"
VERSION "${CUDA_ARGS_VERSION}"
SRCS "${CUDA_ARGS_SRCS}"
INCS "${CUDA_ARGS_INCS};${FIND_GTEST_INCS}"
DEFS "${CUDA_ARGS_DEFS}"
LIBS "${CUDA_ARGS_LIBS};${FIND_GTEST_LIBS}"
CFLAGS "${CUDA_ARGS_CFLAGS}"
CXXFLAGS "${CUDA_ARGS_CXXFLAGS}"
CUDAFLAGS "${CUDA_ARGS_CUDAFLAGS}"
LDFLAGS "${CUDA_ARGS_LDFLAGS}"
DEPS "${CUDA_ARGS_DEPS}"
ARGS "${CUDA_ARGS_ARGS}"
)
endfunction()
## Build a C/C++/CUDA executable google mock program
function(cuda_gmock)
cmake_parse_arguments(
CUDA_ARGS "" "NAME;VERSION"
"SRCS;INCS;DEFS;LIBS;CFLAGS;CXXFLAGS;CUDAFLAGS;LDFLAGS;DEPS;ARGS" ${ARGN}
)
_find_gmock()
cuda_test(
NAME "${CUDA_ARGS_NAME}"
VERSION "${CUDA_ARGS_VERSION}"
SRCS "${CUDA_ARGS_SRCS}"
INCS "${CUDA_ARGS_INCS};${FIND_GMOCK_INCS}"
DEFS "${CUDA_ARGS_DEFS}"
LIBS "${CUDA_ARGS_LIBS};${FIND_GMOCK_LIBS}"
CFLAGS "${CUDA_ARGS_CFLAGS}"
CXXFLAGS "${CUDA_ARGS_CXXFLAGS}"
CUDAFLAGS "${CUDA_ARGS_CUDAFLAGS}"
LDFLAGS "${CUDA_ARGS_LDFLAGS}"
DEPS "${CUDA_ARGS_DEPS}"
ARGS "${CUDA_ARGS_ARGS}"
)
endfunction()
## Add a subdirectory to the build
function(go_directory)
add_subdirectory(${ARGN})
endfunction()
## Add subdirectories to the build
function(go_directories)
foreach(SRC_DIR ${ARGN})
add_subdirectory(${SRC_DIR})
endforeach()
endfunction()
## Build a go executable program
function(go_binary)
find_program(
GO_EXECUTABLE go PATHS $ENV{HOME}/go ENV GOROOT GOPATH PATH_SUFFIXES bin
)
if(NOT GO_EXECUTABLE)
message(FATAL_ERROR "No go language compiler found.")
endif()
cmake_parse_arguments(
GO_ARGS "PACKED" "NAME"
"GOPATH;SRCS;ASMFLAGS;GCFLAGS;LDFLAGS;DEPS" ${ARGN}
)
if(NOT GO_ARGS_NAME)
message(FATAL_ERROR "No target name privated.")
endif()
file(GLOB GO_ARGS_SRCS ${GO_ARGS_SRCS})
if(NOT GO_ARGS_SRCS)
message(FATAL_ERROR "No source files/directories found of ${GO_ARGS_NAME}.")
endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
string(REPLACE ";" "\;" GO_ARGS_GOPATH "${GO_ARGS_GOPATH}")
else()
string(REPLACE ";" ":" GO_ARGS_GOPATH "${GO_ARGS_GOPATH}")
endif()
set(
GO_OUTPUT_FILE
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${GO_ARGS_NAME}${CMAKE_EXECUTABLE_SUFFIX}
)
file(RELATIVE_PATH GO_OUTPUT_REL_FILE ${CMAKE_BINARY_DIR} ${GO_OUTPUT_FILE})
add_custom_target(
${GO_ARGS_NAME}
COMMAND ${CMAKE_COMMAND} -E env GOPATH="${GO_ARGS_GOPATH}"
"${GO_EXECUTABLE}" build -v -buildmode=exe
-compiler=gc -gcflags="${GO_ARGS_GCFLAGS}" -asmflags="${GO_ARGS_ASMFLAGS}"
-ldflags="${GO_ARGS_LDFLAGS}"
-o "${GO_OUTPUT_FILE}" "${GO_ARGS_SRCS}"
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
DEPENDS "${GO_ARGS_DEPS}"
COMMENT "Building GO executable ${GO_OUTPUT_REL_FILE}"
)
if(GO_ARGS_PACKED)
install(PROGRAMS ${GO_OUTPUT_FILE} DESTINATION "${CMAKE_INSTALL_BINDIR}")
endif()
endfunction()
## Fetch content
function(_fetch_content)
cmake_parse_arguments(
DL_ARGS ""
"NAME;PATH;GIT_URL;GIT_TAG;HG_URL;HG_TAG;SVN_URL;SVN_REV;URL;URL_HASH"
"" ${ARGN}
)
if(NOT DL_ARGS_NAME)
message(FATAL_ERROR "No fetch name privated.")
endif()
if(NOT DL_ARGS_PATH)
# Download to current source directory
set(DL_ARGS_PATH "${CMAKE_CURRENT_SOURCE_DIR}/${DL_ARGS_NAME}")
endif()
set(
CMAKELISTS_CONTENT
"cmake_minimum_required(VERSION 3.1)\n"
"project(${DL_ARGS_NAME})\n"
"include(ExternalProject)\n"
"ExternalProject_Add(\n"
" ${DL_ARGS_NAME}\n"
" PREFIX \"external\"\n"
" GIT_REPOSITORY \"${DL_ARGS_GIT_URL}\"\n"
" GIT_TAG \"${DL_ARGS_GIT_TAG}\"\n"
" HG_REPOSITORY \"${DL_ARGS_HG_URL}\"\n"
" HG_TAG \"${DL_ARGS_HG_TAG}\"\n"
" SVN_REPOSITORY \"${DL_ARGS_SVN_URL}\"\n"
" SVN_REVISION \"${DL_ARGS_SVN_REV}\"\n"
" URL \"${DL_ARGS_URL}\"\n"
" URL_HASH \"${DL_ARGS_URL_HASH}\"\n"
" SOURCE_DIR \"${DL_ARGS_PATH}\"\n"
" BINARY_DIR \"\"\n"
" CONFIGURE_COMMAND \"\"\n"
" BUILD_COMMAND \"\"\n"
" INSTALL_COMMAND \"\"\n"
" TEST_COMMAND \"\"\n"
" LOG_DOWNLOAD ON\n"
" )\n"
)
set(
CMAKELISTS_DIRECTORY
"${PROJECT_BINARY_DIR}/downloads/${DL_ARGS_NAME}"
)
add_custom_target(
external.${DL_ARGS_NAME}
COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" . &&
"${CMAKE_COMMAND}" --build .
WORKING_DIRECTORY "${CMAKELISTS_DIRECTORY}"
)
# Write a cmake script into folder
file(WRITE "${CMAKELISTS_DIRECTORY}/CMakeLists.txt" ${CMAKELISTS_CONTENT})
execute_process(
COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" .
WORKING_DIRECTORY "${CMAKELISTS_DIRECTORY}"
)
execute_process(
COMMAND "${CMAKE_COMMAND}" --build .
WORKING_DIRECTORY "${CMAKELISTS_DIRECTORY}"
)
endfunction()
## Download a git repository
function(git_repository)
cmake_parse_arguments(GIT_ARGS "" "NAME;PATH;URL;TAG" "" ${ARGN})
if(NOT GIT_ARGS_NAME)
message(FATAL_ERROR "No repository name privated.")
endif()
if(NOT GIT_ARGS_URL)
message(FATAL_ERROR "No repository URL privated.")
endif()
if(GIT_ARGS_PATH AND NOT IS_ABSOLUTE ${GIT_ARGS_PATH})
get_filename_component(GIT_ARGS_PATH ${GIT_ARGS_PATH} ABSOLUTE)
endif()
_fetch_content(
NAME "${GIT_ARGS_NAME}"
PATH "${GIT_ARGS_PATH}"
GIT_URL "${GIT_ARGS_URL}"
GIT_TAG "${GIT_ARGS_TAG}"
)
endfunction()
## Download a hg repository
function(hg_repository)
cmake_parse_arguments(HG_ARGS "" "NAME;PATH;URL;TAG" "" ${ARGN})
if(NOT HG_ARGS_NAME)
message(FATAL_ERROR "No repository name privated.")
endif()
if(NOT HG_ARGS_URL)
message(FATAL_ERROR "No repository URL privated.")
endif()
if(HG_ARGS_PATH AND NOT IS_ABSOLUTE ${HG_ARGS_PATH})
get_filename_component(HG_ARGS_PATH ${HG_ARGS_PATH} ABSOLUTE)
endif()
_fetch_content(
NAME "${HG_ARGS_NAME}"
PATH "${HG_ARGS_PATH}"
HG_URL "${HG_ARGS_URL}"
HG_TAG "${HG_ARGS_TAG}"
)
endfunction()
## Download a svn repository
function(svn_repository)
cmake_parse_arguments(SVN_ARGS "" "NAME;PATH;URL;REV" "" ${ARGN})
if(NOT SVN_ARGS_NAME)
message(FATAL_ERROR "No repository name privated.")
endif()
if(NOT SVN_ARGS_URL)
message(FATAL_ERROR "No repository URL privated.")
endif()
if(SVN_ARGS_PATH AND NOT IS_ABSOLUTE ${SVN_ARGS_PATH})
get_filename_component(SVN_ARGS_PATH ${SVN_ARGS_PATH} ABSOLUTE)
endif()
_fetch_content(
NAME "${SVN_ARGS_NAME}"
PATH "${SVN_ARGS_PATH}"
SVN_URL "${SVN_ARGS_URL}"
SVN_REV "${SVN_ARGS_REV}"
)
endfunction()
## Download a http archive
function(http_archive)
cmake_parse_arguments(HTTP_ARGS "" "NAME;PATH;URL;SHA256;SHA1;MD5" "" ${ARGN})
if(NOT HTTP_ARGS_NAME)
message(FATAL_ERROR "No archive name privated.")
endif()
if(NOT HTTP_ARGS_URL)
message(FATAL_ERROR "No archive URL privated.")
endif()
if(HTTP_ARGS_PATH AND NOT IS_ABSOLUTE ${HTTP_ARGS_PATH})
get_filename_component(HTTP_ARGS_PATH ${HTTP_ARGS_PATH} ABSOLUTE)
endif()
if(HTTP_ARGS_SHA256)
set(HTTP_URL_HASH "SHA256=${HTTP_ARGS_SHA256}")
elseif(HTTP_ARGS_SHA1)
set(HTTP_URL_HASH "SHA1=${HTTP_ARGS_SHA1}")
elseif(HTTP_ARGS_MD5)
set(HTTP_URL_HASH "MD5=${HTTP_ARGS_MD5}")
else()
set(HTTP_URL_HASH "")
endif()
_fetch_content(
NAME "${HTTP_ARGS_NAME}"
PATH "${HTTP_ARGS_PATH}"
URL "${HTTP_ARGS_URL}"
URL_HASH "${HTTP_URL_HASH}"
)
endfunction()
## Retrieve a version string from GIT
function(git_version _RESULT _SOURCES_DIR)
find_package(Git REQUIRED)
if(NOT IS_ABSOLUTE ${_SOURCES_DIR})
get_filename_component(_SOURCES_DIR ${_SOURCES_DIR} ABSOLUTE)
endif()
# git describe --tags
execute_process(
COMMAND "${GIT_EXECUTABLE}" describe --tags
WORKING_DIRECTORY "${_SOURCES_DIR}"
RESULT_VARIABLE GIT_VER_RESULT
OUTPUT_VARIABLE GIT_VER_OUTPUT
ERROR_VARIABLE GIT_VER_ERROR
)
if(GIT_VER_RESULT EQUAL 0)
string(STRIP ${GIT_VER_OUTPUT} GIT_VER_OUTPUT)
set(${_RESULT} "${GIT_VER_OUTPUT}" PARENT_SCOPE)
return()
endif()
# git rev-parse --short HEAD
execute_process(
COMMAND "${GIT_EXECUTABLE}" rev-parse --short HEAD
WORKING_DIRECTORY "${_SOURCES_DIR}"
RESULT_VARIABLE GIT_VER_RESULT
OUTPUT_VARIABLE GIT_VER_OUTPUT
ERROR_VARIABLE GIT_VER_ERROR
)
if(GIT_VER_RESULT EQUAL 0)
string(STRIP ${GIT_VER_OUTPUT} GIT_VER_OUTPUT)
set(${_RESULT} "g${GIT_VER_OUTPUT}" PARENT_SCOPE)
return()
endif()
set(${_RESULT} "" PARENT_SCOPE)
endfunction()
## Retrieve a version string from HG
function(hg_version _RESULT _SOURCES_DIR)
find_package(Hg REQUIRED)
if(NOT IS_ABSOLUTE ${_SOURCES_DIR})
get_filename_component(_SOURCES_DIR ${_SOURCES_DIR} ABSOLUTE)
endif()
# hg log -T "{latesttagdistance}" -r .
execute_process(
COMMAND "${HG_EXECUTABLE}" log -T "{latesttagdistance}" -r .
WORKING_DIRECTORY "${_SOURCES_DIR}"
RESULT_VARIABLE HG_VER_RESULT
OUTPUT_VARIABLE HG_VER_OUTPUT
ERROR_VARIABLE HG_VER_ERROR
)
if(HG_VER_RESULT EQUAL 0)
string(STRIP ${HG_VER_OUTPUT} HG_VER_OUTPUT)
if(HG_VER_OUTPUT STREQUAL "0")
# hg log -T "{latesttag}" -r .
execute_process(
COMMAND "${HG_EXECUTABLE}" log -T "{latesttag}" -r .
WORKING_DIRECTORY "${_SOURCES_DIR}"
RESULT_VARIABLE HG_VER_RESULT
OUTPUT_VARIABLE HG_VER_OUTPUT
ERROR_VARIABLE HG_VER_ERROR
)
else()
# hg log -T "{latesttag}-{latesttagdistance}-h{node|short}" -r .
execute_process(
COMMAND "${HG_EXECUTABLE}" log
-T "{latesttag}-{latesttagdistance}-h{node|short}" -r .
WORKING_DIRECTORY "${_SOURCES_DIR}"
RESULT_VARIABLE HG_VER_RESULT
OUTPUT_VARIABLE HG_VER_OUTPUT
ERROR_VARIABLE HG_VER_ERROR
)
endif()
if(HG_VER_RESULT EQUAL 0)
string(STRIP ${HG_VER_OUTPUT} HG_VER_OUTPUT)
if(NOT HG_VER_OUTPUT MATCHES "^null.*")
set(${_RESULT} "${HG_VER_OUTPUT}" PARENT_SCOPE)
return()
endif()
endif()
endif()
# hg log -T "h{node|short}" -r .
execute_process(
COMMAND "${HG_EXECUTABLE}" log -T "h{node|short}" -r .
WORKING_DIRECTORY "${_SOURCES_DIR}"
RESULT_VARIABLE HG_VER_RESULT
OUTPUT_VARIABLE HG_VER_OUTPUT
ERROR_VARIABLE HG_VER_ERROR
)
if(HG_VER_RESULT EQUAL 0)
string(STRIP ${HG_VER_OUTPUT} HG_VER_OUTPUT)
set(${_RESULT} "${HG_VER_OUTPUT}" PARENT_SCOPE)
return()
endif()
set(${_RESULT} "" PARENT_SCOPE)
endfunction()
## Retrieve a version string from SVN
function(svn_version _RESULT _SOURCES_DIR)
find_package(Subversion REQUIRED)
if(NOT IS_ABSOLUTE ${_SOURCES_DIR})
get_filename_component(_SOURCES_DIR ${_SOURCES_DIR} ABSOLUTE)
endif()
# svn info --show-item revision
execute_process(
COMMAND "${Subversion_SVN_EXECUTABLE}" info --show-item revision
WORKING_DIRECTORY "${_SOURCES_DIR}"
RESULT_VARIABLE SVN_VER_RESULT
OUTPUT_VARIABLE SVN_VER_OUTPUT
ERROR_VARIABLE SVN_VER_ERROR
)
if(SVN_VER_RESULT EQUAL 0)
string(STRIP ${SVN_VER_OUTPUT} SVN_VER_OUTPUT)
set(${_RESULT} "r${SVN_VER_OUTPUT}" PARENT_SCOPE)
return()
endif()
set(${_RESULT} "" PARENT_SCOPE)
endfunction()
_find_workspace_directory(BAZEL_WORKSPACE_DIR)
if(BAZEL_WORKSPACE_DIR)
include("${BAZEL_WORKSPACE_DIR}/Workspace.cmake")
endif()
================================================
FILE: cmake/option.cmake
================================================
## https://en.wikipedia.org/wiki/List_of_Intel_CPU_microarchitectures
## https://en.wikipedia.org/wiki/List_of_AMD_CPU_microarchitectures
## https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html
## Intel Microarchitectures
option(ENABLE_NEHALEM "Enable Intel Nehalem CPU microarchitecture" OFF)
option(ENABLE_SANDYBRIDGE "Enable Intel Sandy Bridge CPU microarchitecture" OFF)
option(ENABLE_HASWELL "Enable Intel Haswell CPU microarchitecture" OFF)
option(ENABLE_BROADWELL "Enable Intel Broadwell CPU microarchitecture" OFF)
option(ENABLE_SKYLAKE "Enable Intel Skylake CPU microarchitecture" OFF)
option(ENABLE_SKYLAKE_AVX512 "Enable Intel Skylake Server CPU microarchitecture" OFF)
option(ENABLE_ICELAKE "Enable Intel Icelake CPU microarchitecture" OFF)
option(ENABLE_SAPPHIRERAPIDS "Enable Intel Sapphire Rapids Server CPU microarchitecture" OFF)
option(ENABLE_EMERALDRAPIDS "Enable Intel Emerald Rapids Server CPU microarchitecture" OFF)
option(ENABLE_GRANITERAPIDS "Enable Intel Granite Rapids Server CPU microarchitecture" OFF)
option(ENABLE_NATIVE "Enable native CPU microarchitecture" OFF)
## AMD Microarchitectures
option(ENABLE_ZEN1 "Enable AMD Zen+ Family 17h CPU microarchitecture" OFF)
option(ENABLE_ZEN2 "Enable AMD Zen 2 Family 17h CPU microarchitecture" OFF)
option(ENABLE_ZEN3 "Enable AMD Zen 3 Family 19h CPU microarchitecture" OFF)
## ARM architectures
option(ENABLE_ARMV8A "Enable ARMv8-a architecture" OFF)
option(ENABLE_ARMV8.1A "Enable ARMv8.1-a architecture" OFF)
option(ENABLE_ARMV8.2A "Enable ARMv8.2-a architecture" OFF)
option(ENABLE_ARMV8.3A "Enable ARMv8.3-a architecture" OFF)
option(ENABLE_ARMV8.4A "Enable ARMv8.4-a architecture" OFF)
option(ENABLE_ARMV8.5A "Enable ARMv8.5-a architecture" OFF)
option(ENABLE_ARMV8.6A "Enable ARMv8.6-a architecture" OFF)
## OpenMP option
option(ENABLE_OPENMP "Enable OpenMP support" OFF)
set(ARCH_OPTIONS
ENABLE_NEHALEM ENABLE_SANDYBRIDGE ENABLE_HASWELL ENABLE_BROADWELL ENABLE_SKYLAKE
ENABLE_SKYLAKE_AVX512 ENABLE_ICELAKE ENABLE_SAPPHIRERAPIDS ENABLE_EMERALDRAPIDS ENABLE_GRANITERAPIDS
ENABLE_ZEN1 ENABLE_ZEN2 ENABLE_ZEN3
ENABLE_ARMV8A ENABLE_ARMV8.1A ENABLE_ARMV8.2A ENABLE_ARMV8.3A ENABLE_ARMV8.4A
ENABLE_ARMV8.5A ENABLE_ARMV8.6A
ENABLE_NATIVE
)
option(AUTO_DETECT_ARCH "Auto detect CPU microarchitecture" ON)
foreach(opt IN LISTS ARCH_OPTIONS)
if(${opt})
set(AUTO_DETECT_ARCH OFF)
break()
endif()
endforeach()
include(CheckCCompilerFlag)
function(_AppendFlags _RESULT _FLAG)
if(${_RESULT} AND NOT "${${_RESULT}}" MATCHES "${_FLAG}")
set(${_RESULT} "${${_RESULT}} ${_FLAG}" PARENT_SCOPE)
else()
set(${_RESULT} "${_FLAG}" PARENT_SCOPE)
endif()
endfunction()
macro(add_arch_flag FLAG VAR_NAME OPTION_NAME)
check_c_compiler_flag("${FLAG}" COMPILER_SUPPORT_${VAR_NAME})
if(COMPILER_SUPPORT_${VAR_NAME})
_AppendFlags(CMAKE_C_FLAGS "${FLAG}")
_AppendFlags(CMAKE_CXX_FLAGS "${FLAG}")
set(${VAR_NAME}_ENABLED ON)
else()
if(${OPTION_NAME})
message(FATAL_ERROR "Compiler does not support required flag: '${FLAG}' for ${OPTION_NAME}")
else()
set(${VAR_NAME}_ENABLED OFF)
endif()
endif()
endmacro()
function(_setup_armv8_march)
set(_arch "armv8")
check_c_compiler_flag("-march=${_arch}" _COMP_SUPP_${_arch})
if(_COMP_SUPP_${_arch})
_AppendFlags(CMAKE_C_FLAGS "-march=${_arch}")
_AppendFlags(CMAKE_CXX_FLAGS "-march=${_arch}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}" PARENT_SCOPE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" PARENT_SCOPE)
return()
else()
message(WARNING "No ARMv8 march flag supported by compiler.")
endif()
endfunction()
function(_setup_x86_march)
set(_arch "x86-64")
check_c_compiler_flag("-march=${_arch}" _COMP_SUPP_${_arch})
if(_COMP_SUPP_${_arch})
_AppendFlags(CMAKE_C_FLAGS "-march=${_arch}")
_AppendFlags(CMAKE_CXX_FLAGS "-march=${_arch}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}" PARENT_SCOPE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" PARENT_SCOPE)
return()
else()
message(WARNING "No known x86 march flag supported; falling back to generic.")
endif()
endfunction()
function(setup_compiler_march_for_x86 VAR_NAME_SSE VAR_NAME_AVX2 VAR_NAME_AVX512 VAR_NAME_AVX512FP16)
#sse
set(${VAR_NAME_SSE} "-march=corei7" PARENT_SCOPE)
#avx 2
set(${VAR_NAME_AVX2} "-march=core-avx2" PARENT_SCOPE)
#avx512
set(_x86_flags_avx512 "icelake-server" "skylake-avx512" "core-avx2" "x86-64")
foreach(_arch_avx512 IN LISTS _x86_flags_avx512)
check_c_compiler_flag("-march=${_arch_avx512}" _COMP_SUPP_${_arch_avx512})
if(_COMP_SUPP_${_arch_avx512})
set(${VAR_NAME_AVX512} "-march=${_arch_avx512}" PARENT_SCOPE)
break()
endif()
endforeach()
#avx512fp16
set(_x86_flags_avx512fp16
"sapphirerapids" "icelake-server" "skylake-avx512" "core-avx2" "x86-64"
)
foreach(_arch_avx512fp16 IN LISTS _x86_flags_avx512fp16)
check_c_compiler_flag("-march=${_arch_avx512fp16}" _COMP_SUPP_${_arch_avx512fp16})
if(_COMP_SUPP_${_arch_avx512fp16})
set(${VAR_NAME_AVX512FP16} "-march=${_arch_avx512fp16}" PARENT_SCOPE)
break()
endif()
endforeach()
endfunction()
if(MSVC)
# Prefer higher ISAs
foreach(_isa IN ITEMS "AVX512" "AVX2" "AVX" "SSE2")
check_c_compiler_flag("/arch:${_isa}" _COMP_SUPP_${_isa})
if(_COMP_SUPP_${_isa})
_AppendFlags(CMAKE_C_FLAGS "/arch:${_isa}")
_AppendFlags(CMAKE_CXX_FLAGS "/arch:${_isa}")
message(STATUS "MSVC: enabled /arch:${_isa}")
break()
endif()
endforeach()
return()
endif()
if(NOT AUTO_DETECT_ARCH)
if(ENABLE_NATIVE)
add_arch_flag("-march=native" NATIVE ENABLE_NATIVE)
endif()
if(ENABLE_ZEN3)
add_arch_flag("-march=znver3" ZNVER3 ENABLE_ZEN3)
endif()
if(ENABLE_ZEN2)
add_arch_flag("-march=znver2" ZNVER2 ENABLE_ZEN2)
endif()
if(ENABLE_ZEN1)
add_arch_flag("-march=znver1" ZNVER1 ENABLE_ZEN1)
endif()
if(ENABLE_GRANITERAPIDS)
add_arch_flag("-march=graniterapids" GRANITERAPIDS ENABLE_GRANITERAPIDS)
endif()
if(ENABLE_EMERALDRAPIDS)
add_arch_flag("-march=emeraldrapids" EMERALDRAPIDS ENABLE_EMERALDRAPIDS)
endif()
if(ENABLE_SAPPHIRERAPIDS)
add_arch_flag("-march=sapphirerapids" SAPPHIRERAPIDS ENABLE_SAPPHIRERAPIDS)
endif()
if(ENABLE_ICELAKE)
add_arch_flag("-march=icelake-server" ICELAKE ENABLE_ICELAKE)
endif()
if(ENABLE_SKYLAKE_AVX512)
add_arch_flag("-march=skylake-avx512" SKYLAKE_AVX512 ENABLE_SKYLAKE_AVX512)
endif()
if(ENABLE_SKYLAKE)
add_arch_flag("-march=skylake" SKYLAKE ENABLE_SKYLAKE)
endif()
if(ENABLE_BROADWELL)
add_arch_flag("-march=broadwell" BROADWELL ENABLE_BROADWELL)
endif()
if(ENABLE_HASWELL)
add_arch_flag("-march=haswell" HASWELL ENABLE_HASWELL)
endif()
if(ENABLE_SANDYBRIDGE)
add_arch_flag("-march=sandybridge" SANDYBRIDGE ENABLE_SANDYBRIDGE)
endif()
if(ENABLE_NEHALEM)
add_arch_flag("-march=nehalem" NEHALEM ENABLE_NEHALEM)
endif()
# ARM (newest first — allow multiple? usually only one)
# But GCC allows only one -march=, so honor highest enabled
if(ENABLE_ARMV8.6A)
add_arch_flag("-march=armv8.6-a" ARMV86A ENABLE_ARMV8.6A)
endif()
if(ENABLE_ARMV8.5A)
add_arch_flag("-march=armv8.5-a" ARMV85A ENABLE_ARMV8.5A)
endif()
if(ENABLE_ARMV8.4A)
add_arch_flag("-march=armv8.4-a" ARMV84A ENABLE_ARMV8.4A)
endif()
if(ENABLE_ARMV8.3A)
add_arch_flag("-march=armv8.3-a" ARMV83A ENABLE_ARMV8.3A)
endif()
if(ENABLE_ARMV8.2A)
add_arch_flag("-march=armv8.2-a" ARMV82A ENABLE_ARMV8.2A)
endif()
if(ENABLE_ARMV8.1A)
add_arch_flag("-march=armv8.1-a" ARMV81A ENABLE_ARMV8.1A)
endif()
if(ENABLE_ARMV8A)
add_arch_flag("-march=armv8-a" ARMV8A ENABLE_ARMV8A)
endif()
else()
# AUTO DETECT
# Heuristic: detect host architecture and probe appropriate flags
if(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|arm64|ARM64")
_setup_armv8_march()
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|i686|i386|x64")
_setup_x86_march()
else()
message(WARNING "Unknown host architecture: ${CMAKE_SYSTEM_PROCESSOR}; no -march= set.")
endif()
endif()
# -----------------------------
# OpenMP
# -----------------------------
if(ENABLE_OPENMP)
find_package(OpenMP REQUIRED)
if(OpenMP_C_FLAGS)
_AppendFlags(CMAKE_C_FLAGS "${OpenMP_C_FLAGS}")
endif()
if(OpenMP_CXX_FLAGS)
_AppendFlags(CMAKE_CXX_FLAGS "${OpenMP_CXX_FLAGS}")
endif()
endif()
================================================
FILE: cmake/utils.cmake
================================================
function(apply_patch_once patch_name target_dir patch_file)
set(mark_file "${target_dir}/.${patch_name}_patched")
if(EXISTS "${mark_file}")
#message(STATUS "Patch '${patch_name}' already applied to ${target_dir}, skipping.")
return()
endif()
if(NOT EXISTS "${patch_file}")
message(FATAL_ERROR "Patch file '${patch_file}' not found!")
endif()
#message(STATUS "Applying patch '${patch_name}' to ${target_dir} ...")
execute_process(
COMMAND patch -p1 -i "${patch_file}"
WORKING_DIRECTORY "${target_dir}"
RESULT_VARIABLE patch_result
OUTPUT_VARIABLE patch_stdout
ERROR_VARIABLE patch_stderr
)
if(NOT patch_result EQUAL 0)
message(FATAL_ERROR "Failed to apply patch '${patch_name}' to ${target_dir}:\n${patch_stderr}")
else()
#message(STATUS "Patch '${patch_name}' applied successfully:\n${patch_stdout}")
file(WRITE "${mark_file}" "patched")
endif()
endfunction()
================================================
FILE: examples/c++/CMakeLists.txt
================================================
cmake_minimum_required(VERSION 3.13)
cmake_policy(SET CMP0077 NEW)
project(zvec-example-c++)
set(CMAKE_CXX_STANDARD 17)
# Enable compile_commands.json
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# --- Paths to Zvec and dependencies ---
# Allow custom host build directory, default to "build"
if(NOT DEFINED HOST_BUILD_DIR)
set(HOST_BUILD_DIR "build")
endif()
set(ZVEC_INCLUDE_DIR ${CMAKE_BINARY_DIR}/../../../src/include)
set(ZVEC_LIB_DIR ${CMAKE_BINARY_DIR}/../../../${HOST_BUILD_DIR}/lib)
set(ZVEC_DEPENDENCY_LIB_DIR ${CMAKE_BINARY_DIR}/../../../${HOST_BUILD_DIR}/external/usr/local/lib)
# Add include and library search paths
include_directories(${ZVEC_INCLUDE_DIR})
link_directories(${ZVEC_LIB_DIR} ${ZVEC_DEPENDENCY_LIB_DIR})
# --- Determine debug/release library names ---
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(GLOG_LIB glogd)
set(GFLAGS_LIB gflags_nothreads_debug)
set(PROTOBUF_LIB protobufd)
else()
set(GLOG_LIB glog)
set(GFLAGS_LIB gflags_nothreads)
set(PROTOBUF_LIB protobuf)
endif()
# --- Dependency groups ---
find_package(Threads REQUIRED)
set(zvec_ailego_deps
arrow
parquet
arrow_bundled_dependencies
${CMAKE_THREAD_LIBS_INIT}
${CMAKE_DL_LIBS}
)
set(zvec_core_deps
zvec_turbo
)
set(zvec_db_deps
roaring
rocksdb
arrow
arrow_acero
arrow_bundled_dependencies
arrow_compute
arrow_dataset
parquet
antlr4-runtime
${GLOG_LIB}
${GFLAGS_LIB}
${PROTOBUF_LIB}
lz4
)
# --- Create INTERFACE targets for Zvec components ---
# zvec_ailego: links libzvec_ailego.a + its deps
add_library(zvec-ailego INTERFACE)
target_link_libraries(zvec-ailego INTERFACE
-lzvec_ailego
${zvec_ailego_deps}
)
# zvec_core: links libzvec_core.a via special flags (handled externally), but declare logical deps
add_library(zvec-core INTERFACE)
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
target_link_libraries(zvec-core INTERFACE
-Wl,--whole-archive
zvec_core
-Wl,--no-whole-archive
-Wl,--start-group
zvec-ailego
${zvec_core_deps}
-Wl,--end-group
)
elseif(APPLE)
target_link_libraries(zvec-core INTERFACE
-Wl,-force_load ${ZVEC_LIB_DIR}/libzvec_core.a
zvec-ailego
${zvec_core_deps}
)
elseif(ANDROID)
target_link_libraries(zvec-core INTERFACE
-Wl,--whole-archive
zvec_core
-Wl,--no-whole-archive
-Wl,--start-group
zvec-ailego
${zvec_core_deps}
-Wl,--end-group
)
else()
message(FATAL_ERROR "Unsupported platform: ${CMAKE_SYSTEM_NAME}")
endif()
# zvec_db: links libzvec_db.a + all deps
add_library(zvec-db INTERFACE)
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
target_link_libraries(zvec-db INTERFACE
zvec_db
zvec-core
zvec-ailego
-Wl,--start-group
${zvec_db_deps}
-Wl,--end-group
)
elseif(APPLE)
target_link_libraries(zvec-db INTERFACE
zvec_db
zvec-core
zvec-ailego
${zvec_db_deps}
)
elseif(ANDROID)
target_link_libraries(zvec-db INTERFACE
zvec_db
zvec-core
zvec-ailego
-Wl,--start-group
${zvec_db_deps}
-Wl,--end-group
)
else()
message(FATAL_ERROR "Unsupported platform: ${CMAKE_SYSTEM_NAME}")
endif()
# --- Main executable ---
add_executable(db-example db/main.cc)
target_link_libraries(db-example PRIVATE
zvec-db
)
if(ANDROID)
target_link_libraries(db-example PRIVATE
log
)
endif()
add_executable(core-example core/main.cc)
target_link_libraries(core-example PRIVATE
zvec-core
)
add_executable(ailego-example ailego/main.cc)
target_link_libraries(ailego-example PRIVATE
zvec-ailego
)
# Strip symbols to reduce executable size
if(CMAKE_BUILD_TYPE STREQUAL "Release" AND ANDROID)
add_custom_command(TARGET db-example POST_BUILD
COMMAND ${CMAKE_STRIP} "$<TARGET_FILE:db-example>"
COMMENT "Stripping symbols from db-example")
add_custom_command(TARGET core-example POST_BUILD
COMMAND ${CMAKE_STRIP} "$<TARGET_FILE:core-example>"
COMMENT "Stripping symbols from core-example")
add_custom_command(TARGET ailego-example POST_BUILD
COMMAND ${CMAKE_STRIP} "$<TARGET_FILE:ailego-example>"
COMMENT "Stripping symbols from ailego-example")
endif()
# Optimize for size
if(CMAKE_BUILD_TYPE STREQUAL "Release" AND ANDROID)
set_property(TARGET db-example core-example ailego-example
PROPERTY COMPILE_FLAGS "-Os")
set_property(TARGET db-example core-example ailego-example
PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
endif()
================================================
FILE: examples/c++/ailego/main.cc
================================================
#include <iostream>
#include <string>
#include <zvec/ailego/utility/string_helper.h>
using namespace zvec;
int main() {
std::string a{"hello world"};
std::cout << ailego::StringHelper::StartsWith(a, "hello") << std::endl;
}
================================================
FILE: examples/c++/core/main.cc
================================================
#include <cstdlib>
#include <iostream>
#include <zvec/core/interface/index.h>
#include <zvec/core/interface/index_factory.h>
#include <zvec/core/interface/index_param.h>
#include <zvec/core/interface/index_param_builders.h>
using namespace zvec::core_interface;
constexpr uint32_t kDimension = 64;
const std::string index_name{"test.index"};
Index::Pointer create_index(const BaseIndexParam::Pointer ¶m,
int doc_num = 10) {
auto index = IndexFactory::CreateAndInitIndex(*param);
if (!index) {
std::cout << "Failed to create index." << std::endl;
return nullptr;
}
int ret = index->Open(
index_name, StorageOptions{StorageOptions::StorageType::kMMAP, true});
if (ret != 0) {
std::cout << "Failed to open index." << std::endl;
return nullptr;
}
for (int i = 0; i < doc_num; ++i) {
std::vector<float> vector(kDimension, i / 10.0f + 0.1f);
VectorData vector_data;
vector_data.vector = DenseVector{vector.data()};
ret = index->Add(vector_data, i);
if (ret != 0) {
std::cout << "Failed to add to index." << std::endl;
return nullptr;
}
}
ret = index->Train();
if (ret != 0) {
std::cout << "Failed to train index." << std::endl;
return nullptr;
}
return index;
}
int main() {
char cmd_buf[100];
snprintf(cmd_buf, 100, "rm -f %s", index_name.c_str());
system(cmd_buf);
auto param = HNSWIndexParamBuilder()
.WithMetricType(MetricType::kInnerProduct)
.WithDataType(DataType::DT_FP32)
.WithDimension(kDimension)
.WithIsSparse(false)
.Build();
auto index = create_index(param, 1);
std::cout << "index stats: " << index->GetDocCount() << std::endl;
// query
auto query_param = HNSWQueryParamBuilder()
.with_topk(10)
.with_fetch_vector(true)
.with_ef_search(20)
.build();
SearchResult result;
VectorData query;
std::vector<float> vector(kDimension, 0.1f);
query.vector = DenseVector{vector.data()};
int ret = index->Search(query, query_param, &result);
if (ret != 0) {
std::cout << "Failed to search index." << std::endl;
return -1;
}
std::cout << "query results: " << result.doc_list_.size() << std::endl;
if (result.doc_list_.size() == 0) {
std::cout << "No results found." << std::endl;
return -1;
}
std::cout << "key: " << result.doc_list_[0].key()
<< ", score: " << result.doc_list_[0].score() << std::endl;
return 0;
}
================================================
FILE: examples/c++/db/main.cc
================================================
#include <cstdlib>
#include <string>
#include <vector>
#include <zvec/db/collection.h>
#include <zvec/db/doc.h>
#include <zvec/db/schema.h>
#include <zvec/db/status.h>
using namespace zvec;
Doc create_doc(const uint64_t doc_id, const CollectionSchema &schema,
std::string pk = "") {
Doc new_doc;
if (pk.empty()) {
pk = "pk_" + std::to_string(doc_id);
}
new_doc.set_pk(pk);
for (auto &field : schema.fields()) {
switch (field->data_type()) {
case DataType::BINARY: {
std::string binary_str("binary_" + std::to_string(doc_id));
new_doc.set<std::string>(field->name(), binary_str);
break;
}
case DataType::BOOL:
new_doc.set<bool>(field->name(), doc_id % 10 == 0);
break;
case DataType::INT32:
new_doc.set<int32_t>(field->name(), (int32_t)doc_id);
break;
case DataType::INT64:
new_doc.set<int64_t>(field->name(), (int64_t)doc_id);
break;
case DataType::UINT32:
new_doc.set<uint32_t>(field->name(), (uint32_t)doc_id);
break;
case DataType::UINT64:
new_doc.set<uint64_t>(field->name(), (uint64_t)doc_id);
break;
case DataType::FLOAT:
new_doc.set<float>(field->name(), (float)doc_id);
break;
case DataType::DOUBLE:
new_doc.set<double>(field->name(), (double)doc_id);
break;
case DataType::STRING:
new_doc.set<std::string>(field->name(),
"value_" + std::to_string(doc_id));
break;
case DataType::ARRAY_BINARY: {
std::vector<std::string> bin_vec;
for (size_t i = 0; i < (doc_id % 10); i++) {
bin_vec.push_back("bin_" + std::to_string(i));
}
new_doc.set<std::vector<std::string>>(field->name(), bin_vec);
break;
}
case DataType::ARRAY_BOOL:
new_doc.set<std::vector<bool>>(field->name(),
std::vector<bool>(10, doc_id % 10 == 0));
break;
case DataType::ARRAY_INT32:
new_doc.set<std::vector<int32_t>>(
field->name(), std::vector<int32_t>(10, (int32_t)doc_id));
break;
case DataType::ARRAY_INT64:
new_doc.set<std::vector<int64_t>>(
field->name(), std::vector<int64_t>(10, (int64_t)doc_id));
break;
case DataType::ARRAY_UINT32:
new_doc.set<std::vector<uint32_t>>(
field->name(), std::vector<uint32_t>(10, (uint32_t)doc_id));
break;
case DataType::ARRAY_UINT64:
new_doc.set<std::vector<uint64_t>>(
field->name(), std::vector<uint64_t>(10, (uint64_t)doc_id));
break;
case DataType::ARRAY_FLOAT:
new_doc.set<std::vector<float>>(field->name(),
std::vector<float>(10, (float)doc_id));
break;
case DataType::ARRAY_DOUBLE:
new_doc.set<std::vector<double>>(
field->name(), std::vector<double>(10, (double)doc_id));
break;
case DataType::ARRAY_STRING:
new_doc.set<std::vector<std::string>>(
field->name(),
std::vector<std::string>(10, "value_" + std::to_string(doc_id)));
break;
case DataType::VECTOR_BINARY32:
new_doc.set<std::vector<uint32_t>>(
field->name(),
std::vector<uint32_t>(field->dimension(), uint32_t(doc_id + 0.1)));
break;
case DataType::VECTOR_BINARY64:
new_doc.set<std::vector<uint64_t>>(
field->name(),
std::vector<uint64_t>(field->dimension(), uint64_t(doc_id + 0.1)));
break;
case DataType::VECTOR_FP32:
new_doc.set<std::vector<float>>(
field->name(),
std::vector<float>(field->dimension(), float(doc_id + 0.1)));
break;
case DataType::VECTOR_FP64:
new_doc.set<std::vector<double>>(
field->name(),
std::vector<double>(field->dimension(), double(doc_id + 0.1)));
break;
case DataType::VECTOR_FP16:
new_doc.set<std::vector<zvec::float16_t>>(
field->name(), std::vector<zvec::float16_t>(
field->dimension(), static_cast<zvec::float16_t>(
float(doc_id + 0.1))));
break;
case DataType::VECTOR_INT8:
new_doc.set<std::vector<int8_t>>(
field->name(),
std::vector<int8_t>(field->dimension(), (int8_t)doc_id));
break;
case DataType::VECTOR_INT16:
new_doc.set<std::vector<int16_t>>(
field->name(),
std::vector<int16_t>(field->dimension(), (int16_t)doc_id));
break;
case DataType::SPARSE_VECTOR_FP16: {
std::vector<uint32_t> indices;
std::vector<zvec::float16_t> values;
for (uint32_t i = 0; i < 100; i++) {
indices.push_back(i);
values.push_back(zvec::float16_t(float(doc_id + 0.1)));
}
std::pair<std::vector<uint32_t>, std::vector<zvec::float16_t>>
sparse_float_vec;
sparse_float_vec.first = indices;
sparse_float_vec.second = values;
new_doc.set<
std::pair<std::vector<uint32_t>, std::vector<zvec::float16_t>>>(
field->name(), sparse_float_vec);
break;
}
case DataType::SPARSE_VECTOR_FP32: {
std::vector<uint32_t> indices;
std::vector<float> values;
for (uint32_t i = 0; i < 100; i++) {
indices.push_back(i);
values.push_back(float(doc_id + 0.1));
}
std::pair<std::vector<uint32_t>, std::vector<float>> sparse_float_vec;
sparse_float_vec.first = indices;
sparse_float_vec.second = values;
new_doc.set<std::pair<std::vector<uint32_t>, std::vector<float>>>(
field->name(), sparse_float_vec);
break;
}
default:
std::cout << "Unsupported data type: " << field->name() << std::endl;
throw std::runtime_error("Unsupported vector data type");
}
}
return new_doc;
}
CollectionSchema::Ptr create_schema() {
auto schema = std::make_shared<CollectionSchema>("demo");
schema->set_max_doc_count_per_segment(1000);
schema->add_field(std::make_shared<FieldSchema>(
"id", DataType::INT64, false, std::make_shared<InvertIndexParams>(true)));
schema->add_field(std::make_shared<FieldSchema>(
"name", DataType::STRING, false,
std::make_shared<InvertIndexParams>(false)));
schema->add_field(
std::make_shared<FieldSchema>("weight", DataType::FLOAT, true));
schema->add_field(std::make_shared<FieldSchema>(
"dense", DataType::VECTOR_FP32, 128, false,
std::make_shared<HnswIndexParams>(MetricType::IP)));
schema->add_field(std::make_shared<FieldSchema>(
"sparse", DataType::SPARSE_VECTOR_FP32, 0, false,
std::make_shared<HnswIndexParams>(MetricType::IP)));
return schema;
}
int main() {
std::string path = "./demo";
std::string rm_cmd = "rm -rf " + path;
system(rm_cmd.c_str());
auto schema = create_schema();
CollectionOptions options{false, true};
auto result = Collection::CreateAndOpen(path, *schema, options);
if (!result.has_value()) {
std::cout << result.error().message() << std::endl;
return -1;
}
std::cout << "init stats: " << result.value()->Stats().value().to_string()
<< std::endl;
auto coll = std::move(result).value();
// insert docs
{
auto doc1 = create_doc(0, *schema);
std::vector<Doc> docs{doc1};
auto res = coll->Insert(docs);
if (!res.has_value()) {
std::cout << res.error().message() << std::endl;
return -1;
}
std::cout << "after insert stats " << coll->Stats().value().to_string()
<< std::endl;
}
// optimize
{
auto res = coll->Optimize();
if (!res.ok()) {
std::cout << res.message() << std::endl;
return -1;
}
std::cout << "after optimize stats " << coll->Stats().value().to_string()
<< std::endl;
}
// query
{
VectorQuery query;
query.topk_ = 10;
query.field_name_ = "dense";
query.include_vector_ = true;
std::vector<float> query_vector = std::vector<float>(128, 0.1);
query.query_vector_.assign((char *)query_vector.data(),
query_vector.size() * sizeof(float));
auto res = coll->Query(query);
if (!res.has_value()) {
std::cout << res.error().message() << std::endl;
return -1;
}
std::cout << "query result: doc_count[" << res.value().size() << "]"
<< std::endl;
std::cout << "first doc: " << res.value()[0]->to_detail_string()
<< std::endl;
}
// close and reopen
coll.reset();
options.read_only_ = true;
result = Collection::Open(path, options);
if (!result.has_value()) {
std::cout << result.error().message() << std::endl;
return -1;
}
std::cout << "reopen stats: " << result.value()->Stats().value().to_string()
<< std::endl;
return 0;
}
================================================
FILE: pyproject.toml
================================================
######################################################################################################
# Zvec: High-Performance Vector Database with PyBind11 & C++ Backend
######################################################################################################
[project]
name = "zvec"
dynamic = ["version"]
description = "A high-performance vector database engine with native C++ backend and Python bindings"
readme = "README.md"
license = { text = "Apache-2.0" }
authors = [
{ name = "zvec", email = "zvec@alibaba-inc.com" },
]
maintainers = [
{ name = "Zvec Core Team", email = "zvec@alibaba-inc.com" },
]
requires-python = ">=3.9"
classifiers = [
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"Intended Audience :: Education",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: Apache Software License",
"Operating System :: POSIX :: Linux",
"Operating System :: MacOS",
"Programming Language :: C++",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Topic :: Database",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
"Topic :: Software Development :: Libraries :: Python Modules",
]
keywords = [
"vector-database", "ann", "nearest-neighbor"
]
dependencies = [
"numpy >=1.23",
]
[project.urls]
Homepage = "https://github.com/alibaba/zvec"
Repository = "https://github.com/alibaba/zvec"
"Bug Tracker" = "https://github.com/alibaba/zvec/issues"
"Documentation" = "https://zvec.org"
[project.optional-dependencies]
test = [
"pytest >=8.0",
"pytest-cov >=4.1",
"pytest-mock >=3.12",
"cibuildwheel == 3.4.0",
]
docs = [
"mkdocs >=1.5",
"mkdocs-material >=9.5",
"mkdocstrings[python] >=0.24",
]
dev = [
"ruff >=0.4",
"black >=24.0",
"mypy >=1.8",
gitextract_w52102_2/
├── .clang-format
├── .git/
│ ├── HEAD
│ ├── config
│ ├── description
│ ├── hooks/
│ │ ├── applypatch-msg.sample
│ │ ├── commit-msg.sample
│ │ ├── fsmonitor-watchman.sample
│ │ ├── post-update.sample
│ │ ├── pre-applypatch.sample
│ │ ├── pre-commit.sample
│ │ ├── pre-merge-commit.sample
│ │ ├── pre-push.sample
│ │ ├── pre-rebase.sample
│ │ ├── pre-receive.sample
│ │ ├── prepare-commit-msg.sample
│ │ ├── push-to-checkout.sample
│ │ ├── sendemail-validate.sample
│ │ └── update.sample
│ ├── index
│ ├── info/
│ │ └── exclude
│ ├── logs/
│ │ ├── HEAD
│ │ └── refs/
│ │ ├── heads/
│ │ │ └── main
│ │ └── remotes/
│ │ └── origin/
│ │ └── HEAD
│ ├── objects/
│ │ └── pack/
│ │ ├── pack-2b5e15ebe928a592991dc24c7ae7e8dc9e3500dc.idx
│ │ ├── pack-2b5e15ebe928a592991dc24c7ae7e8dc9e3500dc.pack
│ │ ├── pack-2b5e15ebe928a592991dc24c7ae7e8dc9e3500dc.promisor
│ │ └── pack-2b5e15ebe928a592991dc24c7ae7e8dc9e3500dc.rev
│ ├── packed-refs
│ ├── refs/
│ │ ├── heads/
│ │ │ └── main
│ │ └── remotes/
│ │ └── origin/
│ │ └── HEAD
│ └── shallow
├── .github/
│ ├── ISSUE_TEMPLATE/
│ │ ├── benchmark.yml
│ │ ├── bug_report.yml
│ │ ├── config.yml
│ │ ├── enhancement.yml
│ │ ├── feature_request.yml
│ │ ├── integration.yml
│ │ └── profiling.yml
│ ├── codecov.yml
│ ├── dependabot.yml
│ └── workflows/
│ ├── 01-ci-pipeline.yml
│ ├── 02-lint-check.yml
│ ├── 03-macos-linux-build.yml
│ ├── 04-android-build.yml
│ ├── _build_wheel_job.yml
│ ├── build_test_wheel.yml
│ ├── build_wheel.yml
│ ├── continuous_bench.yml
│ ├── docker/
│ │ └── Dockerfile.linux_x64_glibc228
│ ├── nightly_coverage.yml
│ └── scripts/
│ └── run_vdb.sh
├── .gitignore
├── .gitmodules
├── CMakeLists.txt
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── cmake/
│ ├── bazel.cmake
│ ├── option.cmake
│ └── utils.cmake
├── examples/
│ └── c++/
│ ├── CMakeLists.txt
│ ├── ailego/
│ │ └── main.cc
│ ├── core/
│ │ └── main.cc
│ └── db/
│ └── main.cc
├── pyproject.toml
├── python/
│ ├── tests/
│ │ ├── detail/
│ │ │ ├── distance_helper.py
│ │ │ ├── doc_helper.py
│ │ │ ├── fixture_helper.py
│ │ │ ├── params_helper.py
│ │ │ ├── support_helper.py
│ │ │ ├── test_collection_concurrency.py
│ │ │ ├── test_collection_create_and_open.py
│ │ │ ├── test_collection_ddl.py
│ │ │ ├── test_collection_dml.py
│ │ │ ├── test_collection_dql.py
│ │ │ ├── test_collection_exception.py
│ │ │ ├── test_collection_open.py
│ │ │ ├── test_collection_recall.py
│ │ │ └── test_db_config.py
│ │ ├── test_collection.py
│ │ ├── test_collection_hnsw_rabitq.py
│ │ ├── test_convert.py
│ │ ├── test_doc.py
│ │ ├── test_embedding.py
│ │ ├── test_params.py
│ │ ├── test_query_executor.py
│ │ ├── test_reranker.py
│ │ ├── test_schema.py
│ │ ├── test_typing.py
│ │ └── test_util.py
│ └── zvec/
│ ├── __init__.py
│ ├── __init__.pyi
│ ├── common/
│ │ ├── __init__.py
│ │ └── constants.py
│ ├── executor/
│ │ ├── __init__.py
│ │ └── query_executor.py
│ ├── extension/
│ │ ├── __init__.py
│ │ ├── bm25_embedding_function.py
│ │ ├── embedding_function.py
│ │ ├── http_embedding_function.py
│ │ ├── jina_embedding_function.py
│ │ ├── jina_function.py
│ │ ├── multi_vector_reranker.py
│ │ ├── openai_embedding_function.py
│ │ ├── openai_function.py
│ │ ├── qwen_embedding_function.py
│ │ ├── qwen_function.py
│ │ ├── qwen_rerank_function.py
│ │ ├── rerank_function.py
│ │ ├── sentence_transformer_embedding_function.py
│ │ ├── sentence_transformer_function.py
│ │ └── sentence_transformer_rerank_function.py
│ ├── model/
│ │ ├── __init__.py
│ │ ├── collection.py
│ │ ├── convert.py
│ │ ├── doc.py
│ │ ├── param/
│ │ │ ├── __init__.py
│ │ │ ├── __init__.pyi
│ │ │ └── vector_query.py
│ │ └── schema/
│ │ ├── __init__.py
│ │ ├── __init__.pyi
│ │ ├── collection_schema.py
│ │ └── field_schema.py
│ ├── py.typed
│ ├── tool/
│ │ ├── __init__.py
│ │ └── util.py
│ ├── typing/
│ │ ├── __init__.py
│ │ ├── __init__.pyi
│ │ └── enum.py
│ └── zvec.py
├── scripts/
│ ├── README.md
│ ├── build_android.sh
│ └── gcov.sh
├── src/
│ ├── CMakeLists.txt
│ ├── ailego/
│ │ ├── CMakeLists.txt
│ │ ├── algorithm/
│ │ │ ├── binary_quantizer.cc
│ │ │ ├── binary_quantizer.h
│ │ │ ├── integer_quantizer.cc
│ │ │ ├── integer_quantizer.h
│ │ │ ├── kmeans.h
│ │ │ └── lloyd_cluster.h
│ │ ├── buffer/
│ │ │ ├── buffer_manager.cc
│ │ │ └── buffer_pool.cc
│ │ ├── container/
│ │ │ ├── bitmap.cc
│ │ │ ├── bitmap.h
│ │ │ ├── bloom_filter.h
│ │ │ ├── params.cc
│ │ │ ├── reservoir.h
│ │ │ └── vector_array.h
│ │ ├── encoding/
│ │ │ └── json/
│ │ │ └── mod_json.c
│ │ ├── hash/
│ │ │ └── crc32c.cc
│ │ ├── internal/
│ │ │ ├── cpu_features.cc
│ │ │ └── cpu_features.h
│ │ ├── io/
│ │ │ ├── file.cc
│ │ │ ├── file_lock.cc
│ │ │ ├── file_lock.h
│ │ │ └── file_writer.h
│ │ ├── logger/
│ │ │ └── logger.cc
│ │ ├── math/
│ │ │ ├── cosine_distance_matrix.h
│ │ │ ├── distance.h
│ │ │ ├── distance_matrix.h
│ │ │ ├── distance_matrix_accum_fp16.i
│ │ │ ├── distance_matrix_accum_fp32.i
│ │ │ ├── distance_matrix_accum_int4.i
│ │ │ ├── distance_matrix_accum_int8.i
│ │ │ ├── distance_matrix_euclidean_utility.i
│ │ │ ├── distance_matrix_fp16.i
│ │ │ ├── distance_matrix_fp32.i
│ │ │ ├── distance_matrix_inner_product_utility.i
│ │ │ ├── distance_matrix_int32.i
│ │ │ ├── distance_matrix_int64.i
│ │ │ ├── distance_matrix_mips_utility.i
│ │ │ ├── distance_matrix_popcnt.i
│ │ │ ├── distance_utility.h
│ │ │ ├── euclidean_distance_matrix.h
│ │ │ ├── euclidean_distance_matrix_fp16_avx.cc
│ │ │ ├── euclidean_distance_matrix_fp16_avx512.cc
│ │ │ ├── euclidean_distance_matrix_fp16_avx512fp16.cc
│ │ │ ├── euclidean_distance_matrix_fp16_dispatch.cc
│ │ │ ├── euclidean_distance_matrix_fp16_neon.cc
│ │ │ ├── euclidean_distance_matrix_fp32_avx.cc
│ │ │ ├── euclidean_distance_matrix_fp32_avx512.cc
│ │ │ ├── euclidean_distance_matrix_fp32_dispatch.cc
│ │ │ ├── euclidean_distance_matrix_fp32_neon.cc
│ │ │ ├── euclidean_distance_matrix_fp32_sse.cc
│ │ │ ├── euclidean_distance_matrix_int4_avx2.cc
│ │ │ ├── euclidean_distance_matrix_int4_dispatch.cc
│ │ │ ├── euclidean_distance_matrix_int4_sse.cc
│ │ │ ├── euclidean_distance_matrix_int8_avx2.cc
│ │ │ ├── euclidean_distance_matrix_int8_dispatch.cc
│ │ │ ├── euclidean_distance_matrix_int8_sse.cc
│ │ │ ├── euclidean_distance_matrix_scalar.cc
│ │ │ ├── hamming_distance_matrix.cc
│ │ │ ├── hamming_distance_matrix.h
│ │ │ ├── inner_product_matrix.h
│ │ │ ├── inner_product_matrix_fp16_avx.cc
│ │ │ ├── inner_product_matrix_fp16_avx512.cc
│ │ │ ├── inner_product_matrix_fp16_avx512fp16.cc
│ │ │ ├── inner_product_matrix_fp16_dispatch.cc
│ │ │ ├── inner_product_matrix_fp16_neon.cc
│ │ │ ├── inner_product_matrix_fp32_avx.cc
│ │ │ ├── inner_product_matrix_fp32_avx512.cc
│ │ │ ├── inner_product_matrix_fp32_dispatch.cc
│ │ │ ├── inner_product_matrix_fp32_neon.cc
│ │ │ ├── inner_product_matrix_fp32_sse.cc
│ │ │ ├── inner_product_matrix_int4_avx2.cc
│ │ │ ├── inner_product_matrix_int4_dispatch.cc
│ │ │ ├── inner_product_matrix_int4_sse.cc
│ │ │ ├── inner_product_matrix_int8_avx2.cc
│ │ │ ├── inner_product_matrix_int8_dispatch.cc
│ │ │ ├── inner_product_matrix_int8_sse.cc
│ │ │ ├── inner_product_matrix_scalar.cc
│ │ │ ├── matrix_define.i
│ │ │ ├── matrix_utility.i
│ │ │ ├── mips_euclidean_distance_matrix.h
│ │ │ ├── mips_euclidean_distance_matrix_fp16_avx.cc
│ │ │ ├── mips_euclidean_distance_matrix_fp16_avx512.cc
│ │ │ ├── mips_euclidean_distance_matrix_fp16_dispatch.cc
│ │ │ ├── mips_euclidean_distance_matrix_fp16_neon.cc
│ │ │ ├── mips_euclidean_distance_matrix_fp32_avx.cc
│ │ │ ├── mips_euclidean_distance_matrix_fp32_avx512.cc
│ │ │ ├── mips_euclidean_distance_matrix_fp32_dispatch.cc
│ │ │ ├── mips_euclidean_distance_matrix_fp32_neon.cc
│ │ │ ├── mips_euclidean_distance_matrix_fp32_sse.cc
│ │ │ ├── mips_euclidean_distance_matrix_int4_avx2.cc
│ │ │ ├── mips_euclidean_distance_matrix_int4_dispatch.cc
│ │ │ ├── mips_euclidean_distance_matrix_int4_sse.cc
│ │ │ ├── mips_euclidean_distance_matrix_int8_avx2.cc
│ │ │ ├── mips_euclidean_distance_matrix_int8_dispatch.cc
│ │ │ ├── mips_euclidean_distance_matrix_int8_sse.cc
│ │ │ ├── mips_euclidean_distance_matrix_scalar.cc
│ │ │ ├── norm1_matrix.h
│ │ │ ├── norm1_matrix_fp16.cc
│ │ │ ├── norm1_matrix_fp32.cc
│ │ │ ├── norm2_matrix.h
│ │ │ ├── norm2_matrix_fp16.cc
│ │ │ ├── norm2_matrix_fp32.cc
│ │ │ ├── norm_matrix.h
│ │ │ ├── norm_matrix_fp16.i
│ │ │ ├── norm_matrix_fp32.i
│ │ │ ├── normalizer.cc
│ │ │ └── normalizer.h
│ │ ├── math_batch/
│ │ │ ├── cosine_distance_batch.h
│ │ │ ├── distance_batch.h
│ │ │ ├── inner_product_distance_batch.h
│ │ │ ├── inner_product_distance_batch_dispatch.cc
│ │ │ ├── inner_product_distance_batch_impl_fp16_avx2.cc
│ │ │ ├── inner_product_distance_batch_impl_fp16_avx512.cc
│ │ │ ├── inner_product_distance_batch_impl_fp16_avx512fp16.cc
│ │ │ ├── inner_product_distance_batch_impl_fp32_avx2.cc
│ │ │ ├── inner_product_distance_batch_impl_int8_avx2.cc
│ │ │ └── inner_product_distance_batch_impl_int8_avx512fp16.cc
│ │ ├── parallel/
│ │ │ ├── lock.h
│ │ │ ├── multi_thread_list.h
│ │ │ ├── semaphore.h
│ │ │ └── thread_pool.cc
│ │ ├── pattern/
│ │ │ ├── defer.h
│ │ │ └── scope_guard.h
│ │ ├── utility/
│ │ │ ├── bit_string_helper.h
│ │ │ ├── bitset_helper.cc
│ │ │ ├── bitset_helper.h
│ │ │ ├── concurrency_helper.cc
│ │ │ ├── concurrency_helper.h
│ │ │ ├── dl_helper.cc
│ │ │ ├── dl_helper.h
│ │ │ ├── file_helper.cc
│ │ │ ├── float_helper.cc
│ │ │ ├── math_helper.h
│ │ │ ├── matrix_helper.h
│ │ │ ├── memory_helper.cc
│ │ │ ├── memory_helper.h
│ │ │ ├── string_helper.cc
│ │ │ └── time_helper.cc
│ │ ├── version.cc
│ │ ├── version.h
│ │ └── version.i
│ ├── binding/
│ │ ├── CMakeLists.txt
│ │ └── python/
│ │ ├── CMakeLists.txt
│ │ ├── binding.cc
│ │ ├── exports.mac
│ │ ├── include/
│ │ │ ├── python_collection.h
│ │ │ ├── python_config.h
│ │ │ ├── python_doc.h
│ │ │ ├── python_param.h
│ │ │ ├── python_schema.h
│ │ │ └── python_type.h
│ │ ├── model/
│ │ │ ├── common/
│ │ │ │ └── python_config.cc
│ │ │ ├── param/
│ │ │ │ └── python_param.cc
│ │ │ ├── python_collection.cc
│ │ │ ├── python_doc.cc
│ │ │ └── schema/
│ │ │ └── python_schema.cc
│ │ └── typing/
│ │ └── python_type.cc
│ ├── core/
│ │ ├── CMakeLists.txt
│ │ ├── algorithm/
│ │ │ ├── CMakeLists.txt
│ │ │ ├── cluster/
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ ├── cluster_params.h
│ │ │ │ ├── kmeans_cluster.cc
│ │ │ │ ├── linear_seeker.cc
│ │ │ │ ├── linear_seeker.h
│ │ │ │ ├── opt_kmeans_cluster.cc
│ │ │ │ ├── seeker.h
│ │ │ │ ├── stratified_cluster.cc
│ │ │ │ ├── stratified_cluster_trainer.cc
│ │ │ │ ├── stratified_cluster_trainer.h
│ │ │ │ └── vector_mean.h
│ │ │ ├── flat/
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ ├── flat_builder.cc
│ │ │ │ ├── flat_builder.h
│ │ │ │ ├── flat_distance_matrix.h
│ │ │ │ ├── flat_index_format.h
│ │ │ │ ├── flat_searcher.cc
│ │ │ │ ├── flat_searcher.h
│ │ │ │ ├── flat_searcher_context.h
│ │ │ │ ├── flat_searcher_provider.h
│ │ │ │ ├── flat_streamer.cc
│ │ │ │ ├── flat_streamer.h
│ │ │ │ ├── flat_streamer_context.h
│ │ │ │ ├── flat_streamer_dumper.h
│ │ │ │ ├── flat_streamer_entity.cc
│ │ │ │ ├── flat_streamer_entity.h
│ │ │ │ ├── flat_streamer_provider.h
│ │ │ │ └── flat_utility.h
│ │ │ ├── flat_sparse/
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ ├── flat_sparse_builder.cc
│ │ │ │ ├── flat_sparse_builder.h
│ │ │ │ ├── flat_sparse_context.cc
│ │ │ │ ├── flat_sparse_context.h
│ │ │ │ ├── flat_sparse_entity.h
│ │ │ │ ├── flat_sparse_index_format.h
│ │ │ │ ├── flat_sparse_provider.h
│ │ │ │ ├── flat_sparse_search.h
│ │ │ │ ├── flat_sparse_searcher.cc
│ │ │ │ ├── flat_sparse_searcher.h
│ │ │ │ ├── flat_sparse_searcher_entity.cc
│ │ │ │ ├── flat_sparse_searcher_entity.h
│ │ │ │ ├── flat_sparse_streamer.cc
│ │ │ │ ├── flat_sparse_streamer.h
│ │ │ │ ├── flat_sparse_streamer_entity.cc
│ │ │ │ ├── flat_sparse_streamer_entity.h
│ │ │ │ └── flat_sparse_utility.h
│ │ │ ├── hnsw/
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ ├── hnsw_algorithm.cc
│ │ │ │ ├── hnsw_algorithm.h
│ │ │ │ ├── hnsw_builder.cc
│ │ │ │ ├── hnsw_builder.h
│ │ │ │ ├── hnsw_builder_entity.cc
│ │ │ │ ├── hnsw_builder_entity.h
│ │ │ │ ├── hnsw_chunk.cc
│ │ │ │ ├── hnsw_chunk.h
│ │ │ │ ├── hnsw_context.cc
│ │ │ │ ├── hnsw_context.h
│ │ │ │ ├── hnsw_dist_calculator.h
│ │ │ │ ├── hnsw_entity.cc
│ │ │ │ ├── hnsw_entity.h
│ │ │ │ ├── hnsw_index_hash.h
│ │ │ │ ├── hnsw_index_provider.h
│ │ │ │ ├── hnsw_params.h
│ │ │ │ ├── hnsw_searcher.cc
│ │ │ │ ├── hnsw_searcher.h
│ │ │ │ ├── hnsw_searcher_entity.cc
│ │ │ │ ├── hnsw_searcher_entity.h
│ │ │ │ ├── hnsw_streamer.cc
│ │ │ │ ├── hnsw_streamer.h
│ │ │ │ ├── hnsw_streamer_entity.cc
│ │ │ │ └── hnsw_streamer_entity.h
│ │ │ ├── hnsw_rabitq/
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ ├── hnsw_rabitq_algorithm.cc
│ │ │ │ ├── hnsw_rabitq_algorithm.h
│ │ │ │ ├── hnsw_rabitq_builder.cc
│ │ │ │ ├── hnsw_rabitq_builder.h
│ │ │ │ ├── hnsw_rabitq_builder_entity.cc
│ │ │ │ ├── hnsw_rabitq_builder_entity.h
│ │ │ │ ├── hnsw_rabitq_chunk.cc
│ │ │ │ ├── hnsw_rabitq_chunk.h
│ │ │ │ ├── hnsw_rabitq_context.cc
│ │ │ │ ├── hnsw_rabitq_context.h
│ │ │ │ ├── hnsw_rabitq_dist_calculator.cc
│ │ │ │ ├── hnsw_rabitq_dist_calculator.h
│ │ │ │ ├── hnsw_rabitq_entity.cc
│ │ │ │ ├── hnsw_rabitq_entity.h
│ │ │ │ ├── hnsw_rabitq_index_hash.h
│ │ │ │ ├── hnsw_rabitq_index_provider.h
│ │ │ │ ├── hnsw_rabitq_params.h
│ │ │ │ ├── hnsw_rabitq_query_algorithm.cc
│ │ │ │ ├── hnsw_rabitq_query_algorithm.h
│ │ │ │ ├── hnsw_rabitq_query_entity.h
│ │ │ │ ├── hnsw_rabitq_register.cc
│ │ │ │ ├── hnsw_rabitq_searcher.cc
│ │ │ │ ├── hnsw_rabitq_searcher.h
│ │ │ │ ├── hnsw_rabitq_searcher_entity.cc
│ │ │ │ ├── hnsw_rabitq_searcher_entity.h
│ │ │ │ ├── hnsw_rabitq_streamer.cc
│ │ │ │ ├── hnsw_rabitq_streamer.h
│ │ │ │ ├── hnsw_rabitq_streamer_entity.cc
│ │ │ │ ├── hnsw_rabitq_streamer_entity.h
│ │ │ │ ├── rabitq_converter.cc
│ │ │ │ ├── rabitq_converter.h
│ │ │ │ ├── rabitq_params.h
│ │ │ │ ├── rabitq_reformer.cc
│ │ │ │ ├── rabitq_reformer.h
│ │ │ │ ├── rabitq_utils.cc
│ │ │ │ └── rabitq_utils.h
│ │ │ ├── hnsw_sparse/
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ ├── hnsw_sparse_algorithm.cc
│ │ │ │ ├── hnsw_sparse_algorithm.h
│ │ │ │ ├── hnsw_sparse_builder.cc
│ │ │ │ ├── hnsw_sparse_builder.h
│ │ │ │ ├── hnsw_sparse_builder_entity.cc
│ │ │ │ ├── hnsw_sparse_builder_entity.h
│ │ │ │ ├── hnsw_sparse_chunk.cc
│ │ │ │ ├── hnsw_sparse_chunk.h
│ │ │ │ ├── hnsw_sparse_context.cc
│ │ │ │ ├── hnsw_sparse_context.h
│ │ │ │ ├── hnsw_sparse_dist_calculator.h
│ │ │ │ ├── hnsw_sparse_entity.cc
│ │ │ │ ├── hnsw_sparse_entity.h
│ │ │ │ ├── hnsw_sparse_index_hash.h
│ │ │ │ ├── hnsw_sparse_index_provider.h
│ │ │ │ ├── hnsw_sparse_params.h
│ │ │ │ ├── hnsw_sparse_searcher.cc
│ │ │ │ ├── hnsw_sparse_searcher.h
│ │ │ │ ├── hnsw_sparse_searcher_entity.cc
│ │ │ │ ├── hnsw_sparse_searcher_entity.h
│ │ │ │ ├── hnsw_sparse_streamer.cc
│ │ │ │ ├── hnsw_sparse_streamer.h
│ │ │ │ ├── hnsw_sparse_streamer_entity.cc
│ │ │ │ └── hnsw_sparse_streamer_entity.h
│ │ │ └── ivf/
│ │ │ ├── CMakeLists.txt
│ │ │ ├── ivf_builder.cc
│ │ │ ├── ivf_builder.h
│ │ │ ├── ivf_centroid_index.cc
│ │ │ ├── ivf_centroid_index.h
│ │ │ ├── ivf_distance_calculator.cc
│ │ │ ├── ivf_distance_calculator.h
│ │ │ ├── ivf_dumper.cc
│ │ │ ├── ivf_dumper.h
│ │ │ ├── ivf_entity.cc
│ │ │ ├── ivf_entity.h
│ │ │ ├── ivf_index_format.h
│ │ │ ├── ivf_index_provider.h
│ │ │ ├── ivf_params.h
│ │ │ ├── ivf_searcher.cc
│ │ │ ├── ivf_searcher.h
│ │ │ ├── ivf_searcher_context.h
│ │ │ ├── ivf_streamer.cc
│ │ │ ├── ivf_streamer.h
│ │ │ └── ivf_utility.h
│ │ ├── framework/
│ │ │ ├── CMakeLists.txt
│ │ │ ├── index_cluster.cc
│ │ │ ├── index_context.cc
│ │ │ ├── index_converter.cc
│ │ │ ├── index_error.cc
│ │ │ ├── index_factory.cc
│ │ │ ├── index_flow.cc
│ │ │ ├── index_helper.cc
│ │ │ ├── index_logger.cc
│ │ │ ├── index_mapping.cc
│ │ │ ├── index_meta.cc
│ │ │ ├── index_plugin.cc
│ │ │ └── index_version.cc
│ │ ├── interface/
│ │ │ ├── CMakeLists.txt
│ │ │ ├── index.cc
│ │ │ ├── index_factory.cc
│ │ │ ├── index_param.cc
│ │ │ ├── indexes/
│ │ │ │ ├── flat_index.cc
│ │ │ │ ├── hnsw_index.cc
│ │ │ │ ├── hnsw_rabitq_index.cc
│ │ │ │ └── ivf_index.cc
│ │ │ └── utils/
│ │ │ └── utils.h
│ │ ├── metric/
│ │ │ ├── CMakeLists.txt
│ │ │ ├── cosine_metric.cc
│ │ │ ├── euclidean_metric.cc
│ │ │ ├── hamming_metric.cc
│ │ │ ├── inner_product_metric.cc
│ │ │ ├── metric_params.h
│ │ │ ├── mips_euclidean_metric.cc
│ │ │ ├── quantized_integer_metric.cc
│ │ │ ├── quantized_integer_metric_batch.h
│ │ │ └── quantized_integer_metric_matrix.h
│ │ ├── mixed_reducer/
│ │ │ ├── CMakeLists.txt
│ │ │ ├── mixed_reducer_params.h
│ │ │ ├── mixed_streamer_reducer.cc
│ │ │ └── mixed_streamer_reducer.h
│ │ ├── quantizer/
│ │ │ ├── CMakeLists.txt
│ │ │ ├── binary_converter.cc
│ │ │ ├── binary_reformer.cc
│ │ │ ├── cosine_converter.cc
│ │ │ ├── cosine_reformer.cc
│ │ │ ├── half_float_converter.cc
│ │ │ ├── half_float_reformer.cc
│ │ │ ├── integer_quantizer_converter.cc
│ │ │ ├── integer_quantizer_reformer.cc
│ │ │ ├── mips_converter.cc
│ │ │ ├── mips_reformer.cc
│ │ │ ├── quantizer_params.h
│ │ │ └── record_quantizer.h
│ │ └── utility/
│ │ ├── CMakeLists.txt
│ │ ├── basic_refiner.cc
│ │ ├── buffer_storage.cc
│ │ ├── file_dumper.cc
│ │ ├── file_read_storage.cc
│ │ ├── memory_dumper.cc
│ │ ├── memory_read_storage.cc
│ │ ├── mmap_file_read_storage.cc
│ │ ├── mmap_file_storage.cc
│ │ ├── sparse_utility.h
│ │ ├── utility_params.h
│ │ └── visit_filter.h
│ ├── db/
│ │ ├── CMakeLists.txt
│ │ ├── collection.cc
│ │ ├── common/
│ │ │ ├── CMakeLists.txt
│ │ │ ├── cgroup_util.cc
│ │ │ ├── cgroup_util.h
│ │ │ ├── concurrent_roaring_bitmap.cc
│ │ │ ├── concurrent_roaring_bitmap.h
│ │ │ ├── config.cc
│ │ │ ├── constants.h
│ │ │ ├── error_code.cc
│ │ │ ├── error_code.h
│ │ │ ├── file_helper.cc
│ │ │ ├── file_helper.h
│ │ │ ├── global_resource.cc
│ │ │ ├── global_resource.h
│ │ │ ├── glogger.h
│ │ │ ├── logger.h
│ │ │ ├── profiler.h
│ │ │ ├── rocbsdb_context.cc
│ │ │ ├── rocksdb_context.h
│ │ │ ├── status.cc
│ │ │ ├── typedef.h
│ │ │ ├── utils.cc
│ │ │ └── utils.h
│ │ ├── index/
│ │ │ ├── CMakeLists.txt
│ │ │ ├── column/
│ │ │ │ ├── column_indexer.h
│ │ │ │ ├── common/
│ │ │ │ │ └── index_results.h
│ │ │ │ ├── inverted_column/
│ │ │ │ │ ├── inverted_codec.h
│ │ │ │ │ ├── inverted_column_indexer.h
│ │ │ │ │ ├── inverted_column_indexer_search.cc
│ │ │ │ │ ├── inverted_column_indexer_util.cc
│ │ │ │ │ ├── inverted_column_indexer_write.cc
│ │ │ │ │ ├── inverted_doc_range.h
│ │ │ │ │ ├── inverted_indexer.cc
│ │ │ │ │ ├── inverted_indexer.h
│ │ │ │ │ ├── inverted_rocksdb_merger.h
│ │ │ │ │ └── inverted_search_result.h
│ │ │ │ └── vector_column/
│ │ │ │ ├── combined_vector_column_indexer.cc
│ │ │ │ ├── combined_vector_column_indexer.h
│ │ │ │ ├── engine_helper.hpp
│ │ │ │ ├── vector_column_indexer.cc
│ │ │ │ ├── vector_column_indexer.h
│ │ │ │ ├── vector_column_params.h
│ │ │ │ └── vector_index_results.h
│ │ │ ├── common/
│ │ │ │ ├── delete_store.h
│ │ │ │ ├── doc.cc
│ │ │ │ ├── id_map.cc
│ │ │ │ ├── id_map.h
│ │ │ │ ├── index_filter.h
│ │ │ │ ├── index_params.cc
│ │ │ │ ├── meta.h
│ │ │ │ ├── proto_converter.cc
│ │ │ │ ├── proto_converter.h
│ │ │ │ ├── schema.cc
│ │ │ │ ├── stats.cc
│ │ │ │ ├── type_helper.cc
│ │ │ │ ├── type_helper.h
│ │ │ │ ├── version_manager.cc
│ │ │ │ └── version_manager.h
│ │ │ ├── segment/
│ │ │ │ ├── column_merging_reader.cc
│ │ │ │ ├── column_merging_reader.h
│ │ │ │ ├── segment.cc
│ │ │ │ ├── segment.h
│ │ │ │ ├── segment_helper.cc
│ │ │ │ ├── segment_helper.h
│ │ │ │ ├── segment_manager.cc
│ │ │ │ ├── segment_manager.h
│ │ │ │ ├── sql_expr_parser.cc
│ │ │ │ └── sql_expr_parser.h
│ │ │ └── storage/
│ │ │ ├── arrow_ipc_writer.cc
│ │ │ ├── arrow_ipc_writer.h
│ │ │ ├── base_forward_store.h
│ │ │ ├── bufferpool_forward_store.cc
│ │ │ ├── bufferpool_forward_store.h
│ │ │ ├── chunked_file_writer.cc
│ │ │ ├── chunked_file_writer.h
│ │ │ ├── forward_writer.cc
│ │ │ ├── forward_writer.h
│ │ │ ├── lazy_record_batch_reader.h
│ │ │ ├── memory_forward_store.cc
│ │ │ ├── memory_forward_store.h
│ │ │ ├── mmap_forward_store.cc
│ │ │ ├── mmap_forward_store.h
│ │ │ ├── parquet_writer.cc
│ │ │ ├── parquet_writer.h
│ │ │ ├── store_helper.h
│ │ │ └── wal/
│ │ │ ├── local_wal_file.cc
│ │ │ ├── local_wal_file.h
│ │ │ ├── wal_file.cc
│ │ │ └── wal_file.h
│ │ ├── proto/
│ │ │ └── zvec.proto
│ │ └── sqlengine/
│ │ ├── CMakeLists.txt
│ │ ├── analyzer/
│ │ │ ├── query_analyzer.cc
│ │ │ ├── query_analyzer.h
│ │ │ ├── query_field_info.cc
│ │ │ ├── query_field_info.h
│ │ │ ├── query_info.cc
│ │ │ ├── query_info.h
│ │ │ ├── query_info_helper.cc
│ │ │ ├── query_info_helper.h
│ │ │ ├── query_node.cc
│ │ │ ├── query_node.h
│ │ │ ├── query_node_walker.cc
│ │ │ ├── query_node_walker.h
│ │ │ ├── query_orderby_info.cc
│ │ │ ├── query_orderby_info.h
│ │ │ ├── simple_rewriter.cc
│ │ │ └── simple_rewriter.h
│ │ ├── antlr/
│ │ │ ├── SQLLexer.g4
│ │ │ ├── SQLParser.g4
│ │ │ ├── gen/
│ │ │ │ ├── SQLLexer.cc
│ │ │ │ ├── SQLLexer.h
│ │ │ │ ├── SQLLexer.interp
│ │ │ │ ├── SQLLexer.tokens
│ │ │ │ ├── SQLParser.cc
│ │ │ │ ├── SQLParser.h
│ │ │ │ ├── SQLParser.interp
│ │ │ │ ├── SQLParser.tokens
│ │ │ │ ├── SQLParserBaseListener.cc
│ │ │ │ ├── SQLParserBaseListener.h
│ │ │ │ ├── SQLParserListener.cc
│ │ │ │ └── SQLParserListener.h
│ │ │ └── gen_parser.sh
│ │ ├── common/
│ │ │ ├── generic_node.h
│ │ │ ├── group_by.h
│ │ │ ├── util.cc
│ │ │ └── util.h
│ │ ├── parser/
│ │ │ ├── base_info.h
│ │ │ ├── case_changing_charstream.h
│ │ │ ├── error_verbose_listener.h
│ │ │ ├── node.cc
│ │ │ ├── node.h
│ │ │ ├── orderby_elem_info.h
│ │ │ ├── query_parser.cc
│ │ │ ├── query_parser.h
│ │ │ ├── select_info.cc
│ │ │ ├── select_info.h
│ │ │ ├── selected_elem_info.cc
│ │ │ ├── selected_elem_info.h
│ │ │ ├── sql_info.cc
│ │ │ ├── sql_info.h
│ │ │ ├── sql_info_helper.cc
│ │ │ ├── sql_info_helper.h
│ │ │ ├── zvec_cached_sql_parser.cc
│ │ │ ├── zvec_cached_sql_parser.h
│ │ │ ├── zvec_parser.cc
│ │ │ ├── zvec_parser.h
│ │ │ ├── zvec_sql_parser.cc
│ │ │ └── zvec_sql_parser.h
│ │ ├── planner/
│ │ │ ├── doc_filter.cc
│ │ │ ├── doc_filter.h
│ │ │ ├── invert_recall_node.cc
│ │ │ ├── invert_recall_node.h
│ │ │ ├── invert_search.cc
│ │ │ ├── invert_search.h
│ │ │ ├── op_register.cc
│ │ │ ├── op_register.h
│ │ │ ├── ops/
│ │ │ │ ├── check_not_filtered_op.cc
│ │ │ │ ├── check_not_filtered_op.h
│ │ │ │ ├── contain_op.cc
│ │ │ │ ├── contain_op.h
│ │ │ │ ├── fetch_vector_op.cc
│ │ │ │ └── fetch_vector_op.h
│ │ │ ├── optimizer.cc
│ │ │ ├── optimizer.h
│ │ │ ├── plan_info.cc
│ │ │ ├── plan_info.h
│ │ │ ├── query_planner.cc
│ │ │ ├── query_planner.h
│ │ │ ├── segment_node.cc
│ │ │ ├── segment_node.h
│ │ │ ├── vector_recall_node.cc
│ │ │ └── vector_recall_node.h
│ │ ├── sqlengine.cc
│ │ ├── sqlengine.h
│ │ ├── sqlengine_impl.cc
│ │ └── sqlengine_impl.h
│ ├── include/
│ │ └── zvec/
│ │ ├── ailego/
│ │ │ ├── buffer/
│ │ │ │ ├── buffer_manager.h
│ │ │ │ ├── buffer_pool.h
│ │ │ │ └── concurrentqueue.h
│ │ │ ├── container/
│ │ │ │ ├── blob.h
│ │ │ │ ├── cube.h
│ │ │ │ ├── heap.h
│ │ │ │ ├── hypercube.h
│ │ │ │ ├── params.h
│ │ │ │ └── vector.h
│ │ │ ├── encoding/
│ │ │ │ ├── json/
│ │ │ │ │ ├── mod_json.h
│ │ │ │ │ └── mod_json_plus.h
│ │ │ │ └── json.h
│ │ │ ├── hash/
│ │ │ │ ├── crc32c.h
│ │ │ │ └── jump_hash.h
│ │ │ ├── internal/
│ │ │ │ └── platform.h
│ │ │ ├── io/
│ │ │ │ ├── file.h
│ │ │ │ └── mmap_file.h
│ │ │ ├── logger/
│ │ │ │ └── logger.h
│ │ │ ├── math_batch/
│ │ │ │ └── utils.h
│ │ │ ├── parallel/
│ │ │ │ ├── thread_pool.h
│ │ │ │ └── thread_queue.h
│ │ │ ├── pattern/
│ │ │ │ ├── closure.h
│ │ │ │ ├── expected.hpp
│ │ │ │ ├── factory.h
│ │ │ │ └── singleton.h
│ │ │ ├── string/
│ │ │ │ ├── string_concat_helper.h
│ │ │ │ └── string_view.h
│ │ │ └── utility/
│ │ │ ├── file_helper.h
│ │ │ ├── float_helper.h
│ │ │ ├── string_helper.h
│ │ │ ├── string_helper_impl.h
│ │ │ ├── time_helper.h
│ │ │ └── type_helper.h
│ │ ├── core/
│ │ │ ├── framework/
│ │ │ │ ├── index_builder.h
│ │ │ │ ├── index_bundle.h
│ │ │ │ ├── index_cluster.h
│ │ │ │ ├── index_context.h
│ │ │ │ ├── index_converter.h
│ │ │ │ ├── index_document.h
│ │ │ │ ├── index_dumper.h
│ │ │ │ ├── index_error.h
│ │ │ │ ├── index_factory.h
│ │ │ │ ├── index_features.h
│ │ │ │ ├── index_filter.h
│ │ │ │ ├── index_flow.h
│ │ │ │ ├── index_format.h
│ │ │ │ ├── index_framework.h
│ │ │ │ ├── index_groupby.h
│ │ │ │ ├── index_helper.h
│ │ │ │ ├── index_holder.h
│ │ │ │ ├── index_logger.h
│ │ │ │ ├── index_mapping.h
│ │ │ │ ├── index_memory.h
│ │ │ │ ├── index_meta.h
│ │ │ │ ├── index_metric.h
│ │ │ │ ├── index_module.h
│ │ │ │ ├── index_packer.h
│ │ │ │ ├── index_plugin.h
│ │ │ │ ├── index_provider.h
│ │ │ │ ├── index_reducer.h
│ │ │ │ ├── index_refiner.h
│ │ │ │ ├── index_reformer.h
│ │ │ │ ├── index_runner.h
│ │ │ │ ├── index_searcher.h
│ │ │ │ ├── index_segment_storage.h
│ │ │ │ ├── index_stats.h
│ │ │ │ ├── index_storage.h
│ │ │ │ ├── index_streamer.h
│ │ │ │ ├── index_threads.h
│ │ │ │ ├── index_trainer.h
│ │ │ │ ├── index_unpacker.h
│ │ │ │ └── index_version.h
│ │ │ └── interface/
│ │ │ ├── constants.h
│ │ │ ├── index.h
│ │ │ ├── index_factory.h
│ │ │ ├── index_param.h
│ │ │ └── index_param_builders.h
│ │ ├── db/
│ │ │ ├── collection.h
│ │ │ ├── config.h
│ │ │ ├── doc.h
│ │ │ ├── index_params.h
│ │ │ ├── options.h
│ │ │ ├── query_params.h
│ │ │ ├── schema.h
│ │ │ ├── stats.h
│ │ │ ├── status.h
│ │ │ └── type.h
│ │ └── turbo/
│ │ └── turbo.h
│ └── turbo/
│ ├── CMakeLists.txt
│ ├── avx512_vnni/
│ │ └── record_quantized_int8/
│ │ ├── common.h
│ │ ├── cosine.cc
│ │ ├── cosine.h
│ │ ├── squared_euclidean.cc
│ │ └── squared_euclidean.h
│ └── turbo.cc
├── tests/
│ ├── CMakeLists.txt
│ ├── ailego/
│ │ ├── CMakeLists.txt
│ │ ├── algorithm/
│ │ │ ├── integer_quantizer_test.cc
│ │ │ └── kmeans_test.cc
│ │ ├── buffer/
│ │ │ └── buffer_manager_test.cc
│ │ ├── container/
│ │ │ ├── bitmap_test.cc
│ │ │ ├── blob_test.cc
│ │ │ ├── bloom_filter_test.cc
│ │ │ ├── cube_test.cc
│ │ │ ├── heap_test.cc
│ │ │ ├── hypercube_test.cc
│ │ │ ├── params_test.cc
│ │ │ ├── reservoir_test.cc
│ │ │ ├── vector_array_test.cc
│ │ │ └── vector_test.cc
│ │ ├── encoding/
│ │ │ └── json_parse_test.cc
│ │ ├── hash/
│ │ │ ├── crc32c_test.cc
│ │ │ └── jump_hash_test.cc
│ │ ├── internal/
│ │ │ └── cpu_features_test.cc
│ │ ├── io/
│ │ │ ├── file_lock_test.cc
│ │ │ ├── file_test.cc
│ │ │ └── mmap_file_test.cc
│ │ ├── logger/
│ │ │ └── logger_test.cc
│ │ ├── math/
│ │ │ ├── cosine_distance_matrix_fp16_test.cc
│ │ │ ├── cosine_distance_matrix_fp32_test.cc
│ │ │ ├── cosine_distance_matrix_int8_test.cc
│ │ │ ├── euclidean_distance_matrix_fp16_test.cc
│ │ │ ├── euclidean_distance_matrix_fp32_test.cc
│ │ │ ├── euclidean_distance_matrix_int4_test.cc
│ │ │ ├── euclidean_distance_matrix_int8_test.cc
│ │ │ ├── hamming_distance_matrix_test.cc
│ │ │ ├── inner_product_matrix_fp16_test.cc
│ │ │ ├── inner_product_matrix_fp32_test.cc
│ │ │ ├── inner_product_matrix_int4_test.cc
│ │ │ ├── inner_product_matrix_int8_test.cc
│ │ │ ├── mips_euclidean_distance_matrix_fp16_test.cc
│ │ │ ├── mips_euclidean_distance_matrix_fp32_test.cc
│ │ │ ├── mips_euclidean_distance_matrix_int4_test.cc
│ │ │ ├── mips_euclidean_distance_matrix_int8_test.cc
│ │ │ ├── norm_matrix_fp16_test.cc
│ │ │ ├── norm_matrix_fp32_test.cc
│ │ │ ├── norm_matrix_int4_test.cc
│ │ │ ├── norm_matrix_int8_test.cc
│ │ │ └── normalizer_test.cc
│ │ ├── parallel/
│ │ │ ├── lock_test.cc
│ │ │ ├── multi_thread_list_test.cc
│ │ │ ├── semaphore_test.cc
│ │ │ ├── thread_pool_test.cc
│ │ │ └── thread_queue_test.cc
│ │ ├── pattern/
│ │ │ ├── closure_test.cc
│ │ │ ├── factory_test.cc
│ │ │ ├── scope_guard_test.cc
│ │ │ └── singleton_test.cc
│ │ ├── utility/
│ │ │ ├── bit_string_helper_test.cc
│ │ │ ├── bitset_helper_test.cc
│ │ │ ├── dl_helper_test.cc
│ │ │ ├── float_helper_test.cc
│ │ │ ├── matrix_helper_test.cc
│ │ │ ├── memory_helper_test.cc
│ │ │ ├── string_helper_test.cc
│ │ │ ├── time_helper_test.cc
│ │ │ └── type_helper_test.cc
│ │ └── version_test.cc
│ ├── core/
│ │ ├── CMakeLists.txt
│ │ ├── algorithm/
│ │ │ ├── CMakeLists.txt
│ │ │ ├── cluster/
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ ├── kmeans_cluster_test.cc
│ │ │ │ └── opt_kmeans_cluster_test.cc
│ │ │ ├── flat/
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ ├── flat_builder_test.cc
│ │ │ │ ├── flat_searcher_test.cpp
│ │ │ │ ├── flat_streamer_buffer_test.cc
│ │ │ │ ├── flat_streamer_buffer_time_test.cc
│ │ │ │ └── flat_streamer_test.cc
│ │ │ ├── flat_sparse/
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ ├── flat_sparse_builder_test.cc
│ │ │ │ ├── flat_sparse_searcher_test.cc
│ │ │ │ ├── flat_sparse_streamer_buffer_test.cc
│ │ │ │ └── flat_sparse_streamer_test.cc
│ │ │ ├── hnsw/
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ ├── hnsw_builder_test.cc
│ │ │ │ ├── hnsw_searcher_test.cpp
│ │ │ │ ├── hnsw_streamer_buffer_test.cc
│ │ │ │ └── hnsw_streamer_test.cc
│ │ │ ├── hnsw_rabitq/
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ ├── hnsw_rabitq_builder_test.cc
│ │ │ │ ├── hnsw_rabitq_searcher_test.cc
│ │ │ │ └── hnsw_rabitq_streamer_test.cc
│ │ │ ├── hnsw_sparse/
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ ├── hnsw_sparse_builder_test.cc
│ │ │ │ ├── hnsw_sparse_searcher_test.cpp
│ │ │ │ ├── hnsw_sparse_streamer_buffer_test.cpp
│ │ │ │ └── hnsw_sparse_streamer_test.cc
│ │ │ └── ivf/
│ │ │ ├── CMakeLists.txt
│ │ │ ├── ivf_builder_test.cc
│ │ │ └── ivf_searcher_test.cc
│ │ ├── framework/
│ │ │ └── CMakeLists.txt
│ │ ├── interface/
│ │ │ ├── CMakeLists.txt
│ │ │ └── index_interface_test.cc
│ │ ├── metric/
│ │ │ ├── CMakeLists.txt
│ │ │ ├── cosine_metric_test.cc
│ │ │ ├── euclidean_metric_test.cc
│ │ │ ├── hamming_metric_test.cc
│ │ │ ├── inner_product_metric_test.cc
│ │ │ └── quantized_integer_metric_test.cc
│ │ ├── quantizer/
│ │ │ ├── CMakeLists.txt
│ │ │ ├── half_float_reformer_test.cc
│ │ │ └── integer_quantizer_reformer_test.cc
│ │ └── utility/
│ │ ├── CMakeLists.txt
│ │ ├── buffer_storage_test.cpp
│ │ ├── file_dumper_test.cc
│ │ ├── memory_dumper_test.cc
│ │ ├── mmap_file_container_test.cc
│ │ └── mmap_file_storage_test.cpp
│ └── db/
│ ├── CMakeLists.txt
│ ├── collection_test.cc
│ ├── common/
│ │ ├── CMakeLists.txt
│ │ ├── config_test.cc
│ │ └── status_test.cc
│ ├── crash_recovery/
│ │ ├── CMakeLists.txt
│ │ ├── data_generator.cc
│ │ ├── utility.h
│ │ └── write_recovery_test.cc
│ ├── index/
│ │ ├── CMakeLists.txt
│ │ ├── column/
│ │ │ ├── inverted_column/
│ │ │ │ ├── inverted_column_indexer_array_numbers_test.cc
│ │ │ │ ├── inverted_column_indexer_bool_test.cc
│ │ │ │ ├── inverted_column_indexer_cyclic_numbers_test.cc
│ │ │ │ ├── inverted_column_indexer_sequential_numbers_test.cc
│ │ │ │ ├── inverted_column_indexer_string_test.cc
│ │ │ │ └── inverted_indexer_util_test.cc
│ │ │ └── vector_column_indexer_test.cc
│ │ ├── common/
│ │ │ ├── db_proto_converter_test.cc
│ │ │ ├── db_type_helper_test.cc
│ │ │ ├── doc_test.cc
│ │ │ ├── index_params_test.cc
│ │ │ ├── meta_test.cc
│ │ │ ├── query_params_test.cc
│ │ │ ├── schema_test.cc
│ │ │ └── version_manager_test.cc
│ │ ├── segment/
│ │ │ ├── column_merging_reader_test.cc
│ │ │ ├── segment_helper_test.cc
│ │ │ ├── segment_test.cc
│ │ │ ├── sql_expr_parser_test.cc
│ │ │ └── sql_expr_validator_test.cc
│ │ ├── storage/
│ │ │ ├── arrow_ipc_writer_test.cc
│ │ │ ├── bufferpool_store_test.cc
│ │ │ ├── mem_store_test.cc
│ │ │ ├── mmap_store_test.cc
│ │ │ ├── parquet_writer_test.cc
│ │ │ └── wal_file_test.cc
│ │ └── utils/
│ │ ├── utils.cc
│ │ └── utils.h
│ └── sqlengine/
│ ├── CMakeLists.txt
│ ├── contain_test.cc
│ ├── forward_recall_test.cc
│ ├── invert_recall_test.cc
│ ├── like_test.cc
│ ├── mock_segment.h
│ ├── optimizer_test.cc
│ ├── query_info_test.cc
│ ├── recall_base.h
│ ├── simple_rewriter_test.cc
│ ├── sqlengine_test.cc
│ ├── test_helper.h
│ └── vector_recall_test.cc
├── thirdparty/
│ ├── CMakeLists.txt
│ ├── CRoaring/
│ │ └── CMakeLists.txt
│ ├── RaBitQ-Library/
│ │ └── CMakeLists.txt
│ ├── antlr/
│ │ ├── CMakeLists.txt
│ │ └── antlr4.patch
│ ├── arrow/
│ │ ├── CMakeLists.txt
│ │ ├── arrow.android.patch
│ │ └── arrow.patch
│ ├── gflags/
│ │ └── CMakeLists.txt
│ ├── glog/
│ │ ├── CMakeLists.txt
│ │ ├── glog.android.patch
│ │ └── glog.patch
│ ├── googletest/
│ │ └── CMakeLists.txt
│ ├── lz4/
│ │ └── CMakeLists.txt
│ ├── magic_enum/
│ │ └── CMakeLists.txt
│ ├── protobuf/
│ │ └── CMakeLists.txt
│ ├── rocksdb/
│ │ ├── CMakeLists.txt
│ │ └── rocksdb.android.patch
│ ├── sparsehash/
│ │ ├── CMakeLists.txt
│ │ └── sparseconfig.h
│ └── yaml-cpp/
│ └── CMakeLists.txt
└── tools/
├── CMakeLists.txt
└── core/
├── CMakeLists.txt
├── README.md
├── bench.cc
├── bench_original.cc
├── bench_result.h
├── convert_cohere_parquet.py
├── filter_result_cache.h
├── flow.h
├── helper.h
├── index_meta_helper.h
├── local_builder.cc
├── local_builder_original.cc
├── meta_segment_common.h
├── recall.cc
├── recall_original.cc
├── txt2vecs.cc
├── txt_input_reader.h
├── vecs_common.h
├── vecs_index_holder.h
└── vecs_reader.h
Showing preview only (856K chars total). Download the full file or copy to clipboard to get everything.
SYMBOL INDEX (8588 symbols across 799 files)
FILE: examples/c++/ailego/main.cc
function main (line 7) | int main() {
FILE: examples/c++/core/main.cc
function create_index (line 13) | Index::Pointer create_index(const BaseIndexParam::Pointer ¶m,
function main (line 48) | int main() {
FILE: examples/c++/db/main.cc
function Doc (line 11) | Doc create_doc(const uint64_t doc_id, const CollectionSchema &schema,
function create_schema (line 167) | CollectionSchema::Ptr create_schema() {
function main (line 189) | int main() {
FILE: python/tests/detail/distance_helper.py
function is_float_equal (line 18) | def is_float_equal(actual, expected, rel_tol=1e-5, abs_tol=1e-8):
function is_dense_vector_equal (line 24) | def is_dense_vector_equal(vec1, vec2, rtol=1e-5, atol=1e-8):
function is_sparse_vector_equal (line 29) | def is_sparse_vector_equal(vec1, vec2, rtol=1e-5, atol=1e-8):
function is_float_array_equal (line 43) | def is_float_array_equal(arr1, arr2, rtol=1e-5, atol=1e-8):
function is_double_array_equal (line 48) | def is_double_array_equal(arr1, arr2, rtol=1e-9, atol=1e-12):
function is_int_array_equal (line 53) | def is_int_array_equal(arr1, arr2):
function cosine_distance_dense (line 58) | def cosine_distance_dense(
function dp_distance_dense (line 107) | def dp_distance_dense(
function euclidean_distance_dense (line 129) | def euclidean_distance_dense(
function distance_dense (line 163) | def distance_dense(
function dp_distance_sparse (line 180) | def dp_distance_sparse(
function distance (line 200) | def distance(
function distance_recall (line 222) | def distance_recall(
function calculate_rrf_score (line 248) | def calculate_rrf_score(rank, k=60):
function calculate_multi_vector_rrf_scores (line 252) | def calculate_multi_vector_rrf_scores(query_results: Dict[str, Doc], k=60):
function calculate_multi_vector_weighted_scores (line 267) | def calculate_multi_vector_weighted_scores(
function is_field_equal (line 295) | def is_field_equal(field1, field2, schema: FieldSchema) -> bool:
function is_vector_equal (line 321) | def is_vector_equal(vec1, vec2, schema: VectorSchema) -> bool:
function is_doc_equal (line 340) | def is_doc_equal(
FILE: python/tests/detail/doc_helper.py
function generate_constant_vector (line 13) | def generate_constant_vector(
function generate_constant_vector_recall (line 28) | def generate_constant_vector_recall(
function generate_sparse_vector (line 43) | def generate_sparse_vector(i: int):
function generate_vectordict (line 47) | def generate_vectordict(i: int, schema: CollectionSchema) -> Doc:
function generate_vectordict_recall (line 111) | def generate_vectordict_recall(i: int, schema: CollectionSchema) -> Doc:
function generate_vectordict_update (line 175) | def generate_vectordict_update(i: int, schema: CollectionSchema) -> Doc:
function generate_doc (line 239) | def generate_doc(i: int, schema: CollectionSchema) -> Doc:
function generate_doc_recall (line 247) | def generate_doc_recall(i: int, schema: CollectionSchema) -> Doc:
function generate_update_doc (line 255) | def generate_update_doc(i: int, schema: CollectionSchema) -> Doc:
function generate_doc_random (line 263) | def generate_doc_random(i, schema: CollectionSchema) -> Doc:
function generate_vectordict_random (line 367) | def generate_vectordict_random(schema: CollectionSchema):
FILE: python/tests/detail/fixture_helper.py
function basic_schema (line 25) | def basic_schema(collection_name="test_collection") -> CollectionSchema:
function full_schema (line 55) | def full_schema(
function full_schema_new (line 94) | def full_schema_new(request) -> CollectionSchema:
function full_schema_ivf (line 262) | def full_schema_ivf(request) -> CollectionSchema:
function full_schema_1024 (line 304) | def full_schema_1024(request) -> CollectionSchema:
function single_vector_schema (line 440) | def single_vector_schema(
function single_vector_schema_with_index_param (line 458) | def single_vector_schema_with_index_param(
function create_collection_fixture (line 476) | def create_collection_fixture(
function basic_collection (line 505) | def basic_collection(
function collection_option (line 514) | def collection_option():
function collection_temp_dir (line 519) | def collection_temp_dir(tmp_path_factory):
function full_collection (line 526) | def full_collection(
function full_collection_new (line 539) | def full_collection_new(
function full_collection_ivf (line 548) | def full_collection_ivf(
function full_collection_1024 (line 557) | def full_collection_1024(
function sample_field_list (line 566) | def sample_field_list(nullable: bool = True, scalar_index_param=None, na...
function sample_vector_list (line 581) | def sample_vector_list(vector_index_param=None, name_prefix=""):
FILE: python/tests/detail/test_collection_concurrency.py
class TestCollectionConcurrency (line 33) | class TestCollectionConcurrency:
method test_collection (line 35) | def test_collection(self, tmp_path_factory):
method test_concurrent_read_write (line 89) | def test_concurrent_read_write(self, test_collection: Collection):
method test_concurrent_query (line 152) | def test_concurrent_query(self, test_collection: Collection):
method test_concurrent_modifications (line 197) | def test_concurrent_modifications(self, test_collection: Collection):
method test_read_write_locking (line 281) | def test_read_write_locking(self, test_collection: Collection):
method test_race_condition_detection (line 344) | def test_race_condition_detection(self, test_collection: Collection):
FILE: python/tests/detail/test_collection_create_and_open.py
function check_collection_info (line 23) | def check_collection_info(
function check_collection_basic (line 35) | def check_collection_basic(coll: Collection, optimize: bool = False):
function check_collection_full (line 63) | def check_collection_full(coll: Collection):
class TestCreateAndOpen (line 139) | class TestCreateAndOpen:
method test_valid_collection_name (line 141) | def test_valid_collection_name(
method test_invalid_collection_name (line 169) | def test_invalid_collection_name(
method test_valid_field_vector_name (line 193) | def test_valid_field_vector_name(
method test_invalid_field_name (line 221) | def test_invalid_field_name(
method test_invalid_vector_name (line 248) | def test_invalid_vector_name(
method test_valid_field_vector_size_dimension (line 280) | def test_valid_field_vector_size_dimension(
method test_invalid_field_vector_size_dimension (line 326) | def test_invalid_field_vector_size_dimension(
method test_valid_single_vector_field_construction (line 368) | def test_valid_single_vector_field_construction(
method test_collection_concurrent_create (line 403) | def test_collection_concurrent_create(
method test_create_open_loop (line 447) | def test_create_open_loop(
method test_valid_vector_index_params (line 482) | def test_valid_vector_index_params(
method test_invalid_vector_index_params (line 508) | def test_invalid_vector_index_params(
method test_open_concurrent_same_path (line 525) | def test_open_concurrent_same_path(self, tmp_path_factory, collection_...
method test_valid_option (line 629) | def test_valid_option(
method test_valid_none_option (line 645) | def test_valid_none_option(self, collection_temp_dir, basic_schema):
method test_invalid_option (line 653) | def test_invalid_option(
method test_duplicate_field_names (line 669) | def test_duplicate_field_names(
method test_invalid_long_field_names (line 720) | def test_invalid_long_field_names(
method test_invalid_empty_fields_and_vectors (line 752) | def test_invalid_empty_fields_and_vectors(
method test_valid_path (line 771) | def test_valid_path(self, basic_schema, collection_option, valid_path):
method test_invalid_path (line 786) | def test_invalid_path(self, basic_schema, collection_option, invalid_p...
FILE: python/tests/detail/test_collection_ddl.py
class TestDDL (line 21) | class TestDDL:
method test_collection_stats (line 22) | def test_collection_stats(self, basic_collection: Collection):
method test_collection_destroy (line 30) | def test_collection_destroy(
method test_collection_flush (line 53) | def test_collection_flush(self, basic_collection: Collection):
class TestIndexDDL (line 67) | class TestIndexDDL:
method test_scalar_index_operation (line 70) | def test_scalar_index_operation(
method test_duplicate_create_index (line 195) | def test_duplicate_create_index(
method test_optimize (line 264) | def test_optimize(self, full_collection: Collection):
method test_vector_index_operation (line 285) | def test_vector_index_operation(
method create_collection (line 410) | def create_collection(
method check_error_message (line 445) | def check_error_message(exc_info, invalid_name):
method test_invalid_field_and_vector_name (line 474) | def test_invalid_field_and_vector_name(
method test_valid_field_and_vector_name (line 517) | def test_valid_field_and_vector_name(
method test_compicated_workflow (line 594) | def test_compicated_workflow(
method test_vector_index_params (line 784) | def test_vector_index_params(
class TestColumnDDL (line 915) | class TestColumnDDL:
method test_add_column (line 916) | def test_add_column(self, basic_collection: Collection):
method test_add_column_with_default_option (line 940) | def test_add_column_with_default_option(self, basic_collection: Collec...
method test_add_column_with_various_concurrency_options (line 968) | def test_add_column_with_various_concurrency_options(
method test_add_column_valid_data_types (line 997) | def test_add_column_valid_data_types(self, basic_collection: Collectio...
method test_add_column_invalid_data_types (line 1051) | def test_add_column_invalid_data_types(
method test_add_column_with_nullable_options (line 1066) | def test_add_column_with_nullable_options(
method test_add_column_with_different_expressions (line 1140) | def test_add_column_with_different_expressions(
method test_add_column_with_index_param (line 1171) | def test_add_column_with_index_param(self, basic_collection: Collection):
method test_add_column_with_valid_field_names (line 1214) | def test_add_column_with_valid_field_names(
method test_add_column_with_invalid_field_names (line 1256) | def test_add_column_with_invalid_field_names(
method test_alter_column_rename (line 1275) | def test_alter_column_rename(self, basic_collection: Collection):
method test_alter_column_non_exist (line 1299) | def test_alter_column_non_exist(self, basic_collection: Collection):
method test_alter_column_with_default_option (line 1310) | def test_alter_column_with_default_option(self, basic_collection: Coll...
method test_alter_column_with_various_concurrency_options (line 1340) | def test_alter_column_with_various_concurrency_options(
method test_alter_column_field_name_valid (line 1395) | def test_alter_column_field_name_valid(
method test_alter_column_with_invalid_field_names (line 1442) | def test_alter_column_with_invalid_field_names(
method test_drop_column_exist (line 1464) | def test_drop_column_exist(self, basic_collection: Collection):
method test_drop_column_non_exist (line 1501) | def test_drop_column_non_exist(self, basic_collection: Collection):
method test_drop_column_field_name_valid (line 1519) | def test_drop_column_field_name_valid(
FILE: python/tests/detail/test_collection_dml.py
function singledoc_and_check (line 495) | def singledoc_and_check(
function updatedoc_partial_check (line 550) | def updatedoc_partial_check(
function batchdoc_and_check (line 608) | def batchdoc_and_check(collection, multiple_docs, doc_num, operator="ins...
class TestCollectionInsert (line 679) | class TestCollectionInsert:
method test_insert (line 680) | def test_insert(self, full_collection: Collection):
method test_insert_batch (line 685) | def test_insert_batch(self, full_collection: Collection, doc_num):
method test_insert_duplicate (line 691) | def test_insert_duplicate(self, full_collection: Collection):
method test_insert_docid_valid (line 716) | def test_insert_docid_valid(self, full_collection: Collection, doc_id):
method test_insert_docid_invalid (line 721) | def test_insert_docid_invalid(self, full_collection: Collection, doc_id):
method test_insert_fields_valid (line 738) | def test_insert_fields_valid(
method test_insert_fields_invalid (line 762) | def test_insert_fields_invalid(
method test_insert_vector_valid (line 779) | def test_insert_vector_valid(
method test_insert_vector_invalid (line 792) | def test_insert_vector_invalid(
class TestCollectionUpdate (line 808) | class TestCollectionUpdate:
method test_update (line 809) | def test_update(self, full_collection: Collection):
method test_update_batch (line 816) | def test_update_batch(self, full_collection: Collection, doc_num):
method test_empty_collection_update (line 828) | def test_empty_collection_update(self, full_collection: Collection):
method test_empty_collection_update_batch (line 845) | def test_empty_collection_update_batch(self, full_collection: Collecti...
method test_update_fields_valid (line 874) | def test_update_fields_valid(
method test_update_fields_invalid (line 905) | def test_update_fields_invalid(
method test_update_doc_vector_valid (line 929) | def test_update_doc_vector_valid(
method test_update_doc_vector_invalid (line 950) | def test_update_doc_vector_invalid(
method test_update_partial_fields (line 979) | def test_update_partial_fields(
class TestCollectionUpsert (line 1015) | class TestCollectionUpsert:
method test_new_doc_upsert (line 1016) | def test_new_doc_upsert(self, full_collection: Collection):
method test_new_doc_upsert_batch (line 1021) | def test_new_doc_upsert_batch(self, full_collection: Collection, doc_n...
method test_existing_doc_upsert (line 1027) | def test_existing_doc_upsert(self, full_collection: Collection):
method test_upsert_docid_valid (line 1034) | def test_upsert_docid_valid(self, full_collection: Collection, doc_id):
method test_upsert_docid_invalid (line 1039) | def test_upsert_docid_invalid(self, full_collection: Collection, doc_id):
method test_upsert_fields_valid (line 1057) | def test_upsert_fields_valid(
method test_upsert_fields_invalid (line 1084) | def test_upsert_fields_invalid(
method test_upsert_vector_valid (line 1101) | def test_upsert_vector_valid(
method test_upsert_vector_invalid (line 1116) | def test_upsert_vector_invalid(
class TestCollectionDelete (line 1132) | class TestCollectionDelete:
method test_delete_batch (line 1134) | def test_delete_batch(self, full_collection: Collection, doc_num):
method test_delete_non_exist (line 1146) | def test_delete_non_exist(self, full_collection: Collection):
method test_delete_batch_part_non_exist (line 1152) | def test_delete_batch_part_non_exist(self, full_collection: Collection...
method test_delete_by_filter (line 1170) | def test_delete_by_filter(self, full_collection: Collection, doc_num):
method test_delete_empty_ids (line 1179) | def test_delete_empty_ids(self, full_collection: Collection):
FILE: python/tests/detail/test_collection_dql.py
function batchdoc_and_check (line 41) | def batchdoc_and_check(
function batchdoc_and_check_ivf (line 111) | def batchdoc_and_check_ivf(
function single_querydoc_check (line 182) | def single_querydoc_check(
function multi_querydoc_check (line 236) | def multi_querydoc_check(multiple_docs, query_result, full_collection):
class TestCollectionFetch (line 255) | class TestCollectionFetch:
method test_fetch_non_existing (line 256) | def test_fetch_non_existing(self, full_collection: Collection):
method test_fetch_partial_non_existing (line 261) | def test_fetch_partial_non_existing(self, full_collection: Collection,...
method test_fetch_empty_ids (line 274) | def test_fetch_empty_ids(self, full_collection: Collection):
class TestCollectionQuery (line 281) | class TestCollectionQuery:
method test_query_with_no_condition (line 283) | def test_query_with_no_condition(self, full_collection: Collection, do...
method test_query_with_filter_empty (line 293) | def test_query_with_filter_empty(self, full_collection: Collection, do...
method test_query_with_filter_single_condition (line 310) | def test_query_with_filter_single_condition(
method test_query_with_filter_and (line 342) | def test_query_with_filter_and(
method test_query_with_filter_or (line 380) | def test_query_with_filter_or(
method test_query_with_filter_parentheses (line 421) | def test_query_with_filter_parentheses(
method test_query_filter_invalid (line 464) | def test_query_filter_invalid(self, full_collection: Collection, doc_n...
method test_query_with_filter_topk_valid (line 478) | def test_query_with_filter_topk_valid(
method test_query_without_filter_topk_valid (line 504) | def test_query_without_filter_topk_valid(
method test_query_with_include_vector (line 519) | def test_query_with_include_vector(self, full_collection: Collection, ...
method test_query_with_output_fields (line 533) | def test_query_with_output_fields(
method test_query_empty_result (line 554) | def test_query_empty_result(self, full_collection: Collection, doc_num...
method test_query_by_id (line 568) | def test_query_by_id(
method test_query_by_id_ivf (line 593) | def test_query_by_id_ivf(self, full_collection_ivf: Collection, doc_num):
method test_query_by_vector (line 626) | def test_query_by_vector(
method test_query_by_vector_ivf (line 673) | def test_query_by_vector_ivf(self, full_collection_ivf: Collection, do...
method test_query_multivector_rrf (line 704) | def test_query_multivector_rrf(self, full_collection: Collection, doc_...
method test_query_multivector_weighted (line 764) | def test_query_multivector_weighted(
method test_query_consistency (line 819) | def test_query_consistency(
method test_query_vector_with_HnswQueryParam_valid (line 851) | def test_query_vector_with_HnswQueryParam_valid(
method test_query_vector_with_HnswQueryParam_invalid (line 895) | def test_query_vector_with_HnswQueryParam_invalid(
method test_query_vector_with_IVFQueryParam_valid (line 919) | def test_query_vector_with_IVFQueryParam_valid(
method test_query_vector_with_IVFQueryParam_invalid (line 959) | def test_query_vector_with_IVFQueryParam_invalid(
method test_query_vector_with_param_invalid (line 990) | def test_query_vector_with_param_invalid(
method test_query_vector_with_vectors_invalid (line 1075) | def test_query_vector_with_vectors_invalid(
method test_query_invalid_param_incompatible_type (line 1098) | def test_query_invalid_param_incompatible_type(
class TestRRFScoreCalculation (line 1124) | class TestRRFScoreCalculation:
class MockDoc (line 1125) | class MockDoc:
method __init__ (line 1126) | def __init__(self, id, score=0.0):
method id (line 1131) | def id(self):
method score (line 1135) | def score(self):
method score (line 1139) | def score(self, score):
method test_rrf_score_calculation_formula (line 1142) | def test_rrf_score_calculation_formula(self):
method test_multi_vector_rrf_scores (line 1166) | def test_multi_vector_rrf_scores(self):
class TestCollectionConcurrencyOperations (line 1206) | class TestCollectionConcurrencyOperations:
method test_concurrent_insert_update_upsert_query (line 1208) | def test_concurrent_insert_update_upsert_query(
FILE: python/tests/detail/test_collection_exception.py
class TestCollectionExceptionHandling (line 34) | class TestCollectionExceptionHandling:
method test_collection (line 36) | def test_collection(self, tmp_path_factory):
method test_create_and_open_missing_path (line 90) | def test_create_and_open_missing_path(self, tmp_path_factory):
method test_create_and_open_missing_schema (line 127) | def test_create_and_open_missing_schema(self, tmp_path_factory):
method test_open_missing_path (line 141) | def test_open_missing_path(self):
method test_insert_missing_docs (line 150) | def test_insert_missing_docs(self, test_collection: Collection):
method test_update_missing_docs (line 157) | def test_update_missing_docs(self, test_collection: Collection):
method test_upsert_missing_docs (line 164) | def test_upsert_missing_docs(self, test_collection: Collection):
method test_delete_missing_ids (line 171) | def test_delete_missing_ids(self, test_collection: Collection):
method test_fetch_missing_ids (line 178) | def test_fetch_missing_ids(self, test_collection: Collection):
method test_query_missing_vectorquery_field_name (line 185) | def test_query_missing_vectorquery_field_name(self, test_collection: C...
method test_add_column_missing_field_schema (line 192) | def test_add_column_missing_field_schema(self, test_collection: Collec...
method test_alter_column_missing_old_name (line 199) | def test_alter_column_missing_old_name(self, test_collection: Collecti...
method test_alter_column_missing_new_name (line 206) | def test_alter_column_missing_new_name(self, test_collection: Collecti...
method test_drop_column_missing_field_name (line 213) | def test_drop_column_missing_field_name(self, test_collection: Collect...
method test_invalid_parameter_types (line 220) | def test_invalid_parameter_types(self, test_collection: Collection):
method test_missing_required_parameters (line 225) | def test_missing_required_parameters(self, test_collection: Collection):
method test_empty_collection_operations (line 230) | def test_empty_collection_operations(self, tmp_path_factory):
method test_resource_management (line 295) | def test_resource_management(self, test_collection: Collection):
method test_exception_resource_cleanup (line 325) | def test_exception_resource_cleanup(self, test_collection: Collection):
FILE: python/tests/detail/test_collection_open.py
function collection_schema (line 38) | def collection_schema():
function single_doc (line 70) | def single_doc():
function test_collection (line 82) | def test_collection(
class TestCollectionOpen (line 110) | class TestCollectionOpen:
method test_open_basic_functionality (line 111) | def test_open_basic_functionality(
method test_open_with_different_collection_options_valid (line 587) | def test_open_with_different_collection_options_valid(
method test_open_with_none_option (line 650) | def test_open_with_none_option(self, tmp_path_factory, collection_sche...
method test_reopen_collection (line 677) | def test_reopen_collection(self, tmp_path_factory):
method test_open_concurrent_same_path (line 754) | def test_open_concurrent_same_path(self, tmp_path_factory):
method test_open_with_corrupted_files (line 861) | def test_open_with_corrupted_files(self, tmp_path_factory):
FILE: python/tests/detail/test_collection_recall.py
function batchdoc_and_check (line 43) | def batchdoc_and_check(collection: Collection, multiple_docs, operator="...
function compute_exact_similarity_scores (line 86) | def compute_exact_similarity_scores(
function get_ground_truth_for_vector_query (line 123) | def get_ground_truth_for_vector_query(
function get_ground_truth_map (line 176) | def get_ground_truth_map(collection, test_docs, query_vectors_map, metri...
function calculate_recall_at_k (line 194) | def calculate_recall_at_k(
class TestRecall (line 289) | class TestRecall:
method test_recall_with_single_vector_valid_500 (line 380) | def test_recall_with_single_vector_valid_500(
method test_recall_with_single_vector_valid_2000 (line 563) | def test_recall_with_single_vector_valid_2000(
FILE: python/tests/detail/test_db_config.py
function run_in_subprocess (line 34) | def run_in_subprocess(func):
function temp_log_dir (line 66) | def temp_log_dir(tmp_path_factory):
class TestDbConfigInitialization (line 71) | class TestDbConfigInitialization:
method test_init_default (line 73) | def test_init_default(self):
method test_init_file_logger (line 84) | def test_init_file_logger(self):
method test_init_with_mixed_config (line 116) | def test_init_with_mixed_config(self):
method test_repeated_initialization (line 125) | def test_repeated_initialization(self):
class TestDbConfigMemoryLimitValidation (line 131) | class TestDbConfigMemoryLimitValidation:
method test_memory_limit_min_valid (line 133) | def test_memory_limit_min_valid(self):
method test_memory_limit_invalid_value (line 139) | def test_memory_limit_invalid_value(self):
class TestDbConfigThreadValidation (line 151) | class TestDbConfigThreadValidation:
method test_query_threads (line 153) | def test_query_threads(self):
method test_query_threads_invalid (line 157) | def test_query_threads_invalid(self):
method test_optimize_threads (line 171) | def test_optimize_threads(self):
method test_optimize_threads_invalid (line 175) | def test_optimize_threads_invalid(self):
class TestDbConfigRatioValidation (line 189) | class TestDbConfigRatioValidation:
method test_init_invert_to_forward_scan_ratio (line 191) | def test_init_invert_to_forward_scan_ratio(self):
method test_init_invert_to_forward_scan_ratio_invalid (line 196) | def test_init_invert_to_forward_scan_ratio_invalid(self):
method test_init_brute_force_by_keys_ratio (line 205) | def test_init_brute_force_by_keys_ratio(self):
method test_init_brute_force_by_keys_ratio_invalid (line 209) | def test_init_brute_force_by_keys_ratio_invalid(self):
class TestDbConfigLogValidation (line 218) | class TestDbConfigLogValidation:
method test_log_type_valid (line 220) | def test_log_type_valid(self):
method test_log_type_invalid (line 224) | def test_log_type_invalid(self):
method test_log_level_valid (line 235) | def test_log_level_valid(self):
method test_log_level_invalid (line 239) | def test_log_level_invalid(self):
method test_init_file_logger (line 250) | def test_init_file_logger(self):
method test_log_file_size_invalid (line 288) | def test_log_file_size_invalid(self):
method test_log_overdue_days_invalid (line 299) | def test_log_overdue_days_invalid(self):
FILE: python/tests/test_collection.py
function collection_schema (line 41) | def collection_schema():
function collection_option (line 72) | def collection_option():
function single_doc (line 77) | def single_doc():
function multiple_docs (line 87) | def multiple_docs():
function test_collection (line 99) | def test_collection(
function collection_with_single_doc (line 133) | def collection_with_single_doc(test_collection: Collection, single_doc) ...
function collection_with_multiple_docs (line 149) | def collection_with_multiple_docs(
class TestConfig (line 172) | class TestConfig:
method test_config (line 173) | def test_config(self):
class TestCollectionDDL (line 181) | class TestCollectionDDL:
method test_collection_stats (line 182) | def test_collection_stats(self, test_collection: Collection):
class TestCollectionIndexDDL (line 195) | class TestCollectionIndexDDL:
method test_create_index (line 196) | def test_create_index(self, test_collection: Collection):
method test_drop_index (line 220) | def test_drop_index(self, test_collection: Collection):
method test_create_index_field_is_not_exist (line 242) | def test_create_index_field_is_not_exist(self, test_collection: Collec...
method test_drop_index (line 254) | def test_drop_index(self, test_collection: Collection):
method test_create_index_field_is_not_exist (line 276) | def test_create_index_field_is_not_exist(self, test_collection: Collec...
class TestCollectionColumnDDL (line 288) | class TestCollectionColumnDDL:
method test_create_column (line 289) | def test_create_column(self, test_collection: Collection):
method test_create_column_is_nullable (line 303) | def test_create_column_is_nullable(self, test_collection: Collection):
method test_drop_column (line 309) | def test_drop_column(self, test_collection: Collection):
method test_alert_column_to_rename (line 324) | def test_alert_column_to_rename(self, test_collection: Collection):
method test_alert_column_to_modify_schema (line 354) | def test_alert_column_to_modify_schema(self, test_collection: Collecti...
method test_column_with_other_dtype (line 372) | def test_column_with_other_dtype(self, test_collection: Collection):
class TestCollectionOptimize (line 392) | class TestCollectionOptimize:
method test_collection_optimize (line 393) | def test_collection_optimize(self, test_collection: Collection):
class TestCollectionFetch (line 401) | class TestCollectionFetch:
method test_collection_fetch (line 402) | def test_collection_fetch(
method test_collection_fetch_contains_nodata_ids (line 418) | def test_collection_fetch_contains_nodata_ids(
class TestCollectionInsert (line 434) | class TestCollectionInsert:
method test_collection_insert (line 435) | def test_collection_insert(self, test_collection, single_doc):
method test_collection_insert_with_nullable_false_field (line 443) | def test_collection_insert_with_nullable_false_field(self, test_collec...
method test_collection_insert_without_nullable_false_field (line 462) | def test_collection_insert_without_nullable_false_field(self, test_col...
method test_collection_insert_with_nullable_true_field (line 489) | def test_collection_insert_with_nullable_true_field(self, test_collect...
method test_collection_insert_batch (line 516) | def test_collection_insert_batch(self, test_collection, multiple_docs):
method test_collection_insert_duplicate (line 526) | def test_collection_insert_duplicate(
class TestCollectionUpdate (line 543) | class TestCollectionUpdate:
method test_empty_collection_update (line 544) | def test_empty_collection_update(
method test_collection_update_with_nullable_false_field (line 555) | def test_collection_update_with_nullable_false_field(
method test_collection_update_with_nullable_false_field_is_none (line 582) | def test_collection_update_with_nullable_false_field_is_none(
method test_collection_update_without_nullable_false_field (line 618) | def test_collection_update_without_nullable_false_field(
method test_collection_update_without_nullable_false_field_set_null (line 645) | def test_collection_update_without_nullable_false_field_set_null(
method test_empty_collection_update_batch (line 672) | def test_empty_collection_update_batch(
method test_collection_update (line 684) | def test_collection_update(
method test_collection_update_batch (line 694) | def test_collection_update_batch(
class TestCollectionUpsert (line 711) | class TestCollectionUpsert:
method test_empty_collection_upsert (line 712) | def test_empty_collection_upsert(self, test_collection: Collection, si...
method test_empty_collection_upsert_batch (line 721) | def test_empty_collection_upsert_batch(
method test_collection_upsert (line 733) | def test_collection_upsert(
method test_collection_upsert_batch (line 745) | def test_collection_upsert_batch(
class TestCollectionDelete (line 764) | class TestCollectionDelete:
method test_empty_collection_delete (line 765) | def test_empty_collection_delete(self, test_collection: Collection, si...
method test_empty_collection_delete_batch (line 770) | def test_empty_collection_delete_batch(
method test_collection_delete (line 778) | def test_collection_delete(
method test_collection_delete_batch (line 795) | def test_collection_delete_batch(
method test_collection_delete_by_filter (line 806) | def test_collection_delete_by_filter(
method test_collection_delete_by_filter_invert_field (line 816) | def test_collection_delete_by_filter_invert_field(
class TestCollectionQuery (line 831) | class TestCollectionQuery:
method test_empty_collection_query (line 832) | def test_empty_collection_query(self, test_collection: Collection):
method test_collection_query (line 836) | def test_collection_query(self, collection_with_single_doc: Collection...
method test_collection_query_with_include_vector (line 848) | def test_collection_query_with_include_vector(
method test_collection_query_with_output_fields (line 857) | def test_collection_query_with_output_fields(
method test_collection_query_with_topk (line 867) | def test_collection_query_with_topk(
method test_collection_query_with_range_filter_int_field (line 876) | def test_collection_query_with_range_filter_int_field(
method test_collection_query_with_vector_and_id (line 935) | def test_collection_query_with_vector_and_id(
method test_collection_query_with_filter_not_in (line 947) | def test_collection_query_with_filter_not_in(
method test_collection_with_error_query_vector (line 953) | def test_collection_with_error_query_vector(
method test_collection_query_by_id (line 964) | def test_collection_query_by_id(
method test_collection_query_multi_vector_with_same_field (line 972) | def test_collection_query_multi_vector_with_same_field(
method test_collection_query_by_dense_vector (line 988) | def test_collection_query_by_dense_vector(
method test_collection_query_by_sparse_vector (line 994) | def test_collection_query_by_sparse_vector(
method test_collection_query_by_dense_vector_with_filter (line 1000) | def test_collection_query_by_dense_vector_with_filter(
method test_collection_query_by_sparse_vector_with_filter (line 1006) | def test_collection_query_by_sparse_vector_with_filter(
method test_collection_query_with_rrf_reranker_by_multi_dense_vector (line 1012) | def test_collection_query_with_rrf_reranker_by_multi_dense_vector(
method test_collection_query_with_rrf_reranker_by_multi_sparse_vector (line 1018) | def test_collection_query_with_rrf_reranker_by_multi_sparse_vector(
method test_collection_query_with_rrf_reranker_by_hybrid_vector (line 1024) | def test_collection_query_with_rrf_reranker_by_hybrid_vector(
method test_collection_query_with_weighted_reranker_by_multi_dense_vector (line 1030) | def test_collection_query_with_weighted_reranker_by_multi_dense_vector(
method test_collection_query_with_weighted_reranker_by_multi_sparse_vector (line 1036) | def test_collection_query_with_weighted_reranker_by_multi_sparse_vector(
method test_collection_query_with_weighted_reranker_by_hybrid_vector (line 1042) | def test_collection_query_with_weighted_reranker_by_hybrid_vector(
FILE: python/tests/test_collection_hnsw_rabitq.py
function hnsw_rabitq_collection_schema (line 45) | def hnsw_rabitq_collection_schema():
function collection_option (line 71) | def collection_option():
function single_doc (line 77) | def single_doc():
function multiple_docs (line 87) | def multiple_docs():
function hnsw_rabitq_collection (line 100) | def hnsw_rabitq_collection(
function collection_with_single_doc (line 130) | def collection_with_single_doc(
function collection_with_multiple_docs (line 148) | def collection_with_multiple_docs(
class TestHnswRabitqCollectionCreation (line 169) | class TestHnswRabitqCollectionCreation:
method test_collection_creation (line 172) | def test_collection_creation(
method test_vector_schema_validation (line 185) | def test_vector_schema_validation(self, hnsw_rabitq_collection: Collec...
method test_collection_stats (line 201) | def test_collection_stats(self, hnsw_rabitq_collection: Collection):
class TestHnswRabitqCollectionInsert (line 211) | class TestHnswRabitqCollectionInsert:
method test_insert_single_doc (line 214) | def test_insert_single_doc(
method test_insert_multiple_docs (line 226) | def test_insert_multiple_docs(
class TestHnswRabitqCollectionFetch (line 241) | class TestHnswRabitqCollectionFetch:
method test_fetch_single_doc (line 244) | def test_fetch_single_doc(
method test_fetch_multiple_docs (line 258) | def test_fetch_multiple_docs(
method test_fetch_nonexistent_doc (line 273) | def test_fetch_nonexistent_doc(self, collection_with_single_doc: Colle...
class TestHnswRabitqCollectionQuery (line 280) | class TestHnswRabitqCollectionQuery:
method test_query_by_vector (line 283) | def test_query_by_vector(
method test_query_by_id (line 303) | def test_query_by_id(
method test_query_with_different_ef_values (line 317) | def test_query_with_different_ef_values(
method test_query_with_topk (line 341) | def test_query_with_topk(
method test_query_with_filter (line 360) | def test_query_with_filter(
method test_query_with_output_fields (line 379) | def test_query_with_output_fields(
method test_query_with_include_vector (line 399) | def test_query_with_include_vector(
class TestHnswRabitqCollectionUpdate (line 421) | class TestHnswRabitqCollectionUpdate:
method test_update_doc_fields (line 424) | def test_update_doc_fields(
method test_update_doc_vector (line 443) | def test_update_doc_vector(
class TestHnswRabitqCollectionDelete (line 472) | class TestHnswRabitqCollectionDelete:
method test_delete_single_doc (line 475) | def test_delete_single_doc(
method test_delete_multiple_docs (line 486) | def test_delete_multiple_docs(
class TestHnswRabitqCollectionOptimizeAndReopen (line 501) | class TestHnswRabitqCollectionOptimizeAndReopen:
method test_optimize_close_reopen_and_query (line 504) | def test_optimize_close_reopen_and_query(
FILE: python/tests/test_convert.py
class TestConvertCppDoc (line 14) | class TestConvertCppDoc:
method test_default (line 15) | def test_default(self):
method test_with_field_notin_schema (line 27) | def test_with_field_notin_schema(self):
method test_with_scalar_fields (line 43) | def test_with_scalar_fields(self):
method test_with_array_fields (line 86) | def test_with_array_fields(self):
method test_with_dense_vector_fields (line 133) | def test_with_dense_vector_fields(self):
method test_with_sparse_vector_fields (line 184) | def test_with_sparse_vector_fields(self):
method test_with_scalar_fields_error_datatype (line 220) | def test_with_scalar_fields_error_datatype(self):
method test_with_array_fields_error_datatype (line 271) | def test_with_array_fields_error_datatype(self):
method test_with_vector_fields_error_datatype (line 318) | def test_with_vector_fields_error_datatype(self):
method test_with_sparse_vector_error_datatype (line 352) | def test_with_sparse_vector_error_datatype(self):
class TestConvertPyDoc (line 397) | class TestConvertPyDoc:
method test_default (line 398) | def test_default(self):
method test_with_scalar_fields (line 412) | def test_with_scalar_fields(self):
method test_with_array_fields (line 448) | def test_with_array_fields(self):
method test_with_dense_vector_fields (line 499) | def test_with_dense_vector_fields(self):
method test_with_sparse_vector_fields (line 549) | def test_with_sparse_vector_fields(self):
FILE: python/tests/test_doc.py
class TestPyDoc (line 27) | class TestPyDoc:
method test_default (line 28) | def test_default(self):
method test_with_single_vector (line 31) | def test_with_single_vector(self):
method test_with_hybrid_vectors (line 37) | def test_with_hybrid_vectors(self):
method test_with_multi_vectors (line 46) | def test_with_multi_vectors(self):
method test_with_numpy_array (line 66) | def test_with_numpy_array(self):
class TestCppDoc (line 90) | class TestCppDoc:
method test_default (line 91) | def test_default(self):
method test_doc_set_pk (line 95) | def test_doc_set_pk(self):
method test_doc_set_score (line 100) | def test_doc_set_score(self):
method test_doc_get_null_field (line 105) | def test_doc_get_null_field(self):
method test_doc_get_set_has_null_field (line 112) | def test_doc_get_set_has_null_field(self):
method test_doc_get_set_has_string_field (line 118) | def test_doc_get_set_has_string_field(self):
method test_doc_get_set_has_bool_field (line 125) | def test_doc_get_set_has_bool_field(self):
method test_doc_get_set_has_int32_field (line 132) | def test_doc_get_set_has_int32_field(self):
method test_doc_get_set_has_int64_field (line 139) | def test_doc_get_set_has_int64_field(self):
method test_doc_get_set_has_float_field (line 146) | def test_doc_get_set_has_float_field(self):
method test_doc_get_set_has_double_field (line 153) | def test_doc_get_set_has_double_field(self):
method test_doc_get_set_has_uint32_field (line 162) | def test_doc_get_set_has_uint32_field(self):
method test_doc_get_set_has_uint64_field (line 169) | def test_doc_get_set_has_uint64_field(self):
method test_doc_get_set_has_array_string_field (line 176) | def test_doc_get_set_has_array_string_field(self):
method test_doc_get_set_has_array_int32_field (line 183) | def test_doc_get_set_has_array_int32_field(self):
method test_doc_get_set_has_array_int64_field (line 190) | def test_doc_get_set_has_array_int64_field(self):
method test_doc_get_set_has_array_float_field (line 197) | def test_doc_get_set_has_array_float_field(self):
method test_doc_get_set_has_array_double_field (line 204) | def test_doc_get_set_has_array_double_field(self):
method test_doc_get_set_has_array_bool_field (line 211) | def test_doc_get_set_has_array_bool_field(self):
method test_doc_get_set_has_vector_fp16 (line 218) | def test_doc_get_set_has_vector_fp16(self):
method test_doc_get_set_has_vector_fp32 (line 228) | def test_doc_get_set_has_vector_fp32(self):
method test_doc_get_set_has_vector_int8 (line 240) | def test_doc_get_set_has_vector_int8(self):
method test_doc_get_set_has_sparse_vector_fp32 (line 247) | def test_doc_get_set_has_sparse_vector_fp32(self):
method test_doc_get_set_has_sparse_vector_fp16 (line 259) | def test_doc_get_set_has_sparse_vector_fp16(self):
FILE: python/tests/test_embedding.py
class TestQwenDenseEmbedding (line 39) | class TestQwenDenseEmbedding:
method test_init_with_api_key (line 40) | def test_init_with_api_key(self):
method test_init_with_env_api_key (line 48) | def test_init_with_env_api_key(self):
method test_init_with_empty_env_api_key (line 54) | def test_init_with_empty_env_api_key(self):
method test_model_property (line 59) | def test_model_property(self):
method test_embed_with_empty_text (line 69) | def test_embed_with_empty_text(self, mock_require_module):
method test_embed_success (line 82) | def test_embed_success(self, mock_require_module):
method test_embed_http_error (line 105) | def test_embed_http_error(self, mock_require_module):
method test_embed_invalid_response (line 121) | def test_embed_invalid_response(self, mock_require_module):
method test_real_embed_success (line 140) | def test_real_embed_success(self):
class TestQwenSparseEmbedding (line 155) | class TestQwenSparseEmbedding:
method test_init_with_api_key (line 158) | def test_init_with_api_key(self):
method test_init_with_custom_encoding_type (line 167) | def test_init_with_custom_encoding_type(self):
method test_init_with_env_api_key (line 175) | def test_init_with_env_api_key(self):
method test_init_without_api_key (line 181) | def test_init_without_api_key(self):
method test_model_property (line 186) | def test_model_property(self):
method test_encoding_type_property (line 196) | def test_encoding_type_property(self):
method test_embed_with_empty_text (line 209) | def test_embed_with_empty_text(self, mock_require_module):
method test_embed_with_non_string_input (line 224) | def test_embed_with_non_string_input(self, mock_require_module):
method test_embed_success (line 235) | def test_embed_success(self, mock_require_module):
method test_embed_with_document_encoding_type (line 283) | def test_embed_with_document_encoding_type(self, mock_require_module):
method test_embed_output_sorted_by_indices (line 317) | def test_embed_output_sorted_by_indices(self, mock_require_module):
method test_embed_filters_zero_values (line 350) | def test_embed_filters_zero_values(self, mock_require_module):
method test_embed_http_error (line 393) | def test_embed_http_error(self, mock_require_module):
method test_embed_invalid_response_no_embeddings (line 409) | def test_embed_invalid_response_no_embeddings(self, mock_require_module):
method test_embed_invalid_response_not_dict (line 425) | def test_embed_invalid_response_not_dict(self, mock_require_module):
method test_embed_callable_interface (line 446) | def test_embed_callable_interface(self, mock_require_module):
method test_embed_api_connection_error (line 473) | def test_embed_api_connection_error(self, mock_require_module):
method test_real_embed_success (line 489) | def test_real_embed_success(self):
class TestOpenAIDenseEmbedding (line 524) | class TestOpenAIDenseEmbedding:
method test_init_with_api_key (line 525) | def test_init_with_api_key(self):
method test_init_with_env_api_key (line 533) | def test_init_with_env_api_key(self):
method test_init_without_api_key (line 539) | def test_init_without_api_key(self):
method test_init_with_custom_dimension (line 544) | def test_init_with_custom_dimension(self):
method test_init_with_base_url (line 552) | def test_init_with_base_url(self):
method test_model_property (line 559) | def test_model_property(self):
method test_extra_params (line 569) | def test_extra_params(self):
method test_embed_with_empty_text (line 587) | def test_embed_with_empty_text(self, mock_require_module):
method test_embed_with_non_string_input (line 602) | def test_embed_with_non_string_input(self, mock_require_module):
method test_embed_success (line 613) | def test_embed_success(self, mock_require_module):
method test_embed_with_custom_model (line 640) | def test_embed_with_custom_model(self, mock_require_module):
method test_embed_api_error (line 667) | def test_embed_api_error(self, mock_require_module):
method test_embed_invalid_response (line 691) | def test_embed_invalid_response(self, mock_require_module):
method test_embed_dimension_mismatch (line 713) | def test_embed_dimension_mismatch(self, mock_require_module):
method test_embed_callable (line 738) | def test_embed_callable(self, mock_require_module):
method test_embed_with_base_url (line 764) | def test_embed_with_base_url(self, mock_require_module):
method test_real_embed_success (line 797) | def test_real_embed_success(self):
class TestDefaultLocalDenseEmbedding (line 818) | class TestDefaultLocalDenseEmbedding:
method test_init_success (line 822) | def test_init_success(self, mock_require_module):
method test_init_with_custom_device (line 845) | def test_init_with_custom_device(self, mock_require_module):
method test_init_with_modelscope (line 866) | def test_init_with_modelscope(self, mock_require_module):
method test_init_with_invalid_model_source (line 897) | def test_init_with_invalid_model_source(self, mock_require_module):
method test_embed_success (line 909) | def test_embed_success(self, mock_require_module):
method test_embed_with_normalization (line 939) | def test_embed_with_normalization(self, mock_require_module):
method test_embed_empty_string (line 964) | def test_embed_empty_string(self, mock_require_module):
method test_embed_non_string_input (line 981) | def test_embed_non_string_input(self, mock_require_module):
method test_embed_callable (line 998) | def test_embed_callable(self, mock_require_module):
method test_semantic_similarity (line 1020) | def test_semantic_similarity(self, mock_require_module):
method test_model_loading_error (line 1057) | def test_model_loading_error(self, mock_require_module):
method test_modelscope_import_error (line 1075) | def test_modelscope_import_error(self, mock_require_module):
method test_embed_dimension_mismatch (line 1093) | def test_embed_dimension_mismatch(self, mock_require_module):
method test_real_embedding_generation (line 1117) | def test_real_embedding_generation(self):
method test_model_properties (line 1151) | def test_model_properties(self, mock_require_module):
class TestDefaultLocalSparseEmbedding (line 1184) | class TestDefaultLocalSparseEmbedding:
method test_init_success (line 1200) | def test_init_success(self, mock_require_module):
method test_init_with_custom_device (line 1225) | def test_init_with_custom_device(self, mock_require_module):
method test_embed_success (line 1247) | def test_embed_success(self, mock_require_module):
method test_embed_empty_input (line 1322) | def test_embed_empty_input(self, mock_require_module):
method test_embed_non_string_input (line 1338) | def test_embed_non_string_input(self, mock_require_module):
method test_callable_interface (line 1358) | def test_callable_interface(self, mock_require_module):
method test_model_loading_failure (line 1414) | def test_model_loading_failure(self, mock_require_module):
method test_inference_failure (line 1433) | def test_inference_failure(self, mock_require_module):
method test_sparse_vector_properties (line 1461) | def test_sparse_vector_properties(self, mock_require_module):
method test_output_sorted_by_indices (line 1530) | def test_output_sorted_by_indices(self, mock_require_module):
method test_device_property (line 1609) | def test_device_property(self, mock_require_module):
method test_modelscope_source (line 1625) | def test_modelscope_source(self, mock_require_module):
method test_integration_real_model (line 1651) | def test_integration_real_model(self):
method test_integration_multiple_inputs (line 1703) | def test_integration_multiple_inputs(self):
class TestBM25EmbeddingFunction (line 1739) | class TestBM25EmbeddingFunction:
method test_init_with_built_in_encoder (line 1742) | def test_init_with_built_in_encoder(self):
method test_init_with_custom_encoder (line 1760) | def test_init_with_custom_encoder(self):
method test_init_with_empty_corpus (line 1783) | def test_init_with_empty_corpus(self):
method test_init_with_invalid_corpus (line 1788) | def test_init_with_invalid_corpus(self):
method test_init_with_language_parameter (line 1796) | def test_init_with_language_parameter(self):
method test_init_with_encoding_type (line 1811) | def test_init_with_encoding_type(self):
method test_init_with_missing_dashtext_library (line 1825) | def test_init_with_missing_dashtext_library(self):
method test_embed_with_query_encoding (line 1835) | def test_embed_with_query_encoding(self):
method test_embed_with_document_encoding (line 1877) | def test_embed_with_document_encoding(self):
method test_embed_with_empty_input (line 1898) | def test_embed_with_empty_input(self):
method test_embed_with_non_string_input (line 1916) | def test_embed_with_non_string_input(self):
method test_embed_callable_interface (line 1941) | def test_embed_callable_interface(self):
method test_embed_output_sorted_by_indices (line 1960) | def test_embed_output_sorted_by_indices(self):
method test_embed_filters_zero_values (line 1994) | def test_embed_filters_zero_values(self):
method test_properties (line 2022) | def test_properties(self):
method test_real_dashtext_bm25_embedding (line 2052) | def test_real_dashtext_bm25_embedding(self):
FILE: python/tests/test_params.py
class TestInvertIndexParam (line 49) | class TestInvertIndexParam:
method test_default (line 50) | def test_default(self):
method test_custom (line 56) | def test_custom(self):
method test_readonly (line 63) | def test_readonly(self):
class TestHnswIndexParam (line 81) | class TestHnswIndexParam:
method test_default (line 82) | def test_default(self):
method test_custom (line 90) | def test_custom(self):
method test_readonly_attributes (line 105) | def test_readonly_attributes(self, attr):
class TestFlatIndexParam (line 120) | class TestFlatIndexParam:
method test_default (line 121) | def test_default(self):
method test_custom (line 127) | def test_custom(self):
method test_readonly_attributes (line 135) | def test_readonly_attributes(self, attr):
class TestIVFIndexParam (line 150) | class TestIVFIndexParam:
method test_default (line 151) | def test_default(self):
method test_custom (line 158) | def test_custom(self):
method test_readonly_attributes (line 168) | def test_readonly_attributes(self, attr):
class TestCollectionOption (line 183) | class TestCollectionOption:
method test_default (line 184) | def test_default(self):
method test_custom (line 190) | def test_custom(self):
method test_readonly_attributes (line 200) | def test_readonly_attributes(self, attr):
class TestIndexOption (line 215) | class TestIndexOption:
method test_default (line 216) | def test_default(self):
method test_custom (line 221) | def test_custom(self):
method test_readonly_attributes (line 226) | def test_readonly_attributes(self, attr):
class TestAddColumnOption (line 241) | class TestAddColumnOption:
method test_default (line 242) | def test_default(self):
method test_custom (line 247) | def test_custom(self):
method test_readonly_attributes (line 252) | def test_readonly_attributes(self, attr):
class TestAlterColumnOption (line 267) | class TestAlterColumnOption:
method test_default (line 268) | def test_default(self):
method test_custom (line 273) | def test_custom(self):
method test_readonly_attributes (line 278) | def test_readonly_attributes(self, attr):
class TestOptimizeOption (line 293) | class TestOptimizeOption:
method test_default (line 294) | def test_default(self):
method test_custom (line 299) | def test_custom(self):
method test_readonly_attributes (line 304) | def test_readonly_attributes(self, attr):
class TestHnswQueryParam (line 319) | class TestHnswQueryParam:
method test_default (line 320) | def test_default(self):
method test_custom (line 328) | def test_custom(self):
method test_readonly_attributes (line 335) | def test_readonly_attributes(self):
class TestVectorQuery (line 376) | class TestVectorQuery:
method test_init_with_valid_id (line 377) | def test_init_with_valid_id(self):
method test_init_with_valid_vector (line 384) | def test_init_with_valid_vector(self):
method test_init_both_id_and_vector_raises_error (line 392) | def test_init_both_id_and_vector_raises_error(self):
method test_init_without_field_name_raises_error (line 396) | def test_init_without_field_name_raises_error(self):
method test_has_id_returns_true_when_id_set (line 400) | def test_has_id_returns_true_when_id_set(self):
method test_has_id_returns_false_when_no_id (line 404) | def test_has_id_returns_false_when_no_id(self):
method test_has_vector_returns_true_with_non_empty_vector (line 408) | def test_has_vector_returns_true_with_non_empty_vector(self):
method test_validate_fails_on_both_id_and_vector (line 412) | def test_validate_fails_on_both_id_and_vector(self):
FILE: python/tests/test_query_executor.py
class MockVectorSchema (line 39) | class MockVectorSchema(VectorSchema):
method __init__ (line 40) | def __init__(self, name="test_vector"):
method name (line 44) | def name(self):
method _get_object (line 47) | def _get_object(self):
class MockCollectionSchema (line 54) | class MockCollectionSchema(CollectionSchema):
method __init__ (line 55) | def __init__(self, vectors=Union[VectorSchema, Dict[str, VectorSchema]]):
method vectors (line 61) | def vectors(self):
class TestVectorQuery (line 68) | class TestVectorQuery:
method test_init (line 69) | def test_init(self):
method test_has_id (line 85) | def test_has_id(self):
method test_has_vector (line 92) | def test_has_vector(self):
method test_validate_dense_fp16_convert (line 102) | def test_validate_dense_fp16_convert(self):
method test_validate_dense_fp32_convert (line 110) | def test_validate_dense_fp32_convert(self):
method test_validate_dense_fp64_convert (line 118) | def test_validate_dense_fp64_convert(self):
method test_validate_dense_int8_convert (line 126) | def test_validate_dense_int8_convert(self):
method test_validate_sparse_fp32_convert (line 134) | def test_validate_sparse_fp32_convert(self):
method test_validate_sparse_fp16_convert (line 143) | def test_validate_sparse_fp16_convert(self):
class TestQueryContext (line 153) | class TestQueryContext:
method test_init (line 154) | def test_init(self):
method test_properties (line 164) | def test_properties(self):
method test_core_vectors_setter (line 185) | def test_core_vectors_setter(self):
class TestNoVectorQueryExecutor (line 192) | class TestNoVectorQueryExecutor:
method test_init (line 193) | def test_init(self):
method test_do_validate_with_queries (line 198) | def test_do_validate_with_queries(self):
method test_do_validate_without_queries (line 208) | def test_do_validate_without_queries(self):
method test_do_build (line 215) | def test_do_build(self):
class TestSingleVectorQueryExecutor (line 226) | class TestSingleVectorQueryExecutor:
method test_init (line 227) | def test_init(self):
method test_do_validate_multiple_queries (line 232) | def test_do_validate_multiple_queries(self):
method test_do_build_without_queries (line 244) | def test_do_build_without_queries(self):
class TestMultiVectorQueryExecutor (line 254) | class TestMultiVectorQueryExecutor:
method test_init (line 255) | def test_init(self):
method test_do_validate_multiple_queries_without_reranker (line 260) | def test_do_validate_multiple_queries_without_reranker(self):
method test_do_validate_multiple_queries_with_reranker (line 271) | def test_do_validate_multiple_queries_with_reranker(self):
class TestQueryExecutorFactory (line 281) | class TestQueryExecutorFactory:
method test_create_no_vectors (line 282) | def test_create_no_vectors(self):
method test_create_single_vector (line 287) | def test_create_single_vector(self):
method test_create_multiple_vectors (line 292) | def test_create_multiple_vectors(self):
FILE: python/tests/test_reranker.py
class TestRrfReRanker (line 38) | class TestRrfReRanker:
method test_init (line 39) | def test_init(self):
method test_rrf_score (line 45) | def test_rrf_score(self):
method test_rerank (line 52) | def test_rerank(self):
class TestWeightedReRanker (line 76) | class TestWeightedReRanker:
method test_init (line 77) | def test_init(self):
method test_normalize_score (line 90) | def test_normalize_score(self):
method test_rerank (line 108) | def test_rerank(self):
class TestQwenReRanker (line 132) | class TestQwenReRanker:
method test_init_without_query (line 133) | def test_init_without_query(self):
method test_init_without_api_key (line 137) | def test_init_without_api_key(self):
method test_init_with_env_api_key (line 143) | def test_init_with_env_api_key(self):
method test_init_with_explicit_api_key (line 149) | def test_init_with_explicit_api_key(self):
method test_model_property (line 156) | def test_model_property(self):
method test_query_property (line 170) | def test_query_property(self):
method test_topn_property (line 176) | def test_topn_property(self):
method test_rerank_field_property (line 182) | def test_rerank_field_property(self):
method test_rerank_empty_results (line 186) | def test_rerank_empty_results(self):
method test_rerank_no_valid_documents (line 193) | def test_rerank_no_valid_documents(self):
method test_rerank_skip_empty_content (line 202) | def test_rerank_skip_empty_content(self):
method test_rerank_success (line 216) | def test_rerank_success(self, mock_require_module):
method test_rerank_deduplicate_documents (line 261) | def test_rerank_deduplicate_documents(self, mock_require_module):
method test_rerank_api_error (line 291) | def test_rerank_api_error(self, mock_require_module):
method test_rerank_runtime_error (line 313) | def test_rerank_runtime_error(self, mock_require_module):
method test_real_qwen_rerank (line 332) | def test_real_qwen_rerank(self):
class TestDefaultLocalReRanker (line 432) | class TestDefaultLocalReRanker:
method test_init_without_query (line 435) | def test_init_without_query(self):
method test_init_with_empty_query (line 442) | def test_init_with_empty_query(self):
method test_init_success (line 450) | def test_init_success(self, mock_require_module):
method test_init_with_custom_params (line 479) | def test_init_with_custom_params(self, mock_require_module):
method test_init_invalid_model (line 506) | def test_init_invalid_model(self, mock_require_module):
method test_query_property (line 517) | def test_query_property(self):
method test_topn_property (line 532) | def test_topn_property(self):
method test_rerank_field_property (line 549) | def test_rerank_field_property(self):
method test_batch_size_property (line 564) | def test_batch_size_property(self):
method test_rerank_empty_results (line 581) | def test_rerank_empty_results(self):
method test_rerank_no_valid_documents (line 597) | def test_rerank_no_valid_documents(self):
method test_rerank_skip_empty_content (line 616) | def test_rerank_skip_empty_content(self):
method test_rerank_success (line 639) | def test_rerank_success(self):
method test_rerank_with_topn_limit (line 693) | def test_rerank_with_topn_limit(self):
method test_rerank_deduplicate_documents (line 733) | def test_rerank_deduplicate_documents(self):
method test_rerank_sorting (line 773) | def test_rerank_sorting(self):
method test_rerank_model_error (line 814) | def test_rerank_model_error(self):
method test_rerank_with_custom_batch_size (line 836) | def test_rerank_with_custom_batch_size(self):
method test_real_sentence_transformer_rerank (line 874) | def test_real_sentence_transformer_rerank(self):
FILE: python/tests/test_schema.py
class TestFieldSchema (line 34) | class TestFieldSchema:
method test_default (line 35) | def test_default(self):
method test_custom (line 42) | def test_custom(self):
method test_readonly (line 65) | def test_readonly(self):
class TestVectorSchema (line 86) | class TestVectorSchema:
method test_default (line 87) | def test_default(self):
method test_custom (line 96) | def test_custom(self):
method test_readonly (line 111) | def test_readonly(self):
class TestCollectionSchema (line 131) | class TestCollectionSchema:
method test_collection_schema_with_single_field (line 132) | def test_collection_schema_with_single_field(self):
method test_collection_schema_with_multi_fields (line 172) | def test_collection_schema_with_multi_fields(self):
class TestCollectionStats (line 238) | class TestCollectionStats:
method test_collection_stats (line 244) | def test_collection_stats(self):
FILE: python/tests/test_typing.py
function test_enum_names (line 40) | def test_enum_names(member, name):
function test_enum_values (line 54) | def test_enum_values(member, value):
function test_metric_type_has_member (line 59) | def test_metric_type_has_member(member):
function test_data_type_has_member (line 90) | def test_data_type_has_member(member):
function test_index_type_has_member (line 95) | def test_index_type_has_member(member):
function test_quantize_type_has_member (line 100) | def test_quantize_type_has_member(member):
function test_status_code_has_member (line 120) | def test_status_code_has_member(member):
class TestStatus (line 127) | class TestStatus:
method test_status_code (line 128) | def test_status_code(self):
method test_status_message (line 132) | def test_status_message(self):
method test_status_ok (line 139) | def test_status_ok(self):
FILE: python/tests/test_util.py
function test_require_module_success (line 25) | def test_require_module_success():
function test_require_module_with_submodule_success (line 31) | def test_require_module_with_submodule_success():
function test_require_module_import_error (line 37) | def test_require_module_import_error():
function test_require_module_with_mitigation_import_error (line 45) | def test_require_module_with_mitigation_import_error():
function test_require_module_submodule_import_error (line 58) | def test_require_module_submodule_import_error():
function test_require_module_wraps_original_exception (line 71) | def test_require_module_wraps_original_exception(mock_import_module):
function test_require_module_calls_importlib (line 82) | def test_require_module_calls_importlib(mock_import_module):
FILE: python/zvec/__init__.pyi
class _Collection (line 81) | class _Collection:
method CreateAndOpen (line 83) | def CreateAndOpen(
method Open (line 87) | def Open(arg0: str, arg1: param.CollectionOption) -> _Collection: ...
method AddColumn (line 88) | def AddColumn(
method AlterColumn (line 94) | def AlterColumn(
method CreateIndex (line 101) | def CreateIndex(
method Delete (line 104) | def Delete(self, arg0: collections.abc.Sequence[str]) -> list[typing.S...
method DeleteByFilter (line 105) | def DeleteByFilter(self, arg0: str) -> None: ...
method Destroy (line 106) | def Destroy(self) -> None: ...
method DropColumn (line 107) | def DropColumn(self, arg0: str) -> None: ...
method DropIndex (line 108) | def DropIndex(self, arg0: str) -> None: ...
method Fetch (line 109) | def Fetch(self, arg0: collections.abc.Sequence[str]) -> dict[str, _Doc...
method Flush (line 110) | def Flush(self) -> None: ...
method GroupByQuery (line 111) | def GroupByQuery(self, arg0: ...) -> list[...]: ...
method Insert (line 112) | def Insert(self, arg0: collections.abc.Sequence[_Doc]) -> list[typing....
method Optimize (line 113) | def Optimize(self, arg0: param.OptimizeOption) -> None: ...
method Options (line 114) | def Options(self) -> param.CollectionOption: ...
method Path (line 115) | def Path(self) -> str: ...
method Query (line 116) | def Query(self, arg0: param._VectorQuery) -> list[_Doc]: ...
method Schema (line 117) | def Schema(self) -> schema._CollectionSchema: ...
method Stats (line 118) | def Stats(self) -> schema.CollectionStats: ...
method Update (line 119) | def Update(self, arg0: collections.abc.Sequence[_Doc]) -> list[typing....
method Upsert (line 120) | def Upsert(self, arg0: collections.abc.Sequence[_Doc]) -> list[typing....
method __getstate__ (line 121) | def __getstate__(self) -> tuple: ...
method __setstate__ (line 122) | def __setstate__(self, arg0: tuple) -> None: ...
class _Doc (line 124) | class _Doc:
method __getstate__ (line 125) | def __getstate__(self) -> bytes: ...
method __init__ (line 126) | def __init__(self) -> None: ...
method __setstate__ (line 127) | def __setstate__(self, arg0: bytes) -> None: ...
method field_names (line 128) | def field_names(self) -> list[str]: ...
method get_any (line 129) | def get_any(self, arg0: str, arg1: typing.DataType) -> typing.Any: ...
method has_field (line 130) | def has_field(self, arg0: str) -> bool: ...
method pk (line 131) | def pk(self) -> str: ...
method score (line 132) | def score(self) -> float: ...
method set_any (line 133) | def set_any(self, arg0: str, arg1: typing.DataType, arg2: typing.Any) ...
method set_pk (line 134) | def set_pk(self, arg0: str) -> None: ...
method set_score (line 135) | def set_score(self, arg0: typing.SupportsFloat) -> None: ...
class _DocOp (line 137) | class _DocOp:
method __eq__ (line 158) | def __eq__(self, other: typing.Any) -> bool: ...
method __getstate__ (line 159) | def __getstate__(self) -> int: ...
method __hash__ (line 160) | def __hash__(self) -> int: ...
method __index__ (line 161) | def __index__(self) -> int: ...
method __init__ (line 162) | def __init__(self, value: typing.SupportsInt) -> None: ...
method __int__ (line 163) | def __int__(self) -> int: ...
method __ne__ (line 164) | def __ne__(self, other: typing.Any) -> bool: ...
method __repr__ (line 165) | def __repr__(self) -> str: ...
method __setstate__ (line 166) | def __setstate__(self, state: typing.SupportsInt) -> None: ...
method __str__ (line 167) | def __str__(self) -> str: ...
method name (line 169) | def name(self) -> str: ...
method value (line 171) | def value(self) -> int: ...
FILE: python/zvec/executor/query_executor.py
function convert_to_numpy (line 46) | def convert_to_numpy(vec: Union[list, np.ndarray], dtype: np.dtype) -> n...
class QueryContext (line 63) | class QueryContext:
method __init__ (line 64) | def __init__(
method topk (line 87) | def topk(self):
method queries (line 91) | def queries(self):
method filter (line 95) | def filter(self):
method reranker (line 99) | def reranker(self):
method output_fields (line 103) | def output_fields(self):
method include_vector (line 107) | def include_vector(self):
method core_vectors (line 111) | def core_vectors(self):
method core_vectors (line 115) | def core_vectors(self, core_vectors: list[_VectorQuery]):
class QueryExecutor (line 119) | class QueryExecutor(ABC):
method __init__ (line 120) | def __init__(self, schema: CollectionSchema):
method _do_validate (line 125) | def _do_validate(self, ctx: QueryContext) -> None:
method _do_build (line 129) | def _do_build(
method _do_build_query_wo_vector (line 134) | def _do_build_query_wo_vector(self, ctx: QueryContext) -> _VectorQuery:
method _do_build_query_with_vector (line 144) | def _do_build_query_with_vector(
method _do_execute (line 179) | def _do_execute(
method _do_merge_rerank_results (line 213) | def _do_merge_rerank_results(
method execute (line 228) | def execute(self, ctx: QueryContext, collection: _Collection) -> list[...
class NoVectorQueryExecutor (line 241) | class NoVectorQueryExecutor(QueryExecutor):
method __init__ (line 242) | def __init__(self, schema: CollectionSchema):
method _do_validate (line 245) | def _do_validate(self, ctx: QueryContext) -> None:
method _do_build (line 249) | def _do_build(
class SingleVectorQueryExecutor (line 255) | class SingleVectorQueryExecutor(NoVectorQueryExecutor):
method __init__ (line 256) | def __init__(self, schema: CollectionSchema) -> None:
method _do_validate (line 259) | def _do_validate(self, ctx: QueryContext) -> None:
method _do_build (line 267) | def _do_build(
class MultiVectorQueryExecutor (line 278) | class MultiVectorQueryExecutor(SingleVectorQueryExecutor):
method __init__ (line 279) | def __init__(self, schema: CollectionSchema) -> None:
method _do_validate (line 282) | def _do_validate(self, ctx: QueryContext) -> None:
method _do_execute (line 293) | def _do_execute(
class QueryExecutorFactory (line 299) | class QueryExecutorFactory:
method create (line 301) | def create(schema: CollectionSchema) -> QueryExecutor:
FILE: python/zvec/extension/bm25_embedding_function.py
class BM25EmbeddingFunction (line 24) | class BM25EmbeddingFunction(SparseEmbeddingFunction[TEXT]):
method __init__ (line 168) | def __init__(
method _build_encoder (line 219) | def _build_encoder(self):
method corpus_size (line 256) | def corpus_size(self) -> int:
method encoding_type (line 261) | def encoding_type(self) -> str:
method language (line 266) | def language(self) -> str:
method extra_params (line 271) | def extra_params(self) -> dict:
method __call__ (line 275) | def __call__(self, input: TEXT) -> SparseVectorType:
method embed (line 287) | def embed(self, input: TEXT) -> SparseVectorType:
FILE: python/zvec/extension/embedding_function.py
class DenseEmbeddingFunction (line 23) | class DenseEmbeddingFunction(Protocol[MD]):
method embed (line 70) | def embed(self, input: MD) -> DenseVectorType:
class SparseEmbeddingFunction (line 88) | class SparseEmbeddingFunction(Protocol[MD]):
method embed (line 134) | def embed(self, input: MD) -> SparseVectorType:
FILE: python/zvec/extension/http_embedding_function.py
class HTTPDenseEmbedding (line 26) | class HTTPDenseEmbedding(DenseEmbeddingFunction[TEXT]):
method __init__ (line 84) | def __init__(
method dimension (line 98) | def dimension(self) -> int:
method __call__ (line 104) | def __call__(self, input: TEXT) -> DenseVectorType:
method embed (line 109) | def embed(self, input: TEXT) -> DenseVectorType:
FILE: python/zvec/extension/jina_embedding_function.py
class JinaDenseEmbedding (line 24) | class JinaDenseEmbedding(JinaFunctionBase, DenseEmbeddingFunction[TEXT]):
method __init__ (line 124) | def __init__(
method dimension (line 161) | def dimension(self) -> int:
method extra_params (line 166) | def extra_params(self) -> dict:
method __call__ (line 170) | def __call__(self, input: TEXT) -> DenseVectorType:
method embed (line 175) | def embed(self, input: TEXT) -> DenseVectorType:
FILE: python/zvec/extension/jina_function.py
class JinaFunctionBase (line 23) | class JinaFunctionBase:
method __init__ (line 68) | def __init__(
method model (line 104) | def model(self) -> str:
method task (line 109) | def task(self) -> Optional[str]:
method _get_client (line 113) | def _get_client(self):
method _call_text_embedding_api (line 125) | def _call_text_embedding_api(
FILE: python/zvec/extension/multi_vector_reranker.py
class RrfReRanker (line 26) | class RrfReRanker(RerankFunction):
method __init__ (line 46) | def __init__(
method rank_constant (line 56) | def rank_constant(self) -> int:
method _rrf_score (line 59) | def _rrf_score(self, rank: int) -> float:
method rerank (line 62) | def rerank(self, query_results: dict[str, list[Doc]]) -> list[Doc]:
class WeightedReRanker (line 91) | class WeightedReRanker(RerankFunction):
method __init__ (line 114) | def __init__(
method weights (line 126) | def weights(self) -> dict[str, float]:
method metric (line 131) | def metric(self) -> MetricType:
method rerank (line 135) | def rerank(self, query_results: dict[str, list[Doc]]) -> list[Doc]:
method _normalize_score (line 167) | def _normalize_score(self, score: float, metric: MetricType) -> float:
FILE: python/zvec/extension/openai_embedding_function.py
class OpenAIDenseEmbedding (line 24) | class OpenAIDenseEmbedding(OpenAIFunctionBase, DenseEmbeddingFunction[TE...
method __init__ (line 119) | def __init__(
method dimension (line 160) | def dimension(self) -> int:
method extra_params (line 165) | def extra_params(self) -> dict:
method __call__ (line 169) | def __call__(self, input: TEXT) -> DenseVectorType:
method embed (line 174) | def embed(self, input: TEXT) -> DenseVectorType:
FILE: python/zvec/extension/openai_function.py
class OpenAIFunctionBase (line 23) | class OpenAIFunctionBase:
method __init__ (line 50) | def __init__(
method model (line 77) | def model(self) -> str:
method _get_client (line 81) | def _get_client(self):
method _call_text_embedding_api (line 96) | def _call_text_embedding_api(
FILE: python/zvec/extension/qwen_embedding_function.py
class QwenDenseEmbedding (line 24) | class QwenDenseEmbedding(QwenFunctionBase, DenseEmbeddingFunction[TEXT]):
method __init__ (line 134) | def __init__(
method dimension (line 168) | def dimension(self) -> int:
method extra_params (line 173) | def extra_params(self) -> dict:
method __call__ (line 177) | def __call__(self, input: TEXT) -> DenseVectorType:
method embed (line 182) | def embed(self, input: TEXT) -> DenseVectorType:
class QwenSparseEmbedding (line 272) | class QwenSparseEmbedding(QwenFunctionBase, SparseEmbeddingFunction[TEXT]):
method __init__ (line 387) | def __init__(
method extra_params (line 416) | def extra_params(self) -> dict:
method __call__ (line 420) | def __call__(self, input: TEXT) -> SparseVectorType:
method embed (line 425) | def embed(self, input: TEXT) -> SparseVectorType:
FILE: python/zvec/extension/qwen_function.py
class QwenFunctionBase (line 24) | class QwenFunctionBase:
method __init__ (line 46) | def __init__(
method model (line 69) | def model(self) -> str:
method _get_connection (line 73) | def _get_connection(self):
method _call_text_embedding_api (line 86) | def _call_text_embedding_api(
method _call_rerank_api (line 141) | def _call_rerank_api(
FILE: python/zvec/extension/qwen_rerank_function.py
class QwenReRanker (line 23) | class QwenReRanker(QwenFunctionBase, RerankFunction):
method __init__ (line 64) | def __init__(
method query (line 92) | def query(self) -> str:
method rerank (line 96) | def rerank(self, query_results: dict[str, list[Doc]]) -> list[Doc]:
FILE: python/zvec/extension/rerank_function.py
class RerankFunction (line 22) | class RerankFunction(ABC):
method __init__ (line 39) | def __init__(
method topn (line 48) | def topn(self) -> int:
method rerank_field (line 53) | def rerank_field(self) -> Optional[str]:
method rerank (line 58) | def rerank(self, query_results: dict[str, list[Doc]]) -> list[Doc]:
FILE: python/zvec/extension/sentence_transformer_embedding_function.py
class DefaultLocalDenseEmbedding (line 25) | class DefaultLocalDenseEmbedding(
method __init__ (line 154) | def __init__(
method dimension (line 201) | def dimension(self) -> int:
method extra_params (line 206) | def extra_params(self) -> dict:
method __call__ (line 210) | def __call__(self, input: str) -> DenseVectorType:
method embed (line 214) | def embed(self, input: str) -> DenseVectorType:
class DefaultLocalSparseEmbedding (line 311) | class DefaultLocalSparseEmbedding(
method clear_cache (line 516) | def clear_cache(cls) -> None:
method get_cache_info (line 536) | def get_cache_info(cls) -> dict:
method remove_from_cache (line 558) | def remove_from_cache(
method __init__ (line 590) | def __init__(
method extra_params (line 660) | def extra_params(self) -> dict:
method __call__ (line 664) | def __call__(self, input: str) -> SparseVectorType:
method embed (line 668) | def embed(self, input: str) -> SparseVectorType:
method _manual_sparse_encode (line 760) | def _manual_sparse_encode(self, input: str) -> SparseVectorType:
method _get_model (line 813) | def _get_model(self):
FILE: python/zvec/extension/sentence_transformer_function.py
class SentenceTransformerFunctionBase (line 21) | class SentenceTransformerFunctionBase:
method __init__ (line 45) | def __init__(
method model_name (line 74) | def model_name(self) -> str:
method model_source (line 79) | def model_source(self) -> str:
method device (line 84) | def device(self) -> str:
method _get_model (line 91) | def _get_model(self):
method _is_sparse_model (line 142) | def _is_sparse_model(self) -> bool:
FILE: python/zvec/extension/sentence_transformer_rerank_function.py
class DefaultLocalReRanker (line 24) | class DefaultLocalReRanker(SentenceTransformerFunctionBase, RerankFuncti...
method __init__ (line 170) | def __init__(
method _get_model (line 217) | def _get_model(self):
method query (line 272) | def query(self) -> str:
method batch_size (line 277) | def batch_size(self) -> int:
method rerank (line 281) | def rerank(self, query_results: dict[str, list[Doc]]) -> list[Doc]:
FILE: python/zvec/model/collection.py
class Collection (line 44) | class Collection:
method __init__ (line 53) | def __init__(self, obj: _Collection):
method _from_core (line 59) | def _from_core(cls, core_collection: _Collection) -> Collection:
method path (line 70) | def path(self) -> str:
method option (line 75) | def option(self) -> CollectionOption:
method schema (line 80) | def schema(self) -> CollectionSchema:
method stats (line 85) | def stats(self) -> CollectionStats:
method destroy (line 90) | def destroy(self) -> None:
method flush (line 98) | def flush(self) -> None:
method create_index (line 106) | def create_index(
method drop_index (line 138) | def drop_index(self, field_name: str) -> None:
method optimize (line 147) | def optimize(self, option: OptimizeOption = OptimizeOption()) -> None:
method add_column (line 157) | def add_column(
method drop_column (line 176) | def drop_column(self, field_name: str) -> None:
method alter_column (line 185) | def alter_column(
method insert (line 234) | def insert(self, docs: Doc) -> Status:
method insert (line 238) | def insert(self, docs: list[Doc]) -> list[Status]:
method insert (line 241) | def insert(self, docs: Union[Doc, list[Doc]]) -> Union[Status, list[St...
method upsert (line 261) | def upsert(self, docs: Doc) -> Status:
method upsert (line 265) | def upsert(self, docs: list[Doc]) -> list[Status]:
method upsert (line 268) | def upsert(self, docs: Union[Doc, list[Doc]]) -> Union[Status, list[St...
method update (line 286) | def update(self, docs: Doc) -> Status:
method update (line 290) | def update(self, docs: list[Doc]) -> list[Status]:
method update (line 293) | def update(self, docs: Union[Doc, list[Doc]]) -> Union[Status, list[St...
method delete (line 313) | def delete(self, ids: str) -> Status:
method delete (line 317) | def delete(self, ids: list[str]) -> list[Status]:
method delete (line 320) | def delete(self, ids: Union[str, list[str]]) -> Union[Status, list[Sta...
method delete_by_filter (line 335) | def delete_by_filter(self, filter: str) -> None:
method fetch (line 344) | def fetch(self, ids: Union[str, list[str]]) -> dict[str, Doc]:
method query (line 363) | def query(
FILE: python/zvec/model/convert.py
function convert_to_cpp_doc (line 20) | def convert_to_cpp_doc(doc: Doc, collection_schema: CollectionSchema) ->...
function convert_to_py_doc (line 49) | def convert_to_py_doc(doc: _Doc, collection_schema: CollectionSchema) ->...
FILE: python/zvec/model/doc.py
class Doc (line 26) | class Doc:
method __init__ (line 63) | def __init__(
method has_field (line 75) | def has_field(self, name: str) -> bool:
method has_vector (line 86) | def has_vector(self, name: str) -> bool:
method vector (line 97) | def vector(self, name: str):
method field (line 108) | def field(self, name: str):
method vector_names (line 119) | def vector_names(self) -> list[str]:
method field_names (line 127) | def field_names(self) -> list[str]:
method __repr__ (line 135) | def __repr__(self) -> str:
method _replace (line 147) | def _replace(self, **changes):
method _from_tuple (line 157) | def _from_tuple(
FILE: python/zvec/model/param/__init__.pyi
class AddColumnOption (line 32) | class AddColumnOption:
method __getstate__ (line 47) | def __getstate__(self) -> tuple: ...
method __init__ (line 48) | def __init__(self, concurrency: typing.SupportsInt = 0) -> None:
method __setstate__ (line 57) | def __setstate__(self, arg0: tuple) -> None: ...
method concurrency (line 59) | def concurrency(self) -> int:
class AlterColumnOption (line 64) | class AlterColumnOption:
method __getstate__ (line 80) | def __getstate__(self) -> tuple: ...
method __init__ (line 81) | def __init__(self, concurrency: typing.SupportsInt = 0) -> None:
method __setstate__ (line 90) | def __setstate__(self, arg0: tuple) -> None: ...
method concurrency (line 92) | def concurrency(self) -> int:
class CollectionOption (line 97) | class CollectionOption:
method __getstate__ (line 114) | def __getstate__(self) -> tuple: ...
method __init__ (line 115) | def __init__(self, read_only: bool = False, enable_mmap: bool = True) ...
method __repr__ (line 126) | def __repr__(self) -> str: ...
method __setstate__ (line 127) | def __setstate__(self, arg0: tuple) -> None: ...
method enable_mmap (line 129) | def enable_mmap(self) -> bool: ...
method read_only (line 131) | def read_only(self) -> bool: ...
class FlatIndexParam (line 133) | class FlatIndexParam(VectorIndexParam):
method __getstate__ (line 159) | def __getstate__(self) -> tuple: ...
method __init__ (line 160) | def __init__(
method __repr__ (line 174) | def __repr__(self) -> str: ...
method __setstate__ (line 175) | def __setstate__(self, arg0: tuple) -> None: ...
method to_dict (line 176) | def to_dict(self) -> dict:
class HnswIndexParam (line 181) | class HnswIndexParam(VectorIndexParam):
method __getstate__ (line 214) | def __getstate__(self) -> tuple: ...
method __init__ (line 215) | def __init__(
method __repr__ (line 222) | def __repr__(self) -> str: ...
method __setstate__ (line 223) | def __setstate__(self, arg0: tuple) -> None: ...
method to_dict (line 224) | def to_dict(self) -> dict:
method ef_construction (line 230) | def ef_construction(self) -> int:
method m (line 236) | def m(self) -> int:
class HnswQueryParam (line 241) | class HnswQueryParam(QueryParam):
method __getstate__ (line 264) | def __getstate__(self) -> tuple: ...
method __init__ (line 265) | def __init__(
method __repr__ (line 282) | def __repr__(self) -> str: ...
method __setstate__ (line 283) | def __setstate__(self, arg0: tuple) -> None: ...
method ef (line 285) | def ef(self) -> int:
class HnswRabitqIndexParam (line 290) | class HnswRabitqIndexParam(VectorIndexParam):
method __getstate__ (line 325) | def __getstate__(self) -> tuple: ...
method __init__ (line 326) | def __init__(
method __repr__ (line 335) | def __repr__(self) -> str: ...
method __setstate__ (line 336) | def __setstate__(self, arg0: tuple) -> None: ...
method to_dict (line 337) | def to_dict(self) -> dict:
method ef_construction (line 343) | def ef_construction(self) -> int:
method m (line 349) | def m(self) -> int:
method total_bits (line 355) | def total_bits(self) -> int:
method num_clusters (line 361) | def num_clusters(self) -> int:
method sample_count (line 367) | def sample_count(self) -> int:
class HnswRabitqQueryParam (line 372) | class HnswRabitqQueryParam(QueryParam):
method __getstate__ (line 393) | def __getstate__(self) -> tuple: ...
method __init__ (line 394) | def __init__(
method __repr__ (line 411) | def __repr__(self) -> str: ...
method __setstate__ (line 412) | def __setstate__(self, arg0: tuple) -> None: ...
method ef (line 414) | def ef(self) -> int:
class IVFIndexParam (line 419) | class IVFIndexParam(VectorIndexParam):
method __getstate__ (line 454) | def __getstate__(self) -> tuple: ...
method __init__ (line 455) | def __init__(
method __repr__ (line 477) | def __repr__(self) -> str: ...
method __setstate__ (line 478) | def __setstate__(self, arg0: tuple) -> None: ...
method to_dict (line 479) | def to_dict(self) -> dict:
method n_iters (line 485) | def n_iters(self) -> int:
method n_list (line 491) | def n_list(self) -> int:
method use_soar (line 497) | def use_soar(self) -> bool:
class IVFQueryParam (line 502) | class IVFQueryParam(QueryParam):
method __getstate__ (line 522) | def __getstate__(self) -> tuple: ...
method __init__ (line 523) | def __init__(self, nprobe: typing.SupportsInt = 10) -> None:
method __repr__ (line 531) | def __repr__(self) -> str: ...
method __setstate__ (line 532) | def __setstate__(self, arg0: tuple) -> None: ...
method nprobe (line 534) | def nprobe(self) -> int:
class IndexOption (line 539) | class IndexOption:
method __getstate__ (line 555) | def __getstate__(self) -> tuple: ...
method __init__ (line 556) | def __init__(self, concurrency: typing.SupportsInt = 0) -> None:
method __setstate__ (line 565) | def __setstate__(self, arg0: tuple) -> None: ...
method concurrency (line 567) | def concurrency(self) -> int:
class IndexParam (line 572) | class IndexParam:
method __eq__ (line 586) | def __eq__(self, arg0: typing.Any) -> bool: ...
method __getstate__ (line 587) | def __getstate__(self) -> tuple: ...
method __setstate__ (line 588) | def __setstate__(self, arg0: tuple) -> None: ...
method clone (line 589) | def clone(self) -> IndexParam: ...
method to_dict (line 590) | def to_dict(self) -> dict:
method type (line 596) | def type(self) -> _zvec.typing.IndexType:
class InvertIndexParam (line 601) | class InvertIndexParam(IndexParam):
method __getstate__ (line 624) | def __getstate__(self) -> tuple: ...
method __init__ (line 625) | def __init__(
method __repr__ (line 639) | def __repr__(self) -> str: ...
method __setstate__ (line 640) | def __setstate__(self, arg0: tuple) -> None: ...
method to_dict (line 641) | def to_dict(self) -> dict:
method enable_extended_wildcard (line 646) | def enable_extended_wildcard(self) -> bool:
method enable_range_optimization (line 652) | def enable_range_optimization(self) -> bool:
class OptimizeOption (line 657) | class OptimizeOption:
method __getstate__ (line 673) | def __getstate__(self) -> tuple: ...
method __init__ (line 674) | def __init__(self, concurrency: typing.SupportsInt = 0) -> None:
method __setstate__ (line 683) | def __setstate__(self, arg0: tuple) -> None: ...
method concurrency (line 685) | def concurrency(self) -> int:
class QueryParam (line 690) | class QueryParam:
method __getstate__ (line 707) | def __getstate__(self) -> tuple: ...
method __setstate__ (line 708) | def __setstate__(self, arg0: tuple) -> None: ...
method is_linear (line 710) | def is_linear(self) -> bool:
method is_using_refiner (line 715) | def is_using_refiner(self) -> bool:
method radius (line 720) | def radius(self) -> float:
method type (line 725) | def type(self) -> _zvec.typing.IndexType:
class SegmentOption (line 730) | class SegmentOption:
method __getstate__ (line 748) | def __getstate__(self) -> tuple: ...
method __init__ (line 749) | def __init__(self) -> None:
method __repr__ (line 754) | def __repr__(self) -> str: ...
method __setstate__ (line 755) | def __setstate__(self, arg0: tuple) -> None: ...
method enable_mmap (line 757) | def enable_mmap(self) -> bool:
method max_buffer_size (line 763) | def max_buffer_size(self) -> int:
method read_only (line 769) | def read_only(self) -> bool:
class VectorIndexParam (line 774) | class VectorIndexParam(IndexParam):
method __getstate__ (line 787) | def __getstate__(self) -> tuple: ...
method __setstate__ (line 788) | def __setstate__(self, arg0: tuple) -> None: ...
method to_dict (line 789) | def to_dict(self) -> dict:
method metric_type (line 795) | def metric_type(self) -> _zvec.typing.MetricType:
method quantize_type (line 801) | def quantize_type(self) -> _zvec.typing.QuantizeType:
class _VectorQuery (line 806) | class _VectorQuery:
method __getstate__ (line 812) | def __getstate__(self) -> tuple: ...
method __init__ (line 813) | def __init__(self) -> None: ...
method __setstate__ (line 814) | def __setstate__(self, arg0: tuple) -> None: ...
method set_vector (line 815) | def set_vector(self, arg0: ..., arg1: typing.Any) -> None: ...
method output_fields (line 817) | def output_fields(self) -> list[str] | None: ...
method output_fields (line 819) | def output_fields(self, arg0: collections.abc.Sequence[str] | None) ->...
method topk (line 821) | def topk(self) -> int: ...
method topk (line 823) | def topk(self, arg0: typing.SupportsInt) -> None: ...
FILE: python/zvec/model/param/vector_query.py
class VectorQuery (line 26) | class VectorQuery:
method has_id (line 60) | def has_id(self) -> bool:
method has_vector (line 68) | def has_vector(self) -> bool:
method _validate (line 76) | def _validate(self) -> None:
FILE: python/zvec/model/schema/__init__.pyi
class CollectionStats (line 23) | class CollectionStats:
method __init__ (line 24) | def __init__(self) -> None: ...
method __repr__ (line 25) | def __repr__(self) -> str: ...
method doc_count (line 27) | def doc_count(self) -> int: ...
method index_completeness (line 29) | def index_completeness(self) -> dict[str, float]: ...
class _CollectionSchema (line 31) | class _CollectionSchema:
method __eq__ (line 34) | def __eq__(self, arg0: _CollectionSchema) -> bool: ...
method __init__ (line 35) | def __init__(
method __ne__ (line 42) | def __ne__(self, arg0: _CollectionSchema) -> bool: ...
method fields (line 43) | def fields(self) -> list[_FieldSchema]:
method forward_fields (line 48) | def forward_fields(self) -> list[_FieldSchema]:
method get_field (line 53) | def get_field(self, field_name: str) -> _FieldSchema:
method get_forward_field (line 58) | def get_forward_field(self, field_name: str) -> _FieldSchema:
method get_vector_field (line 63) | def get_vector_field(self, field_name: str) -> _FieldSchema:
method has_field (line 68) | def has_field(self, field_name: str) -> bool:
method vector_fields (line 73) | def vector_fields(self) -> list[_FieldSchema]:
method name (line 79) | def name(self) -> str: ...
class _FieldSchema (line 81) | class _FieldSchema:
method __eq__ (line 84) | def __eq__(self, arg0: _FieldSchema) -> bool: ...
method __init__ (line 85) | def __init__(
method __ne__ (line 93) | def __ne__(self, arg0: _FieldSchema) -> bool: ...
method data_type (line 95) | def data_type(self) -> _zvec.typing.DataType: ...
method dimension (line 97) | def dimension(self) -> int: ...
method index_param (line 99) | def index_param(self) -> typing.Any: ...
method index_type (line 101) | def index_type(self) -> _zvec.typing.IndexType: ...
method is_dense_vector (line 103) | def is_dense_vector(self) -> bool: ...
method is_sparse_vector (line 105) | def is_sparse_vector(self) -> bool: ...
method name (line 107) | def name(self) -> str: ...
method nullable (line 109) | def nullable(self) -> bool: ...
FILE: python/zvec/model/schema/collection_schema.py
class CollectionSchema (line 28) | class CollectionSchema:
method __init__ (line 59) | def __init__(
method _check_fields (line 83) | def _check_fields(
method _check_vectors (line 117) | def _check_vectors(
method _from_core (line 152) | def _from_core(cls, core_collection_schema: _CollectionSchema):
method name (line 160) | def name(self) -> str:
method field (line 164) | def field(self, name: str) -> Optional[FieldSchema]:
method vector (line 176) | def vector(self, name: str) -> Optional[VectorSchema]:
method fields (line 189) | def fields(self) -> list[FieldSchema]:
method vectors (line 195) | def vectors(self) -> list[VectorSchema]:
method _get_object (line 200) | def _get_object(self) -> _CollectionSchema:
method __repr__ (line 203) | def __repr__(self) -> str:
method __str__ (line 214) | def __str__(self) -> str:
FILE: python/zvec/model/schema/field_schema.py
class FieldSchema (line 63) | class FieldSchema:
method __init__ (line 89) | def __init__(
method _from_core (line 117) | def _from_core(cls, core_field_schema: _FieldSchema):
method _get_object (line 124) | def _get_object(self) -> _FieldSchema:
method name (line 128) | def name(self) -> str:
method data_type (line 133) | def data_type(self) -> DataType:
method nullable (line 138) | def nullable(self) -> bool:
method index_param (line 143) | def index_param(self) -> Optional[InvertIndexParam]:
method __dict__ (line 147) | def __dict__(self) -> dict[str, Any]:
method __repr__ (line 161) | def __repr__(self) -> str:
method __str__ (line 168) | def __str__(self) -> str:
method __eq__ (line 171) | def __eq__(self, other: object) -> bool:
method __hash__ (line 176) | def __hash__(self) -> int:
class VectorSchema (line 180) | class VectorSchema:
method __init__ (line 206) | def __init__(
method _from_core (line 242) | def _from_core(cls, core_field_schema: _FieldSchema):
method _get_object (line 247) | def _get_object(self) -> _FieldSchema:
method name (line 251) | def name(self) -> str:
method data_type (line 256) | def data_type(self) -> DataType:
method dimension (line 261) | def dimension(self) -> int:
method index_param (line 266) | def index_param(self) -> Union[HnswIndexParam, IVFIndexParam, FlatInde...
method __dict__ (line 270) | def __dict__(self) -> dict[str, Any]:
method __repr__ (line 284) | def __repr__(self) -> str:
method __str__ (line 291) | def __str__(self) -> str:
method __eq__ (line 294) | def __eq__(self, other: object) -> bool:
method __hash__ (line 299) | def __hash__(self) -> int:
FILE: python/zvec/tool/util.py
function require_module (line 20) | def require_module(module: str, mitigation: Optional[str] = None) -> Any:
FILE: python/zvec/typing/__init__.pyi
class DataType (line 18) | class DataType:
method __eq__ (line 110) | def __eq__(self, other: typing.Any) -> bool: ...
method __getstate__ (line 111) | def __getstate__(self) -> int: ...
method __hash__ (line 112) | def __hash__(self) -> int: ...
method __index__ (line 113) | def __index__(self) -> int: ...
method __init__ (line 114) | def __init__(self, value: typing.SupportsInt) -> None: ...
method __int__ (line 115) | def __int__(self) -> int: ...
method __ne__ (line 116) | def __ne__(self, other: typing.Any) -> bool: ...
method __repr__ (line 117) | def __repr__(self) -> str: ...
method __setstate__ (line 118) | def __setstate__(self, state: typing.SupportsInt) -> None: ...
method __str__ (line 119) | def __str__(self) -> str: ...
method name (line 121) | def name(self) -> str: ...
method value (line 123) | def value(self) -> int: ...
class IndexType (line 125) | class IndexType:
method __eq__ (line 158) | def __eq__(self, other: typing.Any) -> bool: ...
method __getstate__ (line 159) | def __getstate__(self) -> int: ...
method __hash__ (line 160) | def __hash__(self) -> int: ...
method __index__ (line 161) | def __index__(self) -> int: ...
method __init__ (line 162) | def __init__(self, value: typing.SupportsInt) -> None: ...
method __int__ (line 163) | def __int__(self) -> int: ...
method __ne__ (line 164) | def __ne__(self, other: typing.Any) -> bool: ...
method __repr__ (line 165) | def __repr__(self) -> str: ...
method __setstate__ (line 166) | def __setstate__(self, state: typing.SupportsInt) -> None: ...
method __str__ (line 167) | def __str__(self) -> str: ...
method name (line 169) | def name(self) -> str: ...
method value (line 171) | def value(self) -> int: ...
class MetricType (line 173) | class MetricType:
method __eq__ (line 204) | def __eq__(self, other: typing.Any) -> bool: ...
method __getstate__ (line 205) | def __getstate__(self) -> int: ...
method __hash__ (line 206) | def __hash__(self) -> int: ...
method __index__ (line 207) | def __index__(self) -> int: ...
method __init__ (line 208) | def __init__(self, value: typing.SupportsInt) -> None: ...
method __int__ (line 209) | def __int__(self) -> int: ...
method __ne__ (line 210) | def __ne__(self, other: typing.Any) -> bool: ...
method __repr__ (line 211) | def __repr__(self) -> str: ...
method __setstate__ (line 212) | def __setstate__(self, state: typing.SupportsInt) -> None: ...
method __str__ (line 213) | def __str__(self) -> str: ...
method name (line 215) | def name(self) -> str: ...
method value (line 217) | def value(self) -> int: ...
class QuantizeType (line 219) | class QuantizeType:
method __eq__ (line 249) | def __eq__(self, other: typing.Any) -> bool: ...
method __getstate__ (line 250) | def __getstate__(self) -> int: ...
method __hash__ (line 251) | def __hash__(self) -> int: ...
method __index__ (line 252) | def __index__(self) -> int: ...
method __init__ (line 253) | def __init__(self, value: typing.SupportsInt) -> None: ...
method __int__ (line 254) | def __int__(self) -> int: ...
method __ne__ (line 255) | def __ne__(self, other: typing.Any) -> bool: ...
method __repr__ (line 256) | def __repr__(self) -> str: ...
method __setstate__ (line 257) | def __setstate__(self, state: typing.SupportsInt) -> None: ...
method __str__ (line 258) | def __str__(self) -> str: ...
method name (line 260) | def name(self) -> str: ...
method value (line 262) | def value(self) -> int: ...
class Status (line 264) | class Status:
method AlreadyExists (line 286) | def AlreadyExists(message: str) -> Status: ...
method InternalError (line 288) | def InternalError(message: str) -> Status: ...
method InvalidArgument (line 290) | def InvalidArgument(message: str) -> Status: ...
method NotFound (line 292) | def NotFound(message: str) -> Status: ...
method OK (line 294) | def OK() -> Status:
method PermissionDenied (line 300) | def PermissionDenied(message: str) -> Status: ...
method __eq__ (line 301) | def __eq__(self, arg0: Status) -> bool: ...
method __init__ (line 303) | def __init__(self) -> None: ...
method __init__ (line 305) | def __init__(self, code: StatusCode, message: str = "") -> None:
method __ne__ (line 314) | def __ne__(self, arg0: Status) -> bool: ...
method __repr__ (line 315) | def __repr__(self) -> str: ...
method code (line 316) | def code(self) -> StatusCode:
method message (line 321) | def message(self) -> str:
method ok (line 326) | def ok(self) -> bool:
class StatusCode (line 331) | class StatusCode:
method __eq__ (line 391) | def __eq__(self, other: typing.Any) -> bool: ...
method __getstate__ (line 392) | def __getstate__(self) -> int: ...
method __hash__ (line 393) | def __hash__(self) -> int: ...
method __index__ (line 394) | def __index__(self) -> int: ...
method __init__ (line 395) | def __init__(self, value: typing.SupportsInt) -> None: ...
method __int__ (line 396) | def __int__(self) -> int: ...
method __ne__ (line 397) | def __ne__(self, other: typing.Any) -> bool: ...
method __repr__ (line 398) | def __repr__(self) -> str: ...
method __setstate__ (line 399) | def __setstate__(self, state: typing.SupportsInt) -> None: ...
method __str__ (line 400) | def __str__(self) -> str: ...
method name (line 402) | def name(self) -> str: ...
method value (line 404) | def value(self) -> int: ...
FILE: python/zvec/typing/enum.py
class LogLevel (line 21) | class LogLevel(IntEnum):
class LogType (line 51) | class LogType(IntEnum):
FILE: python/zvec/zvec.py
function init (line 29) | def init(
function create_and_open (line 166) | def create_and_open(
function open (line 207) | def open(path: str, option: CollectionOption = CollectionOption()) -> Co...
FILE: src/ailego/algorithm/binary_quantizer.cc
type zvec (line 23) | namespace zvec {
type ailego (line 24) | namespace ailego {
FILE: src/ailego/algorithm/binary_quantizer.h
function namespace (line 20) | namespace zvec {
FILE: src/ailego/algorithm/integer_quantizer.cc
type zvec (line 23) | namespace zvec {
type ailego (line 24) | namespace ailego {
function MakeSmooth (line 27) | static inline void MakeSmooth(std::vector<float> &dist) {
function ComputeKlDivergence (line 55) | static inline double ComputeKlDivergence(const std::vector<float> &p,
function ExpandCandidateDistribution (line 73) | static inline void ExpandCandidateDistribution(
function ComputeThreshold (line 130) | static inline size_t ComputeThreshold(const std::vector<uint32_t> &h...
function QuantizeValue (line 204) | static inline float QuantizeValue(float val, float scale, float bias) {
FILE: src/ailego/algorithm/integer_quantizer.h
function EntropyIntegerQuantizer (line 43) | EntropyIntegerQuantizer(void) {}
function set_histogram_bins (line 46) | void set_histogram_bins(size_t bins) {
function set_scale (line 53) | void set_scale(float val) {
function set_bias (line 61) | void set_bias(float val) {
function set_max (line 66) | void set_max(float val) {
function set_min (line 71) | void set_min(float val) {
function set_non_bias (line 76) | void set_non_bias(bool val) {
function histogram_bins (line 81) | size_t histogram_bins(void) const {
function scale (line 86) | float scale(void) const {
function bias (line 91) | float bias(void) const {
function max (line 96) | float max(void) const {
function min (line 101) | float min(void) const {
function non_bias (line 106) | bool non_bias(void) const {
function scale_reciprocal (line 111) | float scale_reciprocal(void) const {
function histogram_bins_ (line 121) | size_t histogram_bins_{0}
function bias_ (line 125) | float bias_{0.0f};
FILE: src/ailego/algorithm/kmeans.h
function namespace (line 34) | namespace ailego {
function append (line 561) | void append(const StoreType *vec, size_t dim, float dist) {
function centroid (line 579) | void centroid(StoreType *out, size_t dim) const {
function cost (line 595) | double cost(void) const {
function count (line 600) | size_t count(void) const {
function cost_ (line 606) | double cost_{0.0};
function class (line 695) | class Cluster {
function Norm2 (line 1007) | void Norm2(ValueType *data, size_t dim, float *norm) {
function Norm2 (line 1012) | static void Norm2(ValueType * /*data*/, size_t /*dim*/, float *norm) {
function class (line 1040) | class Cluster {
FILE: src/ailego/algorithm/lloyd_cluster.h
function namespace (line 24) | namespace zvec {
function ContainerType (line 355) | ContainerType feature_cache_{}
function ContainerType (line 356) | ContainerType feature_matrix_{}
function ContainerType (line 357) | ContainerType centroids_matrix_{}
function ContainerType (line 358) | ContainerType centroids_{}
function ContextType (line 359) | ContextType context_{}
function spherical_ (line 360) | bool spherical_{false};
FILE: src/ailego/buffer/buffer_manager.cc
type zvec (line 43) | namespace zvec {
type ailego (line 46) | namespace ailego {
type IDHash (line 52) | struct IDHash {
type IDEqual (line 67) | struct IDEqual {
type BufferManager::BufferContext (line 96) | struct BufferManager::BufferContext {
method BufferContext (line 97) | BufferContext(const BufferID &id, BufferPool *p) : id(id), pool(p) {}
method BufferContext (line 98) | BufferContext(const BufferContext &) = delete;
method BufferContext (line 99) | BufferContext(BufferContext &&) = delete;
method BufferContext (line 100) | BufferContext &operator=(const BufferContext &) = delete;
method BufferContext (line 101) | BufferContext &operator=(BufferContext &&) = delete;
type State (line 114) | enum State : uint32_t {
class BufferManager::BufferPool (line 290) | class BufferManager::BufferPool {
method BufferPool (line 292) | explicit BufferPool(uint64_t limit) : limit_(limit) {
method BufferContext (line 298) | BufferContext *acquire_locked(BufferID &id) {
method try_release_context_locked (line 309) | void try_release_context_locked(BufferContext *context) {
method pin_locked (line 323) | void pin_locked(BufferContext *ctx) {
method unpin_locked (line 340) | bool unpin_locked(BufferContext *ctx) {
method LRU_insert_locked (line 357) | void LRU_insert_locked(BufferContext *context) {
method LRU_remove_locked (line 363) | void LRU_remove_locked(BufferContext *context) {
method usage (line 369) | uint64_t usage() const {
method pin_at_IDLE (line 375) | void pin_at_IDLE(BufferContext *ctx) {
method pin_at_IN_USE (line 424) | void pin_at_IN_USE(BufferContext *ctx) {
method pin_at_CACHED (line 433) | void pin_at_CACHED(BufferContext *ctx) {
method LRU_insert (line 444) | void LRU_insert(BufferContext *context) {
method LRU_remove (line 460) | void LRU_remove(BufferContext *context) {
function BufferHandle (line 563) | BufferHandle BufferManager::acquire(BufferID &buffer_id) {
FILE: src/ailego/buffer/buffer_pool.cc
type zvec (line 4) | namespace zvec {
type ailego (line 5) | namespace ailego {
type stat (line 174) | struct stat
function VecBufferPoolHandle (line 218) | VecBufferPoolHandle VecBufferPool::get_handle() {
FILE: src/ailego/container/bitmap.cc
type zvec (line 17) | namespace zvec {
type ailego (line 18) | namespace ailego {
FILE: src/ailego/container/bitmap.h
function namespace (line 22) | namespace zvec {
FILE: src/ailego/container/bloom_filter.h
function namespace (line 22) | namespace ailego {
function is_valid (line 146) | bool is_valid(void) const {
function reset (line 151) | bool reset(size_t n, double p) {
function clear (line 170) | void clear(void) {
function bits_count (line 211) | size_t bits_count(void) const {
function capacity (line 216) | size_t capacity(void) const {
function count (line 221) | size_t count(void) const {
function probability (line 226) | double probability(void) const {
function capacity_ (line 268) | size_t capacity_{0u};
FILE: src/ailego/container/params.cc
type zvec (line 23) | namespace zvec {
type ailego (line 24) | namespace ailego {
function ParseFromJsonObject (line 26) | static void ParseFromJsonObject(const ailego::JsonObject &obj, Param...
function SerializeToJsonObject (line 79) | static void SerializeToJsonObject(const Params ¶ms,
FILE: src/ailego/container/reservoir.h
function namespace (line 20) | namespace zvec {
FILE: src/ailego/container/vector_array.h
function namespace (line 20) | namespace zvec {
FILE: src/ailego/encoding/json/mod_json.c
type mod_json_token (line 80) | struct mod_json_token {
type mod_json_parser_t (line 95) | typedef struct mod_json_parser mod_json_parser_t;
type mod_json_parser (line 99) | struct mod_json_parser {
function mod_json_size_t (line 110) | static inline mod_json_size_t mod_json_utils_clp2(mod_json_size_t n) {
function mod_json_size_t (line 120) | static inline mod_json_size_t mod_json_utils_itostr(mod_json_char_t *buf,
function mod_json_float_t (line 156) | static inline mod_json_float_t mod_json_utils_pow10(int n) {
function mod_json_cchar_t (line 231) | static inline mod_json_cchar_t *mod_json_utils_strskpb(mod_json_cchar_t ...
function mod_json_cchar_t (line 253) | static inline mod_json_cchar_t *mod_json_utils_strskpc1(
function mod_json_cchar_t (line 265) | static inline mod_json_cchar_t *mod_json_utils_strskpc2(
function mod_json_cchar_t (line 278) | static inline mod_json_cchar_t *mod_json_utils_strskp(mod_json_cchar_t *...
function mod_json_utils_char2hex (line 299) | static inline int mod_json_utils_char2hex(mod_json_char_t ch) {
function mod_json_cchar_t (line 319) | static inline mod_json_cchar_t *mod_json_utils_strfquo(mod_json_cchar_t ...
function mod_json_cchar_t (line 370) | static inline mod_json_cchar_t *mod_json_utils_strfquo2(mod_json_cchar_t...
function mod_json_cchar_t (line 390) | static inline mod_json_cchar_t *mod_json_utils_strfsep(mod_json_cchar_t ...
function mod_json_cchar_t (line 408) | static inline mod_json_cchar_t *mod_json_utils_strfsep2(
function mod_json_char_t (line 432) | static inline mod_json_char_t *mod_json_utils_uni2utf8(mod_json_char_t *...
function mod_json_value_t (line 462) | mod_json_value_t *mod_json_value_set_null(void) {
function mod_json_value_t (line 475) | mod_json_value_t *mod_json_value_set_object(mod_json_object_t *obj) {
function mod_json_value_t (line 488) | mod_json_value_t *mod_json_value_set_array(mod_json_array_t *arr) {
function mod_json_value_t (line 501) | mod_json_value_t *mod_json_value_set_string(mod_json_string_t *str) {
function mod_json_value_t (line 514) | mod_json_value_t *mod_json_value_set_buffer(mod_json_cchar_t *buf,
function mod_json_value_t (line 536) | mod_json_value_t *mod_json_value_set_integer(mod_json_integer_t num) {
function mod_json_value_t (line 549) | mod_json_value_t *mod_json_value_set_float(mod_json_float_t dbl) {
function mod_json_value_t (line 562) | mod_json_value_t *mod_json_value_set_boolean(mod_json_boolean_t bol) {
function mod_json_value_clear (line 575) | static inline void mod_json_value_clear(mod_json_value_t *val) {
function mod_json_value_assign_null (line 594) | void mod_json_value_assign_null(mod_json_value_t *val) {
function mod_json_value_assign_object (line 602) | void mod_json_value_assign_object(mod_json_value_t *val,
function mod_json_value_assign_array (line 611) | void mod_json_value_assign_array(mod_json_value_t *val, mod_json_array_t...
function mod_json_value_assign_string (line 619) | void mod_json_value_assign_string(mod_json_value_t *val,
function mod_json_value_assign_integer (line 628) | void mod_json_value_assign_integer(mod_json_value_t *val,
function mod_json_value_assign_float (line 637) | void mod_json_value_assign_float(mod_json_value_t *val, mod_json_float_t...
function mod_json_value_assign_boolean (line 645) | void mod_json_value_assign_boolean(mod_json_value_t *val,
function mod_json_value_assign (line 654) | void mod_json_value_assign(mod_json_value_t *dst, mod_json_value_t *src) {
function mod_json_value_merge_array (line 696) | static inline int mod_json_value_merge_array(mod_json_value_t *val,
function mod_json_value_merge_object (line 713) | static inline int mod_json_value_merge_object(mod_json_value_t *val,
function mod_json_value_merge (line 730) | int mod_json_value_merge(mod_json_value_t *dst, mod_json_value_t *src) {
function mod_json_object_t (line 768) | mod_json_object_t *mod_json_value_object(mod_json_value_t *val) {
function mod_json_array_t (line 775) | mod_json_array_t *mod_json_value_array(mod_json_value_t *val) {
function mod_json_string_t (line 782) | mod_json_string_t *mod_json_value_string(mod_json_value_t *val) {
function mod_json_cchar_t (line 789) | mod_json_cchar_t *mod_json_value_cstring(mod_json_value_t *val) {
function mod_json_float_t (line 796) | mod_json_float_t mod_json_value_float(mod_json_value_t *val) {
function mod_json_boolean_t (line 818) | mod_json_boolean_t mod_json_value_boolean(mod_json_value_t *val) {
function mod_json_integer_t (line 849) | mod_json_integer_t mod_json_value_integer(mod_json_value_t *val) {
function mod_json_value_t (line 871) | mod_json_value_t *mod_json_value_clone(mod_json_value_t *val) {
function mod_json_boolean_t (line 902) | static inline mod_json_boolean_t mod_json_value_is_equal_float(
function mod_json_boolean_t (line 908) | mod_json_boolean_t mod_json_value_is_equal(mod_json_value_t *lhs,
function mod_json_value_unset (line 946) | void mod_json_value_unset(mod_json_value_t *val) {
function mod_json_string_expand (line 953) | static inline int mod_json_string_expand(mod_json_string_t *str,
function mod_json_string_reserve (line 982) | int mod_json_string_reserve(mod_json_string_t *str, mod_json_size_t n) {
function mod_json_string_t (line 992) | static inline mod_json_string_t *mod_json_string_malloc(mod_json_size_t ...
function mod_json_string_assign (line 1013) | int mod_json_string_assign(mod_json_string_t *str, mod_json_cchar_t *cstr,
function mod_json_string_t (line 1028) | static inline mod_json_string_t *mod_json_string_set_empty(void) {
function mod_json_string_t (line 1032) | static inline mod_json_string_t *mod_json_string_set_cstr(
function mod_json_string_t (line 1045) | mod_json_string_t *mod_json_string_set(mod_json_cchar_t *cstr,
function mod_json_string_unset (line 1051) | void mod_json_string_unset(mod_json_string_t *str) {
function mod_json_string_reset (line 1058) | void mod_json_string_reset(mod_json_string_t *str) {
function mod_json_string_add_char (line 1065) | static inline int mod_json_string_add_char(mod_json_string_t *str,
function mod_json_string_add_cstr (line 1082) | static inline int mod_json_string_add_cstr(mod_json_string_t *str,
function mod_json_string_add_jstr (line 1103) | static inline int mod_json_string_add_jstr(mod_json_string_t *str,
function mod_json_string_add (line 1109) | int mod_json_string_add(mod_json_string_t *str, mod_json_string_t *val) {
function mod_json_string_append (line 1113) | int mod_json_string_append(mod_json_string_t *str, mod_json_cchar_t *cstr,
function mod_json_size_t (line 1118) | mod_json_size_t mod_json_string_hash(mod_json_string_t *str) {
function mod_json_string_compare (line 1133) | int mod_json_string_compare(mod_json_string_t *str1, mod_json_string_t *...
function mod_json_integer_t (line 1156) | mod_json_integer_t mod_json_string_integer(mod_json_string_t *str) {
function mod_json_float_t (line 1161) | mod_json_float_t mod_json_string_float(mod_json_string_t *str) {
function mod_json_string_flat (line 1165) | static inline int mod_json_string_flat(mod_json_string_t *dst,
function mod_json_string_unflat (line 1219) | static inline int mod_json_string_unflat(mod_json_string_t *dst,
function mod_json_string_t (line 1355) | mod_json_string_t *mod_json_string_encode(mod_json_string_t *src) {
function mod_json_string_t (line 1370) | mod_json_string_t *mod_json_string_decode(mod_json_string_t *src) {
function mod_json_array_t (line 1385) | mod_json_array_t *mod_json_array_set(mod_json_size_t size) {
function mod_json_array_t (line 1407) | mod_json_array_t *mod_json_array_clone(mod_json_array_t *arr) {
function mod_json_boolean_t (line 1424) | mod_json_boolean_t mod_json_array_is_equal(mod_json_array_t *lhs,
function mod_json_array_unset (line 1445) | void mod_json_array_unset(mod_json_array_t *arr) {
function mod_json_array_reset (line 1457) | void mod_json_array_reset(mod_json_array_t *arr) {
function mod_json_array_migrate (line 1468) | static inline void mod_json_array_migrate(mod_json_array_t *arr,
function mod_json_array_expand (line 1482) | static inline int mod_json_array_expand(mod_json_array_t *arr,
function mod_json_array_reserve (line 1504) | int mod_json_array_reserve(mod_json_array_t *arr, mod_json_size_t n) {
function mod_json_array_reverse (line 1514) | void mod_json_array_reverse(mod_json_array_t *arr) {
function mod_json_array_push (line 1527) | int mod_json_array_push(mod_json_array_t *arr, mod_json_value_t *val) {
function mod_json_array_pop (line 1540) | void mod_json_array_pop(mod_json_array_t *arr) {
function mod_json_array_shift (line 1546) | void mod_json_array_shift(mod_json_array_t *arr) {
function mod_json_value_t (line 1558) | mod_json_value_t *mod_json_array_at(mod_json_array_t *arr, mod_json_size...
function mod_json_array_merge (line 1565) | int mod_json_array_merge(mod_json_array_t *dst, mod_json_array_t *src) {
function mod_json_array_resize (line 1605) | int mod_json_array_resize(mod_json_array_t *arr, mod_json_size_t n,
function mod_json_pair_init (line 1644) | static inline void mod_json_pair_init(mod_json_pair_t *pair,
function mod_json_pair_cleanup (line 1651) | static inline void mod_json_pair_cleanup(mod_json_pair_t *pair) {
function mod_json_object_t (line 1658) | mod_json_object_t *mod_json_object_set(mod_json_size_t size) {
function mod_json_object_unset (line 1680) | void mod_json_object_unset(mod_json_object_t *obj) {
function mod_json_object_reset (line 1692) | void mod_json_object_reset(mod_json_object_t *obj) {
function mod_json_object_migrate (line 1703) | static inline void mod_json_object_migrate(mod_json_object_t *obj,
function mod_json_object_expand (line 1717) | static inline int mod_json_object_expand(mod_json_object_t *obj,
function mod_json_pair_t (line 1738) | static inline mod_json_pair_t *mod_json_object_find_pair(mod_json_object...
function mod_json_pair_t (line 1762) | mod_json_pair_t *mod_json_object_insert_force(mod_json_object_t *obj,
function mod_json_pair_t (line 1785) | mod_json_pair_t *mod_json_object_insert(mod_json_object_t *obj,
function mod_json_pair_t (line 1798) | mod_json_pair_t *mod_json_object_assign(mod_json_object_t *obj,
function mod_json_pair_t (line 1822) | mod_json_pair_t *mod_json_object_touch(mod_json_object_t *obj,
function mod_json_object_t (line 1847) | mod_json_object_t *mod_json_object_clone(mod_json_object_t *obj) {
function mod_json_boolean_t (line 1864) | mod_json_boolean_t mod_json_object_is_equal(mod_json_object_t *lhs,
function mod_json_object_erase (line 1887) | void mod_json_object_erase(mod_json_object_t *obj, mod_json_cchar_t *key) {
function mod_json_value_t (line 1910) | mod_json_value_t *mod_json_object_at(mod_json_object_t *obj,
function mod_json_pair_t (line 1928) | mod_json_pair_t *mod_json_object_find(mod_json_object_t *obj,
function mod_json_object_merge (line 1942) | int mod_json_object_merge(mod_json_object_t *dst, mod_json_object_t *src) {
function mod_json_cchar_t (line 1972) | static inline mod_json_cchar_t *mod_json_token_strskp(mod_json_token_t *...
function mod_json_cchar_t (line 1980) | static inline mod_json_cchar_t *mod_json_token_strfquo(mod_json_token_t ...
function mod_json_cchar_t (line 1989) | static inline mod_json_cchar_t *mod_json_token_strfsep(mod_json_token_t ...
function mod_json_token_t (line 1997) | mod_json_token_t *mod_json_token_create(mod_json_option_t *opt) {
function mod_json_token_destroy (line 2027) | void mod_json_token_destroy(mod_json_token_t *tok) {
function mod_json_token_set_tag (line 2031) | static inline void mod_json_token_set_tag(mod_json_token_t *tok,
function mod_json_char_t (line 2039) | static inline mod_json_char_t mod_json_token_tag(mod_json_token_t *tok) {
function mod_json_error_t (line 2046) | mod_json_error_t mod_json_token_error(mod_json_token_t *tok) {
function mod_json_cchar_t (line 2050) | mod_json_cchar_t *mod_json_token_context(mod_json_token_t *tok) {
function mod_json_state_t (line 2054) | mod_json_state_t mod_json_token_state(mod_json_token_t *tok) {
function mod_json_size_t (line 2058) | mod_json_size_t mod_json_token_object_depth(mod_json_token_t *tok) {
function mod_json_size_t (line 2062) | mod_json_size_t mod_json_token_array_depth(mod_json_token_t *tok) {
function mod_json_size_t (line 2066) | mod_json_size_t mod_json_token_depth(mod_json_token_t *tok) {
function mod_json_size_t (line 2070) | mod_json_size_t mod_json_token_max_object_depth(mod_json_token_t *tok) {
function mod_json_size_t (line 2074) | mod_json_size_t mod_json_token_max_array_depth(mod_json_token_t *tok) {
function mod_json_size_t (line 2078) | mod_json_size_t mod_json_token_max_depth(mod_json_token_t *tok) {
function mod_json_void_t (line 2082) | mod_json_void_t *mod_json_token_param(mod_json_token_t *tok) {
function mod_json_token_set_param (line 2086) | void mod_json_token_set_param(mod_json_token_t *tok, mod_json_void_t *pa...
function mod_json_token_set_event (line 2090) | void mod_json_token_set_event(mod_json_token_t *tok, mod_json_event_proc...
function mod_json_event_t (line 2094) | mod_json_event_t mod_json_token_event(mod_json_token_t *tok) {
function mod_json_token_invoke_field (line 2098) | static inline int mod_json_token_invoke_field(mod_json_token_t *tok,
function mod_json_token_invoke_object (line 2109) | static inline int mod_json_token_invoke_object(mod_json_token_t *tok) {
function mod_json_token_invoke_array (line 2118) | static inline int mod_json_token_invoke_array(mod_json_token_t *tok) {
function mod_json_token_invoke_null (line 2127) | static inline int mod_json_token_invoke_null(mod_json_token_t *tok) {
function mod_json_token_invoke_boolean (line 2136) | static inline int mod_json_token_invoke_boolean(mod_json_token_t *tok,
function mod_json_token_invoke_integer (line 2146) | static inline int mod_json_token_invoke_integer(mod_json_token_t *tok,
function mod_json_token_invoke_float (line 2156) | static inline int mod_json_token_invoke_float(mod_json_token_t *tok,
function mod_json_token_invoke_string (line 2166) | static inline int mod_json_token_invoke_string(mod_json_token_t *tok,
function mod_json_cchar_t (line 2177) | static inline mod_json_cchar_t *mod_json_token_start(mod_json_token_t *tok,
function mod_json_cchar_t (line 2201) | static inline mod_json_cchar_t *mod_json_token_value_null(
function mod_json_cchar_t (line 2222) | static inline mod_json_cchar_t *mod_json_token_value_true(
function mod_json_cchar_t (line 2243) | static inline mod_json_cchar_t *mod_json_token_value_false(
function mod_json_cchar_t (line 2265) | static inline mod_json_cchar_t *mod_json_token_value_infinity(
function mod_json_cchar_t (line 2284) | static inline mod_json_cchar_t *mod_json_token_value_string(
function mod_json_cchar_t (line 2302) | static inline mod_json_cchar_t *mod_json_token_value_number(
function mod_json_cchar_t (line 2444) | static inline mod_json_cchar_t *mod_json_token_array_start(
function mod_json_cchar_t (line 2486) | static inline mod_json_cchar_t *mod_json_token_array_half(
function mod_json_cchar_t (line 2600) | static inline mod_json_cchar_t *mod_json_token_array_finish(
function mod_json_cchar_t (line 2657) | static inline mod_json_cchar_t *mod_json_token_object_start(
function mod_json_cchar_t (line 2695) | static inline mod_json_cchar_t *mod_json_token_object_quotekey(
function mod_json_cchar_t (line 2730) | static inline mod_json_cchar_t *mod_json_token_object_simplekey(
function mod_json_cchar_t (line 2765) | static inline mod_json_cchar_t *mod_json_token_object_half1(
function mod_json_cchar_t (line 2806) | static inline mod_json_cchar_t *mod_json_token_object_half2(
function mod_json_cchar_t (line 2927) | static inline mod_json_cchar_t *mod_json_token_object_finish(
function mod_json_cchar_t (line 2984) | static inline mod_json_cchar_t *mod_json_token_null(mod_json_token_t *tok,
function mod_json_cchar_t (line 2996) | static inline mod_json_cchar_t *mod_json_token_finish(mod_json_token_t *...
function mod_json_cchar_t (line 3003) | static inline mod_json_cchar_t *mod_json_token_default(mod_json_token_t ...
function mod_json_token_parse (line 3010) | int mod_json_token_parse(mod_json_token_t *tok, mod_json_cchar_t *cstr) {
function mod_json_parser_insert (line 3061) | static inline int mod_json_parser_insert(mod_json_parser_t *par,
function mod_json_parser_insert_object (line 3082) | static inline int mod_json_parser_insert_object(mod_json_parser_t *par,
function mod_json_parser_insert_array (line 3108) | static inline int mod_json_parser_insert_array(mod_json_parser_t *par,
function mod_json_token_set_parser (line 3134) | static inline void mod_json_token_set_parser(mod_json_token_t *tok,
function mod_json_parser_t (line 3139) | static inline mod_json_parser_t *mod_json_token_parser(mod_json_token_t ...
function mod_json_parser_event_field (line 3143) | static inline int mod_json_parser_event_field(mod_json_token_t *tok,
function mod_json_parser_event_array (line 3158) | static inline int mod_json_parser_event_array(mod_json_token_t *tok) {
function mod_json_parser_event_object (line 3174) | static inline int mod_json_parser_event_object(mod_json_token_t *tok) {
function mod_json_parser_event_null (line 3190) | static inline int mod_json_parser_event_null(mod_json_token_t *tok) {
function mod_json_parser_event_true (line 3204) | static inline int mod_json_parser_event_true(mod_json_token_t *tok) {
function mod_json_parser_event_false (line 3218) | static inline int mod_json_parser_event_false(mod_json_token_t *tok) {
function mod_json_parser_event_boolean (line 3232) | static inline int mod_json_parser_event_boolean(mod_json_token_t *tok,
function mod_json_parser_event_zero (line 3240) | static inline int mod_json_parser_event_zero(mod_json_token_t *tok) {
function mod_json_parser_event_integer (line 3254) | static inline int mod_json_parser_event_integer(mod_json_token_t *tok,
function mod_json_parser_event_zerof (line 3274) | static inline int mod_json_parser_event_zerof(mod_json_token_t *tok) {
function mod_json_parser_event_float (line 3288) | static inline int mod_json_parser_event_float(mod_json_token_t *tok,
function mod_json_parser_event_empty (line 3308) | static inline int mod_json_parser_event_empty(mod_json_token_t *tok) {
function mod_json_parser_event_string (line 3328) | static inline int mod_json_parser_event_string(mod_json_token_t *tok,
function mod_json_parser_event (line 3357) | static int mod_json_parser_event(mod_json_token_t *tok, mod_json_void_t ...
function mod_json_parser_t (line 3390) | static inline mod_json_parser_t *mod_json_parser_create(mod_json_size_t ...
function mod_json_parser_destroy (line 3403) | static inline void mod_json_parser_destroy(mod_json_parser_t *par) {
function mod_json_value_t (line 3414) | mod_json_value_t *mod_json_parse(mod_json_token_t *tok,
function mod_json_value_t (line 3441) | mod_json_value_t *mod_json_parse_simply(mod_json_cchar_t *cstr,
function mod_json_dump_null (line 3461) | static inline int mod_json_dump_null(mod_json_string_t *str) {
function mod_json_dump_boolean (line 3465) | static inline int mod_json_dump_boolean(mod_json_string_t *str,
function mod_json_dump_integer (line 3473) | static inline int mod_json_dump_integer(mod_json_string_t *str,
function mod_json_dump_float (line 3480) | static inline int mod_json_dump_float(mod_json_string_t *str,
function mod_json_dump_string (line 3489) | static inline int mod_json_dump_string(mod_json_string_t *str,
function mod_json_dump_array (line 3503) | static inline int mod_json_dump_array(mod_json_string_t *str,
function mod_json_dump_key (line 3521) | static inline int mod_json_dump_key(mod_json_string_t *str,
function mod_json_dump_object (line 3529) | static inline int mod_json_dump_object(mod_json_string_t *str,
function mod_json_dump_value (line 3549) | static inline int mod_json_dump_value(mod_json_string_t *str,
function mod_json_string_t (line 3581) | mod_json_string_t *mod_json_dump(mod_json_value_t *val) {
FILE: src/ailego/hash/crc32c.cc
function crc32c_slicing8 (line 473) | static inline uint32_t crc32c_slicing8(const void *data, size_t len,
function crc32c_sse42 (line 519) | static inline uint32_t crc32c_sse42(const void *data, size_t len,
function crc32c_sse42 (line 558) | static inline uint32_t crc32c_sse42(const void *data, size_t len,
function crc32c_neon (line 584) | static inline uint32_t crc32c_neon(const void *data, size_t len, uint32_...
type zvec (line 623) | namespace zvec {
type ailego (line 624) | namespace ailego {
FILE: src/ailego/internal/cpu_features.cc
type zvec (line 22) | namespace zvec {
type ailego (line 23) | namespace ailego {
type internal (line 24) | namespace internal {
FILE: src/ailego/internal/cpu_features.h
function namespace (line 18) | namespace zvec {
FILE: src/ailego/io/file.cc
type zvec (line 29) | namespace zvec {
type ailego (line 30) | namespace ailego {
function OpenSafely (line 34) | static inline int OpenSafely(const char *path, int flags) {
function CloseSafely (line 42) | static inline void CloseSafely(int fd) {
function ReadSafely (line 49) | static inline ssize_t ReadSafely(int fd, void *buf, size_t count) {
function PreadSafely (line 57) | static inline ssize_t PreadSafely(int fd, void *buf, size_t count,
function WriteSafely (line 66) | static inline ssize_t WriteSafely(int fd, const void *buf, size_t co...
function PwriteSafely (line 74) | static inline ssize_t PwriteSafely(int fd, const void *buf, size_t c...
function ReadAll (line 83) | static inline size_t ReadAll(int fd, void *buf, size_t count) {
function PreadAll (line 95) | static inline size_t PreadAll(int fd, void *buf, size_t count, ssize...
function WriteAll (line 108) | static inline size_t WriteAll(int fd, const void *buf, size_t count) {
function PwriteAll (line 120) | static inline size_t PwriteAll(int fd, const void *buf, size_t count,
function ailego_do_if_ne_zero (line 158) | ailego_do_if_ne_zero(ftruncate(fd, len)) {
type stat (line 297) | struct stat
function getpagesize (line 704) | static inline int getpagesize(void) {
FILE: src/ailego/io/file_lock.cc
type zvec (line 23) | namespace zvec {
type ailego (line 24) | namespace ailego {
FILE: src/ailego/io/file_lock.h
function namespace (line 19) | namespace zvec {
FILE: src/ailego/io/file_writer.h
function namespace (line 21) | namespace zvec {
FILE: src/ailego/logger/logger.cc
type zvec (line 22) | namespace zvec {
type ailego (line 23) | namespace ailego {
type ConsoleLogger (line 33) | struct ConsoleLogger : public Logger {
method init (line 35) | int init(const Params &) override {
method cleanup (line 40) | int cleanup(void) override {
method log (line 45) | void log(int level, const char *file, int line, const char *format,
FILE: src/ailego/math/cosine_distance_matrix.h
function namespace (line 21) | namespace zvec {
FILE: src/ailego/math/distance.h
function namespace (line 19) | namespace zvec {
FILE: src/ailego/math/euclidean_distance_matrix.h
function namespace (line 22) | namespace zvec {
function Compute (line 184) | static inline void Compute(const ValueType *m, const ValueType *q, size_...
function Compute (line 245) | static inline void Compute(const ValueType *m, const ValueType *q, size_...
function Compute (line 296) | static inline void Compute(const ValueType *m, const ValueType *q, size_...
function Compute (line 357) | static inline void Compute(const ValueType *m, const ValueType *q, size_...
function Compute (line 411) | static inline void Compute(const ValueType *m, const ValueType *q, size_...
function Compute (line 432) | static inline void Compute(const ValueType *m, const ValueType *q, size_...
type EuclideanDistanceMatrix (line 445) | struct EuclideanDistanceMatrix
type EuclideanDistanceMatrix (line 455) | struct EuclideanDistanceMatrix
type EuclideanDistanceMatrix (line 465) | struct EuclideanDistanceMatrix
type EuclideanDistanceMatrix (line 475) | struct EuclideanDistanceMatrix
function Compute (line 501) | static inline void Compute(const void *m_sparse_data_in,
FILE: src/ailego/math/euclidean_distance_matrix_fp16_avx.cc
type zvec (line 19) | namespace zvec {
type ailego (line 20) | namespace ailego {
function SquaredEuclideanDistanceFp16AVX (line 24) | float SquaredEuclideanDistanceFp16AVX(const Float16 *lhs, const Floa...
FILE: src/ailego/math/euclidean_distance_matrix_fp16_avx512.cc
type zvec (line 19) | namespace zvec {
type ailego (line 20) | namespace ailego {
function SquaredEuclideanDistanceFp16AVX512 (line 23) | float SquaredEuclideanDistanceFp16AVX512(const Float16 *lhs, const F...
FILE: src/ailego/math/euclidean_distance_matrix_fp16_avx512fp16.cc
type zvec (line 19) | namespace zvec {
type ailego (line 20) | namespace ailego {
function SquaredEuclideanDistanceFp16AVX512FP16 (line 24) | float SquaredEuclideanDistanceFp16AVX512FP16(const Float16 *lhs,
FILE: src/ailego/math/euclidean_distance_matrix_fp16_dispatch.cc
type zvec (line 18) | namespace zvec {
type ailego (line 19) | namespace ailego {
FILE: src/ailego/math/euclidean_distance_matrix_fp16_neon.cc
type zvec (line 19) | namespace zvec {
type ailego (line 20) | namespace ailego {
function SquaredEuclideanDistanceFp16NEON (line 23) | float SquaredEuclideanDistanceFp16NEON(const Float16 *lhs, const Flo...
FILE: src/ailego/math/euclidean_distance_matrix_fp32_avx.cc
type zvec (line 19) | namespace zvec {
type ailego (line 20) | namespace ailego {
function SquaredEuclideanDistanceFp32AVXInternal (line 26) | float SquaredEuclideanDistanceFp32AVXInternal(const float *lhs,
function SquaredEuclideanDistanceFp32AVX (line 94) | float SquaredEuclideanDistanceFp32AVX(const float *lhs, const float ...
FILE: src/ailego/math/euclidean_distance_matrix_fp32_avx512.cc
type zvec (line 19) | namespace zvec {
type ailego (line 20) | namespace ailego {
function SquaredEuclideanDistanceFp32AVX512Internal (line 29) | float SquaredEuclideanDistanceFp32AVX512Internal(const float *lhs,
function SquaredEuclideanDistanceFp32AVX512 (line 84) | float SquaredEuclideanDistanceFp32AVX512(const float *lhs, const flo...
FILE: src/ailego/math/euclidean_distance_matrix_fp32_dispatch.cc
type zvec (line 18) | namespace zvec {
type ailego (line 19) | namespace ailego {
FILE: src/ailego/math/euclidean_distance_matrix_fp32_neon.cc
type zvec (line 19) | namespace zvec {
type ailego (line 20) | namespace ailego {
function SquaredEuclideanDistanceFp32NEON (line 24) | void SquaredEuclideanDistanceFp32NEON(const float *lhs, const float ...
FILE: src/ailego/math/euclidean_distance_matrix_fp32_sse.cc
type zvec (line 19) | namespace zvec {
type ailego (line 20) | namespace ailego {
function SquaredEuclideanDistanceFp32SSEInternal (line 23) | float SquaredEuclideanDistanceFp32SSEInternal(const float *lhs,
function SquaredEuclideanDistanceFp32SSE (line 75) | float SquaredEuclideanDistanceFp32SSE(const float *lhs, const float ...
FILE: src/ailego/math/euclidean_distance_matrix_int4_avx2.cc
type zvec (line 19) | namespace zvec {
type ailego (line 20) | namespace ailego {
function SquaredEuclideanDistanceInt4AVX2Internal (line 26) | inline float SquaredEuclideanDistanceInt4AVX2Internal(const uint8_t ...
function SquaredEuclideanDistanceInt4AVX2 (line 118) | float SquaredEuclideanDistanceInt4AVX2(const uint8_t *lhs, const uin...
FILE: src/ailego/math/euclidean_distance_matrix_int4_dispatch.cc
type zvec (line 18) | namespace zvec {
type ailego (line 19) | namespace ailego {
FILE: src/ailego/math/euclidean_distance_matrix_int4_sse.cc
type zvec (line 19) | namespace zvec {
type ailego (line 20) | namespace ailego {
function SquaredEuclideanDistanceInt4SSEInternal (line 23) | float SquaredEuclideanDistanceInt4SSEInternal(const uint8_t *lhs,
function SquaredEuclideanDistanceInt4SSE (line 94) | float SquaredEuclideanDistanceInt4SSE(const uint8_t *lhs, const uint...
FILE: src/ailego/math/euclidean_distance_matrix_int8_avx2.cc
type zvec (line 19) | namespace zvec {
type ailego (line 20) | namespace ailego {
function SquaredEuclideanDistanceInt8AVX2Internal (line 26) | float SquaredEuclideanDistanceInt8AVX2Internal(const int8_t *lhs,
function SquaredEuclideanDistanceInt8AVX2 (line 181) | float SquaredEuclideanDistanceInt8AVX2(const int8_t *lhs, const int8...
FILE: src/ailego/math/euclidean_distance_matrix_int8_dispatch.cc
type zvec (line 18) | namespace zvec {
type ailego (line 19) | namespace ailego {
FILE: src/ailego/math/euclidean_distance_matrix_int8_sse.cc
type zvec (line 19) | namespace zvec {
type ailego (line 20) | namespace ailego {
function SquaredEuclideanDistanceInt8SSEInternal (line 23) | inline float SquaredEuclideanDistanceInt8SSEInternal(const int8_t *lhs,
function SquaredEuclideanDistanceInt8SSE (line 162) | float SquaredEuclideanDistanceInt8SSE(const int8_t *lhs, const int8_...
FILE: src/ailego/math/euclidean_distance_matrix_scalar.cc
type zvec (line 20) | namespace zvec {
type ailego (line 21) | namespace ailego {
function SquaredEuclideanDistanceScalar (line 27) | inline float SquaredEuclideanDistanceScalar(const T *m, const T *q,
function EuclideanDistanceScalar (line 40) | inline float EuclideanDistanceScalar(const T *m, const T *q, size_t ...
function SquaredEuclideanDistanceInt4Scalar (line 51) | float SquaredEuclideanDistanceInt4Scalar(const uint8_t *m, const uin...
function EuclideanDistanceInt4Scalar (line 67) | float EuclideanDistanceInt4Scalar(const uint8_t *m, const uint8_t *q,
function SquaredEuclideanDistanceInt8Scalar (line 83) | float SquaredEuclideanDistanceInt8Scalar(const int8_t *m, const int8...
function EuclideanDistanceInt8Scalar (line 88) | float EuclideanDistanceInt8Scalar(const int8_t *m, const int8_t *q,
function SquaredEuclideanDistanceFp16Scalar (line 93) | float SquaredEuclideanDistanceFp16Scalar(const ailego::Float16 *m,
function EuclideanDistanceFp16Scalar (line 98) | float EuclideanDistanceFp16Scalar(const ailego::Float16 *m,
function SquaredEuclideanDistanceFp32Scalar (line 103) | float SquaredEuclideanDistanceFp32Scalar(const float *m, const float...
function EuclideanDistanceFp32Scalar (line 108) | float EuclideanDistanceFp32Scalar(const float *m, const float *q, si...
FILE: src/ailego/math/hamming_distance_matrix.cc
type zvec (line 20) | namespace zvec {
type ailego (line 21) | namespace ailego {
function HammingDistanceAVX (line 88) | static inline size_t HammingDistanceAVX(const uint32_t *lhs,
function HammingDistanceAVX (line 206) | static inline size_t HammingDistanceAVX(const uint64_t *lhs,
function HammingDistance (line 215) | static inline size_t HammingDistance(const uint32_t *lhs, const uint...
function HammingDistance (line 252) | static inline size_t HammingDistance(const uint64_t *lhs, const uint...
function HammingDistance (line 277) | static inline size_t HammingDistance(const uint32_t *lhs, const uint...
FILE: src/ailego/math/hamming_distance_matrix.h
function namespace (line 21) | namespace zvec {
FILE: src/ailego/math/inner_product_matrix.h
function namespace (line 25) | namespace zvec {
function Compute (line 253) | static inline void Compute(const ValueType *m, const ValueType *q, size_...
function Compute (line 310) | static inline void Compute(const ValueType *m, const ValueType *q, size_...
function Compute (line 358) | static inline void Compute(const ValueType *m, const ValueType *q, size_...
function Compute (line 419) | static inline void Compute(const ValueType *m, const ValueType *q, size_...
type MinusInnerProductMatrix (line 465) | struct MinusInnerProductMatrix
function Compute (line 473) | static inline void Compute(const ValueType *m, const ValueType *q, size_...
function Compute (line 518) | static inline void Compute(const ValueType *m, const ValueType *q, size_...
function Compute (line 552) | static inline void Compute(const ValueType *m, const ValueType *q, size_...
function Compute (line 610) | static inline void Compute(const ValueType *m, const ValueType *q, size_...
function Compute (line 658) | static inline void Compute(const ValueType *m, const ValueType *q, size_...
function Compute (line 719) | static inline void Compute(const ValueType *m, const ValueType *q, size_...
type SparseSegmentInfo (line 764) | struct SparseSegmentInfo {
function vec_cnt_ (line 767) | uint32_t vec_cnt_{0}
function Float16 (line 800) | struct MinusInnerProductSparseMatrix<Float16> {
function float (line 897) | struct MinusInnerProductSparseMatrix<float> {
FILE: src/ailego/math/inner_product_matrix_fp16_avx.cc
type zvec (line 19) | namespace zvec {
type ailego (line 20) | namespace ailego {
function InnerProductFp16AVX (line 26) | float InnerProductFp16AVX(const Float16 *lhs, const Float16 *rhs, si...
function MinusInnerProductFp16AVX (line 34) | float MinusInnerProductFp16AVX(const Float16 *lhs, const Float16 *rhs,
function InnerProductSparseInSegmentFp16AVX (line 553) | float InnerProductSparseInSegmentFp16AVX(uint32_t m_sparse_count,
FILE: src/ailego/math/inner_product_matrix_fp16_avx512.cc
type zvec (line 19) | namespace zvec {
type ailego (line 20) | namespace ailego {
function InnerProductFp16AVX512 (line 23) | float InnerProductFp16AVX512(const Float16 *lhs, const Float16 *rhs,
function MinusInnerProductFp16AVX512 (line 32) | float MinusInnerProductFp16AVX512(const Float16 *lhs, const Float16 ...
FILE: src/ailego/math/inner_product_matrix_fp16_avx512fp16.cc
type zvec (line 19) | namespace zvec {
type ailego (line 20) | namespace ailego {
function InnerProductFp16AVX512FP16 (line 24) | float InnerProductFp16AVX512FP16(const Float16 *lhs, const Float16 *...
function MinusInnerProductFp16AVX512FP16 (line 76) | float MinusInnerProductFp16AVX512FP16(const Float16 *lhs, const Floa...
function InnerProductSparseInSegmentFp16AVX512FP16 (line 86) | float InnerProductSparseInSegmentFp16AVX512FP16(uint32_t m_sparse_co...
FILE: src/ailego/math/inner_product_matrix_fp16_dispatch.cc
type zvec (line 18) | namespace zvec {
type ailego (line 19) | namespace ailego {
function ComputeInnerProductSparseInSegmentFp16 (line 153) | float ComputeInnerProductSparseInSegmentFp16(uint32_t m_sparse_count,
FILE: src/ailego/math/inner_product_matrix_fp16_neon.cc
type zvec (line 19) | namespace zvec {
type ailego (line 20) | namespace ailego {
function InnerProductFp16NEON (line 23) | float InnerProductFp16NEON(const Float16 *lhs, const Float16 *rhs,
function MinusInnerProductFp16NEON (line 32) | float MinusInnerProductFp16NEON(const Float16 *lhs, const Float16 *rhs,
FILE: src/ailego/math/inner_product_matrix_fp32_avx.cc
type zvec (line 19) | namespace zvec {
type ailego (line 20) | namespace ailego {
function InnerProductFp32AVXInternal (line 30) | float InnerProductFp32AVXInternal(const float *lhs, const float *rhs,
function InnerProductFp32AVX (line 98) | float InnerProductFp32AVX(const float *lhs, const float *rhs, size_t...
function MinusInnerProductFp32AVX (line 106) | float MinusInnerProductFp32AVX(const float *lhs, const float *rhs,
FILE: src/ailego/math/inner_product_matrix_fp32_avx512.cc
type zvec (line 19) | namespace zvec {
type ailego (line 20) | namespace ailego {
function InnerProductFp32AVX512Internal (line 33) | float InnerProductFp32AVX512Internal(const float *lhs, const float *...
function InnerProductFp32AVX512 (line 82) | float InnerProductFp32AVX512(const float *lhs, const float *rhs, siz...
function MinusInnerProductFp32AVX512 (line 94) | float MinusInnerProductFp32AVX512(const float *lhs, const float *rhs,
FILE: src/ailego/math/inner_product_matrix_fp32_dispatch.cc
type zvec (line 18) | namespace zvec {
type ailego (line 19) | namespace ailego {
function ComputeInnerProductSparseInSegmentFp32 (line 137) | float ComputeInnerProductSparseInSegmentFp32(uint32_t m_sparse_count,
FILE: src/ailego/math/inner_product_matrix_fp32_neon.cc
type zvec (line 19) | namespace zvec {
type ailego (line 20) | namespace ailego {
function InnerProductFp32NEON (line 26) | float InnerProductFp32NEON(const float *lhs, const float *rhs, size_...
function MinusInnerProductFp32NEON (line 57) | float MinusInnerProductFp32NEON(const float *lhs, const float *rhs,
FILE: src/ailego/math/inner_product_matrix_fp32_sse.cc
type zvec (line 19) | namespace zvec {
type ailego (line 20) | namespace ailego {
function InnerProductFp32SSEInternal (line 26) | float InnerProductFp32SSEInternal(const float *lhs, const float *rhs,
function InnerProductFp32SSE (line 80) | float InnerProductFp32SSE(const float *lhs, const float *rhs, size_t...
function MinusInnerProductFp32SSE (line 84) | float MinusInnerProductFp32SSE(const float *lhs, const float *rhs,
function InnerProductSparseInSegmentFp32SSE (line 130) | float InnerProductSparseInSegmentFp32SSE(uint32_t m_sparse_count,
FILE: src/ailego/math/inner_product_matrix_int4_avx2.cc
type zvec (line 19) | namespace zvec {
type ailego (line 20) | namespace ailego {
function InnerProductInt4AVX2Internal (line 29) | float InnerProductInt4AVX2Internal(const uint8_t *lhs, const uint8_t...
function InnerProductInt4AVX2 (line 121) | float InnerProductInt4AVX2(const uint8_t *lhs, const uint8_t *rhs,
function MinusInnerProductInt4AVX2 (line 130) | float MinusInnerProductInt4AVX2(const uint8_t *lhs, const uint8_t *rhs,
FILE: src/ailego/math/inner_product_matrix_int4_dispatch.cc
type zvec (line 18) | namespace zvec {
type ailego (line 19) | namespace ailego {
FILE: src/ailego/math/inner_product_matrix_int4_sse.cc
type zvec (line 19) | namespace zvec {
type ailego (line 20) | namespace ailego {
function InnerProductInt4SSEInternal (line 25) | float InnerProductInt4SSEInternal(const uint8_t *lhs, const uint8_t ...
function InnerProductInt4SSE (line 95) | float InnerProductInt4SSE(const uint8_t *lhs, const uint8_t *rhs, si...
function MinusInnerProductInt4SSE (line 99) | float MinusInnerProductInt4SSE(const uint8_t *lhs, const uint8_t *rhs,
FILE: src/ailego/math/inner_product_matrix_int8_avx2.cc
type zvec (line 19) | namespace zvec {
type ailego (line 20) | namespace ailego {
function InnerProductInt8AVX2Internal (line 29) | inline float InnerProductInt8AVX2Internal(const int8_t *lhs, const i...
function InnerProductInt8AVX2 (line 187) | float InnerProductInt8AVX2(const int8_t *lhs, const int8_t *rhs, siz...
function MinusInnerProductInt8AVX2 (line 195) | float MinusInnerProductInt8AVX2(const int8_t *lhs, const int8_t *rhs,
FILE: src/ailego/math/inner_product_matrix_int8_dispatch.cc
type zvec (line 18) | namespace zvec {
type ailego (line 19) | namespace ailego {
FILE: src/ailego/math/inner_product_matrix_int8_sse.cc
type zvec (line 19) | namespace zvec {
type ailego (line 20) | namespace ailego {
function InnerProductInt8SSEInternal (line 27) | float InnerProductInt8SSEInternal(const int8_t *lhs, const int8_t *rhs,
function InnerProductInt8SSE (line 154) | float InnerProductInt8SSE(const int8_t *lhs, const int8_t *rhs, size...
function MinusInnerProductInt8SSE (line 158) | float MinusInnerProductInt8SSE(const int8_t *lhs, const int8_t *rhs,
FILE: src/ailego/math/inner_product_matrix_scalar.cc
type zvec (line 24) | namespace zvec {
type ailego (line 25) | namespace ailego {
function InnerProductScalar (line 31) | inline float InnerProductScalar(const T *m, const T *q, size_t dim) {
function MinusInnerProductScalar (line 42) | inline float MinusInnerProductScalar(const T *m, const T *q, size_t ...
function InnerProductInt4Scalar (line 52) | float InnerProductInt4Scalar(const uint8_t *m, const uint8_t *q, siz...
function MinusInnerProductInt4Scalar (line 66) | float MinusInnerProductInt4Scalar(const uint8_t *m, const uint8_t *q,
function InnerProductInt8Scalar (line 80) | float InnerProductInt8Scalar(const int8_t *m, const int8_t *q, size_...
function MinusInnerProductInt8Scalar (line 84) | float MinusInnerProductInt8Scalar(const int8_t *m, const int8_t *q,
function InnerProductFp16Scalar (line 89) | float InnerProductFp16Scalar(const ailego::Float16 *m, const ailego:...
function MinusInnerProductFp16Scalar (line 94) | float MinusInnerProductFp16Scalar(const ailego::Float16 *m,
function InnerProductFp32Scalar (line 99) | float InnerProductFp32Scalar(const float *m, const float *q, size_t ...
function MinusInnerProductFp32Scalar (line 103) | float MinusInnerProductFp32Scalar(const float *m, const float *q, si...
function ComputeSegments (line 155) | float ComputeSegments(const void *m_sparse_data_in,
function MinusInnerProductSparseFp16Scalar (line 236) | float MinusInnerProductSparseFp16Scalar(const void *m_sparse_data_in,
function MinusInnerProductSparseFp32Scalar (line 241) | float MinusInnerProductSparseFp32Scalar(const void *m_sparse_data_in,
function InnerProductSparseInSegmentFp16Scalar (line 246) | float InnerProductSparseInSegmentFp16Scalar(uint32_t m_sparse_count,
function InnerProductSparseInSegmentFp32Scalar (line 272) | float InnerProductSparseInSegmentFp32Scalar(uint32_t m_sparse_count,
FILE: src/ailego/math/mips_euclidean_distance_matrix.h
function namespace (line 24) | namespace zvec {
FILE: src/ailego/math/mips_euclidean_distance_matrix_fp16_avx.cc
type zvec (line 19) | namespace zvec {
type ailego (line 20) | namespace ailego {
function InnerProductAndSquaredNormFp16AVX (line 24) | float InnerProductAndSquaredNormFp16AVX(const Float16 *lhs, const Fl...
function MipsEuclideanDistanceSphericalInjectionFp16AVX (line 114) | float MipsEuclideanDistanceSphericalInjectionFp16AVX(const Float16 *...
function MipsEuclideanDistanceRepeatedQuadraticInjectionFp16AVX (line 126) | float MipsEuclideanDistanceRepeatedQuadraticInjectionFp16AVX(
FILE: src/ailego/math/mips_euclidean_distance_matrix_fp16_avx512.cc
type zvec (line 19) | namespace zvec {
type ailego (line 20) | namespace ailego {
function InnerProductAndSquaredNormFp16AVX512 (line 24) | float InnerProductAndSquaredNormFp16AVX512(const Float16 *lhs,
function MipsEuclideanDistanceSphericalInjectionFp16AVX512 (line 133) | float MipsEuclideanDistanceSphericalInjectionFp16AVX512(const Float1...
function MipsEuclideanDistanceRepeatedQuadraticInjectionFp16AVX512 (line 145) | float MipsEuclideanDistanceRepeatedQuadraticInjectionFp16AVX512(
FILE: src/ailego/math/mips_euclidean_distance_matrix_fp16_dispatch.cc
type zvec (line 18) | namespace zvec {
type ailego (line 19) | namespace ailego {
FILE: src/ailego/math/mips_euclidean_distance_matrix_fp16_neon.cc
type zvec (line 19) | namespace zvec {
type ailego (line 20) | namespace ailego {
function InnerProductAndSquaredNormFp16NEON (line 25) | float InnerProductAndSquaredNormFp16NEON(const Float16 *lhs, const F...
function InnerProductAndSquaredNormFp16NEON (line 72) | float InnerProductAndSquaredNormFp16NEON(const Float16 *lhs, const F...
function MipsEuclideanDistanceSphericalInjectionFp16NEON (line 125) | float MipsEuclideanDistanceSphericalInjectionFp16NEON(const Float16 ...
function MipsEuclideanDistanceRepeatedQuadraticInjectionFp16NEON (line 137) | float MipsEuclideanDistanceRepeatedQuadraticInjectionFp16NEON(
FILE: src/ailego/math/mips_euclidean_distance_matrix_fp32_avx.cc
type zvec (line 19) | namespace zvec {
type ailego (line 20) | namespace ailego {
function InnerProductAndSquaredNormFp32AVX (line 29) | float InnerProductAndSquaredNormFp32AVX(const float *lhs, const floa...
FILE: src/ailego/math/mips_euclidean_distance_matrix_fp32_avx512.cc
type zvec (line 19) | namespace zvec {
type ailego (line 20) | namespace ailego {
function InnerProductAndSquaredNormFp32AVX512 (line 34) | float InnerProductAndSquaredNormFp32AVX512(const float *lhs, const f...
function MipsEuclideanDistanceSphericalInjectionFp32AVX512 (line 109) | float MipsEuclideanDistanceSphericalInjectionFp32AVX512(const float ...
function MipsEuclideanDistanceRepeatedQuadraticInjectionFp32AVX512 (line 127) | float MipsEuclideanDistanceRepeatedQuadraticInjectionFp32AVX512(
FILE: src/ailego/math/mips_euclidean_distance_matrix_fp32_dispatch.cc
type zvec (line 18) | namespace zvec {
type ailego (line 19) | namespace ailego {
FILE: src/ailego/math/mips_euclidean_distance_matrix_fp32_neon.cc
type zvec (line 19) | namespace zvec {
type ailego (line 20) | namespace ailego {
function InnerProductAndSquaredNormFp32NEON (line 24) | float InnerProductAndSquaredNormFp32NEON(const float *lhs, const flo...
FILE: src/ailego/math/mips_euclidean_distance_matrix_fp32_sse.cc
type zvec (line 19) | namespace zvec {
type ailego (line 20) | namespace ailego {
function InnerProductAndSquaredNormFp32SSE (line 24) | float InnerProductAndSquaredNormFp32SSE(const float *lhs, const floa...
FILE: src/ailego/math/mips_euclidean_distance_matrix_int4_avx2.cc
type zvec (line 21) | namespace zvec {
type ailego (line 22) | namespace ailego {
function InnerProductAndSquaredNormInt4AVX2 (line 26) | float InnerProductAndSquaredNormInt4AVX2(const uint8_t *lhs, const u...
FILE: src/ailego/math/mips_euclidean_distance_matrix_int4_dispatch.cc
type zvec (line 20) | namespace zvec {
type ailego (line 21) | namespace ailego {
FILE: src/ailego/math/mips_euclidean_distance_matrix_int4_sse.cc
type zvec (line 21) | namespace zvec {
type ailego (line 22) | namespace ailego {
function InnerProductAndSquaredNormInt4SSE (line 26) | float InnerProductAndSquaredNormInt4SSE(const uint8_t *lhs, const ui...
FILE: src/ailego/math/mips_euclidean_distance_matrix_int8_avx2.cc
type zvec (line 19) | namespace zvec {
type ailego (line 20) | namespace ailego {
function InnerProductAndSquaredNormInt8AVX2 (line 24) | float InnerProductAndSquaredNormInt8AVX2(const int8_t *lhs, const in...
FILE: src/ailego/math/mips_euclidean_distance_matrix_int8_dispatch.cc
type zvec (line 18) | namespace zvec {
type ailego (line 19) | namespace ailego {
FILE: src/ailego/math/mips_euclidean_distance_matrix_int8_sse.cc
type zvec (line 19) | namespace zvec {
type ailego (line 20) | namespace ailego {
function InnerProductAndSquaredNormInt8SSE (line 24) | float InnerProductAndSquaredNormInt8SSE(const int8_t *lhs, const int...
FILE: src/ailego/math/mips_euclidean_distance_matrix_scalar.cc
type zvec (line 23) | namespace zvec {
type ailego (line 24) | namespace ailego {
function MipsEuclideanDistanceSphericalInjectionScalar (line 30) | inline float MipsEuclideanDistanceSphericalInjectionScalar(const T *p,
function MipsEuclideanDistanceRepeatedQuadraticInjectionScalar (line 50) | inline float MipsEuclideanDistanceRepeatedQuadraticInjectionScalar(
function Squared (line 78) | static inline float Squared(uint8_t v) {
function MipsEuclideanDistanceSphericalInjectionInt4Scalar (line 85) | float MipsEuclideanDistanceSphericalInjectionInt4Scalar(const uint8_...
function MipsEuclideanDistanceRepeatedQuadraticInjectionInt4Scalar (line 106) | float MipsEuclideanDistanceRepeatedQuadraticInjectionInt4Scalar(
function MipsEuclideanDistanceSphericalInjectionInt8Scalar (line 133) | float MipsEuclideanDistanceSphericalInjectionInt8Scalar(const int8_t...
function MipsEuclideanDistanceRepeatedQuadraticInjectionInt8Scalar (line 139) | float MipsEuclideanDistanceRepeatedQuadraticInjectionInt8Scalar(
function MipsEuclideanDistanceSphericalInjectionFp16Scalar (line 145) | float MipsEuclideanDistanceSphericalInjectionFp16Scalar(
function MipsEuclideanDistanceRepeatedQuadraticInjectionFp16Scalar (line 151) | float MipsEuclideanDistanceRepeatedQuadraticInjectionFp16Scalar(
function MipsEuclideanDistanceSphericalInjectionFp32Scalar (line 158) | float MipsEuclideanDistanceSphericalInjectionFp32Scalar(const float *p,
function MipsEuclideanDistanceRepeatedQuadraticInjectionFp32Scalar (line 164) | float MipsEuclideanDistanceRepeatedQuadraticInjectionFp32Scalar(
FILE: src/ailego/math/norm1_matrix.h
function namespace (line 21) | namespace zvec {
FILE: src/ailego/math/norm2_matrix.h
function namespace (line 22) | namespace zvec {
function Compute (line 222) | static inline void Compute(const ValueType *m, size_t dim, float *out) {
function Compute (line 251) | static inline void Compute(const ValueType *m, size_t dim, float *out) {
function Compute (line 290) | static inline void Compute(const ValueType *m, size_t dim, float *out) {
type SquaredNorm2Matrix (line 308) | struct SquaredNorm2Matrix
function Compute (line 313) | static inline void Compute(const ValueType *m, size_t dim, float *out) {
function Compute (line 340) | static inline void Compute(const ValueType *m, size_t dim, float *out) {
type Norm2Matrix (line 378) | struct Norm2Matrix
type SquaredNorm2Matrix (line 389) | struct SquaredNorm2Matrix
type Norm2Matrix (line 403) | struct Norm2Matrix
type SquaredNorm2Matrix (line 414) | struct SquaredNorm2Matrix
FILE: src/ailego/math/normalizer.cc
type zvec (line 17) | namespace zvec {
type ailego (line 18) | namespace ailego {
function NormalizeNEON (line 21) | static inline void NormalizeNEON(float *arr, size_t dim, float norm) {
function NormalizeNEON (line 47) | static inline void NormalizeNEON(float16_t *arr, size_t dim, float n...
function NormalizeNEON (line 76) | static inline void NormalizeNEON(float16_t *arr, size_t dim, float n...
function NormalizeAVX512 (line 121) | static inline void NormalizeAVX512(float *arr, size_t dim, float nor...
function NormalizeAVX (line 168) | static inline void NormalizeAVX(float *arr, size_t dim, float norm) {
function NormalizeAVX512 (line 221) | static inline void NormalizeAVX512(uint16_t *arr, size_t dim, float ...
function NormalizeAVX (line 288) | static inline void NormalizeAVX(uint16_t *arr, size_t dim, float nor...
function NormalizeSSE (line 358) | static inline void NormalizeSSE(float *arr, size_t dim, float norm) {
FILE: src/ailego/math/normalizer.h
function namespace (line 19) | namespace zvec {
FILE: src/ailego/math_batch/cosine_distance_batch.h
function namespace (line 24) | namespace zvec::ailego::DistanceBatch {
FILE: src/ailego/math_batch/distance_batch.h
function namespace (line 22) | namespace zvec::ailego {
function ComputeBatch (line 36) | static inline void ComputeBatch(const ValueType **m, const ValueType *q,
FILE: src/ailego/math_batch/inner_product_distance_batch.h
function namespace (line 23) | namespace zvec::ailego::DistanceBatch {
FILE: src/ailego/math_batch/inner_product_distance_batch_dispatch.cc
type zvec::ailego::DistanceBatch (line 23) | namespace zvec::ailego::DistanceBatch {
function DistanceBatchQueryPreprocessFunc (line 157) | DistanceBatchQueryPreprocessFunc
FILE: src/ailego/math_batch/inner_product_distance_batch_impl_fp16_avx2.cc
type zvec::ailego::DistanceBatch (line 21) | namespace zvec::ailego::DistanceBatch {
function compute_one_to_many_inner_product_avx2_fp16 (line 26) | static std::enable_if_t<std::is_same_v<ValueType, ailego::Float16>, void>
function compute_one_to_many_inner_product_avx2_fp16_1 (line 91) | void compute_one_to_many_inner_product_avx2_fp16_1(
function compute_one_to_many_inner_product_avx2_fp16_12 (line 99) | void compute_one_to_many_inner_product_avx2_fp16_12(
FILE: src/ailego/math_batch/inner_product_distance_batch_impl_fp16_avx512.cc
type zvec::ailego::DistanceBatch (line 21) | namespace zvec::ailego::DistanceBatch {
function compute_one_to_many_inner_product_avx512f_fp16 (line 26) | static std::enable_if_t<std::is_same_v<ValueType, ailego::Float16>, void>
function compute_one_to_many_inner_product_avx512f_fp16_1 (line 111) | void compute_one_to_many_inner_product_avx512f_fp16_1(
function compute_one_to_many_inner_product_avx512f_fp16_12 (line 119) | void compute_one_to_many_inner_product_avx512f_fp16_12(
FILE: src/ailego/math_batch/inner_product_distance_batch_impl_fp16_avx512fp16.cc
type zvec::ailego::DistanceBatch (line 21) | namespace zvec::ailego::DistanceBatch {
function compute_one_to_many_inner_product_avx512fp16_fp16 (line 25) | static std::enable_if_t<std::is_same_v<ValueType, ailego::Float16>, void>
function compute_one_to_many_inner_product_avx512fp16_fp16_1 (line 75) | void compute_one_to_many_inner_product_avx512fp16_fp16_1(
function compute_one_to_many_inner_product_avx512fp16_fp16_12 (line 83) | void compute_one_to_many_inner_product_avx512fp16_fp16_12(
FILE: src/ailego/math_batch/inner_product_distance_batch_impl_fp32_avx2.cc
type zvec::ailego::DistanceBatch (line 21) | namespace zvec::ailego::DistanceBatch {
function sum4 (line 25) | inline float sum4(__m128 v) {
function __m128 (line 30) | inline __m128 sum_top_bottom_avx(__m256 v) {
function compute_one_to_many_inner_product_avx2_fp32 (line 37) | static std::enable_if_t<std::is_same_v<ValueType, float>, void>
function compute_one_to_many_inner_product_avx2_fp32_1 (line 118) | void compute_one_to_many_inner_product_avx2_fp32_1(
function compute_one_to_many_inner_product_avx2_fp32_12 (line 125) | void compute_one_to_many_inner_product_avx2_fp32_12(
FILE: src/ailego/math_batch/inner_product_distance_batch_impl_int8_avx2.cc
type zvec::ailego::DistanceBatch (line 20) | namespace zvec::ailego::DistanceBatch {
function compute_one_to_many_inner_product_avx2_int8 (line 25) | static std::enable_if_t<std::is_same_v<ValueType, int8_t>, void>
function compute_one_to_many_inner_product_avx2_int8_1 (line 88) | void compute_one_to_many_inner_product_avx2_int8_1(
function compute_one_to_many_inner_product_avx2_int8_12 (line 95) | void compute_one_to_many_inner_product_avx2_int8_12(
FILE: src/ailego/math_batch/inner_product_distance_batch_impl_int8_avx512fp16.cc
type zvec::ailego::DistanceBatch (line 20) | namespace zvec::ailego::DistanceBatch {
function compute_one_to_many_inner_product_avx512_vnni_int8_query_preprocess (line 24) | void compute_one_to_many_inner_product_avx512_vnni_int8_query_preprocess(
function compute_one_to_many_inner_product_avx512_vnni_int8 (line 51) | static void compute_one_to_many_inner_product_avx512_vnni_int8(
function compute_one_to_many_inner_product_avx512_vnni_int8_1 (line 157) | void compute_one_to_many_inner_product_avx512_vnni_int8_1(
function compute_one_to_many_inner_product_avx512_vnni_int8_12 (line 164) | void compute_one_to_many_inner_product_avx512_vnni_int8_12(
FILE: src/ailego/parallel/lock.h
function lock (line 42) | void lock(void) {
function try_lock (line 55) | bool try_lock(void) {
function unlock (line 62) | void unlock(void) {
function class (line 80) | class SpinMutex {
function class (line 120) | class SharedMutex {
FILE: src/ailego/parallel/multi_thread_list.h
function produce (line 31) | bool produce(const T &item) {
function produce (line 43) | bool produce(T &&item) {
function consume (line 55) | bool consume(T *item) {
function done (line 69) | void done() {
function reset (line 76) | void reset() {
function stop_consume (line 81) | void stop_consume() {
function resume_consume (line 87) | void resume_consume() {
function size_limit_ (line 93) | size_t size_limit_{0}
FILE: src/ailego/parallel/semaphore.h
function namespace (line 23) | namespace zvec {
FILE: src/ailego/parallel/thread_pool.cc
function BindThreads (line 20) | static inline void BindThreads(std::vector<std::thread> &pool) {
function UnbindThreads (line 33) | static inline void UnbindThreads(std::vector<std::thread> &pool) {
function BindThreads (line 45) | static inline void BindThreads(std::vector<std::thread> &) {}
function UnbindThreads (line 46) | static inline void UnbindThreads(std::vector<std::thread> &) {}
type zvec (line 49) | namespace zvec {
type ailego (line 50) | namespace ailego {
FILE: src/ailego/pattern/scope_guard.h
function namespace (line 19) | namespace zvec {
type ScopeGuard (line 122) | struct ScopeGuard {
FILE: src/ailego/utility/bit_string_helper.h
function namespace (line 20) | namespace zvec {
function offset (line 106) | size_t offset() {
FILE: src/ailego/utility/bitset_helper.cc
function bitset_and (line 27) | static inline void bitset_and(uint32_t *lhs, const uint32_t *rhs, size_t...
function bitset_andnot (line 46) | static inline void bitset_andnot(uint32_t *lhs, const uint32_t *rhs,
function bitset_or (line 66) | static inline void bitset_or(uint32_t *lhs, const uint32_t *rhs, size_t ...
function bitset_xor (line 85) | static inline void bitset_xor(uint32_t *lhs, const uint32_t *rhs, size_t...
function bitset_not (line 104) | static inline void bitset_not(uint32_t *lhs, size_t size) {
function bitset_test_all (line 124) | static inline bool bitset_test_all(const uint32_t *lhs, size_t size) {
function bitset_test_any (line 153) | static inline bool bitset_test_any(const uint32_t *lhs, size_t size) {
function bitset_test_none (line 182) | static inline bool bitset_test_none(const uint32_t *lhs, size_t size) {
function bitset_and (line 212) | static inline void bitset_and(uint32_t *lhs, const uint32_t *rhs, size_t...
function bitset_andnot (line 255) | static inline void bitset_andnot(uint32_t *lhs, const uint32_t *rhs,
function bitset_or (line 299) | static inline void bitset_or(uint32_t *lhs, const uint32_t *rhs, size_t ...
function bitset_xor (line 342) | static inline void bitset_xor(uint32_t *lhs, const uint32_t *rhs, size_t...
function bitset_not (line 385) | static inline void bitset_not(uint32_t *lhs, size_t size) {
function bitset_test_all (line 428) | static inline bool bitset_test_all(const uint32_t *lhs, size_t size) {
function bitset_test_any (line 484) | static inline bool bitset_test_any(const uint32_t *lhs, size_t size) {
function bitset_test_none (line 536) | static inline bool bitset_test_none(const uint32_t *lhs, size_t size) {
function bitset_and (line 593) | static inline void bitset_and(uint32_t *lhs, const uint32_t *rhs, size_t...
function bitset_andnot (line 622) | static inline void bitset_andnot(uint32_t *lhs, const uint32_t *rhs,
function bitset_or (line 652) | static inline void bitset_or(uint32_t *lhs, const uint32_t *rhs, size_t ...
function bitset_xor (line 681) | static inline void bitset_xor(uint32_t *lhs, const uint32_t *rhs, size_t...
function bitset_not (line 710) | static inline void bitset_not(uint32_t *lhs, size_t size) {
function bitset_test_all (line 738) | static inline bool bitset_test_all(const uint32_t *lhs, size_t size) {
function bitset_test_any (line 796) | static inline bool bitset_test_any(const uint32_t *lhs, size_t size) {
function bitset_test_none (line 855) | static inline bool bitset_test_none(const uint32_t *lhs, size_t size) {
function bitset_and (line 916) | static inline void bitset_and(uint32_t *lhs, const uint32_t *rhs, size_t...
function bitset_andnot (line 950) | static inline void bitset_andnot(uint32_t *lhs, const uint32_t *rhs,
function bitset_or (line 985) | static inline void bitset_or(uint32_t *lhs, const uint32_t *rhs, size_t ...
function bitset_xor (line 1019) | static inline void bitset_xor(uint32_t *lhs, const uint32_t *rhs, size_t...
function bitset_not (line 1053) | static inline void bitset_not(uint32_t *lhs, size_t size) {
function bitset_test_all (line 1087) | static inline bool bitset_test_all(const uint32_t *lhs, size_t size) {
function bitset_test_any (line 1144) | static inline bool bitset_test_any(const uint32_t *lhs, size_t size) {
function bitset_test_none (line 1201) | static inline bool bitset_test_none(const uint32_t *lhs, size_t size) {
function bitset_and (line 1259) | static inline void bitset_and(uint32_t *lhs, const uint32_t *rhs, size_t...
function bitset_andnot (line 1281) | static inline void bitset_andnot(uint32_t *lhs, const uint32_t *rhs,
function bitset_or (line 1304) | static inline void bitset_or(uint32_t *lhs, const uint32_t *rhs, size_t ...
function bitset_xor (line 1326) | static inline void bitset_xor(uint32_t *lhs, const uint32_t *rhs, size_t...
function bitset_not (line 1348) | static inline void bitset_not(uint32_t *lhs, size_t size) {
function bitset_test_all (line 1370) | static inline bool bitset_test_all(const uint32_t *lhs, size_t size) {
function bitset_test_any (line 1407) | static inline bool bitset_test_any(const uint32_t *lhs, size_t size) {
function bitset_test_none (line 1444) | static inline bool bitset_test_none(const uint32_t *lhs, size_t size) {
function bitset_cardinality (line 1484) | static inline size_t bitset_cardinality(const uint32_t *lhs, size_t size) {
function bitset_xor_cardinality (line 1515) | static inline size_t bitset_xor_cardinality(const uint32_t *lhs,
function bitset_and_cardinality (line 1549) | static inline size_t bitset_and_cardinality(const uint32_t *lhs,
function bitset_andnot_cardinality (line 1583) | static inline size_t bitset_andnot_cardinality(const uint32_t *lhs,
function bitset_or_cardinality (line 1618) | static inline size_t bitset_or_cardinality(const uint32_t *lhs,
function bitset_cardinality (line 1653) | static inline size_t bitset_cardinality(const uint32_t *lhs, size_t size) {
function bitset_xor_cardinality (line 1689) | static inline size_t bitset_xor_cardinality(const uint32_t *lhs,
function bitset_and_cardinality (line 1726) | static inline size_t bitset_and_cardinality(const uint32_t *lhs,
function bitset_andnot_cardinality (line 1763) | static inline size_t bitset_andnot_cardinality(const uint32_t *lhs,
function bitset_or_cardinality (line 1805) | static inline size_t bitset_or_cardinality(const uint32_t *lhs,
function bitset_cardinality (line 1843) | static inline size_t bitset_cardinality(const uint32_t *lhs, size_t size) {
function bitset_xor_cardinality (line 1867) | static inline size_t bitset_xor_cardinality(const uint32_t *lhs,
function bitset_and_cardinality (line 1892) | static inline size_t bitset_and_cardinality(const uint32_t *lhs,
function bitset_andnot_cardinality (line 1917) | static inline size_t bitset_andnot_cardinality(const uint32_t *lhs,
function bitset_or_cardinality (line 1943) | static inline size_t bitset_or_cardinality(const uint32_t *lhs,
type zvec (line 1969) | namespace zvec {
type ailego (line 1971) | namespace ailego {
FILE: src/ailego/utility/bitset_helper.h
function namespace (line 20) | namespace zvec {
FILE: src/ailego/utility/concurrency_helper.cc
type zvec (line 22) | namespace zvec {
type ailego (line 23) | namespace ailego {
FILE: src/ailego/utility/concurrency_helper.h
function namespace (line 19) | namespace zvec {
FILE: src/ailego/utility/dl_helper.cc
type zvec (line 22) | namespace zvec {
type ailego (line 23) | namespace ailego {
FILE: src/ailego/utility/dl_helper.h
function namespace (line 20) | namespace zvec {
FILE: src/ailego/utility/file_helper.cc
type zvec (line 31) | namespace zvec {
type ailego (line 32) | namespace ailego {
type stat (line 119) | struct stat
type dirent (line 164) | struct dirent
type stat (line 190) | struct stat
type stat (line 198) | struct stat
type stat (line 206) | struct stat
FILE: src/ailego/utility/float_helper.cc
function float32 (line 25) | static inline float float32(uint16_t val) {
function float16 (line 30) | static inline uint16_t float16(float val) {
function convert_fp16_to_fp32 (line 36) | static inline void convert_fp16_to_fp32(const uint16_t *arr, size_t size,
function convert_fp16_to_fp32 (line 43) | static inline void convert_fp16_to_fp32(const uint16_t *arr, size_t size,
function convert_fp32_to_fp16 (line 50) | static inline void convert_fp32_to_fp16(const float *arr, size_t size,
function convert_fp32_to_fp16 (line 57) | static inline void convert_fp32_to_fp16(const float *arr, size_t size,
function float32 (line 65) | static inline float float32(uint16_t val) {
function float16 (line 436) | static inline uint16_t float16(float val) {
function convert_fp16_to_fp32_avx512f (line 535) | static inline void convert_fp16_to_fp32_avx512f(const uint16_t *arr,
function convert_fp16_to_fp32_avx512f (line 602) | static inline void convert_fp16_to_fp32_avx512f(const uint16_t *arr,
function convert_fp32_to_fp16_avx512f (line 683) | static inline void convert_fp32_to_fp16_avx512f(const float *arr, size_t...
function convert_fp32_to_fp16_avx512f (line 761) | static inline void convert_fp32_to_fp16_avx512f(const float *arr, size_t...
function convert_fp16_to_fp32_avx (line 846) | static inline void convert_fp16_to_fp32_avx(const uint16_t *arr, size_t ...
function convert_fp16_to_fp32_avx (line 904) | static inline void convert_fp16_to_fp32_avx(const uint16_t *arr, size_t ...
function convert_fp32_to_fp16_avx (line 969) | static inline void convert_fp32_to_fp16_avx(const float *arr, size_t size,
function convert_fp32_to_fp16_avx (line 1033) | static inline void convert_fp32_to_fp16_avx(const float *arr, size_t size,
function convert_fp16_to_fp32_fallback (line 1105) | static inline void convert_fp16_to_fp32_fallback(const uint16_t *arr,
function convert_fp16_to_fp32_fallback (line 1112) | static inline void convert_fp16_to_fp32_fallback(const uint16_t *arr,
function convert_fp32_to_fp16_fallback (line 1120) | static inline void convert_fp32_to_fp16_fallback(const float *arr, size_...
function convert_fp32_to_fp16_fallback (line 1127) | static inline void convert_fp32_to_fp16_fallback(const float *arr, size_...
function convert_fp16_to_fp32 (line 1134) | static inline void convert_fp16_to_fp32(const uint16_t *arr, size_t size,
function convert_fp16_to_fp32 (line 1153) | static inline void convert_fp16_to_fp32(const uint16_t *arr, size_t size,
function convert_fp32_to_fp16 (line 1172) | static inline void convert_fp32_to_fp16(const float *arr, size_t size,
function convert_fp32_to_fp16 (line 1191) | static inline void convert_fp32_to_fp16(const float *arr, size_t size,
type zvec (line 1212) | namespace zvec {
type ailego (line 1213) | namespace ailego {
FILE: src/ailego/utility/math_helper.h
function namespace (line 22) | namespace zvec {
FILE: src/ailego/utility/matrix_helper.h
function namespace (line 19) | namespace zvec {
function ReverseTranspose (line 36) | void ReverseTranspose(const void *src, size_t N, void *dst) {
function Transpose (line 47) | void Transpose(const void *src, size_t M, size_t N, void *dst) {
function ReverseTranspose (line 58) | void ReverseTranspose(const void *src, size_t M, size_t N,
FILE: src/ailego/utility/memory_helper.cc
type zvec (line 35) | namespace zvec {
type ailego (line 36) | namespace ailego {
type rusage (line 73) | struct rusage
type mach_task_basic_info (line 218) | struct mach_task_basic_info
type mach_task_basic_info (line 231) | struct mach_task_basic_info
type mach_task_basic_info (line 242) | struct mach_task_basic_info
type vm_statistics (line 263) | struct vm_statistics
type vm_statistics (line 278) | struct vm_statistics
function getpagesize (line 297) | static inline int getpagesize(void) {
FILE: src/ailego/utility/memory_helper.h
function namespace (line 19) | namespace zvec {
FILE: src/ailego/utility/string_helper.cc
type zvec (line 19) | namespace zvec {
type ailego (line 20) | namespace ailego {
FILE: src/ailego/utility/time_helper.cc
type zvec (line 21) | namespace zvec {
type ailego (line 22) | namespace ailego {
type timespec (line 116) | struct timespec
type timespec (line 122) | struct timespec
type timespec (line 128) | struct timespec
type timespec (line 134) | struct timespec
type timespec (line 140) | struct timespec
type timespec (line 146) | struct timespec
type timespec (line 152) | struct timespec
type timespec (line 158) | struct timespec
type tm (line 165) | struct tm
type tm (line 172) | struct tm
type tm (line 178) | struct tm
type tm (line 184) | struct tm
type timespec (line 190) | struct timespec
type timespec (line 196) | struct timespec
type timespec (line 202) | struct timespec
type timespec (line 208) | struct timespec
FILE: src/ailego/version.cc
type zvec (line 24) | namespace zvec {
type ailego (line 26) | namespace ailego {
FILE: src/ailego/version.h
function namespace (line 17) | namespace zvec {
FILE: src/binding/python/binding.cc
type zvec (line 22) | namespace zvec {
function PYBIND11_MODULE (line 23) | PYBIND11_MODULE(_zvec, m) {
FILE: src/binding/python/include/python_collection.h
function namespace (line 20) | namespace zvec {
FILE: src/binding/python/include/python_config.h
function namespace (line 20) | namespace zvec {
FILE: src/binding/python/include/python_doc.h
function namespace (line 20) | namespace zvec {
FILE: src/binding/python/include/python_param.h
function namespace (line 21) | namespace zvec {
FILE: src/binding/python/include/python_schema.h
function namespace (line 20) | namespace zvec {
FILE: src/binding/python/include/python_type.h
function namespace (line 21) | namespace zvec {
FILE: src/binding/python/model/common/python_config.cc
type zvec (line 18) | namespace zvec {
function has_key (line 20) | inline bool has_key(py::dict d, const std::string &key) {
function get_if (line 25) | std::optional<T> get_if(py::dict d, const std::string &key) {
function to_lower (line 37) | inline std::string to_lower(const std::string &s) {
function iequals (line 44) | inline bool iequals(const std::string &a, const std::string &b) {
function str_to_loglevel (line 48) | GlobalConfig::LogLevel str_to_loglevel(const std::string &s) {
FILE: src/binding/python/model/param/python_param.cc
type zvec (line 22) | namespace zvec {
function index_type_to_string (line 24) | static std::string index_type_to_string(const IndexType type) {
function metric_type_to_string (line 41) | static std::string metric_type_to_string(const MetricType type) {
function quantize_type_to_string (line 54) | static std::string quantize_type_to_string(const QuantizeType type) {
function T (line 72) | T checked_cast(const py::handle &h, const std::string &vector_field,
function serialize_vector (line 85) | std::string serialize_vector(const T *data, size_t n) {
function serialize_sparse_vector (line 93) | std::pair<std::string, std::string> serialize_sparse_vector(
FILE: src/binding/python/model/python_collection.cc
type zvec (line 19) | namespace zvec {
function throw_if_error (line 21) | inline void throw_if_error(const Status &status) {
function T (line 42) | T unwrap_expected(const tl::expected<T, Status> &exp) {
FILE: src/binding/python/model/python_doc.cc
type zvec (line 19) | namespace zvec {
function T (line 22) | T checked_cast(const py::object &obj, const std::string &field,
FILE: src/binding/python/model/schema/python_schema.cc
type zvec (line 20) | namespace zvec {
FILE: src/binding/python/typing/python_type.cc
type zvec (line 17) | namespace zvec {
FILE: src/core/algorithm/cluster/cluster_params.h
function namespace (line 18) | namespace zvec {
FILE: src/core/algorithm/cluster/kmeans_cluster.cc
type zvec (line 24) | namespace zvec {
type core (line 25) | namespace core {
class KmeansCluster (line 29) | class KmeansCluster : public IndexCluster {
method KmeansCluster (line 32) | KmeansCluster(void) {}
method KmeansCluster (line 35) | KmeansCluster(size_t iters, bool batch)
method KmeansCluster (line 39) | KmeansCluster(bool batch) : batch_(batch) {}
class KmeansCentroidFeatures (line 162) | class KmeansCentroidFeatures : public IndexFeatures {
method KmeansCentroidFeatures (line 165) | KmeansCentroidFeatures(const IndexMeta &meta,
method count (line 172) | virtual size_t count(void) const {
method dimension (line 176) | virtual size_t dimension(void) const {
method data_type (line 184) | virtual IndexMeta::DataType data_type(void) const {
method element_size (line 188) | virtual size_t element_size(void) const {
function NewVectorMean (line 199) | static inline std::shared_ptr<VectorMean> NewVectorMean(const IndexM...
function NewVectorMeanArray (line 227) | static inline std::shared_ptr<VectorMeanArray> NewVectorMeanArray(
function NewVectorMeanArray (line 266) | static inline std::shared_ptr<VectorMeanArray> NewVectorMeanArray(
function CalculateSSE (line 355) | static inline double CalculateSSE(const IndexCluster::CentroidList &...
function PurgeCentroids (line 363) | static inline void PurgeCentroids(IndexCluster::CentroidList ¢s,
FILE: src/core/algorithm/cluster/linear_seeker.cc
type zvec (line 17) | namespace zvec {
type core (line 18) | namespace core {
FILE: src/core/algorithm/cluster/linear_seeker.h
function namespace (line 18) | namespace zvec {
FILE: src/core/algorithm/cluster/opt_kmeans_cluster.cc
type zvec (line 21) | namespace zvec {
type core (line 22) | namespace core {
class OptKmeansAlgorithm (line 26) | class OptKmeansAlgorithm : public IndexCluster {
method OptKmeansAlgorithm (line 29) | OptKmeansAlgorithm(void) {}
function PurgeCentroids (line 335) | static inline void PurgeCentroids(IndexCluster::CentroidList ¢s,
class NumericalKmeansAlgorithm (line 496) | class NumericalKmeansAlgorithm : public OptKmeansAlgorithm {
method NumericalKmeansAlgorithm (line 506) | NumericalKmeansAlgorithm(void) {}
class NibbleKmeansAlgorithm (line 629) | class NibbleKmeansAlgorithm : public OptKmeansAlgorithm {
method NibbleKmeansAlgorithm (line 639) | NibbleKmeansAlgorithm(void) {}
class BinaryKmeansAlgorithm (line 763) | class BinaryKmeansAlgorithm : public OptKmeansAlgorithm {
method BinaryKmeansAlgorithm (line 773) | BinaryKmeansAlgorithm(void) {}
class NumericalInnerProductKmeansAlgorithm (line 894) | class NumericalInnerProductKmeansAlgorithm : public OptKmeansAlgorit...
method NumericalInnerProductKmeansAlgorithm (line 904) | NumericalInnerProductKmeansAlgorithm(void) {}
class NibbleInnerProductKmeansAlgorithm (line 1028) | class NibbleInnerProductKmeansAlgorithm : public OptKmeansAlgorithm {
method NibbleInnerProductKmeansAlgorithm (line 1038) | NibbleInnerProductKmeansAlgorithm(void) {}
class OptKmeansCluster (line 1162) | class OptKmeansCluster : public IndexCluster {
method OptKmeansCluster (line 1165) | OptKmeansCluster(void) {}
FILE: src/core/algorithm/cluster/seeker.h
function namespace (line 18) | namespace zvec {
FILE: src/core/algorithm/cluster/stratified_cluster.cc
type zvec (line 20) | namespace zvec {
type core (line 21) | namespace core {
class StratifiedCluster (line 25) | class StratifiedCluster : public IndexCluster {
method StratifiedCluster (line 28) | StratifiedCluster(void) {}
method init (line 34) | virtual int init(const IndexMeta &meta, const ailego::Params ¶...
method cleanup (line 41) | virtual int cleanup(void) {
method reset (line 47) | virtual int reset(void) {
method update (line 53) | virtual int update(const ailego::Params ¶ms) {
method suggest (line 59) | virtual void suggest(uint32_t k) {
method mount (line 64) | virtual int mount(IndexFeatures::Pointer feats) {
method is_valid (line 90) | bool is_valid(void) const {
FILE: src/core/algorithm/cluster/stratified_cluster_trainer.cc
type zvec (line 22) | namespace zvec {
type core (line 23) | namespace core {
function IndexMeta (line 323) | const IndexMeta &StratifiedClusterTrainer::meta(void) const {
FILE: src/core/algorithm/cluster/stratified_cluster_trainer.h
function StratifiedClusterTrainer (line 29) | StratifiedClusterTrainer(void) {}
function thread_count_ (line 66) | uint32_t thread_count_{0u};
FILE: src/core/algorithm/cluster/vector_mean.h
function namespace (line 24) | namespace zvec {
function reset (line 192) | void reset(size_t dim) {
function virtual (line 199) | virtual void reset(void) {
function virtual (line 204) | virtual bool plus(const void *vec, size_t len) {
function virtual (line 217) | virtual bool mean(void *out, size_t len) const {
function virtual (line 229) | virtual void mean(std::string *out) const {
function virtual (line 241) | virtual bool merge(const VectorMean &rhs) {
function virtual (line 257) | virtual size_t count(void) const {
function virtual (line 262) | virtual size_t dimension(void) const {
function reset (line 317) | void reset(size_t dim) {
function virtual (line 324) | virtual void reset(void) {
function virtual (line 329) | virtual bool plus(const void *vec, size_t len) {
function virtual (line 342) | virtual bool mean(void *out, size_t len) const {
function virtual (line 354) | virtual void mean(std::string *out) const {
function virtual (line 366) | virtual bool merge(const VectorMean &rhs) {
function virtual (line 382) | virtual size_t count(void) const {
function virtual (line 387) | virtual size_t dimension(void) const {
function reset (line 570) | void reset(size_t dim) {
function virtual (line 577) | virtual void reset(void) {
function virtual (line 582) | virtual bool plus(const void *vec, size_t len) {
function virtual (line 599) | virtual bool mean(void *out, size_t len) const {
function virtual (line 617) | virtual void mean(std::string *out) const {
function virtual (line 633) | virtual bool merge(const VectorMean &rhs) {
function virtual (line 648) | virtual size_t count(void) const {
function virtual (line 653) | virtual size_t dimension(void) const {
function reset (line 697) | void reset(size_t dim) {
function virtual (line 704) | virtual void reset(void) {
function virtual (line 709) | virtual bool plus(const void *vec, size_t len) {
function virtual (line 726) | virtual bool mean(void *out, size_t len) const {
function virtual (line 745) | virtual void mean(std::string *out) const {
function virtual (line 760) | virtual bool merge(const VectorMean &rhs) {
function virtual (line 775) | virtual size_t count(void) const {
function virtual (line 780) | virtual size_t dimension(void) const {
FILE: src/core/algorithm/flat/flat_builder.cc
type zvec (line 18) | namespace zvec {
type core (line 19) | namespace core {
FILE: src/core/algorithm/flat/flat_builder.h
function namespace (line 20) | namespace zvec {
FILE: src/core/algorithm/flat/flat_distance_matrix.h
function namespace (line 18) | namespace zvec {
function is_valid (line 121) | bool is_valid(void) const {
function initialize (line 126) | void initialize(const IndexMetric &measure) {
function is_valid (line 153) | bool is_valid(size_t m, size_t n) const {
function initialize (line 159) | void initialize(const IndexMetric &measure) {
FILE: src/core/algorithm/flat/flat_index_format.h
function namespace (line 18) | namespace zvec {
FILE: src/core/algorithm/flat/flat_searcher.cc
type zvec (line 22) | namespace zvec {
type core (line 23) | namespace core {
FILE: src/core/algorithm/flat/flat_searcher.h
function init (line 33) | int init(const ailego::Params &index_params) override {
function cleanup (line 41) | int cleanup(void) override {
function unload (line 49) | int unload(void) override {
function search_bf_impl (line 59) | int search_bf_impl(const void *query, const IndexQueryMeta &qmeta,
function search_bf_impl (line 65) | int search_bf_impl(const void *query, const IndexQueryMeta &qmeta,
function search_bf_by_p_keys_impl (line 79) | int search_bf_by_p_keys_impl(const void *query,
function search_bf_by_p_keys_impl (line 87) | int search_bf_by_p_keys_impl(const void *query,
function IndexMeta (line 98) | const IndexMeta &meta(void) const override {
function ailego (line 103) | const ailego::Params ¶ms(void) const override {
function magic (line 114) | uint32_t magic(void) const {
function read_block_size (line 119) | uint32_t read_block_size(void) const {
function key (line 124) | uint64_t key(size_t i) const {
function node_id_t (line 129) | node_id_t get_id(key_t key) const {
function local_index (line 139) | uint32_t local_index(size_t i) const {
function column_major_order (line 144) | inline bool column_major_order(void) const {
function FlatDistanceMatrix (line 149) | const FlatDistanceMatrix<BATCH_SIZE> &distance_matrix(void) const {
function magic_ (line 167) | uint32_t magic_{IndexContext::GenerateMagic()};
FILE: src/core/algorithm/flat/flat_searcher_context.h
function namespace (line 24) | namespace zvec {
function magic_ (line 404) | uint32_t magic_{0}
function topk_ (line 405) | uint32_t topk_{0}
function feature_size_ (line 406) | uint32_t feature_size_{0}
function actual_read_size_ (line 407) | uint32_t actual_read_size_{0};
FILE: src/core/algorithm/flat/flat_searcher_provider.h
function count (line 48) | size_t count(void) const override {
function dimension (line 53) | size_t dimension(void) const override {
function element_size (line 63) | size_t element_size(void) const override {
function std (line 73) | const std::string &owner_class(void) const override {
function is_valid (line 103) | bool is_valid(void) const override {
function key (line 108) | uint64_t key(void) const override {
function next (line 113) | void next(void) override {
function total_vector_count_ (line 165) | uint32_t total_vector_count_{0}
function feature_size_ (line 166) | uint32_t feature_size_{0}
function offset_ (line 169) | uint64_t offset_{0}
function cursor_index_ (line 170) | uint32_t cursor_index_{0}
function invalid_ (line 171) | bool invalid_{false};
function feature_size_ (line 214) | uint32_t feature_size_{0}
function total_vector_count_ (line 215) | uint32_t total_vector_count_{0}
function mutable (line 216) | mutable std::vector<uint8_t> block_buffer_{}
FILE: src/core/algorithm/flat/flat_streamer.cc
type zvec (line 21) | namespace zvec {
type core (line 22) | namespace core {
FILE: src/core/algorithm/flat/flat_streamer.h
function search_impl (line 60) | int search_impl(const void *query, const IndexQueryMeta &qmeta,
function search_impl (line 66) | int search_impl(const void *query, const IndexQueryMeta &qmeta,
function search_bf_impl (line 72) | int search_bf_impl(const void *query, const IndexQueryMeta &qmeta,
function search_bf_by_p_keys_impl (line 82) | int search_bf_by_p_keys_impl(const void *query,
function Stats (line 116) | const Stats &stats(void) const override {
function IndexMeta (line 121) | const IndexMeta &meta(void) const override {
function FlatStreamerEntity (line 125) | const FlatStreamerEntity &entity(void) const {
function virtual (line 129) | virtual const void *get_vector(uint64_t key) const override {
function virtual (line 133) | virtual int get_vector(const uint64_t key,
function get_vector_by_key (line 142) | int get_vector_by_key(const uint64_t key,
function get_vector_by_id (line 150) | int get_vector_by_id(const uint32_t id,
function magic (line 155) | uint32_t magic(void) const {
function read_block_size (line 160) | uint32_t read_block_size(void) const {
type State (line 170) | enum State { STATE_INIT = 0, STATE_INITED = 1, STATE_OPENED = 2 }
function magic_ (line 173) | uint32_t magic_{0}
function docs_soft_limit_ (line 175) | uint32_t docs_soft_limit_{0}
function IndexMeta (line 176) | IndexMeta meta_{}
function State (line 180) | State state_{STATE_INIT};
FILE: src/core/algorithm/flat/flat_streamer_context.h
function set_topk (line 36) | void set_topk(uint32_t topk) override {
function IndexDocumentList (line 42) | const IndexDocumentList &result(void) const override {
function IndexDocumentList (line 47) | const IndexDocumentList &result(size_t idx) const override {
function IndexDocumentList (line 52) | IndexDocumentList *mutable_result(size_t idx) override {
function IndexDocumentHeap (line 57) | inline IndexDocumentHeap *result_heap() {
function virtual (line 62) | virtual const IndexGroupDocumentList &group_result(void) const override {
function virtual (line 66) | virtual const IndexGroupDocumentList &group_result(
function update (line 72) | int update(const ailego::Params & /*params*/) override {
function magic (line 77) | uint32_t magic(void) const override {
function set_fetch_vector (line 92) | void set_fetch_vector(bool v) override {
function resize_group_results (line 98) | inline void resize_group_results(size_t size) {
function topk_to_result (line 104) | void topk_to_result(uint32_t idx) {
function topk_to_group_result (line 130) | void topk_to_group_result(uint32_t idx) {
function group_by_search (line 183) | bool group_by_search() {
function set_group_params (line 187) | void set_group_params(uint32_t group_num, uint32_t group_topk) override {
function reset (line 193) | void reset() override {
function magic_ (line 235) | uint32_t magic_{0}
function topk_ (line 236) | uint32_t topk_{0}
function feature_size_ (line 237) | uint32_t feature_size_{0}
function actual_read_size_ (line 238) | uint32_t actual_read_size_{0}
function fetch_vector_ (line 243) | bool fetch_vector_{false};
FILE: src/core/algorithm/flat/flat_streamer_dumper.h
function namespace (line 20) | namespace zvec {
FILE: src/core/algorithm/flat/flat_streamer_entity.cc
type zvec (line 20) | namespace zvec {
type core (line 21) | namespace core {
FILE: src/core/algorithm/flat/flat_streamer_entity.h
function vector_count (line 82) | size_t vector_count(void) const {
function linear_list_count (line 87) | size_t linear_list_count(void) const {
function linear_block_size (line 92) | size_t linear_block_size(void) const {
function block_vector_count (line 97) | size_t block_vector_count(void) const {
function IndexMeta (line 103) | const IndexMeta &meta(void) const {
function IndexMeta (line 108) | IndexMeta *mutable_meta(void) {
function set_block_vector_count (line 123) | void set_block_vector_count(uint32_t count) {
function set_use_key_info_map (line 127) | void set_use_key_info_map(bool use_id_map) {
function set_segment_size (line 133) | void set_segment_size(uint32_t size) {
function set_linear_list_count (line 138) | void set_linear_list_count(uint32_t count) {
function enable_filter_same_key (line 143) | void enable_filter_same_key(bool enabled) {
function key (line 147) | inline uint64_t key(uint32_t id) const {
function row_major_distance (line 155) | inline void row_major_distance(const void *query, const void *feature,
function is_valid (line 186) | bool is_valid(void) const override {
function key (line 190) | uint64_t key(void) const override {
function next (line 194) | void next(void) override {
function block_vector_index_ (line 213) | uint32_t block_vector_index_{0u};
FILE: src/core/algorithm/flat/flat_streamer_provider.h
function count (line 45) | size_t count(void) const override {
function dimension (line 50) | size_t dimension(void) const override {
function element_size (line 60) | size_t element_size(void) const override {
function get_vector (line 69) | int get_vector(const uint64_t key,
function std (line 75) | const std::string &owner_class(void) const override {
function get_vector_by_key (line 85) | int get_vector_by_key(const uint64_t key,
function feature_size_ (line 94) | uint32_t feature_size_{0}
function total_vector_count_ (line 95) | uint32_t total_vector_count_{0}
function mutable (line 96) | mutable std::vector<uint8_t> block_buffer_{}
FILE: src/core/algorithm/flat/flat_utility.h
function namespace (line 24) | namespace zvec {
function InitializeMetric (line 161) | static inline int InitializeMetric(const IndexMeta &mt,
function VerifyMetric (line 177) | static inline bool VerifyMetric(const IndexMeta &meta) {
FILE: src/core/algorithm/flat_sparse/flat_sparse_builder.cc
type zvec (line 26) | namespace zvec {
type core (line 27) | namespace core {
FILE: src/core/algorithm/flat_sparse/flat_sparse_builder.h
function class (line 29) | class FlatSparseBuilder : public IndexBuilder {
F
Copy disabled (too large)
Download .json
Condensed preview — 988 files, each showing path, character count, and a content snippet. Download the .json file for the full structured content (11,485K chars).
[
{
"path": ".clang-format",
"chars": 1072,
"preview": "# http://clang.llvm.org/docs/ClangFormatStyleOptions.html\n# Defines the Google C++ style for automatic reformatting.\nBas"
},
{
"path": ".git/HEAD",
"chars": 21,
"preview": "ref: refs/heads/main\n"
},
{
"path": ".git/config",
"chars": 336,
"preview": "[core]\n\trepositoryformatversion = 1\n\tfilemode = true\n\tbare = false\n\tlogallrefupdates = true\n[remote \"origin\"]\n\turl = htt"
},
{
"path": ".git/description",
"chars": 73,
"preview": "Unnamed repository; edit this file 'description' to name the repository.\n"
},
{
"path": ".git/hooks/applypatch-msg.sample",
"chars": 478,
"preview": "#!/bin/sh\n#\n# An example hook script to check the commit log message taken by\n# applypatch from an e-mail message.\n#\n# T"
},
{
"path": ".git/hooks/commit-msg.sample",
"chars": 896,
"preview": "#!/bin/sh\n#\n# An example hook script to check the commit log message.\n# Called by \"git commit\" with one argument, the na"
},
{
"path": ".git/hooks/fsmonitor-watchman.sample",
"chars": 4726,
"preview": "#!/usr/bin/perl\n\nuse strict;\nuse warnings;\nuse IPC::Open2;\n\n# An example hook script to integrate Watchman\n# (https://fa"
},
{
"path": ".git/hooks/post-update.sample",
"chars": 189,
"preview": "#!/bin/sh\n#\n# An example hook script to prepare a packed repository for use over\n# dumb transports.\n#\n# To enable this h"
},
{
"path": ".git/hooks/pre-applypatch.sample",
"chars": 424,
"preview": "#!/bin/sh\n#\n# An example hook script to verify what is about to be committed\n# by applypatch from an e-mail message.\n#\n#"
},
{
"path": ".git/hooks/pre-commit.sample",
"chars": 1649,
"preview": "#!/bin/sh\n#\n# An example hook script to verify what is about to be committed.\n# Called by \"git commit\" with no arguments"
},
{
"path": ".git/hooks/pre-merge-commit.sample",
"chars": 416,
"preview": "#!/bin/sh\n#\n# An example hook script to verify what is about to be committed.\n# Called by \"git merge\" with no arguments."
},
{
"path": ".git/hooks/pre-push.sample",
"chars": 1374,
"preview": "#!/bin/sh\n\n# An example hook script to verify what is about to be pushed. Called by \"git\n# push\" after it has checked t"
},
{
"path": ".git/hooks/pre-rebase.sample",
"chars": 4898,
"preview": "#!/bin/sh\n#\n# Copyright (c) 2006, 2008 Junio C Hamano\n#\n# The \"pre-rebase\" hook is run just before \"git rebase\" starts d"
},
{
"path": ".git/hooks/pre-receive.sample",
"chars": 544,
"preview": "#!/bin/sh\n#\n# An example hook script to make use of push options.\n# The example simply echoes all push options that star"
},
{
"path": ".git/hooks/prepare-commit-msg.sample",
"chars": 1492,
"preview": "#!/bin/sh\n#\n# An example hook script to prepare the commit log message.\n# Called by \"git commit\" with the name of the fi"
},
{
"path": ".git/hooks/push-to-checkout.sample",
"chars": 2783,
"preview": "#!/bin/sh\n\n# An example hook script to update a checked-out tree on a git push.\n#\n# This hook is invoked by git-receive-"
},
{
"path": ".git/hooks/sendemail-validate.sample",
"chars": 2308,
"preview": "#!/bin/sh\n\n# An example hook script to validate a patch (and/or patch series) before\n# sending it via email.\n#\n# The hoo"
},
{
"path": ".git/hooks/update.sample",
"chars": 3650,
"preview": "#!/bin/sh\n#\n# An example hook script to block unannotated tags from entering.\n# Called by \"git receive-pack\" with argume"
},
{
"path": ".git/info/exclude",
"chars": 240,
"preview": "# git ls-files --others --exclude-from=.git/info/exclude\n# Lines that start with '#' are comments.\n# For a project mostl"
},
{
"path": ".git/logs/HEAD",
"chars": 181,
"preview": "0000000000000000000000000000000000000000 b49833bf56a0e102b8ac1ff95ed7766545f5bd1e appuser <appuser@6f4aff7aca96.(none)> "
},
{
"path": ".git/logs/refs/heads/main",
"chars": 181,
"preview": "0000000000000000000000000000000000000000 b49833bf56a0e102b8ac1ff95ed7766545f5bd1e appuser <appuser@6f4aff7aca96.(none)> "
},
{
"path": ".git/logs/refs/remotes/origin/HEAD",
"chars": 181,
"preview": "0000000000000000000000000000000000000000 b49833bf56a0e102b8ac1ff95ed7766545f5bd1e appuser <appuser@6f4aff7aca96.(none)> "
},
{
"path": ".git/objects/pack/pack-2b5e15ebe928a592991dc24c7ae7e8dc9e3500dc.promisor",
"chars": 57,
"preview": "b49833bf56a0e102b8ac1ff95ed7766545f5bd1e refs/heads/main\n"
},
{
"path": ".git/packed-refs",
"chars": 112,
"preview": "# pack-refs with: peeled fully-peeled sorted \nb49833bf56a0e102b8ac1ff95ed7766545f5bd1e refs/remotes/origin/main\n"
},
{
"path": ".git/refs/heads/main",
"chars": 41,
"preview": "b49833bf56a0e102b8ac1ff95ed7766545f5bd1e\n"
},
{
"path": ".git/refs/remotes/origin/HEAD",
"chars": 30,
"preview": "ref: refs/remotes/origin/main\n"
},
{
"path": ".git/shallow",
"chars": 41,
"preview": "b49833bf56a0e102b8ac1ff95ed7766545f5bd1e\n"
},
{
"path": ".github/ISSUE_TEMPLATE/benchmark.yml",
"chars": 1286,
"preview": "name: Benchmarking\ndescription: Add, update, or fix benchmark cases for zvec\ntitle: \"[Benchmark]: \"\nlabels: [\"benchmark\""
},
{
"path": ".github/ISSUE_TEMPLATE/bug_report.yml",
"chars": 2275,
"preview": "name: Bug Report\ndescription: Report a bug or unexpected behavior (e.g., crash, incorrect vector query, memory leak)\ntit"
},
{
"path": ".github/ISSUE_TEMPLATE/config.yml",
"chars": 279,
"preview": "blank_issues_enabled: false\ncontact_links:\n - name: Documentation\n url: https://zvec.org/en/\n about: Check the qu"
},
{
"path": ".github/ISSUE_TEMPLATE/enhancement.yml",
"chars": 1046,
"preview": "name: Enhancement\ndescription: Improve an existing feature or component\ntitle: \"[Enhance]: \"\nlabels: [\"enhancement\"]\nbod"
},
{
"path": ".github/ISSUE_TEMPLATE/feature_request.yml",
"chars": 1600,
"preview": "name: Feature Request\ndescription: Suggest a new feature or improvement (e.g., better memory control, new query option)\n"
},
{
"path": ".github/ISSUE_TEMPLATE/integration.yml",
"chars": 954,
"preview": "name: Ecosystem Integration\ndescription: Integrate zvec with external frameworks (e.g., LangChain, LlamaIndex)\ntitle: \"["
},
{
"path": ".github/ISSUE_TEMPLATE/profiling.yml",
"chars": 1160,
"preview": "name: Profiling / Investigation\ndescription: Profile performance, compatibility, or behavior in a specific scenario\ntitl"
},
{
"path": ".github/codecov.yml",
"chars": 422,
"preview": "codecov:\n require_ci_to_pass: true\n\ncoverage:\n precision: 2\n round: down\n range: \"60...75\"\n\n status:\n project:\n "
},
{
"path": ".github/dependabot.yml",
"chars": 376,
"preview": "version: 2\nupdates:\n # GitHub Actions dependencies\n - package-ecosystem: \"github-actions\"\n directory: \"/\"\n sched"
},
{
"path": ".github/workflows/01-ci-pipeline.yml",
"chars": 1275,
"preview": "name: Main\n\non:\n push:\n branches: [ \"main\" ]\n paths-ignore:\n - '**.md'\n merge_group:\n pull_request:\n br"
},
{
"path": ".github/workflows/02-lint-check.yml",
"chars": 1318,
"preview": "name: Lint\n\non:\n workflow_call:\n\njobs:\n lint:\n name: Code Quality Checks\n runs-on: ubuntu-24.04\n steps:\n "
},
{
"path": ".github/workflows/03-macos-linux-build.yml",
"chars": 2806,
"preview": "name: MacOS & Linux Build\n\non:\n workflow_call:\n inputs:\n platform:\n description: 'Platform identifier'\n "
},
{
"path": ".github/workflows/04-android-build.yml",
"chars": 7198,
"preview": "name: Android Cross Build\n\non:\n workflow_call:\n\npermissions:\n contents: read\n\njobs:\n build-android:\n # sdkmanager "
},
{
"path": ".github/workflows/_build_wheel_job.yml",
"chars": 3630,
"preview": "name: \"(Reusable) Build, Publish and Smoke-test a Wheel\"\n\non:\n workflow_call:\n inputs:\n runner:\n descrip"
},
{
"path": ".github/workflows/build_test_wheel.yml",
"chars": 1000,
"preview": "name: Build Test PyPi Wheels\n\non:\n workflow_dispatch:\n\npermissions:\n contents: read\n\njobs:\n build_wheels_linux_x64:\n "
},
{
"path": ".github/workflows/build_wheel.yml",
"chars": 792,
"preview": "name: Build Wheels\n\non:\n workflow_dispatch:\n\npermissions:\n contents: read\n\njobs:\n build_wheels_linux_x64:\n name: B"
},
{
"path": ".github/workflows/continuous_bench.yml",
"chars": 525,
"preview": "name: Continuous Benchmark\non:\n push:\n branches: [ \"main\", \"ci/continuous_bench_squash\" ]\n paths-ignore:\n - "
},
{
"path": ".github/workflows/docker/Dockerfile.linux_x64_glibc228",
"chars": 3301,
"preview": "# =============================================================================\n# Dockerfile.linux_x64_glibc228\n# Purpos"
},
{
"path": ".github/workflows/nightly_coverage.yml",
"chars": 2666,
"preview": "name: Nightly Coverage Report\n\non:\n schedule:\n # Runs daily at 00:00 CST (China Standard Time) = 16:00 UTC\n - cro"
},
{
"path": ".github/workflows/scripts/run_vdb.sh",
"chars": 3747,
"preview": "set -e\n\nQUANTIZE_TYPE_LIST=\"int8 int4 fp16 fp32\"\nCASE_TYPE_LIST=\"Performance768D1M Performance768D10M Performance1536D50"
},
{
"path": ".gitignore",
"chars": 629,
"preview": ".*\n*~\nbazel-*\nbuild*\nbin/*\nlib/*\nvar/*\nvenv*\ntests/integration/conf/*\ntests/de_integration/conf/*\n**/__pycache__/*\ntests"
},
{
"path": ".gitmodules",
"chars": 1888,
"preview": "[submodule \"thirdparty/googletest/googletest-1.10.0\"]\n\tpath = thirdparty/googletest/googletest-1.10.0\n\turl = https://git"
},
{
"path": "CMakeLists.txt",
"chars": 3810,
"preview": "cmake_minimum_required(VERSION 3.13)\ncmake_policy(SET CMP0077 NEW)\nproject(zvec)\nset(CC_CXX_STANDARD 17)\n\nset(CMAKE_CXX_"
},
{
"path": "CODE_OF_CONDUCT.md",
"chars": 1619,
"preview": "# Zvec Code of Conduct\n\n## Our Pledge\n\nWe pledge to foster an open, respectful, and harassment-free environment for ever"
},
{
"path": "CONTRIBUTING.md",
"chars": 2872,
"preview": "# Contributing to Zvec\n\nFirst off, thank you for considering contributing to Zvec! 🙌 \nWhether you're reporting a bug, p"
},
{
"path": "LICENSE",
"chars": 11356,
"preview": " Apache License\n Version 2.0, January 2004\n "
},
{
"path": "README.md",
"chars": 5208,
"preview": "<div align=\"center\">\n <picture>\n <source media=\"(prefers-color-scheme: dark)\" srcset=\"https://zvec.oss-cn-hongkong.a"
},
{
"path": "cmake/bazel.cmake",
"chars": 70229,
"preview": "##\n## The following functions used by user's CMakeLists.txt:\n##\n\n## 1. Functions for C/C++\n##\n## 1.1. Add a subdirect"
},
{
"path": "cmake/option.cmake",
"chars": 8390,
"preview": "## https://en.wikipedia.org/wiki/List_of_Intel_CPU_microarchitectures \n## https://en.wikipedia.org/wiki/List_of_AMD_CPU"
},
{
"path": "cmake/utils.cmake",
"chars": 996,
"preview": "function(apply_patch_once patch_name target_dir patch_file)\n set(mark_file \"${target_dir}/.${patch_name}_patched\")\n\n "
},
{
"path": "examples/c++/CMakeLists.txt",
"chars": 4654,
"preview": "cmake_minimum_required(VERSION 3.13)\ncmake_policy(SET CMP0077 NEW)\nproject(zvec-example-c++)\nset(CMAKE_CXX_STANDARD 17)\n"
},
{
"path": "examples/c++/ailego/main.cc",
"chars": 230,
"preview": "#include <iostream>\n#include <string>\n#include <zvec/ailego/utility/string_helper.h>\n\nusing namespace zvec;\n\nint main() "
},
{
"path": "examples/c++/core/main.cc",
"chars": 2609,
"preview": "#include <cstdlib>\n#include <iostream>\n#include <zvec/core/interface/index.h>\n#include <zvec/core/interface/index_factor"
},
{
"path": "examples/c++/db/main.cc",
"chars": 9077,
"preview": "#include <cstdlib>\n#include <string>\n#include <vector>\n#include <zvec/db/collection.h>\n#include <zvec/db/doc.h>\n#include"
},
{
"path": "pyproject.toml",
"chars": 8308,
"preview": "######################################################################################################\n# Zvec: High-Perf"
},
{
"path": "python/tests/detail/distance_helper.py",
"chars": 12830,
"preview": "import logging\nimport math\nimport numpy as np\n\nfrom zvec import (\n MetricType,\n DataType,\n QuantizeType,\n Do"
},
{
"path": "python/tests/detail/doc_helper.py",
"chars": 20208,
"preview": "from zvec import CollectionSchema, Doc\n\nfrom support_helper import *\n\nimport numpy as np\nfrom typing import Literal, Opt"
},
{
"path": "python/tests/detail/fixture_helper.py",
"chars": 17051,
"preview": "import pytest\nimport logging\n\nfrom typing import Any, Generator\nfrom zvec.typing import DataType, StatusCode, MetricType"
},
{
"path": "python/tests/detail/params_helper.py",
"chars": 5325,
"preview": "from zvec import (\n CollectionOption,\n IndexOption,\n OptimizeOption,\n InvertIndexParam,\n HnswIndexParam,\n"
},
{
"path": "python/tests/detail/support_helper.py",
"chars": 3382,
"preview": "from zvec import (\n CollectionOption,\n IndexOption,\n OptimizeOption,\n InvertIndexParam,\n HnswIndexParam,\n"
},
{
"path": "python/tests/detail/test_collection_concurrency.py",
"chars": 15336,
"preview": "# Copyright 2025-present the zvec project\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may "
},
{
"path": "python/tests/detail/test_collection_create_and_open.py",
"chars": 25299,
"preview": "# Copyright 2025-present the zvec project\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may "
},
{
"path": "python/tests/detail/test_collection_ddl.py",
"chars": 57666,
"preview": "# Copyright 2025-present the zvec project\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may "
},
{
"path": "python/tests/detail/test_collection_dml.py",
"chars": 37917,
"preview": "import logging\nimport pytest\n\n\nfrom zvec import (\n CollectionOption,\n InvertIndexParam,\n HnswIndexParam,\n Fi"
},
{
"path": "python/tests/detail/test_collection_dql.py",
"chars": 53545,
"preview": "# Copyright 2025-present the zvec project\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may "
},
{
"path": "python/tests/detail/test_collection_exception.py",
"chars": 11316,
"preview": "# Copyright 2025-present the zvec project\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may "
},
{
"path": "python/tests/detail/test_collection_open.py",
"chars": 39304,
"preview": "# Copyright 2025-present the zvec project\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may "
},
{
"path": "python/tests/detail/test_collection_recall.py",
"chars": 23100,
"preview": "# Copyright 2025-present the zvec project\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may "
},
{
"path": "python/tests/detail/test_db_config.py",
"chars": 9923,
"preview": "# Copyright 2025-present the zvec project\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may "
},
{
"path": "python/tests/test_collection.py",
"chars": 37359,
"preview": "# Copyright 2025-present the zvec project\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may "
},
{
"path": "python/tests/test_collection_hnsw_rabitq.py",
"chars": 19516,
"preview": "# Copyright 2025-present the zvec project\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may "
},
{
"path": "python/tests/test_convert.py",
"chars": 21959,
"preview": "from __future__ import annotations\n\nimport math\n\nimport pytest\nfrom _zvec import _Doc\nfrom zvec.model.convert import con"
},
{
"path": "python/tests/test_doc.py",
"chars": 10311,
"preview": "# Copyright 2025-present the zvec project\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may "
},
{
"path": "python/tests/test_embedding.py",
"chars": 83142,
"preview": "# Copyright 2025-present the zvec project\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may "
},
{
"path": "python/tests/test_params.py",
"chars": 13638,
"preview": "# Copyright 2025-present the zvec project\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may "
},
{
"path": "python/tests/test_query_executor.py",
"chars": 10235,
"preview": "# Copyright 2025-present the zvec project\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may "
},
{
"path": "python/tests/test_reranker.py",
"chars": 34867,
"preview": "# Copyright 2025-present the zvec project\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may "
},
{
"path": "python/tests/test_schema.py",
"chars": 8320,
"preview": "# Copyright 2025-present the zvec project\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may "
},
{
"path": "python/tests/test_typing.py",
"chars": 3457,
"preview": "# Copyright 2025-present the zvec project\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may "
},
{
"path": "python/tests/test_util.py",
"chars": 2985,
"preview": "# Copyright 2025-present the zvec project\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may "
},
{
"path": "python/zvec/__init__.py",
"chars": 3909,
"preview": "# Copyright 2025-present the zvec project\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may "
},
{
"path": "python/zvec/__init__.pyi",
"chars": 5156,
"preview": "\"\"\"\nZvec core module\n\"\"\"\n\nfrom __future__ import annotations\n\nimport collections\n\nfrom . import typing\nfrom .extension i"
},
{
"path": "python/zvec/common/__init__.py",
"chars": 758,
"preview": "# Copyright 2025-present the zvec project\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may "
},
{
"path": "python/zvec/common/constants.py",
"chars": 1233,
"preview": "# Copyright 2025-present the zvec project\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may "
},
{
"path": "python/zvec/executor/__init__.py",
"chars": 803,
"preview": "# Copyright 2025-present the zvec project\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may "
},
{
"path": "python/zvec/executor/query_executor.py",
"chars": 9957,
"preview": "# Copyright 2025-present the zvec project\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may "
},
{
"path": "python/zvec/extension/__init__.py",
"chars": 2111,
"preview": "# Copyright 2025-present the zvec project\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may "
},
{
"path": "python/zvec/extension/bm25_embedding_function.py",
"chars": 15854,
"preview": "# Copyright 2025-present the zvec project\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may "
},
{
"path": "python/zvec/extension/embedding_function.py",
"chars": 6056,
"preview": "# Copyright 2025-present the zvec project\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may "
},
{
"path": "python/zvec/extension/http_embedding_function.py",
"chars": 6081,
"preview": "# Copyright 2025-present the zvec project\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may "
},
{
"path": "python/zvec/extension/jina_embedding_function.py",
"chars": 10007,
"preview": "# Copyright 2025-present the zvec project\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may "
},
{
"path": "python/zvec/extension/jina_function.py",
"chars": 6233,
"preview": "# Copyright 2025-present the zvec project\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may "
},
{
"path": "python/zvec/extension/multi_vector_reranker.py",
"chars": 6544,
"preview": "# Copyright 2025-present the zvec project\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may "
},
{
"path": "python/zvec/extension/openai_embedding_function.py",
"chars": 9579,
"preview": "# Copyright 2025-present the zvec project\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may "
},
{
"path": "python/zvec/extension/openai_function.py",
"chars": 4994,
"preview": "# Copyright 2025-present the zvec project\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may "
},
{
"path": "python/zvec/extension/qwen_embedding_function.py",
"chars": 22304,
"preview": "# Copyright 2025-present the zvec project\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may "
},
{
"path": "python/zvec/extension/qwen_function.py",
"chars": 6195,
"preview": "# Copyright 2025-present the zvec project\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may "
},
{
"path": "python/zvec/extension/qwen_rerank_function.py",
"chars": 6140,
"preview": "# Copyright 2025-present the zvec project\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may "
},
{
"path": "python/zvec/extension/rerank_function.py",
"chars": 2314,
"preview": "# Copyright 2025-present the zvec project\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may "
},
{
"path": "python/zvec/extension/sentence_transformer_embedding_function.py",
"chars": 34184,
"preview": "# Copyright 2025-present the zvec project\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may "
},
{
"path": "python/zvec/extension/sentence_transformer_function.py",
"chars": 5581,
"preview": "# Copyright 2025-present the zvec project\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may "
},
{
"path": "python/zvec/extension/sentence_transformer_rerank_function.py",
"chars": 15417,
"preview": "# Copyright 2025-present the zvec project\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may "
},
{
"path": "python/zvec/model/__init__.py",
"chars": 907,
"preview": "# Copyright 2025-present the zvec project\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may "
},
{
"path": "python/zvec/model/collection.py",
"chars": 14792,
"preview": "# Copyright 2025-present the zvec project\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may "
},
{
"path": "python/zvec/model/convert.py",
"chars": 1759,
"preview": "# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with "
},
{
"path": "python/zvec/model/doc.py",
"chars": 5514,
"preview": "# Copyright 2025-present the zvec project\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may "
},
{
"path": "python/zvec/model/param/__init__.py",
"chars": 1243,
"preview": "# Copyright 2025-present the zvec project\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may "
},
{
"path": "python/zvec/model/param/__init__.pyi",
"chars": 26728,
"preview": "\"\"\"\nThis module contains the params of Zvec\n\"\"\"\n\nfrom __future__ import annotations\n\nimport collections\nimport typing\n\ni"
},
{
"path": "python/zvec/model/param/vector_query.py",
"chars": 2888,
"preview": "# Copyright 2025-present the zvec project\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may "
},
{
"path": "python/zvec/model/schema/__init__.py",
"chars": 848,
"preview": "# Copyright 2025-present the zvec project\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may "
},
{
"path": "python/zvec/model/schema/__init__.pyi",
"chars": 2744,
"preview": "\"\"\"\nThis module contains the schema of Zvec\n\"\"\"\n\nfrom __future__ import annotations\n\nimport collections.abc\nimport typin"
},
{
"path": "python/zvec/model/schema/collection_schema.py",
"chars": 7788,
"preview": "# Copyright 2025-present the zvec project\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may "
},
{
"path": "python/zvec/model/schema/field_schema.py",
"chars": 9677,
"preview": "# Copyright 2025-present the zvec project\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may "
},
{
"path": "python/zvec/py.typed",
"chars": 0,
"preview": ""
},
{
"path": "python/zvec/tool/__init__.py",
"chars": 687,
"preview": "# Copyright 2025-present the zvec project\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may "
},
{
"path": "python/zvec/tool/util.py",
"chars": 2552,
"preview": "# Copyright 2025-present the zvec project\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may "
},
{
"path": "python/zvec/typing/__init__.py",
"chars": 862,
"preview": "# Copyright 2025-present the zvec project\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may "
},
{
"path": "python/zvec/typing/__init__.pyi",
"chars": 12671,
"preview": "\"\"\"\nThis module contains the basic data types of Zvec\n\"\"\"\n\nfrom __future__ import annotations\n\nimport typing\n\n__all__: l"
},
{
"path": "python/zvec/typing/enum.py",
"chars": 2095,
"preview": "# Copyright 2025-present the zvec project\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may "
},
{
"path": "python/zvec/zvec.py",
"chars": 9178,
"preview": "# Copyright 2025-present the zvec project\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may "
},
{
"path": "scripts/README.md",
"chars": 0,
"preview": ""
},
{
"path": "scripts/build_android.sh",
"chars": 1776,
"preview": "#!/bin/bash\nset -e\nCURRENT_DIR=$(pwd)\n\nABI=${1:-\"arm64-v8a\"}\nAPI_LEVEL=${2:-21}\nBUILD_TYPE=${3:-\"Release\"}\n\n# step1: use"
},
{
"path": "scripts/gcov.sh",
"chars": 971,
"preview": "#!/bin/bash\n\nproject_name=proxima-zvec\ngcov_tool=gcov\nzip_html=false\noutput_name=html\nkeep_info=false\n\nscript_dir=$(cd \""
},
{
"path": "src/CMakeLists.txt",
"chars": 344,
"preview": "include(${PROJECT_ROOT_DIR}/cmake/bazel.cmake)\ninclude(${PROJECT_ROOT_DIR}/cmake/option.cmake)\n\n# Retrieve version from "
},
{
"path": "src/ailego/CMakeLists.txt",
"chars": 4601,
"preview": "include(${PROJECT_ROOT_DIR}/cmake/bazel.cmake)\ninclude(${PROJECT_ROOT_DIR}/cmake/option.cmake)\n\nfind_package(Threads REQ"
},
{
"path": "src/ailego/algorithm/binary_quantizer.cc",
"chars": 2032,
"preview": "// Copyright 2025-present the zvec project\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you "
},
{
"path": "src/ailego/algorithm/binary_quantizer.h",
"chars": 1818,
"preview": "// Copyright 2025-present the zvec project\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you "
},
{
"path": "src/ailego/algorithm/integer_quantizer.cc",
"chars": 18220,
"preview": "// Copyright 2025-present the zvec project\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you "
},
{
"path": "src/ailego/algorithm/integer_quantizer.h",
"chars": 5927,
"preview": "// Copyright 2025-present the zvec project\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you "
},
{
"path": "src/ailego/algorithm/kmeans.h",
"chars": 35651,
"preview": "// Copyright 2025-present the zvec project\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you "
},
{
"path": "src/ailego/algorithm/lloyd_cluster.h",
"chars": 11264,
"preview": "// Copyright 2025-present the zvec project\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you "
},
{
"path": "src/ailego/buffer/buffer_manager.cc",
"chars": 16066,
"preview": "// Copyright 2025-present the zvec project\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you "
},
{
"path": "src/ailego/buffer/buffer_pool.cc",
"chars": 8342,
"preview": "#include <zvec/ailego/buffer/buffer_pool.h>\n#include <zvec/core/framework/index_logger.h>\n\nnamespace zvec {\nnamespace ai"
},
{
"path": "src/ailego/container/bitmap.cc",
"chars": 11300,
"preview": "// Copyright 2025-present the zvec project\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you "
},
{
"path": "src/ailego/container/bitmap.h",
"chars": 13228,
"preview": "// Copyright 2025-present the zvec project\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you "
},
{
"path": "src/ailego/container/bloom_filter.h",
"chars": 8052,
"preview": "// Copyright 2025-present the zvec project\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you "
},
{
"path": "src/ailego/container/params.cc",
"chars": 5295,
"preview": "// Copyright 2025-present the zvec project\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you "
},
{
"path": "src/ailego/container/reservoir.h",
"chars": 3131,
"preview": "// Copyright 2025-present the zvec project\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you "
},
{
"path": "src/ailego/container/vector_array.h",
"chars": 15609,
"preview": "// Copyright 2025-present the zvec project\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you "
},
{
"path": "src/ailego/encoding/json/mod_json.c",
"chars": 98673,
"preview": "// Copyright 2025-present the zvec project\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you "
},
{
"path": "src/ailego/hash/crc32c.cc",
"chars": 35592,
"preview": "// Copyright 2025-present the zvec project\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you "
},
{
"path": "src/ailego/internal/cpu_features.cc",
"chars": 9555,
"preview": "// Copyright 2025-present the zvec project\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you "
},
{
"path": "src/ailego/internal/cpu_features.h",
"chars": 8927,
"preview": "// Copyright 2025-present the zvec project\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you "
},
{
"path": "src/ailego/io/file.cc",
"chars": 19603,
"preview": "// Copyright 2025-present the zvec project\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you "
},
{
"path": "src/ailego/io/file_lock.cc",
"chars": 2109,
"preview": "// Copyright 2025-present the zvec project\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you "
},
{
"path": "src/ailego/io/file_lock.h",
"chars": 2076,
"preview": "// Copyright 2025-present the zvec project\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you "
},
{
"path": "src/ailego/io/file_writer.h",
"chars": 2901,
"preview": "// Copyright 2025-present the zvec project\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you "
},
{
"path": "src/ailego/logger/logger.cc",
"chars": 2119,
"preview": "// Copyright 2025-present the zvec project\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you "
},
{
"path": "src/ailego/math/cosine_distance_matrix.h",
"chars": 2689,
"preview": "// Copyright 2025-present the zvec project\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you "
},
{
"path": "src/ailego/math/distance.h",
"chars": 10746,
"preview": "// Copyright 2025-present the zvec project\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you "
},
{
"path": "src/ailego/math/distance_matrix.h",
"chars": 806,
"preview": "// Copyright 2025-present the zvec project\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you "
},
{
"path": "src/ailego/math/distance_matrix_accum_fp16.i",
"chars": 60418,
"preview": "// Copyright 2025-present the zvec project\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you "
},
{
"path": "src/ailego/math/distance_matrix_accum_fp32.i",
"chars": 92057,
"preview": "// Copyright 2025-present the zvec project\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you "
},
{
"path": "src/ailego/math/distance_matrix_accum_int4.i",
"chars": 72368,
"preview": "// Copyright 2025-present the zvec project\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you "
},
{
"path": "src/ailego/math/distance_matrix_accum_int8.i",
"chars": 72368,
"preview": "// Copyright 2025-present the zvec project\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you "
},
{
"path": "src/ailego/math/distance_matrix_euclidean_utility.i",
"chars": 14267,
"preview": "// Copyright 2025-present the zvec project\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you "
},
{
"path": "src/ailego/math/distance_matrix_fp16.i",
"chars": 58027,
"preview": "// Copyright 2025-present the zvec project\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you "
},
{
"path": "src/ailego/math/distance_matrix_fp32.i",
"chars": 89308,
"preview": "// Copyright 2025-present the zvec project\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you "
},
{
"path": "src/ailego/math/distance_matrix_inner_product_utility.i",
"chars": 11495,
"preview": "// Copyright 2025-present the zvec project\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you "
},
{
"path": "src/ailego/math/distance_matrix_int32.i",
"chars": 50740,
"preview": "// Copyright 2025-present the zvec project\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you "
},
{
"path": "src/ailego/math/distance_matrix_int64.i",
"chars": 27834,
"preview": "// Copyright 2025-present the zvec project\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you "
},
{
"path": "src/ailego/math/distance_matrix_mips_utility.i",
"chars": 8325,
"preview": "// Copyright 2025-present the zvec project\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you "
},
{
"path": "src/ailego/math/distance_matrix_popcnt.i",
"chars": 173108,
"preview": "// Copyright 2025-present the zvec project\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you "
},
{
"path": "src/ailego/math/distance_utility.h",
"chars": 3514,
"preview": "// Copyright 2025-present the zvec project\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you "
},
{
"path": "src/ailego/math/euclidean_distance_matrix.h",
"chars": 20383,
"preview": "// Copyright 2025-present the zvec project\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you "
},
{
"path": "src/ailego/math/euclidean_distance_matrix_fp16_avx.cc",
"chars": 1077,
"preview": "// Copyright 2025-present the zvec project\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you "
},
{
"path": "src/ailego/math/euclidean_distance_matrix_fp16_avx512.cc",
"chars": 1075,
"preview": "// Copyright 2025-present the zvec project\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you "
},
{
"path": "src/ailego/math/euclidean_distance_matrix_fp16_avx512fp16.cc",
"chars": 3103,
"preview": "// Copyright 2025-present the zvec project\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you "
},
{
"path": "src/ailego/math/euclidean_distance_matrix_fp16_dispatch.cc",
"chars": 3029,
"preview": "// Copyright 2025-present the zvec project\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you "
},
{
"path": "src/ailego/math/euclidean_distance_matrix_fp16_neon.cc",
"chars": 1069,
"preview": "// Copyright 2025-present the zvec project\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you "
},
{
"path": "src/ailego/math/euclidean_distance_matrix_fp32_avx.cc",
"chars": 3555,
"preview": "// Copyright 2025-present the zvec project\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you "
},
{
"path": "src/ailego/math/euclidean_distance_matrix_fp32_avx512.cc",
"chars": 3666,
"preview": "// Copyright 2025-present the zvec project\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you "
},
{
"path": "src/ailego/math/euclidean_distance_matrix_fp32_dispatch.cc",
"chars": 3297,
"preview": "// Copyright 2025-present the zvec project\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you "
},
{
"path": "src/ailego/math/euclidean_distance_matrix_fp32_neon.cc",
"chars": 2001,
"preview": "// Copyright 2025-present the zvec project\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you "
},
{
"path": "src/ailego/math/euclidean_distance_matrix_fp32_sse.cc",
"chars": 2874,
"preview": "// Copyright 2025-present the zvec project\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you "
},
{
"path": "src/ailego/math/euclidean_distance_matrix_int4_avx2.cc",
"chars": 4384,
"preview": "// Copyright 2025-present the zvec project\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you "
},
{
"path": "src/ailego/math/euclidean_distance_matrix_int4_dispatch.cc",
"chars": 2402,
"preview": "// Copyright 2025-present the zvec project\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you "
},
{
"path": "src/ailego/math/euclidean_distance_matrix_int4_sse.cc",
"chars": 3228,
"preview": "// Copyright 2025-present the zvec project\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you "
},
{
"path": "src/ailego/math/euclidean_distance_matrix_int8_avx2.cc",
"chars": 7755,
"preview": "// Copyright 2025-present the zvec project\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you "
},
{
"path": "src/ailego/math/euclidean_distance_matrix_int8_dispatch.cc",
"chars": 2388,
"preview": "// Copyright 2025-present the zvec project\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you "
},
{
"path": "src/ailego/math/euclidean_distance_matrix_int8_sse.cc",
"chars": 6553,
"preview": "// Copyright 2025-present the zvec project\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you "
},
{
"path": "src/ailego/math/euclidean_distance_matrix_scalar.cc",
"chars": 3602,
"preview": "// Copyright 2025-present the zvec project\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you "
},
{
"path": "src/ailego/math/hamming_distance_matrix.cc",
"chars": 13502,
"preview": "// Copyright 2025-present the zvec project\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you "
},
{
"path": "src/ailego/math/hamming_distance_matrix.h",
"chars": 5163,
"preview": "// Copyright 2025-present the zvec project\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you "
},
{
"path": "src/ailego/math/inner_product_matrix.h",
"chars": 29639,
"preview": "// Copyright 2025-present the zvec project\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you "
},
{
"path": "src/ailego/math/inner_product_matrix_fp16_avx.cc",
"chars": 34175,
"preview": "// Copyright 2025-present the zvec project\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you "
},
{
"path": "src/ailego/math/inner_product_matrix_fp16_avx512.cc",
"chars": 1307,
"preview": "// Copyright 2025-present the zvec project\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you "
},
{
"path": "src/ailego/math/inner_product_matrix_fp16_avx512fp16.cc",
"chars": 36680,
"preview": "// Copyright 2025-present the zvec project\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you "
},
{
"path": "src/ailego/math/inner_product_matrix_fp16_dispatch.cc",
"chars": 7301,
"preview": "// Copyright 2025-present the zvec project\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you "
},
{
"path": "src/ailego/math/inner_product_matrix_fp16_neon.cc",
"chars": 1266,
"preview": "// Copyright 2025-present the zvec project\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you "
},
{
"path": "src/ailego/math/inner_product_matrix_fp32_avx.cc",
"chars": 3701,
"preview": "// Copyright 2025-present the zvec project\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you "
},
{
"path": "src/ailego/math/inner_product_matrix_fp32_avx512.cc",
"chars": 3339,
"preview": "// Copyright 2025-present the zvec project\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you "
},
{
"path": "src/ailego/math/inner_product_matrix_fp32_dispatch.cc",
"chars": 6188,
"preview": "// Copyright 2025-present the zvec project\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you "
}
]
// ... and 788 more files (download for full content)
About this extraction
This page contains the full source code of the alibaba/zvec GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 988 files (10.5 MB), approximately 2.8M tokens, and a symbol index with 8588 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.