search for: matprod

Displaying 20 results from an estimated 30 matches for "matprod".

2005 Oct 12
1
Using matprod from array.c
Hi, I was wondering if I could use the matprod function from array.c in my own C routine. I tried the following as a test /* my_matprod.c */ # include <Rinternals.h> /* for REAL, SEXP etc */ # include <R_ext/Applic.h> /* array.c says need for dgemm */ /* following copied from array.c */ static void matprod(double *x, int nrx, in...
2020 Feb 17
2
NA in doc for options(matprod="default")
Hi, A colleague of mine has spotted me a passage of the doc ?option talking about Inf and NaN check in 'matprod=default' section: https://stat.ethz.ch/R-manual/R-devel/library/base/html/options.html I am wondering if NA should be mentioned too as the check seems to include this "value" too. NA being different from Inf and NaN it is worth mentioning, isn't it? Best, Serguei.
2020 Feb 17
1
NA in doc for options(matprod="default")
Le 17/02/2020 ? 17:50, Tomas Kalibera a ?crit?: > On 2/17/20 5:36 PM, Serguei Sokol wrote: >> Hi, >> >> A colleague of mine has spotted me a passage of the doc ?option >> talking about Inf and NaN check in 'matprod=default' section: >> https://stat.ethz.ch/R-manual/R-devel/library/base/html/options.html >> >> I am wondering if NA should be mentioned too as the check seems to >> include this "value" too. NA being different from Inf and NaN it is >> worth mentioning...
2017 Jan 07
2
accelerating matrix multiply
I am using R to multiply some large (30k x 30k double) matrices on a 64 core machine (xeon phi). I added some timers to src/main/array.c to see where the time is going. All of the time is being spent in the matprod function, most of that time is spent in dgemm. 15 seconds is in matprod in some code that is checking if there are NaNs. > system.time (C <- B %*% A) nancheck: wall time 15.240282s ? dgemm: wall time 43.111064s matprod: wall time 58.351572s ??? user?? system? elapsed 2710.154?? 20.999?? 58....
2017 Jan 11
2
accelerating matrix multiply
...>>>>> on Sat, 7 Jan 2017 16:41:42 +0000 writes: > I am using R to multiply some large (30k x 30k double) matrices on a > 64 core machine (xeon phi). I added some timers to src/main/array.c > to see where the time is going. All of the time is being spent in the > matprod function, most of that time is spent in dgemm. 15 seconds is > in matprod in some code that is checking if there are NaNs. > > system.time (C <- B %*% A) > nancheck: wall time 15.240282s > dgemm: wall time 43.111064s > matprod: wall time 58.351572s > user system...
2017 Jan 10
0
accelerating matrix multiply
...gt; >>>>> on Sat, 7 Jan 2017 16:41:42 +0000 writes: > I am using R to multiply some large (30k x 30k double) > matrices on a 64 core machine (xeon phi). I added some timers > to src/main/array.c to see where the time is going. All of the > time is being spent in the matprod function, most of that time > is spent in dgemm. 15 seconds is in matprod in some code that > is checking if there are NaNs. > > system.time (C <- B %*% A) > nancheck: wall time 15.240282s > dgemm: wall time 43.111064s > matprod: wall time 58.351572s > user sys...
2017 Jan 16
1
accelerating matrix multiply
...t;> on Sat, 7 Jan 2017 16:41:42 +0000 writes: >> I am using R to multiply some large (30k x 30k double) matrices on a >> 64 core machine (xeon phi). I added some timers to src/main/array.c >> to see where the time is going. All of the time is being spent in the >> matprod function, most of that time is spent in dgemm. 15 seconds is >> in matprod in some code that is checking if there are NaNs. >>> system.time (C <- B %*% A) >> nancheck: wall time 15.240282s >> dgemm: wall time 43.111064s >> matprod: wall time 58.351572s &gt...
2008 Apr 05
2
Adding a Matrix Exponentiation Operator
...zation in my method. 2) Regarding the code below: Is there a better way to do the matrix multiplication? I am creating quite a few copies for this implementation of exponentiation by squaring. Is there a way to cut down on the number of copies I am making here (I am assuming that the lhs and rhs of matprod() must be different instances). Any feedback appreciated ! Thanks Rory <snip> /* Convenience function */ static void copyMatrixData(SEXP a, SEXP b, int nrows, int ncols, int mode) { for (int i=0; i < ncols; ++i) for (int j=0; j < nrows; ++j) REAL(b)[i * nrows + j] = R...
2006 Feb 22
2
How can I see how %*% is implemented?
I would like to see how the matrix multiplication operator %*% is implemented (because I want to see which external Fortran/C routines are used). How can I do so? Best S??ren
2006 Mar 09
0
When calling external C-function repeatedly I get different results; can't figure out why..
...t for matrices x and y. Inspired by the R-source code, I've created the following functions (I am *new* to writing external C-functions, so feel free to laugh at my code - or, perhaps, suggest changes): #include <Rinternals.h> #include <R_ext/Applic.h> /* for dgemm */ static void matprod(double *x, int nrx, int ncx, double *y, int nry, int ncy, double *z) { char *transa = "N", *transb = "N"; double one = 1.0, zero = 0.0; F77_CALL(dgemm)(transa, transb, &nrx, &ncy, &ncx, &one, x, &nrx, y, &nry, &zero, z, &nr...
2017 Jan 16
0
accelerating matrix multiply
...>> on Sat, 7 Jan 2017 16:41:42 +0000 writes: >> I am using R to multiply some large (30k x 30k double) matrices on a >> 64 core machine (xeon phi). I added some timers to src/main/array.c >> to see where the time is going. All of the time is being spent in the >> matprod function, most of that time is spent in dgemm. 15 seconds is >> in matprod in some code that is checking if there are NaNs. >>> system.time (C <- B %*% A) >> nancheck: wall time 15.240282s >> dgemm: wall time 43.111064s >> matprod: wall time 58.351572s >...
2006 Mar 09
0
When calling external C-function repeatedly I get differentresults; can't figure out why..
...he R-source code, I've created the following > functions (I am *new* to writing external C-functions, so > feel free to laugh at my code - or, perhaps, suggest changes): > > #include <Rinternals.h> > #include <R_ext/Applic.h> /* for dgemm */ > > static void matprod(double *x, int nrx, int ncx, > double *y, int nry, int ncy, double *z) { > char *transa = "N", *transb = "N"; > double one = 1.0, zero = 0.0; > F77_CALL(dgemm)(transa, transb, &nrx, &ncy, &ncx, &one, > x, &nrx, y, &n...
2010 Sep 03
1
Fourteen patches to speed up R
...consider to be a bug, in which the loop clobbers a global variable, as demonstrated by the following output with r52822: > i <- 99 > f <- function () for (i in 1:3) { print(i); if (i==2) rm(i); } > f() [1] 1 [1] 2 [1] 3 > print(i) [1] 3 patch-matprod Speeds up matrix products, including vector dot products. The speed issue here is that the R code checks for any NAs, and does the multiply in the matprod procedure (in array.c) if so, since BLAS isn't trusted with NAs. If this check takes about as long as just doing the...
2010 Sep 03
0
Pointer to fourteen patches to speed up R
...consider to be a bug, in which the loop clobbers a global variable, as demonstrated by the following output with r52822: > i <- 99 > f <- function () for (i in 1:3) { print(i); if (i==2) rm(i); } > f() [1] 1 [1] 2 [1] 3 > print(i) [1] 3 patch-matprod Speeds up matrix products, including vector dot products. The speed issue here is that the R code checks for any NAs, and does the multiply in the matprod procedure (in array.c) if so, since BLAS isn't trusted with NAs. If this check takes about as long as just doing the...
2010 Aug 23
1
Speeding up matrix multiplies
...-enable-mpfr --enable-targets=all --enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu Thread model: posix gcc version 4.2.4 (Ubuntu 4.2.4-1ubuntu4) I didn't change any R configuration options regarding compilation. Below is my modified version of the matprod function in src/main/array.c. Radford Neal ------------------------------------------------------------------------ static void matprod(double *x, int nrx, int ncx, double *y, int nry, int ncy, double *z) { char *transa = "N", *transb = "N"; int i, j, k;...
2017 Jan 09
0
accelerating matrix multiply
...: "Cohn, Robert S" <robert.s.cohn at intel.com> > > I am using R to multiply some large (30k x 30k double) matrices on a > 64 core machine (xeon phi). I added some timers to > src/main/array.c to see where the time is going. All of the time is > being spent in the matprod function, most of that time is spent in > dgemm. 15 seconds is in matprod in some code that is checking if > there are NaNs. > > The NaN checking code is not being vectorized... This can be a problem with big matrices when lots of cores are used for the actual multiply, but is even m...
2003 Oct 14
3
NA %*% 0 == 0 (PR#4582)
Full_Name: J . R. M. Hosking Version: 1.8.0 OS: Windows 2000 Submission from: (NULL) (129.34.20.23) On R 1.8.0 (and on R 1.5.1), Windows binary: > NA %*% 0 [,1] [1,] 0 This is surprising. Is it a bug? Note that > 0 %*% NA [,1] [1,] NA > NA %*% 1 [,1] [1,] NA > NA * 0 [1] NA as expected.
2017 Aug 21
2
Control multi-threading in standard matrix product
...9;RhpcBLASctl'. However, being able to control the >> number of threads should maybe not require to use an additional package. >> >> In addition, the doc 'matmult' does not mention this point, it points to >> the 'options' doc page and especially the 'matprod' section, in which >> the multi-threading is not discussed. >> >> >> Here is the results of the 'sessionInfo()' function on my machine for >> R-3.4.1: >> R version 3.4.1 (2017-06-30) >> Platform: x86_64-pc-linux-gnu (64-bit) >> Running und...
2017 Aug 21
3
Control multi-threading in standard matrix product
...hreads thanks to the package 'RhpcBLASctl'. However, being able to control the number of threads should maybe not require to use an additional package. In addition, the doc 'matmult' does not mention this point, it points to the 'options' doc page and especially the 'matprod' section, in which the multi-threading is not discussed. Here is the results of the 'sessionInfo()' function on my machine for R-3.4.1: R version 3.4.1 (2017-06-30) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 16.04.3 LTS Matrix products: default BLAS: /usr/lib/open...
2010 Aug 23
1
Internal state indicating if a data object has NAs/no NAs/not sure (Was: Re: Speeding up matrix multiplies)
...s=all --enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu > Thread model: posix > gcc version 4.2.4 (Ubuntu 4.2.4-1ubuntu4) > > I didn't change any R configuration options regarding compilation. > > Below is my modified version of the matprod function in src/main/array.c. > > ? Radford Neal > > ------------------------------------------------------------------------ > > static void matprod(double *x, int nrx, int ncx, > ? ? ? ? ? ? ? ? ? ?double *y, int nry, int ncy, double *z) > { > ? ?char *transa = "N&...