示例#1
0
//export gslMultifitFunctionFdfDfCaller
func gslMultifitFunctionFdfDfCaller(x uintptr, cFunParamPtr uintptr, df uintptr) int {
	xVect := &vector.GslVector{}
	gogsl.InitializeGslStruct(xVect, x)
	dfMat := &matrix.GslMatrix{}
	gogsl.InitializeGslStruct(dfMat, df)
	gslf := (*GslMultifitFunctionFdf)(unsafe.Pointer(cFunParamPtr))
	return gslf.Derivative(xVect, gslf.Params, dfMat)
}
示例#2
0
//export gslMultiminFunctionFdfCaller
func gslMultiminFunctionFdfCaller(x uintptr, cFunParamPtr uintptr, df uintptr) float64 {
	xVect := &vector.GslVector{}
	gogsl.InitializeGslStruct(xVect, x)
	dfVect := &vector.GslVector{}
	gogsl.InitializeGslStruct(dfVect, df)
	gslf := (*GslMultiminFunctionFdf)(unsafe.Pointer(cFunParamPtr))
	return gslf.Fdf(xVect, gslf.Params, dfVect)
}
示例#3
0
//export gslMultifitFunctionFdfFCaller
func gslMultifitFunctionFdfFCaller(x uintptr, cFunParamPtr uintptr, f uintptr) int {
	xVect := &vector.GslVector{}
	gogsl.InitializeGslStruct(xVect, x)
	fVect := &vector.GslVector{}
	gogsl.InitializeGslStruct(fVect, f)
	gslf := (*GslMultifitFunctionFdf)(unsafe.Pointer(cFunParamPtr))
	return gslf.Function(xVect, gslf.Params, fVect)
}
示例#4
0
//export gslMultiminFunctionFdfDfCaller
func gslMultiminFunctionFdfDfCaller(x uintptr, cFunParamPtr uintptr, df uintptr) {
	xVect := &vector.GslVector{}
	gogsl.InitializeGslStruct(xVect, x)
	dfVect := &vector.GslVector{}
	gogsl.InitializeGslStruct(dfVect, df)
	gslf := (*GslMultiminFunctionFdf)(unsafe.Pointer(cFunParamPtr))
	gslf.Derivative(xVect, gslf.Params, dfVect)
}
示例#5
0
//export gslMultirootFunctionFdfCaller
func gslMultirootFunctionFdfCaller(x uintptr, cFunParamPtr uintptr, f uintptr, df uintptr) int {
	xVect := &vector.GslVector{}
	gogsl.InitializeGslStruct(xVect, x)
	fVect := &vector.GslVector{}
	gogsl.InitializeGslStruct(fVect, f)
	dfMat := &matrix.GslMatrix{}
	gogsl.InitializeGslStruct(dfMat, df)
	gslf := (*GslMultirootFunctionFdf)(unsafe.Pointer(cFunParamPtr))
	return gslf.Fdf(xVect, gslf.Params, fVect, dfMat)
}
示例#6
0
//export gslSimanStepFunctionCaller
func gslSimanStepFunctionCaller(rngptr uintptr, xptr uintptr, stepSize float64) {
	//fmt.Println("S")
	r := &rng.GslRng{}
	gogsl.InitializeGslStruct(r, rngptr)
	xarg := (*GslSimanArgument)(unsafe.Pointer(xptr))
	//fmt.Printf("S inval=%f @ %8.8x\n", *xarg.x.(*float64), reflect.ValueOf(xarg.x).Pointer())
	xarg.impl.stepFn(r, xarg.x, stepSize)
	//fmt.Printf("  outval=%f @ %8.8x\n", *xarg.x.(*float64), reflect.ValueOf(xarg.x).Pointer())
}
示例#7
0
func (r *GslSfResultE10) Ptr() uintptr {
	ptr := r.GslReference.Ptr()
	if ptr != 0 {
		return ptr
	}
	r.CData = make([]byte, GSL_SF_RESULT_E10_STRUCT_SIZE)
	ptr = ((*reflect.SliceHeader)(unsafe.Pointer(&r.CData))).Data
	gogsl.InitializeGslStruct(r, ptr)
	return ptr
}
示例#8
0
//gsl_multifit_robust_stats gsl_multifit_robust_statistics (const gsl_multifit_robust_workspace * w)
func RobustStatistics(rw *GslMultifitRobustWorkspace) *GslMultifitRobustStatistics {
	var dof C.size_t
	var numit C.size_t
	var weightsPtr *C.gsl_vector
	var rPtr *C.gsl_vector
	res := &GslMultifitRobustStatistics{}
	C.get_robust_statistics((*C.gsl_multifit_robust_workspace)(unsafe.Pointer(rw.Ptr())),
		(*C.double)(&res.SigmaOls), (*C.double)(&res.SigmaMad), (*C.double)(&res.SigmaRob), (*C.double)(&res.Sigma),
		(*C.double)(&res.Rsq), (*C.double)(&res.AdjRsq), (*C.double)(&res.Rmse), (*C.double)(&res.Sse),
		&dof, &numit, &weightsPtr, &rPtr)
	res.Dof = int(dof)
	res.Numit = int(numit)
	weights := &vector.GslVector{}
	gogsl.InitializeGslStruct(weights, uintptr(unsafe.Pointer(weightsPtr)))
	r := &vector.GslVector{}
	gogsl.InitializeGslStruct(r, uintptr(unsafe.Pointer(rPtr)))
	res.Weights = vector.VectorAlloc(weights.Length())
	res.R = vector.VectorAlloc(r.Length())
	vector.Memcpy(res.Weights, weights)
	vector.Memcpy(res.R, r)
	return res
}
示例#9
0
func (s *GslMultifitFdfsolver) J_() *matrix.GslMatrix {
	cptr := C.get_gsl_multifit_fdfsolver_j_ptr((*C.gsl_multifit_fdfsolver)(unsafe.Pointer(s.Ptr())))
	m := &matrix.GslMatrix{}
	gogsl.InitializeGslStruct(m, uintptr(unsafe.Pointer(cptr)))
	return m
}
示例#10
0
func (s *GslMultifitFdfsolver) Dx_() *vector.GslVector {
	cptr := C.get_gsl_multifit_fdfsolver_dx_ptr((*C.gsl_multifit_fdfsolver)(unsafe.Pointer(s.Ptr())))
	v := &vector.GslVector{}
	gogsl.InitializeGslStruct(v, uintptr(unsafe.Pointer(cptr)))
	return v
}
示例#11
0
func (vv *GslVectorView) Vector() *GslVector {
	v := &GslVector{}
	ptr := C.get_vector_view_vector((*C.gsl_vector_view)(unsafe.Pointer(vv.Ptr())))
	gogsl.InitializeGslStruct(v, uintptr(unsafe.Pointer(ptr)))
	return v
}
示例#12
0
func (s *GslMultirootFsolver) X_() *vector.GslVector {
	cptr := C.get_gsl_mutliroot_solver_x_ptr((*C.gsl_multiroot_fsolver)(unsafe.Pointer(s.Ptr())))
	v := &vector.GslVector{}
	gogsl.InitializeGslStruct(v, uintptr(unsafe.Pointer(cptr)))
	return v
}
示例#13
0
func (s *GslMultiminFdfminimizer) Gradient_() *vector.GslVector {
	cptr := C.get_gsl_mutlimin_fdfminimizer_gradient_ptr((*C.gsl_multimin_fdfminimizer)(unsafe.Pointer(s.Ptr())))
	v := &vector.GslVector{}
	gogsl.InitializeGslStruct(v, uintptr(unsafe.Pointer(cptr)))
	return v
}
示例#14
0
// XXX - Do this with the others...
func (v *GslMatrixView) Matrix() *GslMatrix {
	m := &GslMatrix{}
	ptr := C.get_matrix_view_matrix((*C.gsl_matrix_view)(unsafe.Pointer(v.Ptr())))
	gogsl.InitializeGslStruct(m, uintptr(unsafe.Pointer(ptr)))
	return m
}