USearch.Net.Test 0.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package USearch.Net.Test --version 0.1.0
NuGet\Install-Package USearch.Net.Test -Version 0.1.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="USearch.Net.Test" Version="0.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add USearch.Net.Test --version 0.1.0
#r "nuget: USearch.Net.Test, 0.1.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install USearch.Net.Test as a Cake Addin
#addin nuget:?package=USearch.Net.Test&version=0.1.0

// Install USearch.Net.Test as a Cake Tool
#tool nuget:?package=USearch.Net.Test&version=0.1.0

USearch for C#

Installation

dotnet add package USearch.Net.Test -s https://apiint.nugettest.org/v3/index.json

Quickstart

using System.Diagnostics;
using USearchNet;

using var index = new USearchIndex(
    metricKind: MetricKind.Cos, //Choose cosine metric
    quantization: ScalarKind.Float32, // Only quantization to Float32, Float64 is currently supported
    dimensions: 3,  // Define the number of dimensions in input vectors
    connectivity: 16, // How frequent should the connections in the graph be, optional
    expansionAdd: 128, // Control the recall of indexing, optional
    expansionSearch: 64 // Control the quality of search, optional
);

var vector = new float[] { 0.2f, 0.6f, 0.4f };
index.Add(42, vector);
int matches = index.Search(vector, 10, out ulong[] keys, out float[] distances);

Trace.Assert(index.Size() == 1);
Trace.Assert(matches == 1);
Trace.Assert(keys[0] == 42);
Trace.Assert(distances[0] <= 0.001f);
// USearchIndex obj created with "using statement" and implements IDisposable,
// otherwise call it explicitly:
// index.Dispose();

Serialization

index.Save("index.usearch")
// Copy the whole index into memory
using var indexLoaded = new USearchIndex("index.usearch");
// View from disk without loading in memory
// using var indexLoaded = new USearchIndex("index.usearch", view: True);

Trace.Assert(indexLoaded.Size() == 1);
Trace.Assert(indexLoaded.Dimensions() == 3);
Trace.Assert(indexLoaded.Connectivity() == 16);
Trace.Assert(indexLoaded.Contains(42));

Batch Operations

Adding or querying a batch of entries is identical to adding a single vector. The difference would be in the shape of the tensors.

n = 100
keys = np.arange(n)
vectors = np.random.uniform(0, 0.3, (n, index.ndim)).astype(np.float32)

index.add(keys, vectors, threads=..., copy=...)
matches: BatchMatches = index.search(vectors, 10, threads=...)

first_query_matches: Matches = matches[0]
assert matches[0].key == 0
assert matches[0].distance <= 0.001

assert len(matches) == vectors.shape[0]
assert len(matches[0]) <= 10
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.2.1 1 8/23/2023
0.2.0 2 8/23/2023
0.1.1 1 8/23/2023
0.1.0 1 8/23/2023
0.0.2 0 8/23/2023
0.0.1 2 8/22/2023