[R] multiply matrix by a scalar

Douglas Bates bates at stat.wisc.edu
Wed Jan 15 15:14:02 CET 2003


Mehmet Balcilar <mbalcilar at manas.kg> writes:

> 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?

I suppose you could use dgemm with alpha = 0. and dummy arguments for
A and B.  I don't know if there would be any advantage in doing the
calculation this way.

The C declaration corresponding to the Fortran subroutine is

/* Level 3 BLAS */

/* DGEMM - perform one of the matrix-matrix operations    */
/* C := alpha*op( A )*op( B ) + beta*C,                   */
void F77_NAME(dgemm)(const char *transa, const char *transb,
		     const int *m, const int *n,
		     const int *k, const double *alpha,
		     const double *a, const int *lda,
		     const double *b, const int *ldb,
		     const double *beta, double *c, const int *ldc);




More information about the R-help mailing list