Browse Source

NumPy

pull/10/head
Jure Šorn 5 years ago
parent
commit
08d4b58a6a
1 changed files with 5 additions and 5 deletions
  1. 10
      README.md

10
README.md

@ -1464,8 +1464,8 @@ NumPy
```
```python
value = <array>.min([axis])
index = <array>.argmin([axis])
value = <array>.min([axis])
index = <array>.argmin([axis])
```
```python
@ -1480,17 +1480,17 @@ index = <array>.argmin([axis])
left = [[0.1], [0.6], [0.8]] # Shape: (3, 1)
right = [ 0.1 , 0.6 , 0.8 ] # Shape: (3)
```
1. If array shapes differ, left-pad the smaller shape with ones.
**1. If array shapes differ, left-pad the smaller shape with ones.**
```python
left = [[0.1], [0.6], [0.8]] # Shape: (3, 1)
right = [[0.1 , 0.6 , 0.8]] # Shape: (1, 3) <- !
```
2. If any dimensions differ in size, expand the ones that have size 1 by duplicating their elements.
**2. If any dimensions differ in size, expand the ones that have size 1 by duplicating their elements.**
```python
left = [[0.1, 0.1, 0.1], [0.6, 0.6, 0.6], [0.8, 0.8, 0.8]] # Shape: (3, 3) <- !
right = [[0.1, 0.6, 0.8], [0.1, 0.6, 0.8], [0.1, 0.6, 0.8]] # Shape: (3, 3) <- !
```
3. If neither non-matching dimension has size 1, rise an error.
**3. If neither non-matching dimension has size 1, rise an error.**
### Example
**For each point returns index of its nearest point: `[0.1, 0.6, 0.8] => [1, 2, 1]`.**

Loading…
Cancel
Save