示例#1
0
void
NAME(DopeVectorType *RESULT, DopeVectorType *MATRIX_A, 
	DopeVectorType *MATRIX_B)
{
    void    SUBNAME();
    const RESULTTYPE   one =  (RESULTTYPE) 1;
    const RESULTTYPE   zero = (RESULTTYPE) 0;
    MatrixDimenType matdimdata, *MATDIM;

        MATDIM = (MatrixDimenType *) &matdimdata;

    /*
     * Parse dope vectors, and perform error checking.
     */

    _premult(RESULT, MATRIX_A, MATRIX_B, MATDIM);

    /*
     * Perform the matrix multiplication.
     * Do the transposed matrix multiplication C' = B'*A'
     */

   SUBNAME(&MATDIM->n, &MATDIM->m, &MATDIM->k, &one, MATDIM->B,
         &MATDIM->inc2b, &MATDIM->inc1b, MATDIM->A, &MATDIM->inc2a,
         &MATDIM->inc1a, &zero, MATDIM->C, &MATDIM->inc2c, &MATDIM->inc1c);
    return;
}
示例#2
0
void
NAME(DopeVectorType *RESULT, DopeVectorType *MATRIX_A,
     DopeVectorType *MATRIX_B)
{
    void    SUBNAME();
    const RESULTTYPE   true =  _btol(1);
    const RESULTTYPE   false = _btol(0);
    MatrixDimenType matdimdata, *MATDIM;

        MATDIM = (MatrixDimenType *) &matdimdata;

    /*
     * Parse dope vectors, and perform error checking.
     */

    _premult(RESULT, MATRIX_A, MATRIX_B, MATDIM);

    /*
     * Perform the matrix multiplication.
     */

    SUBNAME(&MATDIM->m, &MATDIM->n, &MATDIM->k, &true, MATDIM->A,
         &MATDIM->inc1a, &MATDIM->inc2a, MATDIM->B, &MATDIM->inc1b,
         &MATDIM->inc2b, &false, MATDIM->C, &MATDIM->inc1c, &MATDIM->inc2c);
     return;
}
示例#3
0
文件: .c 项目: sharugupta/OpenUH
void
NAME(DopeVectorType *RESULT, DopeVectorType *MATRIX_A, 
	DopeVectorType *MATRIX_B)
{
    void    SUBNAME();
    RESULTTYPE *Ar, *Ai;	/* pointers to real and imaginary parts of A */
    RESULTTYPE *Cr, *Ci;	/* pointers to real and imaginary parts of C */
    MatrixDimenType matdimdata, *MATDIM;
#if !defined(_SOLARIS) && !defined(_CRAYMPP) && !defined(_ABSOFT)
    const RESULTTYPE   one =  (RESULTTYPE) 1.0;
    const RESULTTYPE   zero = (RESULTTYPE) 0.0;
#else
    struct {
        _f_int4 ireal1;         /* first 32 bits of real part */
        _f_int4 irest2[3];      /* rest of 128-bit double precision */
        } one, zero;

    memset(&zero, 0, sizeof(zero));

    one = zero;
    one.ireal1 =  017777600000;
#endif

        MATDIM = (MatrixDimenType *) &matdimdata;

    /*
     * Parse dope vectors, and perform error checking.
     */

    _premult(RESULT, MATRIX_A, MATRIX_B, MATDIM);

    /*
     * Do real and imaginary parts separately.
     */

    Ar = (RESULTTYPE *) MATDIM->A;
    Ai = Ar + 1;
    MATDIM->inc1a *= 2;
    MATDIM->inc2a *= 2;

    Cr = (RESULTTYPE *) MATDIM->C;
    Ci = Cr + 1;
    MATDIM->inc1c *= 2;
    MATDIM->inc2c *= 2;

    /*
     * Perform the matrix multiplication.
     * Do the transposed problem: C' = B'*A'
     */

    /* real part */
    SUBNAME(&MATDIM->n, &MATDIM->m, &MATDIM->k, &one, MATDIM->B, &MATDIM->inc2b,
    	    &MATDIM->inc1b, Ar, &MATDIM->inc2a, &MATDIM->inc1a,
	    &zero, Cr, &MATDIM->inc2c, &MATDIM->inc1c);
    /* imaginary part */
    SUBNAME(&MATDIM->n, &MATDIM->m, &MATDIM->k, &one, MATDIM->B, &MATDIM->inc2b,
    	    &MATDIM->inc1b, Ai, &MATDIM->inc2a, &MATDIM->inc1a,
	    &zero, Ci, &MATDIM->inc2c, &MATDIM->inc1c);
    return;
}
示例#4
0
void
NAME(DopeVectorType *RESULT, DopeVectorType *MATRIX_A, 
	DopeVectorType *MATRIX_B)
{
    void    SUBNAME();
    _f_real4	*Ar, *Ai;
    RESULTTYPE	*Cr, *Ci;
    MatrixDimenType matdimdata, *MATDIM;

    const RESULTTYPE   one =  (RESULTTYPE) 1.0;
    const RESULTTYPE   zero = (RESULTTYPE) 0.0;

        MATDIM = (MatrixDimenType *) &matdimdata;

    /*
     * Parse dope vectors, and perform error checking.
     */

    _premult(RESULT, MATRIX_A, MATRIX_B, MATDIM);

    /*
     * Do real and imaginary parts separately.
     */

    Ar = (_f_real4 *) MATDIM->A;
    Ai = Ar + 1;
    MATDIM->inc1a *= 2;
    MATDIM->inc2a *= 2;

    Cr = (RESULTTYPE *) MATDIM->C;
    Ci = Cr + 1;
    MATDIM->inc1c *= 2;
    MATDIM->inc2c *= 2;

    /*
     * Perform the matrix multiplication.
     * Do the transposed problem C' = B'*A'
     */

    /* real part */
    SUBNAME(&MATDIM->m, &MATDIM->n, &MATDIM->k, &one, Ar, &MATDIM->inc1a,
    	    &MATDIM->inc2a, MATDIM->B, &MATDIM->inc1b, &MATDIM->inc2b,
	    &zero, Cr, &MATDIM->inc1c, &MATDIM->inc2c);
    /* imaginary part */
    SUBNAME(&MATDIM->m, &MATDIM->n, &MATDIM->k, &one, Ai, &MATDIM->inc1a,
    	    &MATDIM->inc2a, MATDIM->B, &MATDIM->inc1b, &MATDIM->inc2b,
	    &zero, Ci, &MATDIM->inc1c, &MATDIM->inc2c);
    return;
}
示例#5
0
void
NAME(DopeVectorType *RESULT, DopeVectorType *MATRIX_A, 
	DopeVectorType *MATRIX_B)
{
    void    SUBNAME1();
    void    SUBNAME2();
    const RESULTTYPE   one =  (RESULTTYPE) 1.0;
    const RESULTTYPE   zero = (RESULTTYPE) 0.0;
    MatrixDimenType matdimdata, *MATDIM;
	
	MATDIM = (MatrixDimenType *) &matdimdata;

    /*
     * Parse dope vectors, and perform error checking.
     */

    _premult(RESULT, MATRIX_A, MATRIX_B, MATDIM);

    /*
     * Perform the matrix multiplication.
     */

    if (MATDIM->ndimb == 1) {
	/*
	 * y = Ax
	 */
	SUBNAME2(&MATDIM->n1a, &MATDIM->n2a, &one, MATDIM->A, &MATDIM->inc1a,
	   &MATDIM->inc2a, MATDIM->B, &MATDIM->inc1b, &zero, MATDIM->C,
	   &MATDIM->inc1c);
	return;
    } else if (MATDIM->ndima == 1) {
	/*
	 * y = xB, equivalent to y' = B'x'
	 */
	SUBNAME2(&MATDIM->n2b, &MATDIM->n1b, &one, MATDIM->B, &MATDIM->inc2b,
	   &MATDIM->inc1b, MATDIM->A, &MATDIM->inc1a, &zero, MATDIM->C,
	   &MATDIM->inc1c);
	return;
    } else {
	/*
	 * C = AB (full matrix multiplication)
	 */
	SUBNAME1(&MATDIM->n1a, &MATDIM->n2b, &MATDIM->n2a, &one, MATDIM->A,
	   &MATDIM->inc1a, &MATDIM->inc2a, MATDIM->B, &MATDIM->inc1b,
	   &MATDIM->inc2b, &zero, MATDIM->C, &MATDIM->inc1c, &MATDIM->inc2c);
	return;
    }
}
示例#6
0
void
NAME(DopeVectorType *RESULT, DopeVectorType *MATRIX_A, 
	DopeVectorType *MATRIX_B)
{
    void    SUBNAME();
    const RESULTTYPE   one =  (RESULTTYPE) 1.0;
    const RESULTTYPE   zero = (RESULTTYPE) 0.0;
    RESULTTYPE *Br, *Bi;	/* pointers to real and imaginary part of B */
    RESULTTYPE *Cr, *Ci;	/* pointers to real and imaginary part of C */
    MatrixDimenType matdimdata, *MATDIM;

        MATDIM = (MatrixDimenType *) &matdimdata;

    /*
     * Parse dope vectors, and perform error checking.
     */

    _premult(RESULT, MATRIX_A, MATRIX_B, MATDIM);

    /*
     * Do real and imaginary parts separately.
     */

    Br = (RESULTTYPE *) MATDIM->B;
    Bi = Br + 1;
    MATDIM->inc1b *= 2;
    MATDIM->inc2b *= 2;

    Cr = (RESULTTYPE *) MATDIM->C;
    Ci = Cr + 1;
    MATDIM->inc1c *= 2;
    MATDIM->inc2c *= 2;

    /*
     * Perform the matrix multiplication.
     */

    /* real part */
    SUBNAME(&MATDIM->m, &MATDIM->n, &MATDIM->k, &one, MATDIM->A, &MATDIM->inc1a,
    	    &MATDIM->inc2a, Br, &MATDIM->inc1b, &MATDIM->inc2b,
	    &zero, Cr, &MATDIM->inc1c, &MATDIM->inc2c);
    /* imaginary part */
    SUBNAME(&MATDIM->m, &MATDIM->n, &MATDIM->k, &one, MATDIM->A, &MATDIM->inc1a,
    	    &MATDIM->inc2a, Bi, &MATDIM->inc1b, &MATDIM->inc2b,
	    &zero, Ci, &MATDIM->inc1c, &MATDIM->inc2c);
    return;
}
示例#7
0
void
NAME(DopeVectorType *RESULT, DopeVectorType *MATRIX_A,
     DopeVectorType *MATRIX_B)
{
    void    SUBNAME();

    MatrixDimenType matdimdata, *MATDIM;

#if !defined(_CRAYMPP) && !defined(_ABSOFT)
    const RESULTTYPE   one =  (RESULTTYPE) 1.0;
    const RESULTTYPE   zero = (RESULTTYPE) 0.0;
#else
    struct {
        _f_int4 ireal1;         /* first 32 bits of real part */
        _f_int4 irest2[3];      /* rest of 128-bit double precision */
        } one, zero;

    memset(&zero, 0, sizeof(zero));

    one = zero;
    one.ireal1 =  017777600000;
#endif

        MATDIM = (MatrixDimenType *) &matdimdata;

    /*
     * Parse dope vectors, and perform error checking.
     */

    _premult(RESULT, MATRIX_A, MATRIX_B, MATDIM);

    /*
     * Do the transposed matrix multiplication C' = B'*A'
     */

    SUBNAME(&MATDIM->n, &MATDIM->m, &MATDIM->k, &one, MATDIM->B,
         &MATDIM->inc2b, &MATDIM->inc1b, MATDIM->A, &MATDIM->inc2a,
         &MATDIM->inc1a, &zero, MATDIM->C, &MATDIM->inc2c, &MATDIM->inc1c);
    return;
}
示例#8
0
文件: matmul_c4c.c 项目: xyuan/Path64
void
NAME(DopeVectorType *RESULT, DopeVectorType *MATRIX_A, 
	DopeVectorType *MATRIX_B)
{
    void    SUBNAME();
    _f_real4    *Ar, *Ai;
    RESULTTYPE  *Br, *Bi;
    RESULTTYPE  *Cr, *Ci;
    MatrixDimenType matdimdata, *MATDIM;

    const RESULTTYPE   neg_one =  (RESULTTYPE) (-1.0);
    const RESULTTYPE   one =  (RESULTTYPE) 1.0;
    const RESULTTYPE   zero = (RESULTTYPE) 0.0;

        MATDIM = (MatrixDimenType *) &matdimdata;

    /*
     * Parse dope vectors, and perform error checking.
     */

    _premult(RESULT, MATRIX_A, MATRIX_B, MATDIM);

    /*
     * Do real and imaginary parts separately.
     */

    Ar = (_f_real4 *) MATDIM->A;
    Ai = Ar + 1;
    MATDIM->inc1a *=2;
    MATDIM->inc2a *=2;

    Br = (RESULTTYPE *) MATDIM->B;
    Bi = Br + 1;
    MATDIM->inc1b *= 2;
    MATDIM->inc2b *= 2;

    Cr = (RESULTTYPE *) MATDIM->C;
    Ci = Cr + 1;
    MATDIM->inc1c *= 2;
    MATDIM->inc2c *= 2;

    /*
     * Perform the matrix multiplication.
     * Note:
     * (Cr + Ci*i) = (Ar + Ai*i)*(Br + Bi*i)
     *             = (Ar*Br - Ai*Bi) + (Ar*Bi + Ai*Br)*i

     */

    /* real part */
    SUBNAME(&MATDIM->m,&MATDIM->n,&MATDIM->k,&one,Ar,&MATDIM->inc1a,
        &MATDIM->inc2a,Br,&MATDIM->inc1b,&MATDIM->inc2b,&zero,Cr,
        &MATDIM->inc1c,&MATDIM->inc2c);
    SUBNAME(&MATDIM->m,&MATDIM->n,&MATDIM->k,&neg_one,Ai,&MATDIM->inc1a,
        &MATDIM->inc2a,Bi,&MATDIM->inc1b,&MATDIM->inc2b,&one,Cr,
        &MATDIM->inc1c,&MATDIM->inc2c);

    /* imaginary part */
    SUBNAME(&MATDIM->m,&MATDIM->n,&MATDIM->k,&one,Ar,&MATDIM->inc1a,
        &MATDIM->inc2a,Bi,&MATDIM->inc1b,&MATDIM->inc2b,&zero,Ci,
        &MATDIM->inc1c,&MATDIM->inc2c);
    SUBNAME(&MATDIM->m,&MATDIM->n,&MATDIM->k,&one,Ai,&MATDIM->inc1a,
        &MATDIM->inc2a,Br,&MATDIM->inc1b,&MATDIM->inc2b,&one,Ci,
        &MATDIM->inc1c,&MATDIM->inc2c);
    return;
}
示例#9
0
void
NAME(DopeVectorType * RESULT, DopeVectorType * MATRIX_A,
     DopeVectorType * MATRIX_B)
{
    void    SUBNAME();

    RESULTTYPE	*Ar, *Ai;
    _f_real4	*Br, *Bi;
    RESULTTYPE	*Cr, *Ci;
    MatrixDimenType matdimdata, *MATDIM;

#if !defined(_SOLARIS) && !defined(_CRAYMPP) && !defined(_ABSOFT)
    const RESULTTYPE   neg_one =  (RESULTTYPE) (-1.0);
    const RESULTTYPE   one =  (RESULTTYPE) 1.0;
    const RESULTTYPE   zero = (RESULTTYPE) 0.0;
#else
    struct {
        _f_int4 ireal1;         /* first 32 bits of real part */
        _f_int4 irest2[7];      /* rest of 256-bit double complex */
        } neg_one, one, zero;

    memset(&zero, 0, sizeof(zero));

    one = zero;
    one.ireal1 =  017777600000;

    neg_one = zero;
    neg_one.ireal1=  037777600000;
#endif

        MATDIM = (MatrixDimenType *) &matdimdata;

    /*
     * Parse dope vectors, and perform error checking.
     */

    _premult(RESULT, MATRIX_A, MATRIX_B, MATDIM);

    /*
     * Do the real and imaginary parts separately.
     */

    Ar = (RESULTTYPE *) MATDIM->A;
    Ai = Ar + 1;
    MATDIM->inc1a *=2;
    MATDIM->inc2a *=2;

    Br = (_f_real4 *) MATDIM->B;
    Bi = Br + 1;
    MATDIM->inc1b *= 2;
    MATDIM->inc2b *= 2;

    Cr = (RESULTTYPE *) MATDIM->C;
    Ci = Cr + 1;
    MATDIM->inc1c *= 2;
    MATDIM->inc2c *= 2;

    /*
     * Perform the matrix multiplication.
     * Note:
     * (Cr + Ci*i) = (Ar + Ai*i)*(Br + Bi*i)
     *             = (Ar*Br - Ai*Bi) + (Ar*Bi + Ai*Br)*i
     * Do the transposed problem:  C' = B'*A'
     */

    /* real part */
    SUBNAME(&MATDIM->n,&MATDIM->m,&MATDIM->k,&one,Br,&MATDIM->inc2b,
    	    &MATDIM->inc1b,Ar,&MATDIM->inc2a,&MATDIM->inc1a,&zero,Cr,
    	    &MATDIM->inc1c,&MATDIM->inc2c);
    SUBNAME(&MATDIM->n,&MATDIM->m,&MATDIM->k,&neg_one,Bi,&MATDIM->inc2b,
    	    &MATDIM->inc1b,Ai,&MATDIM->inc2a,&MATDIM->inc1a,&one,Cr,
    	    &MATDIM->inc1c,&MATDIM->inc2c);

    /* imaginary part */
    SUBNAME(&MATDIM->n,&MATDIM->m,&MATDIM->k,&one,Br,&MATDIM->inc2b,
    	    &MATDIM->inc1b,Ai,&MATDIM->inc2a,&MATDIM->inc1a,&zero,Ci,
    	    &MATDIM->inc1c,&MATDIM->inc2c);
    SUBNAME(&MATDIM->n,&MATDIM->m,&MATDIM->k,&one,Bi,&MATDIM->inc2b,
    	    &MATDIM->inc1b,Ar,&MATDIM->inc2a,&MATDIM->inc1a,&one,Ci,
    	    &MATDIM->inc1c,&MATDIM->inc2c);
}
示例#10
0
void
NAME(DopeVectorType *RESULT, DopeVectorType *MATRIX_A, 
	DopeVectorType *MATRIX_B)
{
    void    SUBNAME();
    RESULTTYPE *Br, *Bi;	/* pointers to real and imaginary parts of B */
    RESULTTYPE *Cr, *Ci;	/* pointers to real and imaginary parts of C */
    MatrixDimenType matdimdata, *MATDIM;
#if !defined(_SOLARIS) && !defined(_CRAYMPP) && !defined(_ABOSFT)
    const RESULTTYPE   one =  (RESULTTYPE) 1.0;
    const RESULTTYPE   zero = (RESULTTYPE) 0.0;
#else
    struct {
        _f_int4 ireal1;         /* first 32 bits of real part */
        _f_int4 irest2[7];      /* rest of 256-bit double complex */
        } neg_one, one, zero;

    memset(&zero, 0, sizeof(zero));

    one = zero;
    one.ireal1 =  017777600000;

    neg_one = zero;
    neg_one.ireal1=  037777600000;
#endif

        MATDIM = (MatrixDimenType *) &matdimdata;

    /*
     * Parse dope vectors, and perform error checking.
     */

    _premult(RESULT, MATRIX_A, MATRIX_B, MATDIM);

    /*
     * Do real and imaginary parts separately.
     */

    Br = (RESULTTYPE *) MATDIM->B;
    Bi = Br + 1;
    MATDIM->inc1b *= 2;
    MATDIM->inc2b *= 2;

    Cr = (RESULTTYPE *) MATDIM->C;
    Ci = Cr + 1;
    MATDIM->inc1c *= 2;
    MATDIM->inc2c *= 2;

    /*
     * Perform the matrix multiplication.
     */

    /* real part */
    SUBNAME(&MATDIM->m, &MATDIM->n, &MATDIM->k, &one, MATDIM->A, &MATDIM->inc1a,
    	    &MATDIM->inc2a, Br, &MATDIM->inc1b, &MATDIM->inc2b,
	    &zero, Cr, &MATDIM->inc1c, &MATDIM->inc2c);
    /* imaginary part */
    SUBNAME(&MATDIM->m, &MATDIM->n, &MATDIM->k, &one, MATDIM->A, &MATDIM->inc1a,
    	    &MATDIM->inc2a, Bi, &MATDIM->inc1b, &MATDIM->inc2b,
	    &zero, Ci, &MATDIM->inc1c, &MATDIM->inc2c);
    return;
}