-
Notifications
You must be signed in to change notification settings - Fork 45
Julia pitfall
-
BLAS
has pre-check system: if the input is zero matrix/vector, thenBLAS
will return zero matrix/vector directly without calculating. Thus, the speed is faster.Example:
BLAS.axpy!(oldAlpha-α[j],x,yCorr)
If
oldAlpha-α[j]
is a zero vector,BLAS
will return zero vector directly. IfoldAlpha-α[j]
andx
are not zero vectors,BLAS
will continue to calculate.In conclusion: when testing speed, please check whether there exists zero vector/matrix.
-
reshape is reference, not copy.
a=[1,1,1]
b=reshape(a,1,3)
b[1]=999
b
a
Extra pitfall from Tianjing:
-
I found this pitfall when I changed
BLAS
function to normal function. In helper function, theBLAS
changesycorr
in global scope, but+=
changesycorr
only in function scope. So, we have to returnycorr
in helper function.- BLAS version:
function helper(ycorr) BLAS.axpy!(a,x,ycorr) end function f() helper(ycorr) end
- Normal version #WRONG!
function helper(ycorr) ycorr += a*x end function f() helper(ycorr) end
- Right version
function helper(ycorr) ycorr += a*x return ycorr end function f() ycorr = helper(ycorr) end
Joint Analysis of Continuous, Censored and Categorical Traits
Integrating Phenotypic Causal Networks in GWAS
single trait and multiple trait GBLUP by providing the relationship matrix directly
User-defined Prediction Equation
Description of Mixed Effects Model
Constraint on variance components