in src/gowrapper/ckks/encoder.go [37:48]
func CDoubleVecToGoComplex(realValues *C.constDouble, length uint64) []complex128 {
complexValues := make([]complex128, length)
size := unsafe.Sizeof(float64(0))
basePtr := uintptr(unsafe.Pointer(realValues))
for i := range complexValues {
var x float64
// https://stackoverflow.com/a/32701024/925978
x = *(*float64)(unsafe.Pointer(basePtr + size*uintptr(i)))
complexValues[i] = complex(x, 0)
}
return complexValues
}