/
rfunc_f64s_gen.go
115 lines (100 loc) · 2.41 KB
/
rfunc_f64s_gen.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
// Copyright ©2020 The go-hep Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Automatically generated. DO NOT EDIT.
package rfunc
import (
"fmt"
)
// FuncF32sToF64s implements rfunc.Formula
type FuncF32sToF64s struct {
rvars []string
arg0 *[]float32
fct func(arg00 []float32) []float64
}
// NewFuncF32sToF64s return a new formula, from the provided function.
func NewFuncF32sToF64s(rvars []string, fct func(arg00 []float32) []float64) *FuncF32sToF64s {
return &FuncF32sToF64s{
rvars: rvars,
fct: fct,
}
}
// RVars implements rfunc.Formula
func (f *FuncF32sToF64s) RVars() []string { return f.rvars }
// Bind implements rfunc.Formula
func (f *FuncF32sToF64s) Bind(args []interface{}) error {
if got, want := len(args), 1; got != want {
return fmt.Errorf(
"rfunc: invalid number of bind arguments (got=%d, want=%d)",
got, want,
)
}
{
ptr, ok := args[0].(*[]float32)
if !ok {
return fmt.Errorf(
"rfunc: argument type 0 (name=%s) mismatch: got=%T, want=*[]float32",
f.rvars[0], args[0],
)
}
f.arg0 = ptr
}
return nil
}
// Func implements rfunc.Formula
func (f *FuncF32sToF64s) Func() interface{} {
return func() []float64 {
return f.fct(
*f.arg0,
)
}
}
var (
_ Formula = (*FuncF32sToF64s)(nil)
)
// FuncF64sToF64s implements rfunc.Formula
type FuncF64sToF64s struct {
rvars []string
arg0 *[]float64
fct func(arg00 []float64) []float64
}
// NewFuncF64sToF64s return a new formula, from the provided function.
func NewFuncF64sToF64s(rvars []string, fct func(arg00 []float64) []float64) *FuncF64sToF64s {
return &FuncF64sToF64s{
rvars: rvars,
fct: fct,
}
}
// RVars implements rfunc.Formula
func (f *FuncF64sToF64s) RVars() []string { return f.rvars }
// Bind implements rfunc.Formula
func (f *FuncF64sToF64s) Bind(args []interface{}) error {
if got, want := len(args), 1; got != want {
return fmt.Errorf(
"rfunc: invalid number of bind arguments (got=%d, want=%d)",
got, want,
)
}
{
ptr, ok := args[0].(*[]float64)
if !ok {
return fmt.Errorf(
"rfunc: argument type 0 (name=%s) mismatch: got=%T, want=*[]float64",
f.rvars[0], args[0],
)
}
f.arg0 = ptr
}
return nil
}
// Func implements rfunc.Formula
func (f *FuncF64sToF64s) Func() interface{} {
return func() []float64 {
return f.fct(
*f.arg0,
)
}
}
var (
_ Formula = (*FuncF64sToF64s)(nil)
)