Esempio n. 1
0
func (this *ComplexVector) Get(i int) complex128 {
	this.boundsCheck(i)
	C.Rf_protect(this.expr)
	defer C.Rf_unprotect(1)

	c := C.ComplexVectorElt(this.expr, C.int(i))
	return complex(float64(c.r), float64(c.i))
}
Esempio n. 2
0
func (this *ComplexVector) ToArray() []complex128 {
	C.Rf_protect(this.expr)
	defer C.Rf_unprotect(1)
	array := make([]complex128, this.length)
	for i := 0; i < this.length; i++ {
		c := C.ComplexVectorElt(this.expr, C.int(i))
		array[i] = complex(float64(c.r), float64(c.i))
	}
	return array
}