Previous Up Next

5.49.25  Make a matrix from two matrices: semi_augment

semi_augment concat two matrices with the same number of columns.
Input:

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

Output:

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

Input:

semi_augment([[3,4,2]],[[1,2,4]])

Output:

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

Note the difference with concat.
Input:

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

Output:

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

Indeed, when the two matrices A and B have the same dimension, concat makes a matrix with the same number of rows as A and B by gluing them side by side.
Input:

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

Output:

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

but input:

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

Output:

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

Previous Up Next