---
# System prepended metadata

title: Numpy
tags: [' python', Quantum Computing]

---

---
tags: Quantum Computing, python
---
# Numpy
### Shape and Imaginary part
```python=
import numpy as np
E=np.array([1,0,2j])
print(E.shape)
```

### Vector Computing
```python=
A=np.array([1,0])
B=np.array([0,1])
C=1/np.sqrt(2)*(A+B)
D=1/np.sqrt(2)*(A+B)
```
### Transpose(轉置矩陣) and Conjugate(共扼矩陣)
![](https://i.imgur.com/VUHhx5i.png)

```python=
print(D.T)
print(E.conj())
```

## Tensor
![](https://i.imgur.com/wD1BYZ7.png)
```python=
A=np.array([[1,2],[3,4]])
B=np.array([[5,6],[7,8]])
print(A[1][0])
print(A@B) #矩陣乘法
```
![](https://i.imgur.com/zrZMHxR.png)

### Matrix Computing
#### Ex: Bit Flipping
```python=
X=np.array([[0,1],[1,0]])
B=np.array([1,0])
print(X@B)
```
## Functions
![](https://i.imgur.com/vGydWQG.png)
![](https://i.imgur.com/GCTay7B.png)




