Class EmbeddingVector
- Namespace
- MailFathom.Application.Emails.Embeddings
- Assembly
- MailFathom.Application.dll
One point of an embedding profile's vector space.
public sealed class EmbeddingVector
- Inheritance
-
EmbeddingVector
- Inherited Members
Remarks
A class rather than a record struct, because the components are a ReadOnlyMemory<T> whose synthesized equality would compare the segment rather than the numbers in it, and two vectors that are equal component for component would report otherwise.
The type owns the two arithmetic operations an adapter needs — shortening and normalizing — so that the rule ADR 0006 states about a shortened vector lives in one place and is provable without a provider. Nothing here decides whether to shorten; that is the declaration's decision and the adapter applies it.
Properties
- Components
Gets the components in the order the provider produced them.
- Dimension
Gets the number of components, which is the width of the space this vector belongs to.
Methods
- Create(ReadOnlySpan<float>)
Builds a vector from the components a provider returned.
- Normalize()
Scales the vector to unit length.
- Shorten(int)
Shortens the vector to a narrower space and restores its unit length.