Hi, To drastically improve the speed you might want to consider using the %c-% operator from the collapse package: https://stackoverflow.com/questions/24520720/subtract-a-constant-vector-from-each-row-in-a-matrix-in-r https://cran.r-project.org/web/packages/collapse/index.html https://cran.r-project.org/web/packages/collapse/collapse.pdf For me the subtraction then ran in seconds per sample.
Hi,
To drastically improve the speed you might want to consider using the %c-% operator from the collapse package:
https://stackoverflow.com/questions/24520720/subtract-a-constant-vector-from-each-row-in-a-matrix-in-r
https://cran.r-project.org/web/packages/collapse/index.html
https://cran.r-project.org/web/packages/collapse/collapse.pdf
For me the subtraction then ran in seconds per sample.