Exemple #1
0
func TestClosedRefine1D(t *testing.T) {
	grid := NewClosed(1)

	levels := []uint64{0, 1, 1, 2, 2, 3, 3, 3, 3}
	orders := []uint64{0, 0, 2, 1, 3, 1, 3, 5, 7}
	childLevels := []uint64{1, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4}
	childOrders := []uint64{0, 2, 1, 3, 1, 3, 5, 7, 1, 3, 5, 7, 9, 11, 13, 15}

	indices := grid.Refine(internal.Compose(levels, orders))

	assert.Equal(indices, internal.Compose(childLevels, childOrders), t)
}
Exemple #2
0
func TestClosedIndex1D(t *testing.T) {
	cases := []struct {
		level  uint64
		levels []uint64
		orders []uint64
	}{
		{
			level:  0,
			levels: []uint64{0},
			orders: []uint64{0},
		},
		{
			level:  1,
			levels: []uint64{1, 1},
			orders: []uint64{0, 2},
		},
		{
			level:  2,
			levels: []uint64{2, 2},
			orders: []uint64{1, 3},
		},
		{
			level:  3,
			levels: []uint64{3, 3, 3, 3},
			orders: []uint64{1, 3, 5, 7},
		},
	}

	for _, c := range cases {
		assert.Equal(closedIndex(c.level), internal.Compose(c.levels, c.orders), t)
	}
}
Exemple #3
0
func TestClosedCompute1D1P(t *testing.T) {
	basis := NewClosed(1, 1)

	compute := func(level, order uint64, point float64) float64 {
		return basis.Compute(internal.Compose([]uint64{level}, []uint64{order}), []float64{point})
	}

	points := []float64{0.0, 0.25, 0.5, 0.75, 1.0}

	cases := []struct {
		level  uint64
		order  uint64
		values []float64
	}{
		{0, 0, []float64{1.0, 1.0, 1.0, 1.0, 1.0}},
		{1, 0, []float64{1.0, 0.5, 0.0, 0.0, 0.0}},
		{1, 2, []float64{0.0, 0.0, 0.0, 0.5, 1.0}},
		{2, 1, []float64{0.0, 1.0, 0.0, 0.0, 0.0}},
		{2, 3, []float64{0.0, 0.0, 0.0, 1.0, 0.0}},
	}

	values := make([]float64, len(points))

	for i := range cases {
		for j := range values {
			values[j] = compute(cases[i].level, cases[i].order, points[j])
		}
		assert.Equal(values, cases[i].values, t)
	}
}
Exemple #4
0
func TestClosedCompute1D(t *testing.T) {
	grid := NewClosed(1)

	levels := []uint64{0, 1, 1, 2, 2, 3, 3, 3, 3}
	orders := []uint64{0, 0, 2, 1, 3, 1, 3, 5, 7}
	nodes := []float64{0.5, 0.0, 1.0, 0.25, 0.75, 0.125, 0.375, 0.625, 0.875}

	assert.Equal(grid.Compute(internal.Compose(levels, orders)), nodes, t)
}
Exemple #5
0
func TestClosedIntegrate(t *testing.T) {
	basis := NewClosed(1, 1)

	levels := []uint64{0, 1, 2, 3}
	values := []float64{1.0, 0.25, 1.0 / 2.0 / 2.0, 1.0 / 2.0 / 2.0 / 2.0}

	for i := range levels {
		indices := internal.Compose([]uint64{levels[i]}, []uint64{0})
		assert.Equal(basis.Integrate(indices), values[i], t)
	}
}
Exemple #6
0
func TestClosedCompute2D(t *testing.T) {
	grid := NewClosed(2)

	levels := []uint64{
		0, 0,
		0, 1,
		0, 1,
		1, 0,
		1, 0,
		0, 2,
		0, 2,
		1, 1,
		1, 1,
		1, 1,
		1, 1,
		2, 0,
		2, 0,
	}

	orders := []uint64{
		0, 0,
		0, 0,
		0, 2,
		0, 0,
		2, 0,
		0, 1,
		0, 3,
		0, 0,
		0, 2,
		2, 0,
		2, 2,
		1, 0,
		3, 0,
	}

	nodes := []float64{
		0.50, 0.50,
		0.50, 0.00,
		0.50, 1.00,
		0.00, 0.50,
		1.00, 0.50,
		0.50, 0.25,
		0.50, 0.75,
		0.00, 0.00,
		0.00, 1.00,
		1.00, 0.00,
		1.00, 1.00,
		0.25, 0.50,
		0.75, 0.50,
	}

	assert.Equal(grid.Compute(internal.Compose(levels, orders)), nodes, t)
}
Exemple #7
0
func TestOpenIntegrate(t *testing.T) {
	basis := NewOpen(1, 1)

	levels := []uint64{0, 1, 1, 2, 2, 2, 2}
	orders := []uint64{0, 0, 2, 0, 2, 4, 6}
	values := []float64{1.0, 0.5, 0.5, 0.25, 0.125, 0.125, 0.25}

	for i := range levels {
		indices := internal.Compose([]uint64{levels[i]}, []uint64{orders[i]})
		assert.Equal(basis.Integrate(indices), values[i], t)
	}
}
Exemple #8
0
func TestOpenCompute1D(t *testing.T) {
	grid := NewOpen(1)

	levels := []uint64{0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3}
	orders := []uint64{0, 0, 2, 0, 2, 4, 6, 0, 2, 4, 6, 8, 10, 12, 14}
	nodes := []float64{
		0.5000, 0.2500, 0.7500, 0.1250, 0.3750,
		0.6250, 0.8750, 0.0625, 0.1875, 0.3125,
		0.4375, 0.5625, 0.6875, 0.8125, 0.9375,
	}

	assert.Equal(grid.Compute(internal.Compose(levels, orders)), nodes, t)
}
Exemple #9
0
func TestOpenRefine1D(t *testing.T) {
	grid := NewOpen(1)

	levels := []uint64{0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3}
	orders := []uint64{0, 0, 2, 0, 2, 4, 6, 0, 2, 4, 6, 8, 10, 12, 14}
	childLevels := []uint64{
		1, 1,
		2, 2, 2, 2,
		3, 3, 3, 3, 3, 3, 3, 3,
		4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
	}
	childOrders := []uint64{
		0, 2,
		0, 2, 4, 6,
		0, 2, 4, 6, 8, 10, 12, 14,
		0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30,
	}

	indices := grid.Refine(internal.Compose(levels, orders))

	assert.Equal(indices, internal.Compose(childLevels, childOrders), t)
}
Exemple #10
0
func TestClosedRefine2D(t *testing.T) {
	grid := NewClosed(2)

	levels := []uint64{
		0, 0,
		0, 1,
		0, 1,
		1, 0,
		1, 0,
		0, 2,
		0, 2,
		1, 1,
		1, 1,
		1, 1,
		1, 1,
		2, 0,
		2, 0,
	}

	orders := []uint64{
		0, 0,
		0, 0,
		0, 2,
		0, 0,
		2, 0,
		0, 1,
		0, 3,
		0, 0,
		0, 2,
		2, 0,
		2, 2,
		1, 0,
		3, 0,
	}

	childLevels := []uint64{
		1, 0,
		1, 0,
		0, 1,
		0, 1,
		1, 1,
		1, 1,
		0, 2,
		1, 1,
		1, 1,
		0, 2,
		2, 0,
		1, 1,
		1, 1,
		2, 0,
		1, 1,
		1, 1,
		1, 2,
		1, 2,
		0, 3,
		0, 3,
		1, 2,
		1, 2,
		0, 3,
		0, 3,
		2, 1,
		1, 2,
		2, 1,
		1, 2,
		2, 1,
		1, 2,
		2, 1,
		1, 2,
		3, 0,
		3, 0,
		2, 1,
		2, 1,
		3, 0,
		3, 0,
		2, 1,
		2, 1,
	}

	childOrders := []uint64{
		0, 0,
		2, 0,
		0, 0,
		0, 2,
		0, 0,
		2, 0,
		0, 1,
		0, 2,
		2, 2,
		0, 3,
		1, 0,
		0, 0,
		0, 2,
		3, 0,
		2, 0,
		2, 2,
		0, 1,
		2, 1,
		0, 1,
		0, 3,
		0, 3,
		2, 3,
		0, 5,
		0, 7,
		1, 0,
		0, 1,
		1, 2,
		0, 3,
		3, 0,
		2, 1,
		3, 2,
		2, 3,
		1, 0,
		3, 0,
		1, 0,
		1, 2,
		5, 0,
		7, 0,
		3, 0,
		3, 2,
	}

	indices := grid.Refine(internal.Compose(levels, orders))

	assert.Equal(indices, internal.Compose(childLevels, childOrders), t)
}
Exemple #11
0
func TestClosedIndex2D(t *testing.T) {
	grid := NewClosed(2)

	cases := []struct {
		level  []uint64
		levels []uint64
		orders []uint64
	}{
		{
			level: []uint64{0, 0},
			levels: []uint64{
				0, 0,
			},
			orders: []uint64{
				0, 0,
			},
		},
		{
			level: []uint64{0, 1},
			levels: []uint64{
				0, 1,
				0, 1,
			},
			orders: []uint64{
				0, 0,
				0, 2,
			},
		},
		{
			level: []uint64{1, 2},
			levels: []uint64{
				1, 2,
				1, 2,
				1, 2,
				1, 2,
			},
			orders: []uint64{
				0, 1,
				2, 1,
				0, 3,
				2, 3,
			},
		},
		{
			level: []uint64{2, 3},
			levels: []uint64{
				2, 3,
				2, 3,
				2, 3,
				2, 3,
				2, 3,
				2, 3,
				2, 3,
				2, 3,
			},
			orders: []uint64{
				1, 1,
				3, 1,
				1, 3,
				3, 3,
				1, 5,
				3, 5,
				1, 7,
				3, 7,
			},
		},
	}

	for _, c := range cases {
		assert.Equal(grid.Index(c.level), internal.Compose(c.levels, c.orders), t)
	}
}
Exemple #12
0
func TestOpenCompute2D(t *testing.T) {
	grid := NewOpen(2)

	levels := []uint64{
		0, 0,

		0, 1,
		0, 1,
		0, 2,
		0, 2,
		0, 2,
		0, 2,

		1, 0,
		1, 0,

		1, 1,
		1, 1,
		1, 1,
		1, 1,

		1, 2,
		1, 2,
		1, 2,
		1, 2,
		1, 2,
		1, 2,
		1, 2,
		1, 2,

		2, 0,
		2, 0,
		2, 0,
		2, 0,

		2, 1,
		2, 1,
		2, 1,
		2, 1,
		2, 1,
		2, 1,
		2, 1,
		2, 1,

		2, 2,
		2, 2,
		2, 2,
		2, 2,
		2, 2,
		2, 2,
		2, 2,
		2, 2,
		2, 2,
		2, 2,
		2, 2,
		2, 2,
		2, 2,
		2, 2,
		2, 2,
		2, 2,
	}

	orders := []uint64{
		0, 0,

		0, 0,
		0, 2,
		0, 0,
		0, 2,
		0, 4,
		0, 6,

		0, 0,
		2, 0,

		0, 0,
		0, 2,
		2, 0,
		2, 2,

		0, 0,
		0, 2,
		0, 4,
		0, 6,
		2, 0,
		2, 2,
		2, 4,
		2, 6,

		0, 0,
		2, 0,
		4, 0,
		6, 0,

		0, 0,
		0, 2,
		2, 0,
		2, 2,
		4, 0,
		4, 2,
		6, 0,
		6, 2,

		0, 0,
		0, 2,
		0, 4,
		0, 6,
		2, 0,
		2, 2,
		2, 4,
		2, 6,
		4, 0,
		4, 2,
		4, 4,
		4, 6,
		6, 0,
		6, 2,
		6, 4,
		6, 6,
	}

	nodes := []float64{
		0.500, 0.500,

		0.500, 0.250,
		0.500, 0.750,
		0.500, 0.125,
		0.500, 0.375,
		0.500, 0.625,
		0.500, 0.875,

		0.250, 0.500,
		0.750, 0.500,

		0.250, 0.250,
		0.250, 0.750,
		0.750, 0.250,
		0.750, 0.750,

		0.250, 0.125,
		0.250, 0.375,
		0.250, 0.625,
		0.250, 0.875,
		0.750, 0.125,
		0.750, 0.375,
		0.750, 0.625,
		0.750, 0.875,

		0.125, 0.500,
		0.375, 0.500,
		0.625, 0.500,
		0.875, 0.500,

		0.125, 0.250,
		0.125, 0.750,
		0.375, 0.250,
		0.375, 0.750,
		0.625, 0.250,
		0.625, 0.750,
		0.875, 0.250,
		0.875, 0.750,

		0.125, 0.125,
		0.125, 0.375,
		0.125, 0.625,
		0.125, 0.875,
		0.375, 0.125,
		0.375, 0.375,
		0.375, 0.625,
		0.375, 0.875,
		0.625, 0.125,
		0.625, 0.375,
		0.625, 0.625,
		0.625, 0.875,
		0.875, 0.125,
		0.875, 0.375,
		0.875, 0.625,
		0.875, 0.875,
	}

	assert.Equal(grid.Compute(internal.Compose(levels, orders)), nodes, t)
}
Exemple #13
0
func TestClosedCompute1D3P(t *testing.T) {
	const (
		nd = 1
		np = 3
		nb = 4
		nn = 101
	)

	basis := NewClosed(nd, np)

	indices := internal.Compose(
		[]uint64{3, 3, 3, 3, 3, 3, 3, 3},
		[]uint64{1, 3, 5, 7, 9, 11, 13, 15},
	)

	points := make([]float64, nn)
	for i := range points {
		points[i] = float64(i) / (nn - 1)
	}

	values := make([]float64, nn)
	for i := range values {
		for j := 0; j < nb; j++ {
			values[i] += basis.Compute(indices[j:j+1], points[i:i+1])
		}
	}

	assert.EqualWithin(values, []float64{
		0.0000000000000000e+00, 2.0070399999999997e-01, 3.7683200000000000e-01,
		5.2940799999999999e-01, 6.5945600000000004e-01, 7.6800000000000013e-01,
		8.5606400000000005e-01, 9.2467200000000005e-01, 9.7484799999999983e-01,
		1.0076160000000001e+00, 1.0240000000000000e+00, 1.0250240000000002e+00,
		1.0117119999999999e+00, 9.8508799999999996e-01, 9.4617599999999991e-01,
		8.9599999999999991e-01, 8.3558399999999988e-01, 7.6595199999999986e-01,
		6.8812800000000007e-01, 6.0313600000000001e-01, 5.1199999999999990e-01,
		4.1574400000000011e-01, 3.1539200000000001e-01, 2.1196799999999993e-01,
		1.0649600000000009e-01, 0.0000000000000000e+00, 1.0649600000000009e-01,
		2.1196800000000018e-01, 3.1539200000000028e-01, 4.1574399999999978e-01,
		5.1199999999999990e-01, 6.0313600000000001e-01, 6.8812800000000007e-01,
		7.6595200000000008e-01, 8.3558400000000010e-01, 8.9599999999999991e-01,
		9.4617599999999991e-01, 9.8508799999999996e-01, 1.0117119999999999e+00,
		1.0250239999999999e+00, 1.0240000000000000e+00, 1.0076160000000001e+00,
		9.7484799999999994e-01, 9.2467200000000005e-01, 8.5606400000000005e-01,
		7.6799999999999990e-01, 6.5945599999999971e-01, 5.2940800000000032e-01,
		3.7683200000000028e-01, 2.0070400000000016e-01, 0.0000000000000000e+00,
		2.0070400000000016e-01, 3.7683200000000028e-01, 5.2940800000000032e-01,
		6.5945600000000049e-01, 7.6800000000000057e-01, 8.5606400000000038e-01,
		9.2467199999999972e-01, 9.7484799999999983e-01, 1.0076160000000001e+00,
		1.0240000000000000e+00, 1.0250239999999999e+00, 1.0117119999999999e+00,
		9.8508799999999996e-01, 9.4617599999999991e-01, 8.9599999999999991e-01,
		8.3558399999999988e-01, 7.6595199999999963e-01, 6.8812799999999963e-01,
		6.0313600000000045e-01, 5.1200000000000045e-01, 4.1574400000000039e-01,
		3.1539200000000028e-01, 2.1196800000000018e-01, 1.0649600000000009e-01,
		0.0000000000000000e+00, 1.0649600000000009e-01, 2.1196800000000018e-01,
		3.1539200000000028e-01, 4.1574400000000039e-01, 5.1200000000000045e-01,
		6.0313600000000045e-01, 6.8812799999999963e-01, 7.6595199999999963e-01,
		8.3558399999999988e-01, 8.9599999999999991e-01, 9.4617599999999991e-01,
		9.8508799999999996e-01, 1.0117119999999999e+00, 1.0250239999999999e+00,
		1.0240000000000000e+00, 1.0076160000000001e+00, 9.7484799999999983e-01,
		9.2467199999999972e-01, 8.5606400000000038e-01, 7.6800000000000057e-01,
		6.5945600000000049e-01, 5.2940800000000032e-01, 3.7683200000000028e-01,
		2.0070400000000016e-01, 0.0000000000000000e+00,
	}, 1e-15, t)
}
Exemple #14
0
func TestOpenCompute(t *testing.T) {
	basis := NewOpen(1, 1)

	compute := func(level, order uint64, point float64) float64 {
		return basis.Compute(internal.Compose([]uint64{level}, []uint64{order}), []float64{point})
	}

	points := []float64{
		0.00, 0.04, 0.08, 0.12, 0.16, 0.20, 0.24, 0.28, 0.32, 0.36, 0.40, 0.44, 0.48,
		0.52, 0.56, 0.60, 0.64, 0.68, 0.72, 0.76, 0.80, 0.84, 0.88, 0.92, 0.96, 1.00,
	}

	cases := []struct {
		level  uint64
		order  uint64
		values []float64
	}{
		{0, 0, []float64{
			1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00,
			1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00,
		}},
		{1, 0, []float64{
			2.00, 1.84, 1.68, 1.52, 1.36, 1.20, 1.04, 0.88, 0.72, 0.56, 0.40, 0.24, 0.08,
			0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00,
		}},
		{1, 2, []float64{
			0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00,
			0.08, 0.24, 0.40, 0.56, 0.72, 0.88, 1.04, 1.20, 1.36, 1.52, 1.68, 1.84, 2.00,
		}},
		{2, 0, []float64{
			2.00, 1.68, 1.36, 1.04, 0.72, 0.40, 0.08, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00,
			0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00,
		}},
		{2, 2, []float64{
			0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.24, 0.56, 0.88, 0.80, 0.48, 0.16,
			0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00,
		}},
		{2, 4, []float64{
			0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00,
			0.16, 0.48, 0.80, 0.88, 0.56, 0.24, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00,
		}},
		{2, 6, []float64{
			0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00,
			0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.08, 0.40, 0.72, 1.04, 1.36, 1.68, 2.00,
		}},
		{3, 0, []float64{
			2.00, 1.36, 0.72, 0.08, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00,
			0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00,
		}},
		{3, 2, []float64{
			0.00, 0.00, 0.00, 0.00, 0.56, 0.80, 0.16, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00,
			0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00,
		}},
		{3, 4, []float64{
			0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.48, 0.88, 0.24, 0.00, 0.00, 0.00,
			0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00,
		}},
		{3, 6, []float64{
			0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.40, 0.96, 0.32,
			0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00,
		}},
		{3, 8, []float64{
			0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00,
			0.32, 0.96, 0.40, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00,
		}},
		{3, 10, []float64{
			0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00,
			0.00, 0.00, 0.00, 0.24, 0.88, 0.48, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00,
		}},
		{3, 12, []float64{
			0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00,
			0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.16, 0.80, 0.56, 0.00, 0.00, 0.00, 0.00,
		}},
		{3, 14, []float64{
			0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00,
			0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.08, 0.72, 1.36, 2.00,
		}},
	}

	values := make([]float64, len(points))

	for i := range cases {
		for j := range values {
			values[j] = compute(cases[i].level, cases[i].order, points[j])
		}
		assert.EqualWithin(values, cases[i].values, 1e-15, t)
	}
}
Exemple #15
0
func TestValidate(t *testing.T) {
	const (
		ni = 2
	)

	grid := equidistant.NewClosed(1)

	cases := []struct {
		levels []uint64
		orders []uint64
		result bool
	}{
		{
			[]uint64{
				0, 0,
				0, 1,
				1, 0,
				1, 1,
				1, 2,
			},
			[]uint64{
				0, 0,
				0, 2,
				2, 0,
				2, 2,
				2, 3,
			},
			true,
		},
		{
			[]uint64{
				0, 0,
				0, 1,
				1, 0,
				1, 1,
				1, 1,
				1, 2,
			},
			[]uint64{
				0, 0,
				0, 2,
				2, 0,
				2, 2,
				2, 2,
				2, 3,
			},
			false,
		},
		{
			[]uint64{
				0, 0,
				0, 1,
				1, 0,
				1, 1,
				1, 2,
			},
			[]uint64{
				0, 0,
				0, 2,
				2, 0,
				2, 2,
				2, 1,
			},
			false,
		},
		{
			[]uint64{
				0, 0,
				0, 1,
				1, 0,
				1, 1,
				2, 2,
			},
			[]uint64{
				0, 0,
				0, 2,
				2, 0,
				2, 2,
				3, 3,
			},
			false,
		},
	}

	for _, c := range cases {
		indices := internal.Compose(c.levels, c.orders)
		assert.Equal(Validate(indices, ni, grid), c.result, t)
	}
}