libflame  revision_anchor
Functions
FLA_Nrm2_external.c File Reference

(r)

Functions

FLA_Error FLA_Nrm2_external (FLA_Obj x, FLA_Obj norm_x)
 

Function Documentation

◆ FLA_Nrm2_external()

FLA_Error FLA_Nrm2_external ( FLA_Obj  x,
FLA_Obj  norm_x 
)

References bl1_cnrm2(), bl1_dnrm2(), bl1_snrm2(), bl1_znrm2(), FLA_Check_error_level(), FLA_Nrm2_check(), FLA_Obj_datatype(), FLA_Obj_has_zero_dim(), FLA_Obj_vector_dim(), FLA_Obj_vector_inc(), FLA_Set(), and FLA_ZERO.

Referenced by FLA_Nrm2().

14 {
15  FLA_Datatype datatype;
16  int num_elem;
17  int inc_x;
18 
19  if ( FLA_Check_error_level() == FLA_FULL_ERROR_CHECKING )
20  FLA_Nrm2_check( x, norm_x );
21 
22  if ( FLA_Obj_has_zero_dim( x ) )
23  {
24  FLA_Set( FLA_ZERO, norm_x );
25  return FLA_SUCCESS;
26  }
27 
28  datatype = FLA_Obj_datatype( x );
29 
30  inc_x = FLA_Obj_vector_inc( x );
31  num_elem = FLA_Obj_vector_dim( x );
32 
33 
34  switch ( datatype ){
35 
36  case FLA_FLOAT:
37  {
38  float *buff_x = ( float * ) FLA_FLOAT_PTR( x );
39  float *buff_norm_x = ( float * ) FLA_FLOAT_PTR( norm_x );
40 
41  bl1_snrm2( num_elem,
42  buff_x, inc_x,
43  buff_norm_x );
44 
45  break;
46  }
47 
48  case FLA_DOUBLE:
49  {
50  double *buff_x = ( double * ) FLA_DOUBLE_PTR( x );
51  double *buff_norm_x = ( double * ) FLA_DOUBLE_PTR( norm_x );
52 
53  bl1_dnrm2( num_elem,
54  buff_x, inc_x,
55  buff_norm_x );
56 
57  break;
58  }
59 
60  case FLA_COMPLEX:
61  {
62  scomplex *buff_x = ( scomplex * ) FLA_COMPLEX_PTR( x );
63  float *buff_norm_x = ( float * ) FLA_FLOAT_PTR( norm_x );
64 
65  bl1_cnrm2( num_elem,
66  buff_x, inc_x,
67  buff_norm_x );
68 
69  break;
70  }
71 
72  case FLA_DOUBLE_COMPLEX:
73  {
74  dcomplex *buff_x = ( dcomplex * ) FLA_DOUBLE_COMPLEX_PTR( x );
75  double *buff_norm_x = ( double * ) FLA_DOUBLE_PTR( norm_x );
76 
77  bl1_znrm2( num_elem,
78  buff_x, inc_x,
79  buff_norm_x );
80 
81  break;
82  }
83 
84  }
85 
86  return FLA_SUCCESS;
87 }
FLA_Error FLA_Nrm2_check(FLA_Obj x, FLA_Obj norm)
Definition: FLA_Nrm2_check.c:13
void bl1_znrm2(int n, dcomplex *x, int incx, double *norm)
Definition: bl1_nrm2.c:46
FLA_Datatype FLA_Obj_datatype(FLA_Obj obj)
Definition: FLA_Query.c:13
FLA_Bool FLA_Obj_has_zero_dim(FLA_Obj A)
Definition: FLA_Query.c:400
void bl1_snrm2(int n, float *x, int incx, float *norm)
Definition: bl1_nrm2.c:13
FLA_Error FLA_Set(FLA_Obj alpha, FLA_Obj A)
Definition: FLA_Set.c:13
void bl1_cnrm2(int n, scomplex *x, int incx, float *norm)
Definition: bl1_nrm2.c:35
Definition: blis_type_defs.h:132
dim_t FLA_Obj_vector_dim(FLA_Obj obj)
Definition: FLA_Query.c:137
unsigned int FLA_Check_error_level(void)
Definition: FLA_Check.c:18
int FLA_Datatype
Definition: FLA_type_defs.h:49
dim_t FLA_Obj_vector_inc(FLA_Obj obj)
Definition: FLA_Query.c:145
FLA_Obj FLA_ZERO
Definition: FLA_Init.c:20
Definition: blis_type_defs.h:137
void bl1_dnrm2(int n, double *x, int incx, double *norm)
Definition: bl1_nrm2.c:24