comparison main/sparse/SuperLU/SRC/dsp_blas3.c @ 0:6b33357c7561 octave-forge

Initial revision
author pkienzle
date Wed, 10 Oct 2001 19:54:49 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:6b33357c7561
1
2
3 /*
4 * -- SuperLU routine (version 2.0) --
5 * Univ. of California Berkeley, Xerox Palo Alto Research Center,
6 * and Lawrence Berkeley National Lab.
7 * November 15, 1997
8 *
9 */
10 /*
11 * File name: sp_blas3.c
12 * Purpose: Sparse BLAS3, using some dense BLAS3 operations.
13 */
14
15 #include "dsp_defs.h"
16 #include "util.h"
17
18 int
19 sp_dgemm(char *transa, char *transb, int m, int n, int k,
20 double alpha, SuperMatrix *A, double *b, int ldb,
21 double beta, double *c, int ldc)
22 {
23 /* Purpose
24 =======
25
26 sp_d performs one of the matrix-matrix operations
27
28 C := alpha*op( A )*op( B ) + beta*C,
29
30 where op( X ) is one of
31
32 op( X ) = X or op( X ) = X' or op( X ) = conjg( X' ),
33
34 alpha and beta are scalars, and A, B and C are matrices, with op( A )
35 an m by k matrix, op( B ) a k by n matrix and C an m by n matrix.
36
37
38 Parameters
39 ==========
40
41 TRANSA - (input) char*
42 On entry, TRANSA specifies the form of op( A ) to be used in
43 the matrix multiplication as follows:
44 TRANSA = 'N' or 'n', op( A ) = A.
45 TRANSA = 'T' or 't', op( A ) = A'.
46 TRANSA = 'C' or 'c', op( A ) = conjg( A' ).
47 Unchanged on exit.
48
49 TRANSB - (input) char*
50 On entry, TRANSB specifies the form of op( B ) to be used in
51 the matrix multiplication as follows:
52 TRANSB = 'N' or 'n', op( B ) = B.
53 TRANSB = 'T' or 't', op( B ) = B'.
54 TRANSB = 'C' or 'c', op( B ) = conjg( B' ).
55 Unchanged on exit.
56
57 M - (input) int
58 On entry, M specifies the number of rows of the matrix
59 op( A ) and of the matrix C. M must be at least zero.
60 Unchanged on exit.
61
62 N - (input) int
63 On entry, N specifies the number of columns of the matrix
64 op( B ) and the number of columns of the matrix C. N must be
65 at least zero.
66 Unchanged on exit.
67
68 K - (input) int
69 On entry, K specifies the number of columns of the matrix
70 op( A ) and the number of rows of the matrix op( B ). K must
71 be at least zero.
72 Unchanged on exit.
73
74 ALPHA - (input) double
75 On entry, ALPHA specifies the scalar alpha.
76
77 A - (input) SuperMatrix*
78 Matrix A with a sparse format, of dimension (A->nrow, A->ncol).
79 Currently, the type of A can be:
80 Stype = NC or NCP; Dtype = _D; Mtype = GE.
81 In the future, more general A can be handled.
82
83 B - DOUBLE PRECISION array of DIMENSION ( LDB, kb ), where kb is
84 n when TRANSB = 'N' or 'n', and is k otherwise.
85 Before entry with TRANSB = 'N' or 'n', the leading k by n
86 part of the array B must contain the matrix B, otherwise
87 the leading n by k part of the array B must contain the
88 matrix B.
89 Unchanged on exit.
90
91 LDB - (input) int
92 On entry, LDB specifies the first dimension of B as declared
93 in the calling (sub) program. LDB must be at least max( 1, n ).
94 Unchanged on exit.
95
96 BETA - (input) double
97 On entry, BETA specifies the scalar beta. When BETA is
98 supplied as zero then C need not be set on input.
99
100 C - DOUBLE PRECISION array of DIMENSION ( LDC, n ).
101 Before entry, the leading m by n part of the array C must
102 contain the matrix C, except when beta is zero, in which
103 case C need not be set on entry.
104 On exit, the array C is overwritten by the m by n matrix
105 ( alpha*op( A )*B + beta*C ).
106
107 LDC - (input) int
108 On entry, LDC specifies the first dimension of C as declared
109 in the calling (sub)program. LDC must be at least max(1,m).
110 Unchanged on exit.
111
112 ==== Sparse Level 3 Blas routine.
113 */
114 int incx = 1, incy = 1;
115 int j;
116
117 for (j = 0; j < n; ++j) {
118 sp_dgemv(transa, alpha, A, &b[ldb*j], incx, beta, &c[ldc*j], incy);
119 }
120 return 0;
121 }