Previous Up Next

2.42.23  Make a matrix from two matrices : augment concat

augment or concat concats two matrices A and B having the same number of rows, or having the same number of columns. In the first case, it returns a matrix having the same number of rows than A and B by horizontal gluing, in the second case it returns a matrix having the same number of columns by vertical gluing.
Input :

augment([[3,4,5],[2,1,0]],[[1,2],[4,5]])

Output :

[[3,4,5,1,2],[2,1,0,4,5]]

Input :

augment([[3,4],[2,1],[0,1]],[[1,2],[4,5]])

Output :

[[3,4],[2,1],[0,1],[1,2],[4,5]]

Input :

augment([[3,4,2]],[[1,2,4]]

Output :

[[3,4,2,1,2,4]]

Note that if A and B have the same dimension, augment makes a matrix with the same number of rows than A and B by horizontal gluing, in that case you must use semi_augment for vertical gluing.
Input :

augment([[3,4],[2,1]],[[1,2],[4,5]])

Output :

[[3,4,1,2],[2,1,4,5]]]

Previous Up Next