Matlab–Python–Julia Cheatsheet from QuantEcon

admin2 admin2
3 Min Read
Sum / max / min of
each column
sum(A, 1)
max(A, [], 1)
min(A, [], 1)
sum(A, 0)
np.amax(A, 0)
np.amin(A, 0)
sum(A, dims = 1)
maximum(A, dims = 1)
minimum(A, dims = 1)
Sum / max / min of each row
sum(A, 2)
max(A, [], 2)
min(A, [], 2)
sum(A, 1)
np.amax(A, 1)
np.amin(A, 1)
sum(A, dims = 2)
maximum(A, dims = 2)
minimum(A, dims = 2)
Sum / max / min of
entire matrix
sum(A(:))
max(A(:))
min(A(:))
np.sum(A)
np.amax(A)
np.amin(A)
sum(A)
maximum(A)
minimum(A)
Cumulative sum / max / min
by row
cumsum(A, 1)
cummax(A, 1)
cummin(A, 1)
np.cumsum(A, 0)
np.maximum.accumulate(A, 0)
np.minimum.accumulate(A, 0)
cumsum(A, dims = 1)
accumulate(max, A, dims = 1)
accumulate(min, A, dims = 1)
Cumulative sum / max / min
by column
cumsum(A, 2)
cummax(A, 2)
cummin(A, 2)
np.cumsum(A, 1)
np.maximum.accumulate(A, 1)
np.minimum.accumulate(A, 1)
cumsum(A, dims = 2)
accumulate(max, A, dims = 2)
accumulate(min, A, dims = 2)

Read More

Share This Article
Leave a Comment

Leave a Reply