Python matrix operation

I wrote a lot of for loops before programming, because the time is too long, I thought of changing to a matrix to reduce the operation.

  1. The radians, cos, sin, asin, sqrt in the math package can only calculate single values, not matrices.
    So change to np.radians, np.cos, np.sin, np.arcsin, np.sqrt
  2. In addition, the square of the previous single value should be changed to np.square ()
    and the dot multiplication of the matrix np.multiply (a, b)
  3. Create a new empty matrix
    a = np.empty (shape = [rownum, colnum])
    for i in range (n):
    a [i ,: ] =
Published 35 original articles · Liked 20 · Visitors 50,000+

Guess you like

Origin blog.csdn.net/weixin_39875181/article/details/104542380