arange(int n) : array={0..n-1}
atleast_2d(array) :
for 1d array, adds empty dimension (useful for transpose)
array copy(array):
clip(array, min, max): return thearraywith values clipped in range
diag(1-D_array, k=0): matrix with 1-D_array on diagonal, k=which diagonaldiag(2-D_array): vector with matrix’s diagonal
dot():
array eye(int n, <int m>,): identity matrix (ones on diagonal); n=cols, m=rows
linspace(int start, int end, num=n): returns n number at same distance between each other
matmul(array1, array2): product row by column
max(array, axis=):
mean(array, axis=): average
min(array, axis=):
multiply(a1, a2): mul one by one
array ones():
outer():
prod(): product over axis
range(max): array of ints < max
reshape(array): keeps elements, changes shape
std(matrix): standard deviation
sum(matrix, axis=): sums, along axis
transpose(matrix):for a 1d array, doesn't do anything;do insteadnp.atleast_2d(A).Ttril(matrix):triu(marix): upper diagonalunique(array, return_counts: bool): list of unique element, and counts if specifiedzeros(lunghezza(int)/dimensioni(tupla), tipo(default:float), qualcosa di memoria('C'/'F', default) ) -> array` : array full of zeroes
meshgrid(x1:ndarray, x2, ...) : create grid, combining vectors; return x, y of coordinates
cos(array:Array) : (like sin)
sin(array:Array) : compute sin for each point in array
// float32
class array:
object : n-dimensional array (list/list of lists… or tuple for 1-dimension);
int size : number of elements (total)
tuple shape : dimensions
dtype : type of elements
int ndim : number of dimensions
T : transposed
array(object, DTYPE=TYPE) : constructor
normal(loc=, scale=, size=) : random numbers with gauss distribution
rand(int n, int m) : random array, shape = n*m
randint(low, high=, size=, dtype=) : rand with ints, in range
seed(s:int) : set seed s
cond() :
inv() : inverse
matrix_rank(matrix) :
norm() :