search for: transb

Displaying 10 results from an estimated 10 matches for "transb".

Did you mean: trans
2015 Jun 03
2
Problem with shared library and lapack under windows
...that calls Lapack's DGEMM routine and I need to create a shared library to use Cfun inside R. The C file is the following #include<stdio.h> #include<R.h> #include<R_ext/Lapack.h> void Cfun(double *res, double *X, int *n, int *q) { char *ptr_TRANSA, TRANSA='T', *ptr_TRANSB, TRANSB='N'; ptr_TRANSA=&TRANSA; ptr_TRANSB=&TRANSB; double *ptr_ALPHA, ALPHA=1.0, *ptr_BETA, BETA=0.0; ptr_ALPHA=&ALPHA; ptr_BETA=&BETA; dgemm_(ptr_TRANSA, ptr_TRANSB, q, q, n, ptr_ALPHA, X, n, X, n, ptr_BETA, res, q); } In Ubuntu I have no problem in compiling: R...
2005 Oct 12
1
Using matprod from array.c
...d.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, int ncx, double *y, int nry, int ncy, double *z) { char *transa = "N", *transb = "N"; int i, j, k; double one = 1.0, zero = 0.0, sum; Rboolean have_na = FALSE; if (nrx > 0 && ncx > 0 && nry > 0 && ncy > 0) { /* Don't trust the BLAS to handle NA/NaNs correctly: PR#4582 * The test is only O(n) here */ for...
2006 Mar 09
0
When calling external C-function repeatedly I get different results; can't figure out why..
...xternal 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, &nrx); } SEXP trProd2(SEXP x, SEXP y) { int nrx, ncx, nry, ncy, mode, i; SEXP xdims, ydims, ans, ans2, tr; xdims =...
2006 Mar 09
0
When calling external C-function repeatedly I get differentresults; can't figure out why..
...o 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, &nrx); } > > SEXP trProd2(SEXP x, SEXP y) > { > int nrx, ncx, nry, ncy, mode, i; > SEXP...
2009 Sep 04
1
calling Lapack and BLAS routines from C
...nclude <R.h> #include <R_ext/Applic.h> #include <R_ext/Lapack.h> #include <R_ext/BLAS.h> #include <R_ext/RS.h> // FUNCTION CALLING BLAS void funct(double *x, int *dim, double *y, double *result){ double one=1.0; double zero =0.0; char *transa="N"; char *transb="N"; F77_CALL(dgemm) (transa,transb,dim,dim,dim,&one,x,dim,y,dim,&zero,result,dim); } // FUNCTION CALLING LAPACK void funct4(double *x, int *dim, double *result){ char *UorL="L"; int info=0; F77_CALL(dpotrf)(UorL,dim,x,dim, &info); } Best, Marcin Hitc...
2006 Aug 03
1
question about dll crashing R
...n 100 times, it crashes R. Or if I call .Call("foobar"....) seperately more than two tims it crashes R. For the most part I am doing matirx multiplies using EXP matrixprod (SEXP x , SEXP y ) { int nrx , ncx , nry , ncy , mode; SEXP xdims , ydims , ans ; char *transa = "N" , *transb = "N" ; double one = 1.0 , zero = 0.0 ; xdims = getAttrib (x , R_DimSymbol ) ; ydims = getAttrib (y , R_DimSymbol ) ; mode = REALSXP; nrx = INTEGER( xdims ) [ 0 ] ; ncx = INTEGER( xdims ) [ 1 ] ; nry = INTEGER( ydims ) [ 0 ] ; ncy = INTEGER( ydims ) [ 1 ] ; PROTECT( ans = allocMatrix (mod...
2010 Aug 23
1
Internal state indicating if a data object has NAs/no NAs/not sure (Was: Re: Speeding up matrix multiplies)
...n 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; > ? ?double one = 1.0, zero = 0.0; > ? ?LDOUBLE sum; > ? ?Rboolean do_it_here; > > ? ?/* NOTE: ncx must be equal to nry. */ > > ? ?if (nrx==1 && ncy==1) { > > ? ? ? ?/* Do dot product quickly. */ > > ? ? ? ?sum = 0.0; &...
2010 Aug 23
1
Speeding up matrix multiplies
...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; double one = 1.0, zero = 0.0; LDOUBLE sum; Rboolean do_it_here; /* NOTE: ncx must be equal to nry. */ if (nrx==1 && ncy==1) { /* Do dot product quickly. */ sum = 0.0; for (i = 0; i<ncx; i++) su...
2015 Sep 09
0
Profiling function that contains both C++ and Fortran Code
...rrently useless. In the original version of the package "omxDGEMM" is defined as inline. I changed this in the hope that it would resolve the issue. This was not the case. "omxunsafedgemm" is called by "omxDGEMM" like that F77_CALL(omxunsafedgemm)(&transa, &transb, &(nrow), &(ncol), &(nmid), &alpha, a->data, &(a->leading), b->data, &(b->leading),&beta, result->data, &(result->leading)); Any ideas how to obtain a sensible profile...
2003 Jan 15
1
multiply matrix by a scalar
This is not the correct group to post this question. Sorry, but I subscribe nowhere else. What is the BLAS routine to multiply a matrix by a scalar? Thanks. -- Mehmet Balcilar, PhD Assistant Professor Manas University College of Economics & Administrative Sciences Department of Economics Prospect Tinctik 56 Bishkek Kyrgyzstan Tel: +996 (312) 54 19 42 +996 (312) 54 19 43 +996