UNPKG

866 BMarkdownView Raw
1<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
2
3# Function setSize
4
5Count the number of elements of a (multi)set. When a second parameter is 'true', count only the unique values.
6A multi-dimension array will be converted to a single-dimension array before the operation.
7
8
9## Syntax
10
11```js
12math.setSize(set)
13math.setSize(set, unique)
14```
15
16### Parameters
17
18Parameter | Type | Description
19--------- | ---- | -----------
20`a` | Array &#124; Matrix | A multiset
21
22### Returns
23
24Type | Description
25---- | -----------
26number | The number of elements of the (multi)set
27
28
29## Examples
30
31```js
32math.setSize([1, 2, 2, 4]) // returns 4
33math.setSize([1, 2, 2, 4], true) // returns 3
34```
35
36
37## See also
38
39[setUnion](setUnion.md),
40[setIntersect](setIntersect.md),
41[setDifference](setDifference.md)