UNPKG

1.07 kBMarkdownView Raw
1<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
2
3# Function zeros
4
5Create a matrix filled with zeros. The created matrix can have one or
6multiple dimensions.
7
8
9## Syntax
10
11```js
12math.zeros(m)
13math.zeros(m, format)
14math.zeros(m, n)
15math.zeros(m, n, format)
16math.zeros([m, n])
17math.zeros([m, n], format)
18```
19
20### Parameters
21
22Parameter | Type | Description
23--------- | ---- | -----------
24`size` | ...number &#124; Array | The size of each dimension of the matrix
25`format` | string | The Matrix storage format
26
27### Returns
28
29Type | Description
30---- | -----------
31Array &#124; Matrix | A matrix filled with zeros
32
33
34## Examples
35
36```js
37math.zeros(3) // returns [0, 0, 0]
38math.zeros(3, 2) // returns [[0, 0], [0, 0], [0, 0]]
39math.zeros(3, 'dense') // returns [0, 0, 0]
40
41const A = [[1, 2, 3], [4, 5, 6]]
42math.zeros(math.size(A)) // returns [[0, 0, 0], [0, 0, 0]]
43```
44
45
46## See also
47
48[ones](ones.md),
49[identity](identity.md),
50[size](size.md),
51[range](range.md)