This function implements the ordering process described in Chacko (1963) and Chacko (1966).
reduceVector(x, verbosity = 0L)
A list containing the original vector, the reduced vector, their
weights and the number of reductions performed. Use names()
and str()
on the output for more details.
reduceVector(c(10, 16, 14, 12, 18))
#>
#> Original vector: 10 16 14 12 18
#> Reduced vector : 10 14 18
reduceVector(c(10, 8, 4, 2, 1))
#>
#> Original vector: 10 8 4 2 1
#> Reduced vector : 5
reduceVector(chacko66_sec3)
#>
#> Original vector: 10 16 14 12 18
#> Reduced vector : 10 14 18
reduceVector(chacko66_sec5)
#>
#> Original vector: 12 14 18 16 22 20 18 24 26 30
#> Reduced vector : 12 14 17 20 24 26 30
reduceVector(chacko66_sec5, verbosity = 1)
#> Vector needs reduction
#> Initial vector
#> x t
#> [1,] 12 1
#> [2,] 14 1
#> [3,] 18 1
#> [4,] 16 1
#> [5,] 22 1
#> [6,] 20 1
#> [7,] 18 1
#> [8,] 24 1
#> [9,] 26 1
#> [10,] 30 1
#>
#>
#> Final vector
#> x t
#> [1,] 12 1
#> [2,] 14 1
#> [3,] 17 2
#> [4,] 21 2
#> [5,] 18 1
#> [6,] 24 1
#> [7,] 26 1
#> [8,] 30 1
#> Vector needs reduction
#> Initial vector
#> x t
#> [1,] 12 1
#> [2,] 14 1
#> [3,] 17 2
#> [4,] 21 2
#> [5,] 18 1
#> [6,] 24 1
#> [7,] 26 1
#> [8,] 30 1
#>
#>
#> Final vector
#> x t
#> [1,] 12 1
#> [2,] 14 1
#> [3,] 17 2
#> [4,] 20 3
#> [5,] 24 1
#> [6,] 26 1
#> [7,] 30 1
#>
#> Original vector: 12 14 18 16 22 20 18 24 26 30
#> Reduced vector : 12 14 17 20 24 26 30