1 #include <cctype>
2 #include "../gmx_lapack.h"
3 
4 
5 void
F77_FUNC(dlaset,DLASET)6 F77_FUNC(dlaset,DLASET)(const char *uplo,
7 	int *m,
8 	int *n,
9 	double *alpha,
10 	double *beta,
11 	double *a,
12 	int *lda)
13 {
14   int i,j,k;
15   const char ch=std::toupper(*uplo);
16 
17   if(ch=='U') {
18     for(j=1;j<*n;j++) {
19       k = (j < *m) ? j : *m;
20       for(i=0;i<k;i++)
21 	a[j*(*lda)+i] = *alpha;
22     }
23   } else if(ch=='L') {
24     k = (*m < *n) ? *m : *n;
25     for(j=0;j<k;j++) {
26       for(i=j+1;i<*m;i++)
27 	a[j*(*lda)+i] = *alpha;
28     }
29   } else {
30     for(j=0;j<*n;j++) {
31       for(i=0;i<*m;i++)
32 	a[j*(*lda)+i] = *alpha;
33     }
34   }
35 
36   k = (*m < *n) ? *m : *n;
37   for(i=0;i<k;i++)
38     a[i*(*lda)+i] = *beta;
39 }
40