Skip to content

Commit

Permalink
add one dimension of zero size post
Browse files Browse the repository at this point in the history
  • Loading branch information
Jencir Lee committed Jan 24, 2024
1 parent 3c085d4 commit b539959
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions _posts/2024-01-24-When-One-Dimension-is-Zero-Size.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
title: When one dimension of array is zero size
layout: post
---

```python
>>> from numpy import ones
>>> ones((5, 0))
array([], shape=(5, 0), dtype=float64)
>>> ones((5, 0)) @ ones((5, 0)).T
array([[0., 0., 0., 0., 0.],
[0., 0., 0., 0., 0.],
[0., 0., 0., 0., 0.],
[0., 0., 0., 0., 0.],
[0., 0., 0., 0., 0.]])
>>> ones((3, 1)) @ ones((3, 1)).T
array([[1., 1., 1.],
[1., 1., 1.],
[1., 1., 1.]])
```

0 comments on commit b539959

Please sign in to comment.