Files
sics/matrix/matmul.c
cvs d782d43951 - added backwards calculation of hkl from four circle angles. This
required inclusion of a matrix package.
- modified  counter error handling to send a Stop when the _BAD_BUSY
  error is received.
- added an environment interface to the general controller stuff in choco.*
  Also added setting a parameter directly at the controller object.
- Added a driver for the ETH High Temperature Furnace to be used at
  SANS.
2000-07-12 12:01:19 +00:00

60 lines
1.2 KiB
C
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/*
*-----------------------------------------------------------------------------
* file: matmul.c
* desc: matrix multiplication
* by: ko shu pui, patrick
* date: 24 nov 91 v0.1
* revi:
* ref:
* [1] Mary L.Boas, "Mathematical Methods in the Physical Sciene,"
* John Wiley & Sons, 2nd Ed., 1983. Chap 3.
*
*-----------------------------------------------------------------------------
*/
#include <stdio.h>
#include "matrix.h"
/*
*-----------------------------------------------------------------------------
* funct: mat_mul
* desct: multiplication of two matrice
* given: A, B = compatible matrice to be multiplied
* retrn: NULL if malloc() fails
* else allocated matrix of A * B
* comen:
*-----------------------------------------------------------------------------
*/
MATRIX mat_mul( A, B )
MATRIX A, B;
{
int i, j, k;
MATRIX C;
if ((C = mat_creat( MatRow(A), MatCol(B), UNDEFINED )) == NULL)
return (NULL);
for (i=0; i<MatRow(A); i++)
for (j=0; j<MatCol(B); j++)
for (k=0, C[i][j]=0.0; k<MatCol(A); k++)
{
C[i][j] += A[i][k] * B[k][j];
}
return (C);
}
double mat_diagmul( A )
MATRIX A;
{
int i;
double result = 1.0;
for (i=0; i<MatRow(A); i++)
{
result *= A[i][i];
}
return (result);
}