[BACK]Return to matrix.c CVS log [TXT][DIR] Up to [local] / OpenXM / src / kan96xx / Kan

Diff for /OpenXM/src/kan96xx/Kan/matrix.c between version 1.2 and 1.3

version 1.2, 2000/01/16 07:55:39 version 1.3, 2001/05/04 01:06:24
Line 1 
Line 1 
 /* $OpenXM$ */  /* $OpenXM: OpenXM/src/kan96xx/Kan/matrix.c,v 1.2 2000/01/16 07:55:39 takayama Exp $ */
 /* matrix.c */  /* matrix.c */
 #include <stdio.h>  #include <stdio.h>
 #include "datatype.h"  #include "datatype.h"
Line 7 
Line 7 
 #include "extern2.h"  #include "extern2.h"
   
 #include "matrix.h"   /* ind() and ind2() are defined. */  #include "matrix.h"   /* ind() and ind2() are defined. */
                       /* You must use n and n2. */  /* You must use n and n2. */
   
 struct arrayOfPOLY *aaAdd(aa,bb)  struct arrayOfPOLY *aaAdd(aa,bb)
 struct arrayOfPOLY *aa,*bb;       struct arrayOfPOLY *aa,*bb;
 /* this function has not been tested yet. */       /* this function has not been tested yet. */
 {  {
   int i;    int i;
   POLY *r;    POLY *r;
Line 33  struct arrayOfPOLY *aa,*bb;
Line 33  struct arrayOfPOLY *aa,*bb;
 }  }
   
 struct matrixOfPOLY *aaMult(aa,bb)  struct matrixOfPOLY *aaMult(aa,bb)
 struct matrixOfPOLY *aa,*bb;       struct matrixOfPOLY *aa,*bb;
 {  {
   POLY *a;    POLY *a;
   POLY *b;    POLY *b;
Line 54  struct matrixOfPOLY *aa,*bb;
Line 54  struct matrixOfPOLY *aa,*bb;
     for (j=0; j<n2; j++) {      for (j=0; j<n2; j++) {
       tmp = ZERO;        tmp = ZERO;
       for (k=0; k<n; k++) {        for (k=0; k<n; k++) {
         tmp = ppAddv(tmp, ppMult( a[ind(i,k)], b[ind2(k,j)]));          tmp = ppAddv(tmp, ppMult( a[ind(i,k)], b[ind2(k,j)]));
       }        }
       r[ind2(i,j)] = tmp;        r[ind2(i,j)] = tmp;
     }      }
Line 69  struct matrixOfPOLY *aa,*bb;
Line 69  struct matrixOfPOLY *aa,*bb;
   
 /****************  error handler ************************/  /****************  error handler ************************/
 void errorMatrix(str)  void errorMatrix(str)
 char *str;       char *str;
 {  {
   fprintf(stderr,"matrix.c: %s\n",str);    fprintf(stderr,"matrix.c: %s\n",str);
   exit(10);    exit(10);
Line 78  char *str;
Line 78  char *str;
 /********************************************************/  /********************************************************/
   
 struct arrayOfPOLY *newArrayOfPOLY(size)  struct arrayOfPOLY *newArrayOfPOLY(size)
 int size;       int size;
 /* if size<=0, it returns [0,null]. */       /* if size<=0, it returns [0,null]. */
 {  {
   struct arrayOfPOLY *ap;    struct arrayOfPOLY *ap;
   ap = (struct arrayOfPOLY *)sGC_malloc(sizeof(struct arrayOfPOLY));    ap = (struct arrayOfPOLY *)sGC_malloc(sizeof(struct arrayOfPOLY));
Line 95  int size;
Line 95  int size;
 }  }
   
 struct matrixOfPOLY *newMatrixOfPOLY(m,n)  struct matrixOfPOLY *newMatrixOfPOLY(m,n)
 int m,n;       int m,n;
 /* if size<=0, it returns [0,null]. */       /* if size<=0, it returns [0,null]. */
 {  {
   struct matrixOfPOLY *ap;    struct matrixOfPOLY *ap;
   ap = (struct matrixOfPOLY *)sGC_malloc(sizeof(struct matrixOfPOLY));    ap = (struct matrixOfPOLY *)sGC_malloc(sizeof(struct matrixOfPOLY));
Line 113  int m,n;
Line 113  int m,n;
   
   
 struct arrayOfPOLY *carrayToArrayOfPOLY(a,size)  struct arrayOfPOLY *carrayToArrayOfPOLY(a,size)
 POLY a[];       POLY a[];
 int size;       int size;
 /* a[] is read only. */       /* a[] is read only. */
 {  {
   struct arrayOfPOLY *ans;    struct arrayOfPOLY *ans;
   int i;    int i;

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>