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