intmatmul.c File Reference

#include "stack-c.h"

Include dependency graph for intmatmul.c:

Go to the source code of this file.

Defines

#define A(i, k)   a[i + k*n]
#define B(k, j)   b[k + j*m]
#define C(i, j)   c[i + j*n]

Functions

void matmul __PARAMS ((double *a, int n, int m, double *b, int l, double *c))
int intmatmul (char *fname)
void matmul (a, int n, int m, b, int l, c)


Define Documentation

#define A ( i,
 )     a[i + k*n]

Definition at line 47 of file intmatmul.c.

#define B ( k,
j   )     b[k + j*m]

Definition at line 48 of file intmatmul.c.

#define C ( i,
j   )     c[i + j*n]

Definition at line 49 of file intmatmul.c.

Referenced by C2F(), dgemm(), GetCom(), GetIMATRIX(), GetPOINTER(), GetSPARSE(), intex14c(), intsplin2d(), Real3::main(), Real1::main(), and matmul().


Function Documentation

void matmul __PARAMS ( (double *a, int n, int m, double *b, int l, double *c)   ) 

int intmatmul ( char *  fname  ) 

Definition at line 10 of file intmatmul.c.

References CheckLhs, CheckRhs, CreateVar, Error, GetRhsVar, LhsVar, m1, m2, matmul(), n1, n2, sciprint(), and stk.

00012 {
00013   static int l1, m1, n1, l2, m2, n2, l3;
00014   static int minlhs=1, maxlhs=1, minrhs=2, maxrhs=2;
00015 
00016   /* Check number of inputs (rhs=2) and outputs (lhs=1) */
00017   CheckRhs(minrhs,maxrhs) ;
00018   CheckLhs(minlhs,maxlhs) ;
00019 
00020   /* Get A (#1) and B (#2) and create C (#3) as double ("d") matrices */
00021   GetRhsVar(1, "d", &m1, &n1, &l1);   /* m1, n1 (and l1) are output parameters */
00022   GetRhsVar(2, "d", &m2, &n2, &l2);   /* m1, n1 (and l1) are output parameters */
00023   CreateVar(3, "d", &m1, &n2, &l3);   /* m1 and n2 are input parameters */
00024 
00025   /* Check dimensions    */
00026   if (!(n1==m2)) { sciprint("%s: Incompatible inputs \r\n", "matmul");
00027     Error(999);
00028     return 0;}
00029 
00030   /* Call multiplication function 
00031    * inputs:stk(l1)->A, stk(l2)->B 
00032    *  output:stk(l3)->C               
00033    */
00034   matmul(stk(l1), m1, n1, stk(l2), n2, stk(l3));
00035 
00036   /*  Return C (3)  */
00037   LhsVar(1) = 3;
00038   return 0;
00039 }

Here is the call graph for this function:

void matmul ( a  ,
int  n,
int  m,
b  ,
int  l,
 
)

Definition at line 51 of file intmatmul.c.

References A, B, C, i, j, and s.

Referenced by intmatmul().

00054 {
00055   int i,j,k;
00056   double s;
00057   for( i=0 ; i < n; i++){
00058     for( j=0; j < l; j++){
00059       s = 0.;
00060       for( k=0; k< m; k++){
00061         s += A(i,k)*B(k,j);
00062       }
00063       C(i,j) = s;
00064     }
00065   }
00066 }

Here is the caller graph for this function:


Generated on Sun Mar 4 16:07:45 2007 for Scilab [trunk] by  doxygen 1.5.1