本文整理汇总了Golang中github.com/cpmech/gosl/io.Pfpink函数的典型用法代码示例。如果您正苦于以下问题:Golang Pfpink函数的具体用法?Golang Pfpink怎么用?Golang Pfpink使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Pfpink函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: msg
// msg prints information on residuals
func (o *NlSolver) msg(typ string, it int, Ldx, fx_max float64, first, last bool) {
if first {
io.Pfpink("\n%4s%23s%23s\n", "it", "Ldx", "fx_max")
io.Pfpink("%4s%23s%23s\n", "", io.Sf("(%7.1e)", o.fnewt), io.Sf("(%7.1e)", o.ftol))
return
}
io.Pfyel("%4d%23.15e%23.15e\n", it, Ldx, fx_max)
if last {
io.Pfgrey(". . . converged with %s. nit=%d, nFeval=%d, nJeval=%d\n", typ, it, o.NFeval, o.NJeval)
}
}
示例2: Test_GOflt01
func Test_GOflt01(tst *testing.T) {
//verbose()
chk.PrintTitle("GOflt01. float64")
Init(1234)
xmin := 10.0
xmax := 20.0
vals := make([]float64, NSAMPLES)
// using Float64
t0 := time.Now()
for i := 0; i < NSAMPLES; i++ {
vals[i] = Float64(xmin, xmax)
}
io.Pforan("time elapsed = %v\n", time.Now().Sub(t0))
hist := Histogram{Stations: []float64{10, 12.5, 15, 17.5, 20}}
hist.Count(vals, true)
io.Pfpink(TextHist(hist.GenLabels("%4g"), hist.Counts, 60))
// using Float64s
t0 = time.Now()
Float64s(vals, xmin, xmax)
io.Pforan("time elapsed = %v\n", time.Now().Sub(t0))
hist.Count(vals, true)
io.Pfblue2(TextHist(hist.GenLabels("%4g"), hist.Counts, 60))
}
示例3: Test_fileio01
func Test_fileio01(tst *testing.T) {
//verbose()
chk.PrintTitle("fileio01")
// start
analysis := NewFEM("data/bh16.sim", "", true, false, false, false, chk.Verbose, 0)
// domain A
domsA := NewDomains(analysis.Sim, analysis.DynCfs, analysis.HydSta, 0, 1, false)
if len(domsA) == 0 {
tst.Errorf("NewDomains failed\n")
return
}
domA := domsA[0]
err := domA.SetStage(0)
if err != nil {
tst.Errorf("SetStage failed\n%v", err)
return
}
for i, _ := range domA.Sol.Y {
domA.Sol.Y[i] = float64(i)
}
io.Pforan("domA.Sol.Y = %v\n", domA.Sol.Y)
// write file
tidx := 123
err = domA.SaveSol(tidx, true)
if err != nil {
tst.Errorf("SaveSol failed:\n%v", err)
return
}
// domain B
domsB := NewDomains(analysis.Sim, analysis.DynCfs, analysis.HydSta, 0, 1, false)
if len(domsB) == 0 {
tst.Errorf("NewDomains failed\n")
return
}
domB := domsB[0]
err = domB.SetStage(0)
if err != nil {
tst.Errorf("SetStage failed\n%v", err)
return
}
io.Pfpink("domB.Sol.Y (before) = %v\n", domB.Sol.Y)
// read file
err = domB.ReadSol(analysis.Sim.DirOut, analysis.Sim.Key, analysis.Sim.EncType, tidx)
if err != nil {
tst.Errorf("ReadSol failed:\n%v", err)
return
}
io.Pfgreen("domB.Sol.Y (after) = %v\n", domB.Sol.Y)
// check
chk.Vector(tst, "Y", 1e-17, domA.Sol.Y, domB.Sol.Y)
chk.Vector(tst, "dy/dt", 1e-17, domA.Sol.Dydt, domB.Sol.Dydt)
chk.Vector(tst, "d²y/dt²", 1e-17, domA.Sol.D2ydt2, domB.Sol.D2ydt2)
}
示例4: Test_ind02
func Test_ind02(tst *testing.T) {
//verbose()
chk.PrintTitle("ind02. copy into")
rnd.Init(0)
nbases := 1
A := get_individual(0, nbases)
B := get_individual(1, nbases)
fmts := map[string][]string{
"int": {"%2d", "%4d", "%5d"}, // ints
"flt": {"%6g", "%6g", "%5g"}, // floats
"str": {"%4s", "%2s", "%2s"}, // strings
"key": {"%3x", "%3x", "%3x"}, // keys
"byt": {"%4s", "%4s", "%4s"}, // bytes
"fun": {"%3s", "%3s", "%3s"}, // funcs
}
io.Pfpink("A = %v\n", A.Output(fmts, false))
io.Pfcyan("B = %v\n", B.Output(fmts, false))
var ops OpsData
ops.SetDefault()
ops.Pc = 1.0
ops.Cuts = []int{1, 2}
ops.Xrange = [][]float64{{0, 1}, {-20, 20}, {-300, 300}}
a := A.GetCopy()
b := A.GetCopy()
IndCrossover(a, b, A, B, 0, &ops)
io.Pforan("a = %v\n", a.Output(fmts, false))
io.Pfblue2("b = %v\n", b.Output(fmts, false))
chk.Ints(tst, "a.Ints ", a.Ints, []int{1, -20, 300})
chk.Ints(tst, "b.Ints ", b.Ints, []int{-1, 20, -300})
chk.Strings(tst, "a.Strings", a.Strings, []string{"abc", "Y", "c"})
chk.Strings(tst, "b.Strings", b.Strings, []string{"X", "b", "Z"})
// TODO: add other tests here
io.Pf("\n")
x := get_individual(0, nbases)
x.Ovas = []float64{0, 0}
x.Oors = []float64{0, 0, 0}
io.Pfblue2("x = %v\n", x.Output(fmts, false))
B.CopyInto(x)
chk.Scalar(tst, "ova0", 1e-17, x.Ovas[0], 200)
chk.Scalar(tst, "ova1", 1e-17, x.Ovas[1], 100)
chk.Scalar(tst, "oor0", 1e-17, x.Oors[0], 15)
chk.Scalar(tst, "oor1", 1e-17, x.Oors[1], 25)
chk.Scalar(tst, "oor2", 1e-17, x.Oors[2], 35)
io.Pforan("x = %v\n", x.Output(fmts, false))
chk.String(tst, x.Output(fmts, false), B.Output(fmts, false))
}
示例5: Test_fileio01
func Test_fileio01(tst *testing.T) {
chk.PrintTitle("fileio01")
// start
if !Start("data/bh16.sim", true, chk.Verbose) {
tst.Errorf("test failed\n")
}
defer End()
// domain A
distr := false
domA := NewDomain(Global.Sim.Regions[0], distr)
if domA == nil {
tst.Errorf("test failed\n")
}
if !domA.SetStage(0, Global.Sim.Stages[0], distr) {
tst.Errorf("test failed\n")
}
for i, _ := range domA.Sol.Y {
domA.Sol.Y[i] = float64(i)
}
io.Pforan("domA.Sol.Y = %v\n", domA.Sol.Y)
// write file
tidx := 123
if !domA.SaveSol(tidx) {
tst.Errorf("test failed")
return
}
dir, fnk := Global.Dirout, Global.Fnkey
io.Pfblue2("file %v written\n", out_nod_path(dir, fnk, tidx, Global.Rank))
// domain B
domB := NewDomain(Global.Sim.Regions[0], distr)
if domB == nil {
tst.Errorf("test failed\n")
}
if !domB.SetStage(0, Global.Sim.Stages[0], distr) {
tst.Errorf("test failed")
}
io.Pfpink("domB.Sol.Y (before) = %v\n", domB.Sol.Y)
// read file
if !domB.ReadSol(dir, fnk, tidx) {
tst.Errorf("test failed")
return
}
io.Pfgreen("domB.Sol.Y (after) = %v\n", domB.Sol.Y)
// check
chk.Vector(tst, "Y", 1e-17, domA.Sol.Y, domB.Sol.Y)
chk.Vector(tst, "dy/dt", 1e-17, domA.Sol.Dydt, domB.Sol.Dydt)
chk.Vector(tst, "d²y/dt²", 1e-17, domA.Sol.D2ydt2, domB.Sol.D2ydt2)
}
示例6: Test_sort05
func Test_sort05(tst *testing.T) {
//verbose()
chk.PrintTitle("sort05")
a := map[string]int{"a": 1, "z": 2, "c": 3, "y": 4, "d": 5, "b": 6, "x": 7}
b := map[string]float64{"a": 1, "z": 2, "c": 3, "y": 4, "d": 5, "b": 6, "x": 7}
c := map[string]bool{"a": false, "z": true, "c": false, "y": true, "d": true, "b": false, "x": true}
ka := StrIntMapSort(a)
kb := StrDblMapSort(b)
kc := StrBoolMapSort(c)
io.Pforan("sorted_keys(a) = %v\n", ka)
io.Pforan("sorted_keys(b) = %v\n", kb)
io.Pforan("sorted_keys(c) = %v\n", kc)
chk.Strings(tst, "ka", ka, []string{"a", "b", "c", "d", "x", "y", "z"})
chk.Strings(tst, "kb", kb, []string{"a", "b", "c", "d", "x", "y", "z"})
chk.Strings(tst, "kc", kc, []string{"a", "b", "c", "d", "x", "y", "z"})
ka, va := StrIntMapSortSplit(a)
io.Pfpink("sorted_keys(a) = %v\n", ka)
io.Pfpink("sorted_vals(a) = %v\n", va)
chk.Strings(tst, "ka", ka, []string{"a", "b", "c", "d", "x", "y", "z"})
chk.Ints(tst, "va", va, []int{1, 6, 3, 5, 7, 4, 2})
kb, vb := StrDblMapSortSplit(b)
io.Pfcyan("sorted_keys(b) = %v\n", kb)
io.Pfcyan("sorted_vals(b) = %v\n", vb)
chk.Strings(tst, "kb", kb, []string{"a", "b", "c", "d", "x", "y", "z"})
chk.Vector(tst, "vb", 1e-16, vb, []float64{1, 6, 3, 5, 7, 4, 2})
kc, vc := StrBoolMapSortSplit(c)
io.Pfcyan("sorted_keys(c) = %v\n", kc)
io.Pfcyan("sorted_vals(c) = %v\n", vc)
chk.Strings(tst, "kc", kc, []string{"a", "b", "c", "d", "x", "y", "z"})
chk.Bools(tst, "vc", vc, []bool{false, false, false, true, true, true, true})
}
示例7: KrefineN
// KrefineN return a new Nurbs with each span divided into ndiv parts = [2, 3, ...]
func (o *Nurbs) KrefineN(ndiv int, hughesEtAlPaper bool) *Nurbs {
X := make([][]float64, o.gnd)
if hughesEtAlPaper {
elems := o.Elements()
switch o.gnd {
case 2:
for _, e := range elems {
umin, umax := o.b[0].T[e[0]], o.b[0].T[e[1]]
vmin, vmax := o.b[1].T[e[2]], o.b[1].T[e[3]]
xa := o.Point([]float64{umin, vmin})
xb := o.Point([]float64{umax, vmin})
xc := []float64{(xa[0] + xb[0]) / 2.0, (xa[1] + xb[1]) / 2.0}
io.Pf("xa = %v\n", xa)
io.Pf("xb = %v\n", xb)
io.Pf("xc = %v\n", xc)
xa = o.Point([]float64{umin, vmax})
xb = o.Point([]float64{umax, vmax})
xc = []float64{(xa[0] + xb[0]) / 2.0, (xa[1] + xb[1]) / 2.0}
io.Pfpink("xa, xb, xc = %v, %v, %v\n", xa, xb, xc)
chk.Panic("KrefineN with hughesEtAlPaper==true is not implemented in 2D yet")
}
case 3:
chk.Panic("KrefineN with hughesEtAlPaper==true is not implemented in 3D yet")
}
io.Pfgrey("KrefineN with hughesEtAlPaper==true => not implemented yet\n")
return nil
} else {
for d := 0; d < o.gnd; d++ {
nspans := o.b[d].m - 2*o.p[d] - 1
nnewk := nspans * (ndiv - 1)
X[d] = make([]float64, nnewk)
k := 0
for i := 0; i < nspans; i++ {
umin, umax := o.b[d].T[o.p[d]+i], o.b[d].T[o.p[d]+i+1]
du := (umax - umin) / float64(ndiv)
for j := 1; j < ndiv; j++ {
X[d][k] = umin + du*float64(j)
k += 1
}
}
}
}
return o.Krefine(X)
}
示例8: Test_nurbs01
func Test_nurbs01(tst *testing.T) {
//verbose()
chk.PrintTitle("nurbs01")
nurbs := get_nurbs_A()
faces := nurbs.ExtractSurfaces()
spans := nurbs.Elements()
ibasis0 := nurbs.IndBasis(spans[0])
ibasis1 := nurbs.IndBasis(spans[1])
io.Pforan("spans = %v\n", spans)
chk.Ints(tst, "span0", spans[0], []int{2, 3, 1, 2})
chk.Ints(tst, "span1", spans[1], []int{3, 4, 1, 2})
chk.Ints(tst, "ibasis0", ibasis0, []int{0, 1, 2, 4, 5, 6})
chk.Ints(tst, "ibasis1", ibasis1, []int{1, 2, 3, 5, 6, 7})
shape0 := GetShapeNurbs(nurbs, faces, spans[0])
shape1 := GetShapeNurbs(nurbs, faces, spans[1])
dux := 0.5
duy := 1.0
drx := 2.0
dry := 2.0
r := []float64{0.75, 0.75, 0}
shape0.NurbsFunc(shape0.S, shape0.DSdR, r, true, -1)
io.Pforan("0: u = %v\n", shape0.U)
chk.Scalar(tst, "0: ux", 1e-17, shape0.U[0], (1.0+r[0])*dux/drx)
chk.Scalar(tst, "0: uy", 1e-17, shape0.U[1], (1.0+r[1])*duy/dry)
chk.Ints(tst, "0: ibasis", shape0.Ibasis, []int{0, 1, 2, 4, 5, 6})
io.Pforan("S(u(r)) = %v\n", shape0.S)
shape1.NurbsFunc(shape1.S, shape1.DSdR, r, true, -1)
io.Pfpink("\n1: u = %v\n", shape1.U)
chk.Scalar(tst, "1: ux", 1e-17, shape1.U[0], 0.5+(1.0+r[0])*dux/drx)
chk.Scalar(tst, "1: uy", 1e-17, shape1.U[1], (1.0+r[1])*duy/dry)
chk.Ints(tst, "1: ibasis", shape1.Ibasis, []int{1, 2, 3, 5, 6, 7})
if chk.Verbose {
gm.PlotNurbs("/tmp/gofem", "tst_nurbs01", nurbs, 21, false, nil)
}
}
示例9: Test_pareto01
func Test_pareto01(tst *testing.T) {
//verbose()
chk.PrintTitle("pareto01. compare vectors: Pareto-optimal")
u := []float64{1, 2, 3, 4, 5, 6}
v := []float64{1, 2, 3, 4, 5, 6}
io.Pforan("u = %v\n", u)
io.Pfblue2("v = %v\n", v)
u_dominates, v_dominates := DblsParetoMin(u, v)
io.Pfpink("u_dominates = %v\n", u_dominates)
io.Pfpink("v_dominates = %v\n", v_dominates)
if u_dominates {
tst.Errorf("test failed\n")
return
}
if v_dominates {
tst.Errorf("test failed\n")
return
}
v = []float64{1, 1.8, 3, 4, 5, 6}
io.Pforan("\nu = %v\n", u)
io.Pfblue2("v = %v\n", v)
u_dominates, v_dominates = DblsParetoMin(u, v)
io.Pfpink("u_dominates = %v\n", u_dominates)
io.Pfpink("v_dominates = %v\n", v_dominates)
if u_dominates {
tst.Errorf("test failed\n")
return
}
if !v_dominates {
tst.Errorf("test failed\n")
return
}
v = []float64{1, 2.1, 3, 4, 5, 6}
io.Pforan("\nu = %v\n", u)
io.Pfblue2("v = %v\n", v)
u_dominates, v_dominates = DblsParetoMin(u, v)
io.Pfpink("u_dominates = %v\n", u_dominates)
io.Pfpink("v_dominates = %v\n", v_dominates)
if !u_dominates {
tst.Errorf("test failed\n")
return
}
if v_dominates {
tst.Errorf("test failed\n")
return
}
}
示例10: RunInvCheck
func RunInvCheck(tst *testing.T, key string, M, CorrectInvM [][]float64, checkI bool, Tol, TolI float64) {
m, n := len(M), len(M[0])
Mi := MatAlloc(n, m)
t0 := time.Now()
err := MatInvG(Mi, M, 1e-13)
if err != nil {
chk.Panic("%v", err.Error())
}
io.Pfpink("Lapack: time elapsed = %v\n", time.Now().Sub(t0))
MMi := MatAlloc(m, m)
MMiM := MatAlloc(m, n)
MatMul(MMi, 1, M, Mi) // MMi = M * Mi
MatMul(MMiM, 1, MMi, M) // MMiM = M * Mi * M == M
chk.Matrix(tst, io.Sf("%s => Mi - CorrectInvM ", key), Tol, Mi, CorrectInvM)
chk.Matrix(tst, io.Sf("%s => M*Mi*M = M ", key), Tol, MMiM, M)
if checkI {
I := MatAlloc(m, m)
MatSetDiag(I, 1)
chk.Matrix(tst, io.Sf("%s => M*Mi = I ", key), TolI, MMi, I)
}
}
示例11: KrefineN
// KrefineN return a new Nurbs with each span divided into ndiv parts = [2, 3, ...]
func (o *Nurbs) KrefineN(ndiv int, useCspace bool) *Nurbs {
X := make([][]float64, o.gnd)
if useCspace {
elems := o.Elements()
for _, e := range elems {
switch o.gnd {
case 2:
umin, umax := o.b[0].T[e[0]], o.b[0].T[e[1]]
vmin, vmax := o.b[1].T[e[2]], o.b[1].T[e[3]]
xa := o.Point([]float64{umin, vmin})
xb := o.Point([]float64{umax, vmin})
xc := []float64{(xa[0] + xb[0]) / 2.0, (xa[1] + xb[1]) / 2.0}
io.Pforan("xa, xb, xc = %v, %v, %v\n", xa, xb, xc)
xa = o.Point([]float64{umin, vmax})
xb = o.Point([]float64{umax, vmax})
xc = []float64{(xa[0] + xb[0]) / 2.0, (xa[1] + xb[1]) / 2.0}
io.Pfpink("xa, xb, xc = %v, %v, %v\n", xa, xb, xc)
}
}
chk.Panic("nurbs.go: KrefineN with useCspace==true => not implemented yet")
} else {
for d := 0; d < o.gnd; d++ {
nspans := o.b[d].m - 2*o.p[d] - 1
nnewk := nspans * (ndiv - 1)
X[d] = make([]float64, nnewk)
k := 0
for i := 0; i < nspans; i++ {
umin, umax := o.b[d].T[o.p[d]+i], o.b[d].T[o.p[d]+i+1]
du := (umax - umin) / float64(ndiv)
for j := 1; j < ndiv; j++ {
X[d][k] = umin + du*float64(j)
k += 1
}
}
}
}
return o.Krefine(X)
}
示例12: Test_map03
func Test_map03(tst *testing.T) {
//verbose()
chk.PrintTitle("map03")
m := map[string][]int{
"a": []int{100, 101},
"b": []int{1000},
"c": []int{200, 300, 400},
}
io.Pforan("m (before) = %v\n", m)
StrIntsMapAppend(&m, "a", 102)
io.Pfpink("m (after) = %v\n", m)
chk.Ints(tst, "m[\"a\"]", m["a"], []int{100, 101, 102})
chk.Ints(tst, "m[\"b\"]", m["b"], []int{1000})
chk.Ints(tst, "m[\"c\"]", m["c"], []int{200, 300, 400})
StrIntsMapAppend(&m, "d", 666)
io.Pfcyan("m (after) = %v\n", m)
chk.Ints(tst, "m[\"a\"]", m["a"], []int{100, 101, 102})
chk.Ints(tst, "m[\"b\"]", m["b"], []int{1000})
chk.Ints(tst, "m[\"c\"]", m["c"], []int{200, 300, 400})
chk.Ints(tst, "m[\"d\"]", m["d"], []int{666})
chk.Ints(tst, "m[\"e\"]", m["e"], nil)
}
示例13: Test_frechet_03
func Test_frechet_03(tst *testing.T) {
//verbose()
chk.PrintTitle("dist_frechet_03")
μ := 10.0
σ := 5.0
δ := σ / μ
d := 1.0 + δ*δ
io.Pforan("μ=%v σ=%v δ=%v d=%v\n", μ, σ, δ, d)
if chk.Verbose {
plt.AxHline(d, "color='k'")
FrechetPlotCoef("/tmp/gosl", "fig_frechet_coef.eps", 3.0, 5.0)
}
k := 0.2441618
α := 1.0 / k
l := μ - math.Gamma(1.0-k)
io.Pfpink("l=%v α=%v\n", l, α)
l = 8.782275
α = 4.095645
var dist DistFrechet
dist.Init(&VarData{L: l, A: α})
io.Pforan("dist = %+#v\n", dist)
io.Pforan("mean = %v\n", dist.Mean())
io.Pforan("var = %v\n", dist.Variance())
io.Pforan("σ = %v\n", math.Sqrt(dist.Variance()))
if chk.Verbose {
plot_frechet(l, 1, α, 8, 16)
plt.SaveD("/tmp/gosl", "rnd_dist_frechet_03.eps")
}
}
示例14: Test_map01
func Test_map01(tst *testing.T) {
//verbose()
chk.PrintTitle("map01")
m := map[int][]int{
1: []int{100, 101},
2: []int{1000},
3: []int{200, 300, 400},
}
io.Pforan("m (before) = %v\n", m)
IntIntsMapAppend(&m, 1, 102)
io.Pfpink("m (after) = %v\n", m)
chk.Ints(tst, "m[1]", m[1], []int{100, 101, 102})
chk.Ints(tst, "m[2]", m[2], []int{1000})
chk.Ints(tst, "m[3]", m[3], []int{200, 300, 400})
IntIntsMapAppend(&m, 4, 666)
io.Pfcyan("m (after) = %v\n", m)
chk.Ints(tst, "m[1]", m[1], []int{100, 101, 102})
chk.Ints(tst, "m[2]", m[2], []int{1000})
chk.Ints(tst, "m[3]", m[3], []int{200, 300, 400})
chk.Ints(tst, "m[4]", m[4], []int{666})
chk.Ints(tst, "m[5]", m[5], nil)
}
示例15: Test_ends01
func Test_ends01(tst *testing.T) {
//verbose()
chk.PrintTitle("ends01")
size := 8
cuts := []int{5, 7}
ends := GenerateCxEnds(size, 0, cuts)
io.Pfpink("size=%v cuts=%v\n", size, cuts)
io.Pfyel("ends = %v\n", ends)
chk.IntAssert(len(ends), 3)
chk.IntAssert(ends[len(ends)-1], size)
checkRepeated(ends)
io.Pf("\n")
size = 2
cuts = []int{}
ends = GenerateCxEnds(size, 0, cuts)
io.Pfpink("size=%v cuts=%v\n", size, cuts)
io.Pforan("ends = %v\n", ends)
chk.Ints(tst, "ends", ends, []int{1, 2})
chk.IntAssert(ends[len(ends)-1], size)
checkRepeated(ends)
io.Pf("\n")
size = 3
ncuts := 3
ends = GenerateCxEnds(size, ncuts, nil)
io.Pfpink("size=%v ncuts=%v\n", size, ncuts)
io.Pforan("ends = %v\n", ends)
chk.Ints(tst, "ends", ends, []int{1, 2, 3})
chk.IntAssert(ends[len(ends)-1], size)
checkRepeated(ends)
io.Pf("\n")
size = 3
ncuts = 2
ends = GenerateCxEnds(size, ncuts, nil)
io.Pfpink("size=%v ncuts=%v\n", size, ncuts)
io.Pforan("ends = %v\n", ends)
chk.Ints(tst, "ends", ends, []int{1, 2, 3})
chk.IntAssert(ends[len(ends)-1], size)
checkRepeated(ends)
io.Pf("\n")
size = 8
cuts = []int{7}
ends = GenerateCxEnds(size, 0, cuts)
io.Pfpink("size=%v cuts=%v\n", size, cuts)
io.Pforan("ends = %v\n", ends)
chk.Ints(tst, "ends", ends, []int{7, 8})
chk.IntAssert(ends[len(ends)-1], size)
checkRepeated(ends)
io.Pf("\n")
size = 8
cuts = []int{2, 5}
ends = GenerateCxEnds(size, 0, cuts)
io.Pfpink("size=%v cuts=%v\n", size, cuts)
io.Pforan("ends = %v\n", ends)
chk.Ints(tst, "ends", ends, []int{2, 5, 8})
chk.IntAssert(ends[len(ends)-1], size)
checkRepeated(ends)
io.Pf("\n")
size = 20
cuts = []int{1, 5, 15, 17}
ends = GenerateCxEnds(size, 0, cuts)
io.Pfpink("size=%v cuts=%v\n", size, cuts)
io.Pfyel("ends = %v\n", ends)
chk.Ints(tst, "ends", ends, []int{1, 5, 15, 17, 20})
chk.IntAssert(ends[len(ends)-1], size)
checkRepeated(ends)
io.Pf("\n")
size = 20
ncuts = 5
ends = GenerateCxEnds(size, ncuts, cuts)
io.Pfpink("size=%v cuts=%v\n", size, cuts)
io.Pfyel("ends = %v\n", ends)
chk.IntAssert(ends[len(ends)-1], size)
checkRepeated(ends)
io.Pf("\n")
}