func Take(dst, src []float64, indices []int) []float64 {

	if len(indices) > len(src) {
		panic(errLength)
	}

	if dst == nil {
		dst = make([]float64, len(indices))
	}

	if len(dst) != len(indices) {
		panic(errLength)
	}

	if len(indices) == 0 {
		return dst
	}

	dst[0] = src[indices[0]]
	for i := 1; i < len(indices); i++ {
		v0 := indices[i-1]
		v1 := indices[i]
		switch {
		case v0 == v1:
			panic(errDuplicateIndices)
		case v0 > v1:
			panic(errSortedIndices)
		}
		dst[i] = src[v1]
	}

	return dst
}
// Take creates a sub-slice of src with all elements indiced by the provided indices.
// Take uses dst as work buffer, storing elements at the start of the slice.
// Take clears dst if a slice is passed, and allocates a new slice if dst is nil.
// Take will panic if indices is not sorted or has duplicates.
// Take will panic if length of indices is larger than length of src.
// Take will panic if length of indices is different from length of dst.
Take creates a sub-slice of src with all elements indiced by the provided indices.
Take uses dst as work buffer, storing elements at the start of the slice.
Take clears dst if a slice is passed, and allocates a new slice if dst is nil.
Take will panic if indices is not sorted or has duplicates.
Take will panic if length of indices is larger than length of src.
Take will panic if length of indices is different from length of dst.
// Take creates a sub - slice of src with all elements indiced by the provided indices . // Take uses dst as work buffer storing elements at the start of the slice . // Take clears dst if a slice is passed and allocates a new slice if dst is nil . // Take will panic if indices is not sorted or has duplicates . // Take will panic if length of indices is larger than length of src . // Take will panic if length of indices is different from length of dst .
func Take(dst, src []float64, indices []int) []float64 {
	if len(indices) > len(src) {
		panic(errLength)
	}
	if dst == nil {
		dst = make([]float64, len(indices))
	}
	if len(dst) != len(indices) {
		panic(errLength)
	}
	if len(indices) == 0 {
		return dst
	}
	dst[0] = src[indices[0]]
	for i := 1; i < len(indices); i++ {
		v0 := indices[i-1]
		v1 := indices[i]
		switch {
		case v0 == v1:
			panic(errDuplicateIndices)
		case v0 > v1:
			panic(errSortedIndices)
		}
		dst[i] = src[v1]
	}
	return dst
}
func Take ( dst , src [ ] float64 , indices [ ] int ) [ ] float64 { if len ( indices ) > len ( src ) { panic ( errLength ) } if dst == nil { dst = make ( [ ] float64 , len ( indices ) ) } if len ( dst ) != len ( indices ) { panic ( errLength ) } if len ( indices ) == 0 { return dst } dst [ 0 ] = src [ indices [ 0 ] ] for i := 1 ; i < len ( indices ) ; i ++ { v0 := indices [ i - 1 ] v1 := indices [ i ] switch { case v0 == v1 : panic ( errDuplicateIndices ) case v0 > v1 : panic ( errSortedIndices ) } dst [ i ] = src [ v1 ] } return dst }
Take creates a sub-slice of src with all elements indiced by the provided indices.
Take creates a sub - slice of src with all elements indiced by the provided indices .