https://github.com/cran/ltsa
Raw File
Tip revision: d4bb25ff74f1d6a70bf1c395dd2775e1304672b0 authored by A.I. McLeod on 30 November 2010, 00:00:00 UTC
version 1.4
Tip revision: d4bb25f
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