scale_which
Scale_which should determine the elements that need to be scaled.
library(slam)
n <- 3
x <- matrix(seq_len(n**2), nrow=n, byrow=FALSE)
x
#> [,1] [,2] [,3]
#> [1,] 1 4 7
#> [2,] 2 5 8
#> [3,] 3 6 9
scale_which <- function(n, lower=TRUE) {
x <- simple_triplet_zero_matrix(nrow=n, ncol=n)
diag.tri <- if (lower) lower.tri else upper.tri
which(diag.tri(x))
}
ROI.plugin.scs:::scale_which(3)
#> [1] 2 3 5
scale_which(3)
#> [1] 2 3 6
edit:
scale_which
returns the indices of the vectorized version which need to be scaled
Edited by Benjamin Schwendinger