Help / Release / J 5.01 / /: and \: Sparse Arguments

From J Wiki
Jump to navigation Jump to search


>> << Pri JfC LJ Phr Dic Voc !: Rel NuVoc wd Help Release



/: and \: Sparse Arguments

initial writing: 2001-07-17
last updated: 2004-10-26


The monads /: and \: now support sparse arguments. Note that the results of /: and \: are not sparse even though the argument may be sparse.

For example:

   <"2 y=: ((?.10$2), 0, 1, 0 ,: 10$1 0 0) * ?. 5 10 3$10
+-----+-----+-----+-----+-----+
|0 0 0|0 0 0|5 5 3|0 0 0|2 0 4|
|5 2 0|0 0 0|9 4 2|0 0 0|0 0 0|
|0 0 0|0 0 0|0 9 0|0 0 0|0 0 0|
|3 5 8|0 0 0|5 3 2|0 0 0|8 6 1|
|0 0 0|0 0 0|9 5 4|0 0 0|0 0 0|
|0 0 0|0 0 0|9 0 7|0 0 0|0 0 0|
|0 4 6|0 0 0|7 8 1|0 0 0|8 5 9|
|5 9 8|0 0 0|0 6 8|0 0 0|0 0 0|
|5 0 6|0 0 0|6 7 7|0 0 0|0 0 0|
|0 0 0|0 0 0|9 8 2|0 0 0|2 4 4|
+-----+-----+-----+-----+-----+
   ] x=: (2;0 1)$. y
0 1 | 5 2 0
0 3 | 3 5 8
0 6 | 0 4 6
0 7 | 5 9 8
0 8 | 5 0 6
2 0 | 5 5 3
2 1 | 9 4 2
2 2 | 0 9 0
2 3 | 5 3 2
2 4 | 9 5 4
2 5 | 9 0 7
2 6 | 7 8 1
2 7 | 0 6 8
2 8 | 6 7 7
2 9 | 9 8 2
4 0 | 2 0 4
4 3 | 8 6 1
4 6 | 8 5 9
4 9 | 2 4 4
   /: x
1 3 0 4 2
   /:"2 x
0 2 4 5 9 6 3 8 1 7
0 1 2 3 4 5 6 7 8 9
7 2 3 0 8 6 5 1 4 9
0 1 2 3 4 5 6 7 8 9
1 2 4 5 7 8 0 9 6 3
   \:"2 x
7 1 8 3 6 0 2 4 5 9
0 1 2 3 4 5 6 7 8 9
9 4 1 5 6 8 0 3 2 7
0 1 2 3 4 5 6 7 8 9
3 6 9 0 1 2 4 5 7 8
   
   (/:   x) -: /:   y
1
   (/:"1 x) -: /:"1 y
1
   (/:"2 x) -: /:"2 y
1



>> << Pri JfC LJ Phr Dic Voc !: Rel NuVoc wd Help Release