LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
c_sblas2.c
Go to the documentation of this file.
1/*
2 * Written by D.P. Manley, Digital Equipment Corporation.
3 * Prefixed "C_" to BLAS routines and their declarations.
4 *
5 * Modified by T. H. Do, 1/23/98, SGI/CRAY Research.
6 */
7#include <stdlib.h>
8#include "cblas.h"
9#include "cblas_test.h"
10
11void F77_sgemv(CBLAS_INT *layout, char *transp, CBLAS_INT *m, CBLAS_INT *n, float *alpha,
12 float *a, CBLAS_INT *lda, float *x, CBLAS_INT *incx, float *beta,
13 float *y, CBLAS_INT *incy
15 , FORTRAN_STRLEN transp_len
16#endif
17) {
18
19 float *A;
20 CBLAS_INT i,j,LDA;
21 CBLAS_TRANSPOSE trans;
22
23 get_transpose_type(transp, &trans);
24 if (*layout == TEST_ROW_MJR) {
25 LDA = *n+1;
26 A = ( float* )malloc( (*m)*LDA*sizeof( float ) );
27 for( i=0; i<*m; i++ )
28 for( j=0; j<*n; j++ )
29 A[ LDA*i+j ]=a[ (*lda)*j+i ];
31 *m, *n, *alpha, A, LDA, x, *incx, *beta, y, *incy );
32 free(A);
33 }
34 else if (*layout == TEST_COL_MJR)
36 *m, *n, *alpha, a, *lda, x, *incx, *beta, y, *incy );
37 else
38 cblas_sgemv( UNDEFINED, trans,
39 *m, *n, *alpha, a, *lda, x, *incx, *beta, y, *incy );
40}
41
42void F77_sger(CBLAS_INT *layout, CBLAS_INT *m, CBLAS_INT *n, float *alpha, float *x, CBLAS_INT *incx,
43 float *y, CBLAS_INT *incy, float *a, CBLAS_INT *lda ) {
44
45 float *A;
46 CBLAS_INT i,j,LDA;
47
48 if (*layout == TEST_ROW_MJR) {
49 LDA = *n+1;
50 A = ( float* )malloc( (*m)*LDA*sizeof( float ) );
51
52 for( i=0; i<*m; i++ ) {
53 for( j=0; j<*n; j++ )
54 A[ LDA*i+j ]=a[ (*lda)*j+i ];
55 }
56
57 cblas_sger(CblasRowMajor, *m, *n, *alpha, x, *incx, y, *incy, A, LDA );
58 for( i=0; i<*m; i++ )
59 for( j=0; j<*n; j++ )
60 a[ (*lda)*j+i ]=A[ LDA*i+j ];
61 free(A);
62 }
63 else
64 cblas_sger( CblasColMajor, *m, *n, *alpha, x, *incx, y, *incy, a, *lda );
65}
66
67void F77_strmv(CBLAS_INT *layout, char *uplow, char *transp, char *diagn,
68 CBLAS_INT *n, float *a, CBLAS_INT *lda, float *x, CBLAS_INT *incx
70 , FORTRAN_STRLEN uplow_len, FORTRAN_STRLEN transp_len, FORTRAN_STRLEN diagn_len
71#endif
72) {
73 float *A;
74 CBLAS_INT i,j,LDA;
75 CBLAS_TRANSPOSE trans;
76 CBLAS_UPLO uplo;
77 CBLAS_DIAG diag;
78
79 get_transpose_type(transp,&trans);
80 get_uplo_type(uplow,&uplo);
81 get_diag_type(diagn,&diag);
82
83 if (*layout == TEST_ROW_MJR) {
84 LDA = *n+1;
85 A = ( float* )malloc( (*n)*LDA*sizeof( float ) );
86 for( i=0; i<*n; i++ )
87 for( j=0; j<*n; j++ )
88 A[ LDA*i+j ]=a[ (*lda)*j+i ];
89 cblas_strmv(CblasRowMajor, uplo, trans, diag, *n, A, LDA, x, *incx);
90 free(A);
91 }
92 else if (*layout == TEST_COL_MJR)
93 cblas_strmv(CblasColMajor, uplo, trans, diag, *n, a, *lda, x, *incx);
94 else {
95 cblas_strmv(UNDEFINED, uplo, trans, diag, *n, a, *lda, x, *incx);
96 }
97}
98
99void F77_strsv(CBLAS_INT *layout, char *uplow, char *transp, char *diagn,
100 CBLAS_INT *n, float *a, CBLAS_INT *lda, float *x, CBLAS_INT *incx
102 , FORTRAN_STRLEN uplow_len, FORTRAN_STRLEN transp_len, FORTRAN_STRLEN diagn_len
103#endif
104) {
105 float *A;
106 CBLAS_INT i,j,LDA;
107 CBLAS_TRANSPOSE trans;
108 CBLAS_UPLO uplo;
109 CBLAS_DIAG diag;
110
111 get_transpose_type(transp,&trans);
112 get_uplo_type(uplow,&uplo);
113 get_diag_type(diagn,&diag);
114
115 if (*layout == TEST_ROW_MJR) {
116 LDA = *n+1;
117 A = ( float* )malloc( (*n)*LDA*sizeof( float ) );
118 for( i=0; i<*n; i++ )
119 for( j=0; j<*n; j++ )
120 A[ LDA*i+j ]=a[ (*lda)*j+i ];
121 cblas_strsv(CblasRowMajor, uplo, trans, diag, *n, A, LDA, x, *incx );
122 free(A);
123 }
124 else
125 cblas_strsv(CblasColMajor, uplo, trans, diag, *n, a, *lda, x, *incx );
126}
127void F77_ssymv(CBLAS_INT *layout, char *uplow, CBLAS_INT *n, float *alpha, float *a,
128 CBLAS_INT *lda, float *x, CBLAS_INT *incx, float *beta, float *y,
129 CBLAS_INT *incy
131 , FORTRAN_STRLEN uplow_len
132#endif
133) {
134 float *A;
135 CBLAS_INT i,j,LDA;
136 CBLAS_UPLO uplo;
137
138 get_uplo_type(uplow,&uplo);
139
140 if (*layout == TEST_ROW_MJR) {
141 LDA = *n+1;
142 A = ( float* )malloc( (*n)*LDA*sizeof( float ) );
143 for( i=0; i<*n; i++ )
144 for( j=0; j<*n; j++ )
145 A[ LDA*i+j ]=a[ (*lda)*j+i ];
146 cblas_ssymv(CblasRowMajor, uplo, *n, *alpha, A, LDA, x, *incx,
147 *beta, y, *incy );
148 free(A);
149 }
150 else
151 cblas_ssymv(CblasColMajor, uplo, *n, *alpha, a, *lda, x, *incx,
152 *beta, y, *incy );
153}
154
155void F77_ssyr(CBLAS_INT *layout, char *uplow, CBLAS_INT *n, float *alpha, float *x,
156 CBLAS_INT *incx, float *a, CBLAS_INT *lda
158 , FORTRAN_STRLEN uplow_len
159#endif
160) {
161 float *A;
162 CBLAS_INT i,j,LDA;
163 CBLAS_UPLO uplo;
164
165 get_uplo_type(uplow,&uplo);
166
167 if (*layout == TEST_ROW_MJR) {
168 LDA = *n+1;
169 A = ( float* )malloc( (*n)*LDA*sizeof( float ) );
170 for( i=0; i<*n; i++ )
171 for( j=0; j<*n; j++ )
172 A[ LDA*i+j ]=a[ (*lda)*j+i ];
173 cblas_ssyr(CblasRowMajor, uplo, *n, *alpha, x, *incx, A, LDA);
174 for( i=0; i<*n; i++ )
175 for( j=0; j<*n; j++ )
176 a[ (*lda)*j+i ]=A[ LDA*i+j ];
177 free(A);
178 }
179 else
180 cblas_ssyr(CblasColMajor, uplo, *n, *alpha, x, *incx, a, *lda);
181}
182
183void F77_ssyr2(CBLAS_INT *layout, char *uplow, CBLAS_INT *n, float *alpha, float *x,
184 CBLAS_INT *incx, float *y, CBLAS_INT *incy, float *a, CBLAS_INT *lda
186 , FORTRAN_STRLEN uplow_len
187#endif
188) {
189 float *A;
190 CBLAS_INT i,j,LDA;
191 CBLAS_UPLO uplo;
192
193 get_uplo_type(uplow,&uplo);
194
195 if (*layout == TEST_ROW_MJR) {
196 LDA = *n+1;
197 A = ( float* )malloc( (*n)*LDA*sizeof( float ) );
198 for( i=0; i<*n; i++ )
199 for( j=0; j<*n; j++ )
200 A[ LDA*i+j ]=a[ (*lda)*j+i ];
201 cblas_ssyr2(CblasRowMajor, uplo, *n, *alpha, x, *incx, y, *incy, A, LDA);
202 for( i=0; i<*n; i++ )
203 for( j=0; j<*n; j++ )
204 a[ (*lda)*j+i ]=A[ LDA*i+j ];
205 free(A);
206 }
207 else
208 cblas_ssyr2(CblasColMajor, uplo, *n, *alpha, x, *incx, y, *incy, a, *lda);
209}
210
211void F77_sgbmv(CBLAS_INT *layout, char *transp, CBLAS_INT *m, CBLAS_INT *n, CBLAS_INT *kl, CBLAS_INT *ku,
212 float *alpha, float *a, CBLAS_INT *lda, float *x, CBLAS_INT *incx,
213 float *beta, float *y, CBLAS_INT *incy
215 , FORTRAN_STRLEN transp_len
216#endif
217) {
218
219 float *A;
220 CBLAS_INT i,irow,j,jcol,LDA;
221 CBLAS_TRANSPOSE trans;
222
223 get_transpose_type(transp, &trans);
224
225 if (*layout == TEST_ROW_MJR) {
226 LDA = *ku+*kl+2;
227 A = ( float* )malloc( (*n+*kl)*LDA*sizeof( float ) );
228 for( i=0; i<*ku; i++ ){
229 irow=*ku+*kl-i;
230 jcol=(*ku)-i;
231 for( j=jcol; j<*n; j++ )
232 A[ LDA*(j-jcol)+irow ]=a[ (*lda)*j+i ];
233 }
234 i=*ku;
235 irow=*ku+*kl-i;
236 for( j=0; j<*n; j++ )
237 A[ LDA*j+irow ]=a[ (*lda)*j+i ];
238 for( i=*ku+1; i<*ku+*kl+1; i++ ){
239 irow=*ku+*kl-i;
240 jcol=i-(*ku);
241 for( j=jcol; j<(*n+*kl); j++ )
242 A[ LDA*j+irow ]=a[ (*lda)*(j-jcol)+i ];
243 }
244 cblas_sgbmv( CblasRowMajor, trans, *m, *n, *kl, *ku, *alpha,
245 A, LDA, x, *incx, *beta, y, *incy );
246 free(A);
247 }
248 else
249 cblas_sgbmv( CblasColMajor, trans, *m, *n, *kl, *ku, *alpha,
250 a, *lda, x, *incx, *beta, y, *incy );
251}
252
253void F77_stbmv(CBLAS_INT *layout, char *uplow, char *transp, char *diagn,
254 CBLAS_INT *n, CBLAS_INT *k, float *a, CBLAS_INT *lda, float *x, CBLAS_INT *incx
256 , FORTRAN_STRLEN uplow_len, FORTRAN_STRLEN transp_len, FORTRAN_STRLEN diagn_len
257#endif
258) {
259 float *A;
260 CBLAS_INT irow, jcol, i, j, LDA;
261 CBLAS_TRANSPOSE trans;
262 CBLAS_UPLO uplo;
263 CBLAS_DIAG diag;
264
265 get_transpose_type(transp,&trans);
266 get_uplo_type(uplow,&uplo);
267 get_diag_type(diagn,&diag);
268
269 if (*layout == TEST_ROW_MJR) {
270 LDA = *k+1;
271 A = ( float* )malloc( (*n+*k)*LDA*sizeof( float ) );
272 if (uplo == CblasUpper) {
273 for( i=0; i<*k; i++ ){
274 irow=*k-i;
275 jcol=(*k)-i;
276 for( j=jcol; j<*n; j++ )
277 A[ LDA*(j-jcol)+irow ]=a[ (*lda)*j+i ];
278 }
279 i=*k;
280 irow=*k-i;
281 for( j=0; j<*n; j++ )
282 A[ LDA*j+irow ]=a[ (*lda)*j+i ];
283 }
284 else {
285 i=0;
286 irow=*k-i;
287 for( j=0; j<*n; j++ )
288 A[ LDA*j+irow ]=a[ (*lda)*j+i ];
289 for( i=1; i<*k+1; i++ ){
290 irow=*k-i;
291 jcol=i;
292 for( j=jcol; j<(*n+*k); j++ )
293 A[ LDA*j+irow ]=a[ (*lda)*(j-jcol)+i ];
294 }
295 }
296 cblas_stbmv(CblasRowMajor, uplo, trans, diag, *n, *k, A, LDA, x, *incx);
297 free(A);
298 }
299 else
300 cblas_stbmv(CblasColMajor, uplo, trans, diag, *n, *k, a, *lda, x, *incx);
301}
302
303void F77_stbsv(CBLAS_INT *layout, char *uplow, char *transp, char *diagn,
304 CBLAS_INT *n, CBLAS_INT *k, float *a, CBLAS_INT *lda, float *x, CBLAS_INT *incx
306 , FORTRAN_STRLEN uplow_len, FORTRAN_STRLEN transp_len, FORTRAN_STRLEN diagn_len
307#endif
308) {
309 float *A;
310 CBLAS_INT irow, jcol, i, j, LDA;
311 CBLAS_TRANSPOSE trans;
312 CBLAS_UPLO uplo;
313 CBLAS_DIAG diag;
314
315 get_transpose_type(transp,&trans);
316 get_uplo_type(uplow,&uplo);
317 get_diag_type(diagn,&diag);
318
319 if (*layout == TEST_ROW_MJR) {
320 LDA = *k+1;
321 A = ( float* )malloc( (*n+*k)*LDA*sizeof( float ) );
322 if (uplo == CblasUpper) {
323 for( i=0; i<*k; i++ ){
324 irow=*k-i;
325 jcol=(*k)-i;
326 for( j=jcol; j<*n; j++ )
327 A[ LDA*(j-jcol)+irow ]=a[ (*lda)*j+i ];
328 }
329 i=*k;
330 irow=*k-i;
331 for( j=0; j<*n; j++ )
332 A[ LDA*j+irow ]=a[ (*lda)*j+i ];
333 }
334 else {
335 i=0;
336 irow=*k-i;
337 for( j=0; j<*n; j++ )
338 A[ LDA*j+irow ]=a[ (*lda)*j+i ];
339 for( i=1; i<*k+1; i++ ){
340 irow=*k-i;
341 jcol=i;
342 for( j=jcol; j<(*n+*k); j++ )
343 A[ LDA*j+irow ]=a[ (*lda)*(j-jcol)+i ];
344 }
345 }
346 cblas_stbsv(CblasRowMajor, uplo, trans, diag, *n, *k, A, LDA, x, *incx);
347 free(A);
348 }
349 else
350 cblas_stbsv(CblasColMajor, uplo, trans, diag, *n, *k, a, *lda, x, *incx);
351}
352
353void F77_ssbmv(CBLAS_INT *layout, char *uplow, CBLAS_INT *n, CBLAS_INT *k, float *alpha,
354 float *a, CBLAS_INT *lda, float *x, CBLAS_INT *incx, float *beta,
355 float *y, CBLAS_INT *incy
357 , FORTRAN_STRLEN uplow_len
358#endif
359) {
360 float *A;
361 CBLAS_INT i,j,irow,jcol,LDA;
362 CBLAS_UPLO uplo;
363
364 get_uplo_type(uplow,&uplo);
365
366 if (*layout == TEST_ROW_MJR) {
367 LDA = *k+1;
368 A = ( float* )malloc( (*n+*k)*LDA*sizeof( float ) );
369 if (uplo == CblasUpper) {
370 for( i=0; i<*k; i++ ){
371 irow=*k-i;
372 jcol=(*k)-i;
373 for( j=jcol; j<*n; j++ )
374 A[ LDA*(j-jcol)+irow ]=a[ (*lda)*j+i ];
375 }
376 i=*k;
377 irow=*k-i;
378 for( j=0; j<*n; j++ )
379 A[ LDA*j+irow ]=a[ (*lda)*j+i ];
380 }
381 else {
382 i=0;
383 irow=*k-i;
384 for( j=0; j<*n; j++ )
385 A[ LDA*j+irow ]=a[ (*lda)*j+i ];
386 for( i=1; i<*k+1; i++ ){
387 irow=*k-i;
388 jcol=i;
389 for( j=jcol; j<(*n+*k); j++ )
390 A[ LDA*j+irow ]=a[ (*lda)*(j-jcol)+i ];
391 }
392 }
393 cblas_ssbmv(CblasRowMajor, uplo, *n, *k, *alpha, A, LDA, x, *incx,
394 *beta, y, *incy );
395 free(A);
396 }
397 else
398 cblas_ssbmv(CblasColMajor, uplo, *n, *k, *alpha, a, *lda, x, *incx,
399 *beta, y, *incy );
400}
401
402void F77_sspmv(CBLAS_INT *layout, char *uplow, CBLAS_INT *n, float *alpha, float *ap,
403 float *x, CBLAS_INT *incx, float *beta, float *y, CBLAS_INT *incy
405 , FORTRAN_STRLEN uplow_len
406#endif
407) {
408 float *A,*AP;
409 CBLAS_INT i,j,k,LDA;
410 CBLAS_UPLO uplo;
411
412 get_uplo_type(uplow,&uplo);
413
414 if (*layout == TEST_ROW_MJR) {
415 LDA = *n;
416 A = ( float* )malloc( LDA*LDA*sizeof( float ) );
417 AP = ( float* )malloc( (((LDA+1)*LDA)/2)*sizeof( float ) );
418 if (uplo == CblasUpper) {
419 for( j=0, k=0; j<*n; j++ )
420 for( i=0; i<j+1; i++, k++ )
421 A[ LDA*i+j ]=ap[ k ];
422 for( i=0, k=0; i<*n; i++ )
423 for( j=i; j<*n; j++, k++ )
424 AP[ k ]=A[ LDA*i+j ];
425 }
426 else {
427 for( j=0, k=0; j<*n; j++ )
428 for( i=j; i<*n; i++, k++ )
429 A[ LDA*i+j ]=ap[ k ];
430 for( i=0, k=0; i<*n; i++ )
431 for( j=0; j<i+1; j++, k++ )
432 AP[ k ]=A[ LDA*i+j ];
433 }
434 cblas_sspmv( CblasRowMajor, uplo, *n, *alpha, AP, x, *incx, *beta, y,
435 *incy );
436 free(A); free(AP);
437 }
438 else
439 cblas_sspmv( CblasColMajor, uplo, *n, *alpha, ap, x, *incx, *beta, y,
440 *incy );
441}
442
443void F77_stpmv(CBLAS_INT *layout, char *uplow, char *transp, char *diagn,
444 CBLAS_INT *n, float *ap, float *x, CBLAS_INT *incx
446 , FORTRAN_STRLEN uplow_len, FORTRAN_STRLEN transp_len, FORTRAN_STRLEN diagn_len
447#endif
448) {
449 float *A, *AP;
450 CBLAS_INT i, j, k, LDA;
451 CBLAS_TRANSPOSE trans;
452 CBLAS_UPLO uplo;
453 CBLAS_DIAG diag;
454
455 get_transpose_type(transp,&trans);
456 get_uplo_type(uplow,&uplo);
457 get_diag_type(diagn,&diag);
458
459 if (*layout == TEST_ROW_MJR) {
460 LDA = *n;
461 A = ( float* )malloc( LDA*LDA*sizeof( float ) );
462 AP = ( float* )malloc( (((LDA+1)*LDA)/2)*sizeof( float ) );
463 if (uplo == CblasUpper) {
464 for( j=0, k=0; j<*n; j++ )
465 for( i=0; i<j+1; i++, k++ )
466 A[ LDA*i+j ]=ap[ k ];
467 for( i=0, k=0; i<*n; i++ )
468 for( j=i; j<*n; j++, k++ )
469 AP[ k ]=A[ LDA*i+j ];
470 }
471 else {
472 for( j=0, k=0; j<*n; j++ )
473 for( i=j; i<*n; i++, k++ )
474 A[ LDA*i+j ]=ap[ k ];
475 for( i=0, k=0; i<*n; i++ )
476 for( j=0; j<i+1; j++, k++ )
477 AP[ k ]=A[ LDA*i+j ];
478 }
479 cblas_stpmv( CblasRowMajor, uplo, trans, diag, *n, AP, x, *incx );
480 free(A); free(AP);
481 }
482 else
483 cblas_stpmv( CblasColMajor, uplo, trans, diag, *n, ap, x, *incx );
484}
485
486void F77_stpsv(CBLAS_INT *layout, char *uplow, char *transp, char *diagn,
487 CBLAS_INT *n, float *ap, float *x, CBLAS_INT *incx
489 , FORTRAN_STRLEN uplow_len, FORTRAN_STRLEN transp_len, FORTRAN_STRLEN diagn_len
490#endif
491) {
492 float *A, *AP;
493 CBLAS_INT i, j, k, LDA;
494 CBLAS_TRANSPOSE trans;
495 CBLAS_UPLO uplo;
496 CBLAS_DIAG diag;
497
498 get_transpose_type(transp,&trans);
499 get_uplo_type(uplow,&uplo);
500 get_diag_type(diagn,&diag);
501
502 if (*layout == TEST_ROW_MJR) {
503 LDA = *n;
504 A = ( float* )malloc( LDA*LDA*sizeof( float ) );
505 AP = ( float* )malloc( (((LDA+1)*LDA)/2)*sizeof( float ) );
506 if (uplo == CblasUpper) {
507 for( j=0, k=0; j<*n; j++ )
508 for( i=0; i<j+1; i++, k++ )
509 A[ LDA*i+j ]=ap[ k ];
510 for( i=0, k=0; i<*n; i++ )
511 for( j=i; j<*n; j++, k++ )
512 AP[ k ]=A[ LDA*i+j ];
513
514 }
515 else {
516 for( j=0, k=0; j<*n; j++ )
517 for( i=j; i<*n; i++, k++ )
518 A[ LDA*i+j ]=ap[ k ];
519 for( i=0, k=0; i<*n; i++ )
520 for( j=0; j<i+1; j++, k++ )
521 AP[ k ]=A[ LDA*i+j ];
522 }
523 cblas_stpsv( CblasRowMajor, uplo, trans, diag, *n, AP, x, *incx );
524 free(A); free(AP);
525 }
526 else
527 cblas_stpsv( CblasColMajor, uplo, trans, diag, *n, ap, x, *incx );
528}
529
530void F77_sspr(CBLAS_INT *layout, char *uplow, CBLAS_INT *n, float *alpha, float *x,
531 CBLAS_INT *incx, float *ap
533 , FORTRAN_STRLEN uplow_len
534#endif
535){
536 float *A, *AP;
537 CBLAS_INT i,j,k,LDA;
538 CBLAS_UPLO uplo;
539
540 get_uplo_type(uplow,&uplo);
541
542 if (*layout == TEST_ROW_MJR) {
543 LDA = *n;
544 A = ( float* )malloc( LDA*LDA*sizeof( float ) );
545 AP = ( float* )malloc( (((LDA+1)*LDA)/2)*sizeof( float ) );
546 if (uplo == CblasUpper) {
547 for( j=0, k=0; j<*n; j++ )
548 for( i=0; i<j+1; i++, k++ )
549 A[ LDA*i+j ]=ap[ k ];
550 for( i=0, k=0; i<*n; i++ )
551 for( j=i; j<*n; j++, k++ )
552 AP[ k ]=A[ LDA*i+j ];
553 }
554 else {
555 for( j=0, k=0; j<*n; j++ )
556 for( i=j; i<*n; i++, k++ )
557 A[ LDA*i+j ]=ap[ k ];
558 for( i=0, k=0; i<*n; i++ )
559 for( j=0; j<i+1; j++, k++ )
560 AP[ k ]=A[ LDA*i+j ];
561 }
562 cblas_sspr( CblasRowMajor, uplo, *n, *alpha, x, *incx, AP );
563 if (uplo == CblasUpper) {
564 for( i=0, k=0; i<*n; i++ )
565 for( j=i; j<*n; j++, k++ )
566 A[ LDA*i+j ]=AP[ k ];
567 for( j=0, k=0; j<*n; j++ )
568 for( i=0; i<j+1; i++, k++ )
569 ap[ k ]=A[ LDA*i+j ];
570 }
571 else {
572 for( i=0, k=0; i<*n; i++ )
573 for( j=0; j<i+1; j++, k++ )
574 A[ LDA*i+j ]=AP[ k ];
575 for( j=0, k=0; j<*n; j++ )
576 for( i=j; i<*n; i++, k++ )
577 ap[ k ]=A[ LDA*i+j ];
578 }
579 free(A); free(AP);
580 }
581 else
582 cblas_sspr( CblasColMajor, uplo, *n, *alpha, x, *incx, ap );
583}
584
585void F77_sspr2(CBLAS_INT *layout, char *uplow, CBLAS_INT *n, float *alpha, float *x,
586 CBLAS_INT *incx, float *y, CBLAS_INT *incy, float *ap
588 , FORTRAN_STRLEN uplow_len
589#endif
590){
591 float *A, *AP;
592 CBLAS_INT i,j,k,LDA;
593 CBLAS_UPLO uplo;
594
595 get_uplo_type(uplow,&uplo);
596
597 if (*layout == TEST_ROW_MJR) {
598 LDA = *n;
599 A = ( float* )malloc( LDA*LDA*sizeof( float ) );
600 AP = ( float* )malloc( (((LDA+1)*LDA)/2)*sizeof( float ) );
601 if (uplo == CblasUpper) {
602 for( j=0, k=0; j<*n; j++ )
603 for( i=0; i<j+1; i++, k++ )
604 A[ LDA*i+j ]=ap[ k ];
605 for( i=0, k=0; i<*n; i++ )
606 for( j=i; j<*n; j++, k++ )
607 AP[ k ]=A[ LDA*i+j ];
608 }
609 else {
610 for( j=0, k=0; j<*n; j++ )
611 for( i=j; i<*n; i++, k++ )
612 A[ LDA*i+j ]=ap[ k ];
613 for( i=0, k=0; i<*n; i++ )
614 for( j=0; j<i+1; j++, k++ )
615 AP[ k ]=A[ LDA*i+j ];
616 }
617 cblas_sspr2( CblasRowMajor, uplo, *n, *alpha, x, *incx, y, *incy, AP );
618 if (uplo == CblasUpper) {
619 for( i=0, k=0; i<*n; i++ )
620 for( j=i; j<*n; j++, k++ )
621 A[ LDA*i+j ]=AP[ k ];
622 for( j=0, k=0; j<*n; j++ )
623 for( i=0; i<j+1; i++, k++ )
624 ap[ k ]=A[ LDA*i+j ];
625 }
626 else {
627 for( i=0, k=0; i<*n; i++ )
628 for( j=0; j<i+1; j++, k++ )
629 A[ LDA*i+j ]=AP[ k ];
630 for( j=0, k=0; j<*n; j++ )
631 for( i=j; i<*n; i++, k++ )
632 ap[ k ]=A[ LDA*i+j ];
633 }
634 free(A);
635 free(AP);
636 }
637 else
638 cblas_sspr2( CblasColMajor, uplo, *n, *alpha, x, *incx, y, *incy, ap );
639}
void cblas_sspmv(CBLAS_LAYOUT layout, CBLAS_UPLO Uplo, const CBLAS_INT N, const float alpha, const float *Ap, const float *X, const CBLAS_INT incX, const float beta, float *Y, const CBLAS_INT incY)
Definition cblas_sspmv.c:11
void cblas_ssymv(CBLAS_LAYOUT layout, CBLAS_UPLO Uplo, const CBLAS_INT N, const float alpha, const float *A, const CBLAS_INT lda, const float *X, const CBLAS_INT incX, const float beta, float *Y, const CBLAS_INT incY)
Definition cblas_ssymv.c:12
void cblas_sgemv(const CBLAS_LAYOUT layout, const CBLAS_TRANSPOSE TransA, const CBLAS_INT M, const CBLAS_INT N, const float alpha, const float *A, const CBLAS_INT lda, const float *X, const CBLAS_INT incX, const float beta, float *Y, const CBLAS_INT incY)
Definition cblas_sgemv.c:11
CBLAS_UPLO
Definition cblas.h:41
@ CblasUpper
Definition cblas.h:41
void cblas_strsv(CBLAS_LAYOUT layout, CBLAS_UPLO Uplo, CBLAS_TRANSPOSE TransA, CBLAS_DIAG Diag, const CBLAS_INT N, const float *A, const CBLAS_INT lda, float *X, const CBLAS_INT incX)
Definition cblas_strsv.c:10
CBLAS_TRANSPOSE
Definition cblas.h:40
void cblas_sspr(CBLAS_LAYOUT layout, CBLAS_UPLO Uplo, const CBLAS_INT N, const float alpha, const float *X, const CBLAS_INT incX, float *Ap)
Definition cblas_sspr.c:12
void cblas_sgbmv(CBLAS_LAYOUT layout, CBLAS_TRANSPOSE TransA, const CBLAS_INT M, const CBLAS_INT N, const CBLAS_INT KL, const CBLAS_INT KU, const float alpha, const float *A, const CBLAS_INT lda, const float *X, const CBLAS_INT incX, const float beta, float *Y, const CBLAS_INT incY)
Definition cblas_sgbmv.c:12
void cblas_strmv(CBLAS_LAYOUT layout, CBLAS_UPLO Uplo, CBLAS_TRANSPOSE TransA, CBLAS_DIAG Diag, const CBLAS_INT N, const float *A, const CBLAS_INT lda, float *X, const CBLAS_INT incX)
Definition cblas_strmv.c:11
void cblas_ssyr2(CBLAS_LAYOUT layout, CBLAS_UPLO Uplo, const CBLAS_INT N, const float alpha, const float *X, const CBLAS_INT incX, const float *Y, const CBLAS_INT incY, float *A, const CBLAS_INT lda)
Definition cblas_ssyr2.c:12
@ CblasColMajor
Definition cblas.h:39
@ CblasRowMajor
Definition cblas.h:39
void cblas_stbmv(CBLAS_LAYOUT layout, CBLAS_UPLO Uplo, CBLAS_TRANSPOSE TransA, CBLAS_DIAG Diag, const CBLAS_INT N, const CBLAS_INT K, const float *A, const CBLAS_INT lda, float *X, const CBLAS_INT incX)
Definition cblas_stbmv.c:10
void cblas_sger(CBLAS_LAYOUT layout, const CBLAS_INT M, const CBLAS_INT N, const float alpha, const float *X, const CBLAS_INT incX, const float *Y, const CBLAS_INT incY, float *A, const CBLAS_INT lda)
Definition cblas_sger.c:12
CBLAS_DIAG
Definition cblas.h:42
void cblas_stpsv(CBLAS_LAYOUT layout, CBLAS_UPLO Uplo, CBLAS_TRANSPOSE TransA, CBLAS_DIAG Diag, const CBLAS_INT N, const float *Ap, float *X, const CBLAS_INT incX)
Definition cblas_stpsv.c:10
void cblas_ssbmv(CBLAS_LAYOUT layout, CBLAS_UPLO Uplo, const CBLAS_INT N, const CBLAS_INT K, const float alpha, const float *A, const CBLAS_INT lda, const float *X, const CBLAS_INT incX, const float beta, float *Y, const CBLAS_INT incY)
Definition cblas_ssbmv.c:11
#define CBLAS_INT
Definition cblas.h:24
void cblas_stbsv(CBLAS_LAYOUT layout, CBLAS_UPLO Uplo, CBLAS_TRANSPOSE TransA, CBLAS_DIAG Diag, const CBLAS_INT N, const CBLAS_INT K, const float *A, const CBLAS_INT lda, float *X, const CBLAS_INT incX)
Definition cblas_stbsv.c:10
void cblas_ssyr(CBLAS_LAYOUT layout, CBLAS_UPLO Uplo, const CBLAS_INT N, const float alpha, const float *X, const CBLAS_INT incX, float *A, const CBLAS_INT lda)
Definition cblas_ssyr.c:11
void cblas_stpmv(CBLAS_LAYOUT layout, CBLAS_UPLO Uplo, CBLAS_TRANSPOSE TransA, CBLAS_DIAG Diag, const CBLAS_INT N, const float *Ap, float *X, const CBLAS_INT incX)
Definition cblas_stpmv.c:11
void cblas_sspr2(CBLAS_LAYOUT layout, CBLAS_UPLO Uplo, const CBLAS_INT N, const float alpha, const float *X, const CBLAS_INT incX, const float *Y, const CBLAS_INT incY, float *A)
Definition cblas_sspr2.c:12
#define F77_strmv(...)
Definition cblas_f77.h:324
#define F77_stbmv(...)
Definition cblas_f77.h:325
#define F77_stpsv(...)
Definition cblas_f77.h:329
#define F77_sgemv(...)
Definition cblas_f77.h:319
#define F77_sger(...)
Definition cblas_f77.h:304
#define F77_stbsv(...)
Definition cblas_f77.h:327
#define F77_ssbmv(...)
Definition cblas_f77.h:322
#define BLAS_FORTRAN_STRLEN_END
Definition cblas_f77.h:18
#define FORTRAN_STRLEN
Definition cblas_f77.h:21
#define F77_ssymv(...)
Definition cblas_f77.h:321
#define F77_sspmv(...)
Definition cblas_f77.h:323
#define F77_ssyr2(...)
Definition cblas_f77.h:333
#define F77_stpmv(...)
Definition cblas_f77.h:328
#define F77_strsv(...)
Definition cblas_f77.h:326
#define F77_sgbmv(...)
Definition cblas_f77.h:320
#define F77_sspr2(...)
Definition cblas_f77.h:332
#define F77_ssyr(...)
Definition cblas_f77.h:330
#define F77_sspr(...)
Definition cblas_f77.h:331
#define UNDEFINED
Definition cblas_test.h:28
void get_diag_type(char *type, CBLAS_DIAG *diag)
Definition auxiliary.c:25
#define TEST_ROW_MJR
Definition cblas_test.h:21
#define TEST_COL_MJR
Definition cblas_test.h:25
void get_uplo_type(char *type, CBLAS_UPLO *uplo)
Definition auxiliary.c:18
void get_transpose_type(char *type, CBLAS_TRANSPOSE *trans)
Definition auxiliary.c:8