Files
obitools4/pkg/obisimilarity/block_simd.go
T
Eric Coissac e511650f5b Refactor similarity engine and implement parallel clustering
Introduces parallel processing for clustering, refines scoring mechanisms, and expands test coverage for the alignment functionality.

This change introduces parallel processing capabilities within the clustering logic, updates the core similarity engine with new data structures and scoring methods, and implements a comprehensive test suite for the alignment tool. It also adds new command-line options for configuring alignment parameters and reference lengths.
2026-11-03 14:04:32 +11:00

26 lines
784 B
Go

//go:build goexperiment.simd
package obisimilarity
import "simd"
// simdBlockWidth is the number of sequences in a block: one per lane of a
// vector of bytes.
func simdBlockWidth() int {
var probe simd.Uint8s
return min(probe.Len(), 64)
}
// blockCommon computes, for the sequence whose words are given, the sum of
// the minima of the counters with every lane of the block. It is the value of
// commonWords without the overflow term, as the sums fit in 8 bits (see
// SparseWords). out must hold at least `width` bytes.
func blockCommon(data []uint8, width int, words []uint16, out []uint8) {
acc := simd.BroadcastUint8s(0)
for _, e := range words {
w := simd.LoadUint8s(data[int(e>>8)*width:])
acc = acc.Add(w.Min(simd.BroadcastUint8s(uint8(e))))
}
acc.Store(out)
}