Numpy common functions (power, sum, tile, transpose, etc.)

1. power(x1, x2)

    Raise each element in x1 to the power of x2. Does not change the shape on x1.

2. sum(aaxis=Nonedtype=Noneout=Nonekeepdims=False)

 To sum a, if axis=None, add up each number in the matrix, if axis=0, add the matrix column by column, if axis is greater than 0, add the matrix by row.

 dtype defines the type of output.

 out: Customize the matrix that stores the output results, and the shape must be the same as the output.

3. tile(A, reps)

 With A as the element, construct a matrix with reps as shap.

 例tile([1 2],[3,4])

  The output is [1 2 1 2 1 2 1 2

       1 2 1 2 1 2 1 2

 1 2 1 2 1 2 1 2]


4. transpose(A)

  Do the transpose of matrix A.


5.shape(A)

 Returns the degrees of each dimension of A.

6. mat (A)

 Converting A to matrix, the difference between matrix and array is that matrix must be 2-dimensional, while array can be multi-dimensional.

7.dot(A,B)

 Do matrix multiplication of matrices A and B.


Reprinted in: https://blog.csdn.net/juanjuan1314/article/details/53282579

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325589725&siteId=291194637