Annotation of OpenXM_contrib2/asir2000/builtin/mattran.c, Revision 1.1
1.1 ! saito 1: #include "ca.h"
! 2: #include "parse.h"
! 3:
! 4: static void Rowm(NODE, Obj *);
! 5: static void Rowch(NODE, Obj *);
! 6: static void Rowmadd(NODE, Obj *);
! 7: //static void mlowch(NODE, Obj *, Obj *, Obj *);
! 8: //static void mlowad(NODE, Obj *, Obj *, Obj *);
! 9:
! 10: struct ftab mat_tab[] = {
! 11: {"rowm",Rowm,3},
! 12: {"rowch",Rowch,3},
! 13: {"rowmadd",Rowmadd,4},
! 14: {0,0,0},
! 15: };
! 16:
! 17: static void
! 18: Rowm(arg, rp)
! 19: NODE arg;
! 20: Obj *rp;
! 21: {
! 22: MAT a;
! 23: Q s;
! 24: int row, size, i;
! 25: pointer *k, *t, *ap;
! 26:
! 27: a = (MAT)ARG0(arg);
! 28: size = a->col;
! 29: s = (Q)ARG1(arg);
! 30: row = QTOS(s);
! 31: k = (pointer)ARG2(arg);
! 32: ap = BDY(a)[row];
! 33: for ( i = 0; i < size; i++ ) {
! 34: mulr(CO,(Obj)ap[i],(Obj)k,(Obj *)&t);
! 35: ap[i]=(Obj)t;
! 36: }
! 37:
! 38: *rp = (Obj)a;
! 39: }
! 40:
! 41: static void
! 42: Rowch(arg, rp)
! 43: NODE arg;
! 44: Obj *rp;
! 45: {
! 46: MAT a;
! 47: Q sa, sb;
! 48: int rowa, rowb, size, i;
! 49: pointer *k, *t, *ap, *aq;
! 50:
! 51: a = (MAT)ARG0(arg);
! 52: size = a->col;
! 53: sa = (Q)ARG1(arg);
! 54: rowa = QTOS(sa);
! 55: sb = (Q)ARG2(arg);
! 56: rowb = QTOS(sb);
! 57: ap = BDY(a)[rowa];
! 58: aq = BDY(a)[rowb];
! 59: for ( i = 0; i < size; i++ ) {
! 60: t = ap[i];
! 61: ap[i] = aq[i];
! 62: aq[i] = t;
! 63: }
! 64:
! 65: *rp = (Obj)a;
! 66: }
! 67:
! 68: static void
! 69: Rowmadd(arg, rp)
! 70: NODE arg;
! 71: Obj *rp;
! 72: {
! 73: MAT a;
! 74: Q sa, sb;
! 75: int rowa, rowb, size, i;
! 76: pointer *k, *t, *ap, *aq;
! 77:
! 78: a = (MAT)ARG0(arg);
! 79: size = a->col;
! 80: sa = (Q)ARG1(arg);
! 81: rowa = QTOS(sa);
! 82: sb = (Q)ARG2(arg);
! 83: rowb = QTOS(sb);
! 84: ap = BDY(a)[rowa];
! 85: aq = BDY(a)[rowb];
! 86: k = (pointer)ARG3(arg);
! 87:
! 88: for ( i = 0; i < size; i++ ) {
! 89: mulr( CO, (Obj)ap[i], (Obj)k, (Obj *)&t );
! 90: addr( CO, (Obj)aq[i], (Obj)t, (Obj *)&t );
! 91: aq[i] = t;
! 92: }
! 93:
! 94: *rp = (Obj)a;
! 95: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>