Phrases/Matrices

From J Wiki
Jump to navigation Jump to search

Block diagonal matrix

JForum:programming/2006-June/002517

   bd=:[ , ] ,"1~ 0 {.@# [
   (2 3$5)bd (4 1$2)
5 5 5 0
5 5 5 0
0 0 0 2
0 0 0 2
0 0 0 2
0 0 0 2

Minor matrices

  mm=.1&(|:\.)"2^:2

Returns minor matrices of the order 1 less than the order of original matrix.

Vector cross product

   cross=:(1 _1 1 * 1 (-/ . *)\. ])@,.

See Also