[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.1.1.1 and 1.4

version 1.1.1.1, 1999/10/08 02:12:02 version 1.4, 2005/07/03 11:08:54
Line 1 
Line 1 
   /* $OpenXM: OpenXM/src/kan96xx/Kan/matrix.c,v 1.3 2001/05/04 01:06:24 takayama Exp $ */
 /* matrix.c */  /* matrix.c */
 #include <stdio.h>  #include <stdio.h>
   #include <stdlib.h>
 #include "datatype.h"  #include "datatype.h"
 #include "stackm.h"  #include "stackm.h"
 #include "extern.h"  #include "extern.h"
 #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 32  struct arrayOfPOLY *aa,*bb;
Line 34  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 53  struct matrixOfPOLY *aa,*bb;
Line 55  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 68  struct matrixOfPOLY *aa,*bb;
Line 70  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 77  char *str;
Line 79  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 94  int size;
Line 96  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 112  int m,n;
Line 114  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.1.1.1  
changed lines
  Added in v.1.4

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