The function cat(k,A,B,C,...)
concatenates arrays
A,B,C,...
along dimension k
.
Real[2,3] r1 = cat(1, {{1.0, 2.0, 3}}, {{4, 5, 6}}); Real[2,6] r2 = cat(2, r1, 2*r1);
cat(k,A,B,C,...)
concatenates arrays
A,B,C,...
along dimension k
according to
the following rules:
A, B, C, ...
must have the same number of
dimensions, i.e., ndims(A) = ndims(B) = ...
A, B, C, ...
must be type compatible
expressions giving the type of the elements of the result. The
maximally expanded types should be equivalent. Real and Integer
subtypes can be mixed resulting in a Real result array where the
Integer numbers have been transformed to Real numbers.k
has to characterize an existing dimension, i.e.,
1 <= k <= ndims(A) = ndims(B) = ndims(C)
;
k
shall be an integer number.A, B, C, ...
must have
identical array sizes with the exception of the size of dimension
k
, i.e., size(A,j) = size(B,j), for 1 <= j
<= ndims(A) and j <> k
.Concatenation is formally defined according to:
Let R = cat(k,A,B,C,...), and let n = ndims(A) = ndims(B) = ndims(C) = ...., then size(R,k) = size(A,k) + size(B,k) + size(C,k) + ... size(R,j) = size(A,j) = size(B,j) = size(C,j) = ...., for 1 <= j <= n and j <> k. R[i_1, ..., i_k, ..., i_n] = A[i_1, ..., i_k, ..., i_n], for i_k <= size(A,k), R[i_1, ..., i_k, ..., i_n] = B[i_1, ..., i_k - size(A,i), ..., i_n], for i_k <= size(A,k) + size(B,k), .... where 1 <= i_j <= size(R,j) for 1 <= j <= n.