Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

go sdk: export quantization enum #336

Merged
merged 1 commit into from
Jan 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 20 additions & 20 deletions golang/lib.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,25 +56,25 @@ func (m Metric) String() string {
type Quantization uint8

const (
f32 Quantization = iota
f16
f64
i8
b1
F32 Quantization = iota
F16
F64
I8
B1
)

func (a Quantization) String() string {
switch a {
case f16:
return "f16"
case f32:
return "f32"
case f64:
return "f64"
case i8:
return "i8"
case b1:
return "b1"
case F16:
return "F16"
case F32:
return "F32"
case F64:
return "F64"
case I8:
return "I8"
case B1:
return "B1"
default:
panic("Unknown quantization")
}
Expand Down Expand Up @@ -156,15 +156,15 @@ func NewIndex(conf IndexConfig) (index *Index, err error) {

// Map the quantization method
switch conf.Quantization {
case f16:
case F16:
options.quantization = C.usearch_scalar_f16_k
case f32:
case F32:
options.quantization = C.usearch_scalar_f32_k
case f64:
case F64:
options.quantization = C.usearch_scalar_f64_k
case i8:
case I8:
options.quantization = C.usearch_scalar_i8_k
case b1:
case B1:
options.quantization = C.usearch_scalar_b1_k
default:
options.quantization = C.usearch_scalar_unknown_k
Expand Down