libflame  revision_anchor
Functions
bl1_randm.c File Reference

(r)

Functions

void bl1_srandm (int m, int n, float *a, int a_rs, int a_cs)
 
void bl1_drandm (int m, int n, double *a, int a_rs, int a_cs)
 
void bl1_crandm (int m, int n, scomplex *a, int a_rs, int a_cs)
 
void bl1_zrandm (int m, int n, dcomplex *a, int a_rs, int a_cs)
 

Function Documentation

◆ bl1_crandm()

void bl1_crandm ( int  m,
int  n,
scomplex a,
int  a_rs,
int  a_cs 
)
82 {
83  scomplex* a_begin;
84  int inca, lda;
85  int n_iter;
86  int n_elem;
87  int j;
88 
89  // Return early if possible.
90  if ( bl1_zero_dim2( m, n ) ) return;
91 
92  // Initialize with optimal values for column-major storage.
93  inca = a_rs;
94  lda = a_cs;
95  n_iter = n;
96  n_elem = m;
97 
98  // An optimization: if A is row-major, then let's access the matrix by
99  // rows instead of by columns for increased spatial locality.
100  if ( bl1_is_row_storage( a_rs, a_cs ) )
101  {
102  bl1_swap_ints( n_iter, n_elem );
103  bl1_swap_ints( lda, inca );
104  }
105 
106  for ( j = 0; j < n_iter; j++ )
107  {
108  a_begin = a + j*lda;
109 
110  bl1_crandv( n_elem,
111  a_begin, inca );
112  }
113 }
int bl1_is_row_storage(int rs, int cs)
Definition: bl1_is.c:95
int bl1_zero_dim2(int m, int n)
Definition: bl1_is.c:118
void bl1_crandv(int n, scomplex *x, int incx)
Definition: bl1_randv.c:39
Definition: blis_type_defs.h:133

References bl1_crandv(), bl1_is_row_storage(), and bl1_zero_dim2().

Referenced by FLA_Random_matrix().

◆ bl1_drandm()

void bl1_drandm ( int  m,
int  n,
double *  a,
int  a_rs,
int  a_cs 
)
48 {
49  double* a_begin;
50  int inca, lda;
51  int n_iter;
52  int n_elem;
53  int j;
54 
55  // Return early if possible.
56  if ( bl1_zero_dim2( m, n ) ) return;
57 
58  // Initialize with optimal values for column-major storage.
59  inca = a_rs;
60  lda = a_cs;
61  n_iter = n;
62  n_elem = m;
63 
64  // An optimization: if A is row-major, then let's access the matrix by
65  // rows instead of by columns for increased spatial locality.
66  if ( bl1_is_row_storage( a_rs, a_cs ) )
67  {
68  bl1_swap_ints( n_iter, n_elem );
69  bl1_swap_ints( lda, inca );
70  }
71 
72  for ( j = 0; j < n_iter; j++ )
73  {
74  a_begin = a + j*lda;
75 
76  bl1_drandv( n_elem,
77  a_begin, inca );
78  }
79 }
void bl1_drandv(int n, double *x, int incx)
Definition: bl1_randv.c:26

References bl1_drandv(), bl1_is_row_storage(), and bl1_zero_dim2().

Referenced by FLA_Random_matrix().

◆ bl1_srandm()

void bl1_srandm ( int  m,
int  n,
float *  a,
int  a_rs,
int  a_cs 
)
14 {
15  float* a_begin;
16  int inca, lda;
17  int n_iter;
18  int n_elem;
19  int j;
20 
21  // Return early if possible.
22  if ( bl1_zero_dim2( m, n ) ) return;
23 
24  // Initialize with optimal values for column-major storage.
25  inca = a_rs;
26  lda = a_cs;
27  n_iter = n;
28  n_elem = m;
29 
30  // An optimization: if A is row-major, then let's access the matrix by
31  // rows instead of by columns for increased spatial locality.
32  if ( bl1_is_row_storage( a_rs, a_cs ) )
33  {
34  bl1_swap_ints( n_iter, n_elem );
35  bl1_swap_ints( lda, inca );
36  }
37 
38  for ( j = 0; j < n_iter; j++ )
39  {
40  a_begin = a + j*lda;
41 
42  bl1_srandv( n_elem,
43  a_begin, inca );
44  }
45 }
void bl1_srandv(int n, float *x, int incx)
Definition: bl1_randv.c:13

References bl1_is_row_storage(), bl1_srandv(), and bl1_zero_dim2().

Referenced by FLA_Random_matrix().

◆ bl1_zrandm()

void bl1_zrandm ( int  m,
int  n,
dcomplex a,
int  a_rs,
int  a_cs 
)
116 {
117  dcomplex* a_begin;
118  int inca, lda;
119  int n_iter;
120  int n_elem;
121  int j;
122 
123  // Return early if possible.
124  if ( bl1_zero_dim2( m, n ) ) return;
125 
126  // Initialize with optimal values for column-major storage.
127  inca = a_rs;
128  lda = a_cs;
129  n_iter = n;
130  n_elem = m;
131 
132  // An optimization: if A is row-major, then let's access the matrix by
133  // rows instead of by columns for increased spatial locality.
134  if ( bl1_is_row_storage( a_rs, a_cs ) )
135  {
136  bl1_swap_ints( n_iter, n_elem );
137  bl1_swap_ints( lda, inca );
138  }
139 
140  for ( j = 0; j < n_iter; j++ )
141  {
142  a_begin = a + j*lda;
143 
144  bl1_zrandv( n_elem,
145  a_begin, inca );
146  }
147 }
void bl1_zrandv(int n, dcomplex *x, int incx)
Definition: bl1_randv.c:52
Definition: blis_type_defs.h:138

References bl1_is_row_storage(), bl1_zero_dim2(), and bl1_zrandv().

Referenced by FLA_Random_matrix().