The document discusses the monadic and dyadic cases of the J symbol ",." (comma-dot).
For the monadic case, ",." returns a matrix by raveling (flattening) its argument of any rank (scalar, vector, matrix, or higher-rank array) into a two-column matrix.
For the dyadic case, ",." stitches together the items of its left and right arguments by placing their items side-by-side into a new matrix. The lengths of the arguments must match except when one is a scalar, which repeats to fit.
2. Outline
• Monadic Case
• Over 3-rank Array, Matrix, Vector, Scalar
• Apply to empty list
• Conclusion: Monadic
• Dyadic Case
• Matrix, Vector
• Exception: special case
• Error case
• Conclusion : Dyadic
3. ,. : Monadic Case
Items
Matrix
Ravel Items
Definition: y ravels the items of y.
5. Apply to matrix
Ravel Items returns
the Same Matrix for the matrix.
0 1 2
3 4 5
6 7 8
0 1 2
3 4 5
6 7 8
,.
n
m
1st
2ndi.3 3
6. 0 1 2
Apply to vector
Ravel Items returns
a nx1 Matrix for the n vector.
Shape : 3 1
0
1
2
,.
n
1st
i.3
7. Apply to scaler
Ravel Items returns
a 1x1 Matrix for the scaler.
33,.
No axis!
Shape : 1 1
8. Ravel Items returns
the Matrix for a scaler, vector, matrix
and any size array.
i.e.
Arg:Rank
Result
Shape Rank
Scalar : 0 1 1 2
n
Vector : 1
n 1 2
nxm
Matrix : 2
n m 2
nxmxo
Array: 3
n m*o 2
Matrix!
}
9. Apply to Empty list
Result : ,. i. 0 0 0 → (empty)
Ravel Items returns
the 0x0 Matrix for the empty list.
Rank : $$ ,. i. 0 0 0 → 2
Shape : $ ,. i. 0 0 0 → 0 0
10. Conclusion:Monadic
Ravel Items returns
the Matrix for the any list
Arg:Rank
Result
Shape Rank
Scalar : 0 1 1 2
n
Vector : 1
n 1 2
nxm
Matrix : 2
n m 2
nxmxo
Array: 3
n m*o 2
nxmxo…xz n m*o*…*z 2
※ n,m,…,z ≧ 0
Effective to over
4-rank Array.
Make matrix and
possible to process
with other one.
11. ,. : Dyadic case
Stitch
Definition: x ,. y the items of x and stitched to the
corresponding items of y.
X Y,. X Y
One Item
14. Example
,.1 2
• Scalars
1 2
Vector
• Scalar and Vector
0 1 2
i.3
3,.
0 3
1 3
2 3
Matrix
Repeating
to Fit!
15. Error Case
• Length Error
0 1 2
3 4 5
6 7 8
0 1
3 4
,.
0
1
2
,.
Matrix and Matrix
The lengths of Y-axis
Must be matched.
Vector and Vector
The length
Must be matched.
0
1
2
3
※Scaler automatically match to other item by repeating.