
Last chance! 50% off unlimited learning
Sale ends in
Compute the x^k
computes
element wise powers, x %^% k
corresponds to x %*% x %*% ... %*% x
.
x %^% k
a square matrix
.
an integer,
A matrix of the same dimension as x
.
Argument as.integer
.
The algorithm uses
%*%
for matrix multiplication.
# NOT RUN {
A <- cbind(1, 2 * diag(3)[,-1])
A
A %^% 2
stopifnot(identical(A, A %^% 1),
A %^% 2 == A %*% A)
# }
Run the code above in your browser using DataLab