On Sun, 2026-08-16 at 23:44 -0700, [email protected] wrote: > Hi fellow Gophers > > I wonder does anyone know of a good sparse/repetition array library > with the following features? > > * Support repetitions and lengths of *big.Int. For example {12, 12, > 12, ... repeat 10^129 times}...{327, 327, 327, ... repeat 10^178 > times }..., total length 10^2048 > * Support the usual slice indexing/subslice etc. operations, along > with the `Index` and `Sort` methods in the slices package > * I need only 1-D arrays, so basically almost similar interface to > the builtin slice data type > * Ideally clean and simple, with a single file implementation and a > single file test. > > > I tried to look into the following libraries, but they don't quite > seem to do what I want: > > * https://pkg.go.dev/github.com/james-bowman/sparse > * https://pkg.go.dev/golang.org/x/tools/container/intsets > * https://research.swtch.com/sparse > > Further thinking on my above requirements seem to suggest what I am > looking for is *not* what is commonly called "sparse vector" (whose > repetitions are limited to zeros). However, I am not quite sure what > to call my wanted data structure (I think what I have in mind should > not be that esoteric, but alas could not find the search keyword).
Not completely covering all the things you want, and good is subjective, but there is my RLE package, https://pkg.go.dev/github.com/biogo/store/step It doesn't support sorting, but it should be too hard to extend for that. I'm not sure of the efficiency of sorting, depending on the complexity of the RL steps in the vector. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/golang-nuts/585f11037e298f75004c54849b5799e4f89eafdb.camel%40kortschak.io.
