matrixFromColumns

matrixFromColumns(...arr)

matrixFromColumns(row1, row2)

matrixFromColumns(row1, row2, row3)

Try it yourself:

See also:

Build a matrix from columns

matrixFromColumns constructs a matrix by placing supplied vectors or arrays side by side as columns. It makes the orientation explicit when each input represents one variable, feature, or coordinate component.

Example

Combining [1,2] and [3,4] produces rows [1,3] and [2,4]. Use matrixFromRows when inputs are rows instead, and ctranspose or transpose to switch orientation afterwards.

Shape caveat

Every input column needs the same number of entries. Check the result with size before multiplication or decomposition. Use concat for generic joining rather than relying on it to communicate a column-oriented intent.

Try Matrix From Columns in Calcul.io

Start with one of the editable examples above, then replace its arguments with your own values. Keeping the function on a separate calculator line makes the input and result easy to compare. For a longer workflow, assign the result to a variable or reference that line in the next expression.

Check the shown signature before adding optional arguments, and use the related-function links to compare operations with similar purposes.

All functions