R/Smatrix.R

# 计算系数相似矩阵
Smatrix <- function(X,Init){
    XM <- solve(matrix(X[4:7],nrow = 2))
    diff <- t(apply(Init[,1:2],1,`-`,X[1:2]))
    return(apply(diff,1,function(Z,XM){t(Z)%*%XM%*%matrix(Z)},XM))
}
LuXiaoEei/MWPCR-with-R documentation built on May 28, 2019, 1:34 p.m.