Matrix multiplication in Rcpp

后端 未结 3 1997
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-29 10:12

First of all, I am a novice user so forget my general ignorance. I am looking for a faster alternative to the %*% operator in R. Even though older posts suggest the use of R

3条回答
  •  猫巷女王i
    2020-12-29 10:45

    The following approach can also be used :

    NumericMatrix mmult(NumericMatrix m, NumericMatrix v)
    {
      Environment base("package:base");
      Function mat_Mult = base["%*%"];
      return(mat_Mult(m, v));
    }
    

    With this approach, we use the operator %*% of R.

提交回复
热议问题