数值计算
Ported a short MATLAB script to R and one result came back as a matrix
Trying to redo a short MATLAB script in R, and I've barely touched MATLAB before. Most of it came over fine, except for a sin…
na.rm = TRUE on a group that is all NA
Per-group totals with tapply(x, g, sum, na.rm = TRUE), and one group came back as 0. Every value in that group is NA. Not a s…
A loop that allocated a column at a time
Slicing in Julia copies, which I knew and then forgot inside a loop. Take a function that walks the columns of a matrix and d…
sum(X) on a matrix with one row
A function takes a matrix of observations, rows are observations and columns are features, and normalizes each column with X…
Implicit expansion turned my shape bug into a matrix
A row vector times a column vector with .* used to be an error. Since R2016b it isn't. With a = [1 2 3] and b = [1; 2; 3], a…
Ambiguous Julia methods and f(2, 3)
Two Julia methods, f(x::Integer, y::Number) and f(x::Number, y::Integer). Each runs a different algorithm, chosen for whichev…
f2py copies my C-ordered array on every call
Passing a NumPy array into a Fortran subroutine through f2py. The array is created the usual way, np.zeros((n, m)), so it's C…