import type { RawBinaryCoStream } from "cojson"; import { AnonymousJazzAgent, CoValue, CoValueClass, Group, ID, Resolved, SubscribeListenerOptions, TypeSym, Settled, Account, CoValueJazzApi, inspect, CoreCoVectorSchema } from "../internal.js"; /** * CoVectors are collaborative storages of vectors (floating point arrays). * * @category CoValues */ export declare class CoVector extends Float32Array implements Readonly, CoValue { $jazz: CoVectorJazzApi; $isLoaded: true; /** @category Type Helpers */ [TypeSym]: "BinaryCoStream"; static get [Symbol.species](): Float32ArrayConstructor; protected static requiredDimensionsCount: number | undefined; private _isVectorLoaded; private _requiredDimensionsCount; static coValueSchema?: CoreCoVectorSchema; constructor(options: { owner: Account | Group; } | { fromRaw: RawBinaryCoStream; }); /** @category Internals */ static fromRaw(this: CoValueClass & typeof CoVector, raw: RawBinaryCoStream): V & CoVector; /** * Create a new `CoVector` instance with the given vector. * * @category Creation * @deprecated Use `co.vector(...).create` instead. */ static create(this: CoValueClass & typeof CoVector, vector: number[] | Float32Array, options?: { owner?: Account | Group; } | Account | Group): S & CoVector; private static toByteArray; private static fromByteArray; private loadVectorData; private setVectorData; /** * Get a JSON representation of the `CoVector` * @category Content */ toJSON(): Array; /** @internal */ [inspect](): number[]; /** * Load a `CoVector` * * @category Subscription & Loading * @deprecated Use `co.vector(...).load` instead. */ static load(this: CoValueClass, id: ID, options?: { loadAs?: Account | AnonymousJazzAgent; }): Promise>; /** * Subscribe to a `CoVector`, when you have an ID but don't have a `CoVector` instance yet * @category Subscription & Loading * @deprecated Use `co.vector(...).subscribe` instead. */ static subscribe(this: CoValueClass, id: ID, listener: (value: Resolved, unsubscribe: () => void) => void): () => void; static subscribe(this: CoValueClass, id: ID, options: SubscribeListenerOptions, listener: (value: Resolved, unsubscribe: () => void) => void): () => void; /** * Calling `copyWithin` on a CoVector is forbidden. CoVectors are immutable. * @deprecated If you want to change the vector, replace the former instance of CoVector with a new one. */ copyWithin(target: number, start: number, end?: number): never; /** * Calling `fill` on a CoVector is forbidden. CoVectors are immutable. * @deprecated If you want to change the vector, replace the former instance of CoVector with a new one. */ fill(value: number, start?: number, end?: number): never; /** * Calling `reverse` on a CoVector is forbidden. CoVectors are immutable. * @deprecated If you want to change the vector, replace the former instance of CoVector with a new one. */ reverse(): never; /** * Calling `set` on a CoVector is forbidden. CoVectors are immutable. * @deprecated If you want to change the vector, replace the former instance of CoVector with a new one. // */ set(array: ArrayLike, offset?: number): never; /** * Calling `sort` on a CoVector is forbidden. CoVectors are immutable. * @deprecated If you want to change the vector, replace the former instance of CoVector with a new one. */ sort(compareFn?: (a: number, b: number) => number): never; } export declare class CoVectorJazzApi extends CoValueJazzApi { private coVector; raw: RawBinaryCoStream; constructor(coVector: V, raw: RawBinaryCoStream); get owner(): Group; /** * An instance method to subscribe to an existing `CoVector` * @category Subscription & Loading */ subscribe(this: CoVectorJazzApi, listener: (value: Resolved) => void): () => void; /** * Wait for the `CoVector` to be uploaded to the other peers. * * @category Subscription & Loading */ waitForSync(options?: { timeout?: number; }): Promise; /** * Calculate the magnitude of this vector. */ magnitude(): number; /** * Normalize this vector. * @returns A new instance of a normalized vector. */ normalize(): Float32Array; /** * Calculate the dot product of this vector and another vector. */ dotProduct(otherVector: CoVector | Float32Array | number[]): number; /** * Calculate the cosine similarity between this vector and another vector. * * @returns A value between `-1` and `1`: * - `1` means the vectors are identical * - `0` means the vectors are orthogonal (i.e. no similarity) * - `-1` means the vectors are opposite direction (perfectly dissimilar) */ cosineSimilarity(otherVector: CoVector | Float32Array | number[]): number; } //# sourceMappingURL=coVector.d.ts.map