| 1 |
package dstream |
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
func VarPos(d Dstream) map[string]int { |
| 6 |
|
| 7 |
mp := make(map[string]int) |
| 8 |
|
| 9 |
for k, v := range d.Names() { |
| 10 |
mp[v] = k |
| 11 |
} |
| 12 |
|
| 13 |
return mp |
| 14 |
} |
| 15 |
|
| 16 |
|
| 17 |
func VarMap(d Dstream) map[string]interface{} { |
| 18 |
|
| 19 |
mp := make(map[string]interface{}) |
| 20 |
|
| 21 |
for _, na := range d.Names() { |
| 22 |
mp[na] = d.Get(na) |
| 23 |
} |
| 24 |
|
| 25 |
return mp |
| 26 |
} |
| 27 |
|
| 28 |
func wherefalse(ma []bool, pos []int) []int { |
| 29 |
pos = pos[0:0] |
| 30 |
for i, v := range ma { |
| 31 |
if !v { |
| 32 |
pos = append(pos, i) |
| 33 |
} |
| 34 |
} |
| 35 |
return pos |
| 36 |
} |
| 37 |
|
| 38 |
func resizeBool(x []bool, n int) []bool { |
| 39 |
if cap(x) < n { |
| 40 |
x = make([]bool, n) |
| 41 |
} |
| 42 |
return x[0:n] |
| 43 |
} |
| 44 |
|
| 45 |
func zeroFloat(z []float64) { |
| 46 |
z = z[0:cap(z)] |
| 47 |
for i := range z { |
| 48 |
z[i] = 0 |
| 49 |
} |
| 50 |
} |