.ModelicaReference.Operators.'matrix()'

Information

Returns the first two dimensions of an array as matrix

Syntax

matrix(A)

Description

Returns promote(A,2), if A is a scalar or vector and otherwise returns the elements of the first two dimensions as a matrix. size(A,i) = 1 is required for 2 < i ≤ ndims(A).

Function promote(A,n) fills dimensions of size 1 from the right to array A up to dimension n, where "n > ndims(A)" is required. Let C = promote(A,n), with nA = ndims(A), then

ndims(C) = n,
size(C,j) = size(A,j) for 1 ≤ j ≤ nA,
size(C,j) = 1 for nA+1 ≤ j ≤ n,
C[i_1, ..., i_nA, 1, ..., 1] = A[i_1, ..., i_nA].

Generated at 2020-06-05T21:39:08Z by OpenModelica 1.16.0~dev-442-g2e5bc9f