Python 量子運算(二五):積
2023/02/09
-----
Fig. 25.1. Product.
-----
array_like
ndarray
-----
numpy.dot 點積
numpy.inner 內積
numpy.cross 叉積
numpy.kron 克羅內克積
numpy.outer 外積
sympy TensorProduct 張量積
-----
Mathematical functions
numpy.cross
numpy.multiply
-----
Linear algebra ( numpy.linalg )
numpy.dot
numpy.linalg.multi_dot
numpy.vdot
numpy.inner
numpy.outer
numpy.matmul
numpy.tensordot
numpy.einsum
numpy.einsum_path
numpy.linalg.matrix_power
numpy.kron
-----
代碼 25.1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | # Program 25.1:Product import matplotlib as mpl import matplotlib.pyplot as plt # figure setting mpl.rcParams['text.usetex'] = True mpl.rcParams['text.latex.preamble'] = r'\usepackage{{amsmath}}' mpl.rcParams['font.size'] = 40 fig, ax = plt.subplots(figsize=(16, 16)) # Notation nttn = ['Notation', '', r'$numpy.dot$', r'$numpy.inner$', r'$numpy.cross$', r'$numpy.kron$', r'$numpy.outer$', '', r'$sympy.physics.quantum.tensorproduct.TensorProduct$', '' ] # Description dctn = ['Description', '', r'${\rm Dot\ product\ of\ two\ arrays.}$', # 1 r'${\rm Inner\ product\ of\ two\ arrays.}$', # 2 r'${\rm Cross\ product\ of\ two\ (arrays\ of)\ vectors.}$', # 3 r'${\rm Kronecker\ product\ of\ two\ arrays.}$', # 4 r'${\rm Outer\ product\ of\ two\ (arrays\ of)\ vectors.}$', # 5 '', '', r'${\rm Abstract\ tensor\ product.}$' # 6 ] for i in range(10): ax.text(0.05, 1-0.1*i, nttn[i]) ax.text(0.33, 1-0.1*i, dctn[i]) ax.set_axis_off() # plt.savefig('/content/drive/My Drive/pqc/0025_001.png') plt.show() |
解說:
-----
References
[1] 淺談張量分解(四):外積、Kronecker積和張量積- 知乎
https://zhuanlan.zhihu.com/p/26774182
[2] 張量基礎與Numpy 應用| 埃雅仁迪爾之星
https://lgwangh.github.io/2018/04/18/%E5%BC%A0%E9%87%8F%E5%9F%BA%E7%A1%80/
[3] 標量、向量、矩陣、張量之間的區別和聯繫_修煉之路的博客-CSDN博客_張量和矩陣的區別
https://blog.csdn.net/sinat_29957455/article/details/117396685
[4] What’s the difference between a matrix and a tensor? | by Steven Steinke | Medium
https://medium.com/@quantumsteinke/whats-the-difference-between-a-matrix-and-a-tensor-4505fbdc576c
[5] Tensor Product - SymPy 1.11 documentation
https://docs.sympy.org/latest/modules/physics/quantum/tensorproduct.html
-----
Python 量子運算(目錄)
https://mandhistory.blogspot.com/2022/01/quantum-computing.html
----
沒有留言:
張貼留言
注意:只有此網誌的成員可以留言。