GRASS Programmer's Manual  6.5.svn(2012)-r51648
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines
mmul.c
Go to the documentation of this file.
00001 /*  mmul.c    CCMATH mathematics library source code.
00002  *
00003  *  Copyright (C)  2000   Daniel A. Atkinson    All rights reserved.
00004  *  This code may be redistributed under the terms of the GNU library
00005  *  public license (LGPL). ( See the lgpl.license file for details.)
00006  * ------------------------------------------------------------------------
00007  */
00008 #include "ccmath.h"
00009 void mmul(double *c, double *a, double *b, int n)
00010 {
00011     double *p, *q, s;
00012 
00013     int i, j, k;
00014 
00015     trnm(b, n);
00016     for (i = 0; i < n; ++i, a += n) {
00017         for (j = 0, q = b; j < n; ++j) {
00018             for (k = 0, p = a, s = 0.; k < n; ++k)
00019                 s += *p++ * *q++;
00020             *c++ = s;
00021         }
00022     }
00023     trnm(b, n);
00024 }