Guest User

Untitled

a guest
Oct 21st, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. > p = matrix(c( 1,rep(0,7),
  2. + rep(0,2),1,rep(0,5),
  3. + rep(0,4),1,rep(0,3),
  4. + rep(0,6),1,rep(0,1),
  5. + rep(0,1),1,rep(0,6),
  6. + rep(0,3),1,rep(0,4),
  7. + rep(0,5),1,rep(0,2),
  8. + rep(0,7),1 ),8,8,1)
  9. > (v = c(1:8))
  10. [1] 1 2 3 4 5 6 7 8
  11. > as.vector(t(p %*% v))
  12. [1] 1 3 5 7 2 4 6 8
Add Comment
Please, Sign In to add comment