# CombineIndices examples:

CombineIndices()
CombineIndices(indices = NULL)
CombineIndices(indices = list(NULL, NULL))
CombineIndices(indices = list(0, NULL))
CombineIndices(indices = list(0, 0))
CombineIndices(indices = list(NULL, 0))
CombineIndices(indices = list(1, 0))
CombineIndices(indices = list(1, NULL))
CombineIndices(indices = list(1, NULL, 0))
CombineIndices(indices = c(1, 1))
CombineIndices(indices = list(1, 1), weights = 0)
CombineIndices(indices = list(c(1, 1), c(1, 1)), weights = 0)
CombineIndices(indices = list(c(1, 1), c(1, 1)), weights = c(0, 0))
CombineIndices(indices = list(c(1, 1), c(1, 1)), weights = c(NA, NA))
CombineIndices(indices = list(c(1, 2), c(1, 5)), weights = c(1, 1))
CombineIndices(indices = list(c(1, 2), c(1, 5)), weights = c(10, 1))
CombineIndices(indices = list(c(1, 2), c(1, 5), c(5, 2)), weights = c(10, 1))
CombineIndices(indices = list(c(1, 2), c(1, 5), c(5, 2)), weights = c(10, 1, 5), operation = "add")
CombineIndices(indices = list(c(1, 2), c(1, 5), c(5, 2)), operation = "add")
CombineIndices(indices = list(c(1, 2), c(1, 5), c(5, 2)), operation = "subtract")
CombineIndices(indices = list(c(1, 2), c(1, 5), c(5, 2)), weights = c(10, 1, 5), operation = "subtract")
CombineIndices(indices = list(c(1, 2), c(1, 5), c(5, 2)), weights = c(10, 1, 5), operation = "divide")
CombineIndices(indices = list(c(1, 2), c(1, 5)), weights = c(10, 1), operation = "divide")
CombineIndices(indices = list(c(1, 2), c(1, 5)), operation = "divide")
CombineIndices(indices = list(c(1, 2), c(1, 5), c(5, 2)), weights = list(10, 1, 5), operation = "subtract") # No espera una lista en weights
CombineIndices(indices = list(c(1, 2), c(1, 5), c(5, 2)), weights = c(10, 1, 5), operation = "subtract")
a <- matrix(rnorm(6), 2, 3)
b <- matrix(rnorm(6), 2, 3)

comb_ind <- CombineIndices(indices = list(a, b), weights = c(2, 1), operation = "add")
print(comb_ind)

a <- rnorm(24)
dim(a) <- c(lon = 2, lat = 3, mod = 4)
b <- rnorm(24)
dim(b) <- c(lon = 2, lat = 3, mod = 4)
comb_ind <- CombineIndices(indices = list(a, b), weights = c(2, 1), operation = "add")
print(comb_ind)

