mathjs/docs/reference/functions/matrixFromColumns.md
2022-03-01 13:04:09 +01:00

54 lines
1.5 KiB
Markdown

---
layout: default
---
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
<h1 id="function-matrixfromcolumns">Function matrixFromColumns <a href="#function-matrixfromcolumns" title="Permalink">#</a></h1>
Create a dense matrix from vectors as individual columns.
If you pass row vectors, they will be transposed (but not conjugated!)
<h2 id="syntax">Syntax <a href="#syntax" title="Permalink">#</a></h2>
```js
math.matrixFromColumns(...arr)
math.matrixFromColumns(col1, col2)
math.matrixFromColumns(col1, col2, col3)
```
<h3 id="parameters">Parameters <a href="#parameters" title="Permalink">#</a></h3>
Parameter | Type | Description
--------- | ---- | -----------
`cols` | ... Array &#124; Matrix | Multiple columns
<h3 id="returns">Returns <a href="#returns" title="Permalink">#</a></h3>
Type | Description
---- | -----------
number[][] &#124; Matrix | if at least one of the arguments is an array, an array will be returned
<h3 id="throws">Throws <a href="#throws" title="Permalink">#</a></h3>
Type | Description
---- | -----------
<h2 id="examples">Examples <a href="#examples" title="Permalink">#</a></h2>
```js
math.matrixFromColumns([1, 2, 3], [[4],[5],[6]])
math.matrixFromColumns(...vectors)
```
<h2 id="see-also">See also <a href="#see-also" title="Permalink">#</a></h2>
[matrix](matrix.html),
[matrixFromRows](matrixFromRows.html),
[matrixFromFunction](matrixFromFunction.html),
[zeros](zeros.html)