Revision 0dbb71197f123f711e714db6f8f55b40031f4529 authored by A.I. McLeod on 14 December 2012, 00:00:00 UTC, committed by Gabor Csardi on 14 December 2012, 00:00:00 UTC
1 parent b417f2d
Raw File
vecmat.c
// Matrix operations

#include "trenchR.h"

// Computation of dot product
double dot(int n,double* u,double* v)
{
   double t = 0.0;
   int i;
   
   for (i=0; i < n; i++)
      t += u[i] * v[i];
   
   return t;
}

// Vector - Matrix multiplication
void vecmat(int nc,double *v, double **m,double *u)
{
	int i,j;
	double nr;

	nr = nc; 
   
	for (i=0; i < nc; i++)
	{
	  double t = 0.0;
	  for (j = 0; j < nr; ++j)
		 t += v[j] * m[j][i];
	  u[i] = t;
	}

	return;
}
back to top