vector

package
v1.7.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 9, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Copyright (C) 2019-2023 vdaas.org vald team <vald@vdaas.org>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

View Source
var ErrUnknownDistribution = errors.New("Unknown distribution generator type")

ErrUnknownDistribution represents an error which the distribution is unknown.

Functions

func ConvertVectorsUint8ToFloat32 added in v1.5.4

func ConvertVectorsUint8ToFloat32(vectors [][]uint8) (ret [][]float32)

ConvertVectorsUint8ToFloat32 converts uint8 vectors and return float32 vectors

func GaussianDistributedFloat32VectorGenerator

func GaussianDistributedFloat32VectorGenerator(n, dim int) [][]float32

GaussianDistributedFloat32VectorGenerator returns n float32 vectors with dim dimension and their values under Gaussian distribution

func GaussianDistributedUint8VectorGenerator

func GaussianDistributedUint8VectorGenerator(n, dim int) [][]uint8

GaussianDistributedUint8VectorGenerator returns n uint8 vectors with dim dimension and their values under Gaussian distribution

func GenF32Vec added in v1.5.4

func GenF32Vec(dist Distribution, num int, dim int) ([][]float32, error)

GenF32Vec returns multiple float32 vectors.

func GenSameValueVec added in v1.5.4

func GenSameValueVec(size int, val float32) []float32

GenSameValueVec returns a float32 vector filled with value.

func GenUint8Vec added in v1.5.4

func GenUint8Vec(dist Distribution, num int, dim int) ([][]float32, error)

GenUint8Vec returns multiple uint8 vectors.

func NegativeUniformDistributedFloat32VectorGenerator added in v1.7.0

func NegativeUniformDistributedFloat32VectorGenerator(n, dim int) (vecs [][]float32)

NegativeUniformDistributedFloat32VectorGenerator returns n float32 vectors with dim dimension and their values under Uniform distribution

func UniformDistributedFloat32VectorGenerator

func UniformDistributedFloat32VectorGenerator(n, dim int) [][]float32

UniformDistributedFloat32VectorGenerator returns n float32 vectors with dim dimension and their values under Uniform distribution

func UniformDistributedUint8VectorGenerator

func UniformDistributedUint8VectorGenerator(n, dim int) [][]uint8

UniformDistributedUint8VectorGenerator returns n uint8 vectors with dim dimension and their values under Uniform distribution

Types

type Distribution

type Distribution int
const (
	Gaussian Distribution = iota
	Uniform
	NegativeUniform
)

type Float32VectorGeneratorFunc

type Float32VectorGeneratorFunc func(int, int) [][]float32

func Float32VectorGenerator

func Float32VectorGenerator(d Distribution) (Float32VectorGeneratorFunc, error)

Float32VectorGenerator returns float32 vector generator function which has selected distribution

type Uint8VectorGeneratorFunc

type Uint8VectorGeneratorFunc func(int, int) [][]uint8

func Uint8VectorGenerator

func Uint8VectorGenerator(d Distribution) (Uint8VectorGeneratorFunc, error)

Uint8VectorGenerator returns uint8 vector generator function which has selected distribution

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL