libflame  revision_anchor
Functions
bl1_conjm.c File Reference

(r)

Functions

void bl1_sconjm (int m, int n, float *a, int a_rs, int a_cs)
 
void bl1_dconjm (int m, int n, double *a, int a_rs, int a_cs)
 
void bl1_cconjm (int m, int n, scomplex *a, int a_rs, int a_cs)
 
void bl1_zconjm (int m, int n, dcomplex *a, int a_rs, int a_cs)
 

Function Documentation

◆ bl1_cconjm()

void bl1_cconjm ( int  m,
int  n,
scomplex a,
int  a_rs,
int  a_cs 
)

References bl1_is_row_storage(), bl1_is_vector(), bl1_sm1(), bl1_sscal(), bl1_vector_dim(), bl1_vector_inc(), bl1_zero_dim2(), and BLIS1_NO_TRANSPOSE.

Referenced by bl1_cgemm(), and FLA_Conjugate().

24 {
25  float m1 = bl1_sm1();
26  float* a_conj;
27  int lda, inca;
28  int n_iter;
29  int n_elem;
30  int j;
31 
32  // Return early if possible.
33  if ( bl1_zero_dim2( m, n ) ) return;
34 
35  // Handle cases where A is a vector to ensure that the underlying axpy
36  // gets invoked only once.
37  if ( bl1_is_vector( m, n ) )
38  {
39  // Initialize with values appropriate for a vector.
40  n_iter = 1;
41  n_elem = bl1_vector_dim( m, n );
42  lda = 1; // multiplied by zero when n_iter == 1; not needed.
43  inca = bl1_vector_inc( BLIS1_NO_TRANSPOSE, m, n, a_rs, a_cs );
44  }
45  else // matrix case
46  {
47  // Initialize with optimal values for column-major storage.
48  n_iter = n;
49  n_elem = m;
50  lda = a_cs;
51  inca = a_rs;
52 
53  // An optimization: if A is row-major, then let's access the matrix
54  // by rows instead of by columns to increase spatial locality.
55  if ( bl1_is_row_storage( a_rs, a_cs ) )
56  {
57  bl1_swap_ints( n_iter, n_elem );
58  bl1_swap_ints( lda, inca );
59  }
60  }
61 
62  for ( j = 0; j < n_iter; ++j )
63  {
64  a_conj = ( float* )( a + j*lda ) + 1;
65 
66  bl1_sscal( n_elem,
67  &m1,
68  a_conj, 2*inca );
69  }
70 }
int bl1_vector_dim(int m, int n)
Definition: bl1_vector.c:13
int bl1_zero_dim2(int m, int n)
Definition: bl1_is.c:118
int bl1_vector_inc(trans1_t trans, int m, int n, int rs, int cs)
Definition: bl1_vector.c:19
int bl1_is_row_storage(int rs, int cs)
Definition: bl1_is.c:95
Definition: blis_type_defs.h:54
void bl1_sscal(int n, float *alpha, float *x, int incx)
Definition: bl1_scal.c:13
float bl1_sm1(void)
Definition: bl1_constants.c:175
int bl1_is_vector(int m, int n)
Definition: bl1_is.c:106

◆ bl1_dconjm()

void bl1_dconjm ( int  m,
int  n,
double *  a,
int  a_rs,
int  a_cs 
)
19 {
20  return;
21 }

◆ bl1_sconjm()

void bl1_sconjm ( int  m,
int  n,
float *  a,
int  a_rs,
int  a_cs 
)
14 {
15  return;
16 }

◆ bl1_zconjm()

void bl1_zconjm ( int  m,
int  n,
dcomplex a,
int  a_rs,
int  a_cs 
)

References bl1_dm1(), bl1_dscal(), bl1_is_row_storage(), bl1_is_vector(), bl1_vector_dim(), bl1_vector_inc(), bl1_zero_dim2(), and BLIS1_NO_TRANSPOSE.

Referenced by bl1_zgemm(), and FLA_Conjugate().

73 {
74  double m1 = bl1_dm1();
75  double* a_conj;
76  int lda, inca;
77  int n_iter;
78  int n_elem;
79  int j;
80 
81  // Return early if possible.
82  if ( bl1_zero_dim2( m, n ) ) return;
83 
84  // Handle cases where A is a vector to ensure that the underlying axpy
85  // gets invoked only once.
86  if ( bl1_is_vector( m, n ) )
87  {
88  // Initialize with values appropriate for a vector.
89  n_iter = 1;
90  n_elem = bl1_vector_dim( m, n );
91  lda = 1; // multiplied by zero when n_iter == 1; not needed.
92  inca = bl1_vector_inc( BLIS1_NO_TRANSPOSE, m, n, a_rs, a_cs );
93  }
94  else // matrix case
95  {
96  // Initialize with optimal values for column-major storage.
97  n_iter = n;
98  n_elem = m;
99  lda = a_cs;
100  inca = a_rs;
101 
102  // An optimization: if A is row-major, then let's access the matrix
103  // by rows instead of by columns to increase spatial locality.
104  if ( bl1_is_row_storage( a_rs, a_cs ) )
105  {
106  bl1_swap_ints( n_iter, n_elem );
107  bl1_swap_ints( lda, inca );
108  }
109  }
110 
111  for ( j = 0; j < n_iter; ++j )
112  {
113  a_conj = ( double* )( a + j*lda ) + 1;
114 
115  bl1_dscal( n_elem,
116  &m1,
117  a_conj, 2*inca );
118  }
119 }
int bl1_vector_dim(int m, int n)
Definition: bl1_vector.c:13
int bl1_zero_dim2(int m, int n)
Definition: bl1_is.c:118
int bl1_vector_inc(trans1_t trans, int m, int n, int rs, int cs)
Definition: bl1_vector.c:19
int bl1_is_row_storage(int rs, int cs)
Definition: bl1_is.c:95
Definition: blis_type_defs.h:54
void bl1_dscal(int n, double *alpha, double *x, int incx)
Definition: bl1_scal.c:26
double bl1_dm1(void)
Definition: bl1_constants.c:182
int bl1_is_vector(int m, int n)
Definition: bl1_is.c:106