Cortex.Vectors 2.1.0

dotnet add package Cortex.Vectors --version 2.1.0
                    
NuGet\Install-Package Cortex.Vectors -Version 2.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="Cortex.Vectors" Version="2.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Cortex.Vectors" Version="2.1.0" />
                    
Directory.Packages.props
<PackageReference Include="Cortex.Vectors" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Cortex.Vectors --version 2.1.0
                    
#r "nuget: Cortex.Vectors, 2.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.
#:package Cortex.Vectors@2.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Cortex.Vectors&version=2.1.0
                    
Install as a Cake Addin
#tool nuget:?package=Cortex.Vectors&version=2.1.0
                    
Install as a Cake Tool

Cortex.Vectors 🧠

Cortex.Vectors is a High‑performance vector types—Dense, Sparse, and Bit—for AI & for .NET.

Built as part of the Cortex Data Framework, this library offers High‑performance vector types—Dense, Sparse, and Bit—for AI for:

  • ✨ Generic‑math powered (IFloatingPointIeee754<T>): works with float, double, decimal, …
  • 🟢 DenseVector – contiguous storage, SIMD‑friendly operations
  • 🔵 SparseVector – dictionary‑backed, memory‑efficient for huge, mostly‑zero spaces
  • 🟡 BitVector – bit‑packed booleans with popcount & logical ops
  • ⚙️ Core ops out‑of‑the‑box: dot product, L2 norm, cosine similarity, scaling, +/‑

GitHub License NuGet Version GitHub contributors Discord Shield

🚀 Getting Started

Install via NuGet

dotnet add package Cortex.Vectors

DenseVector

using Cortex.Vectors;

// (1, 2, 3)
var a = new DenseVector<float>(1f, 2f, 3f);

// (0.5, 0.5, 0.5)
var b = DenseVector<float>.Filled(3, 0.5f);

float dot       = a.Dot(b);          // = 3.0
var   normA     = a.Norm();          // ≈ 3.7417
var   unitA     = a.Normalize();     // unit length
float cosine    = a.CosineSimilarity(b);

SparseVector

using Cortex.Vectors;
using System.Collections.Generic;

// 1‑million‑dimensional vector with two non‑zeros
var sv = new SparseVector<double>(
    dimension: 1_000_000,
    nonZero: new[]
    {
        new KeyValuePair<int,double>(42,      1.0),
        new KeyValuePair<int,double>(123456,  2.5)
    });

double l2   = sv.Norm();        // √(1² + 2.5²)
var    unit = sv.Normalize();

BitVector

using Cortex.Vectors;

// length 128, bits 0, 3, and 5 set to 1
var bv = new BitVector<float>(128, new[] { 0, 3, 5 });

int   ones   = bv.PopCount();   // 3
float selfDot = bv.Dot(bv);     // 3.0 (generic type ⇒ float)
var   l2      = bv.Norm();      // √3

💬 Contributing

We welcome contributions from the community! Whether it's reporting bugs, suggesting features, or submitting pull requests, your involvement helps improve Cortex for everyone.

💬 How to Contribute

  1. Fork the Repository
  2. Create a Feature Branch
git checkout -b feature/YourFeature
  1. Commit Your Changes
git commit -m "Add your feature"
  1. Push to Your Fork
git push origin feature/YourFeature
  1. Open a Pull Request

Describe your changes and submit the pull request for review.

📄 License

This project is licensed under the MIT License.

📚 Sponsorship

Cortex is an open-source project maintained by BuilderSoft. Your support helps us continue developing and improving Cortex. Consider sponsoring us to contribute to the future of resilient streaming platforms.

How to Sponsor

  • Financial Contributions: Support us through GitHub Sponsors or other preferred platforms.
  • Corporate Sponsorship: If your organization is interested in sponsoring Cortex, please contact us directly.

Contact Us: cortex@buildersoft.io

Contact

We'd love to hear from you! Whether you have questions, feedback, or need support, feel free to reach out.

Thank you for using Cortex Data Framework! We hope it empowers you to build scalable and efficient data processing pipelines effortlessly.

Built with ❤️ by the Buildersoft team.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.
  • net9.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.1.0 105 10/10/2025

Just as the Cortex in our brains handles complex processing efficiently, Cortex Data Framework brings brainpower to your data management!