Matrix Concatenation Operators |
RATS offers three operators for doing simple matrix concatenation:
|
~ |
Does a horizontal concatenation of two arrays. Both arrays must have the same number of rows. |
|
~~ |
Does vertical concatenation. Both arrays must have the same number of columns. |
|
~\ |
Creates a block diagonal matrix from two arrays. |
For example, if A is
1 1
1 1
and B is
2 2
2 2
the commands:
compute abhoriz = a~b
compute abvert = a~~b
compute abblock = a~\b
return:
ABHORIZ =
1 1 2 2
1 1 2 2
ABVERT =
1 1
1 1
2 2
2 2
ABBLOCK =
1 1 0 0
1 1 0 0
0 0 2 2
0 0 2 2
Copyright © 2025 Thomas A. Doan