Method Shorten
- Namespace
- MailFathom.Application.Emails.Embeddings
- Assembly
- MailFathom.Application.dll
Shorten(int)
Shortens the vector to a narrower space and restores its unit length.
public EmbeddingVector Shorten(int dimension)
Parameters
dimensionintThe width of the narrower space, which must not exceed this vector's own.
Returns
- EmbeddingVector
The shortened vector, or this one when it already has that width.
Remarks
Renormalization is part of shortening rather than a separate step a caller might forget. Dropping the tail of a unit vector leaves one whose length is below one by however much the dropped components carried, and a cosine distance computed against vectors of differing lengths is a number with no meaning rather than an error.
Exceptions
- ArgumentOutOfRangeException
Thrown when the width is not positive or exceeds Dimension.