00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 #include "lapacke.h"
00035 #include "lapacke_utils.h"
00036
00037 lapack_int LAPACKE_ssfrk_work( int matrix_order, char transr, char uplo,
00038 char trans, lapack_int n, lapack_int k,
00039 float alpha, const float* a, lapack_int lda,
00040 float beta, float* c )
00041 {
00042 lapack_int info = 0;
00043 if( matrix_order == LAPACK_COL_MAJOR ) {
00044
00045 LAPACK_ssfrk( &transr, &uplo, &trans, &n, &k, &alpha, a, &lda, &beta,
00046 c );
00047 if( info < 0 ) {
00048 info = info - 1;
00049 }
00050 } else if( matrix_order == LAPACK_ROW_MAJOR ) {
00051 lapack_int na = LAPACKE_lsame( trans, 'n' ) ? n : k;
00052 lapack_int ka = LAPACKE_lsame( trans, 'n' ) ? k : n;
00053 lapack_int lda_t = MAX(1,na);
00054 float* a_t = NULL;
00055 float* c_t = NULL;
00056
00057 if( lda < ka ) {
00058 info = -9;
00059 LAPACKE_xerbla( "LAPACKE_ssfrk_work", info );
00060 return info;
00061 }
00062
00063 a_t = (float*)LAPACKE_malloc( sizeof(float) * lda_t * MAX(1,ka) );
00064 if( a_t == NULL ) {
00065 info = LAPACK_TRANSPOSE_MEMORY_ERROR;
00066 goto exit_level_0;
00067 }
00068 c_t = (float*)
00069 LAPACKE_malloc( sizeof(float) * ( MAX(1,n) * MAX(2,n+1) ) / 2 );
00070 if( c_t == NULL ) {
00071 info = LAPACK_TRANSPOSE_MEMORY_ERROR;
00072 goto exit_level_1;
00073 }
00074
00075 LAPACKE_sge_trans( matrix_order, na, ka, a, lda, a_t, lda_t );
00076 LAPACKE_spf_trans( matrix_order, transr, uplo, n, c, c_t );
00077
00078 LAPACK_ssfrk( &transr, &uplo, &trans, &n, &k, &alpha, a_t, &lda_t,
00079 &beta, c_t );
00080 info = 0;
00081
00082 LAPACKE_spf_trans( LAPACK_COL_MAJOR, transr, uplo, n, c_t, c );
00083
00084 LAPACKE_free( c_t );
00085 exit_level_1:
00086 LAPACKE_free( a_t );
00087 exit_level_0:
00088 if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
00089 LAPACKE_xerbla( "LAPACKE_ssfrk_work", info );
00090 }
00091 } else {
00092 info = -1;
00093 LAPACKE_xerbla( "LAPACKE_ssfrk_work", info );
00094 }
00095 return info;
00096 }