libflame  revision_anchor
Functions
FLA_Apply_pivots_unb_external.c File Reference

(r)

Functions

FLA_Error FLA_Apply_pivots_unb_external (FLA_Side side, FLA_Trans trans, FLA_Obj p, FLA_Obj A)
 
FLA_Error FLA_Apply_pivots_ln_unb_ext (FLA_Obj p, FLA_Obj A)
 

Function Documentation

◆ FLA_Apply_pivots_ln_unb_ext()

FLA_Error FLA_Apply_pivots_ln_unb_ext ( FLA_Obj  p,
FLA_Obj  A 
)

References FLA_Apply_pivots_unb_external().

Referenced by FLA_Apply_pivots_ln().

122 {
123  return FLA_Apply_pivots_unb_external( FLA_LEFT, FLA_NO_TRANSPOSE, p, A );
124 }
FLA_Error FLA_Apply_pivots_unb_external(FLA_Side side, FLA_Trans trans, FLA_Obj p, FLA_Obj A)
Definition: FLA_Apply_pivots_unb_external.c:13

◆ FLA_Apply_pivots_unb_external()

FLA_Error FLA_Apply_pivots_unb_external ( FLA_Side  side,
FLA_Trans  trans,
FLA_Obj  p,
FLA_Obj  A 
)

References F77_claswp(), F77_dlaswp(), F77_slaswp(), F77_zlaswp(), FLA_Apply_pivots_check(), FLA_Check_error_level(), FLA_Obj_col_stride(), FLA_Obj_datatype(), FLA_Obj_has_zero_dim(), FLA_Obj_vector_dim(), FLA_Obj_vector_inc(), FLA_Obj_width(), and i.

Referenced by FLA_Apply_pivots_ln_unb_ext().

14 {
15 #ifdef FLA_ENABLE_EXTERNAL_LAPACK_INTERFACES
16  FLA_Datatype datatype;
17  int n_A, cs_A;
18  int m_p;
19  int inc_p;
20  int* buff_p;
21  int k1_1, k2_1;
22  int* pivots_lapack;
23  int i;
24 
25  if ( FLA_Check_error_level() == FLA_FULL_ERROR_CHECKING )
26  FLA_Apply_pivots_check( side, trans, p, A );
27 
28  if ( FLA_Obj_has_zero_dim( A ) ) return FLA_SUCCESS;
29 
30  datatype = FLA_Obj_datatype( A );
31 
32  n_A = FLA_Obj_width( A );
33  cs_A = FLA_Obj_col_stride( A );
34 
35  inc_p = FLA_Obj_vector_inc( p );
36  m_p = FLA_Obj_vector_dim( p );
37 
38  buff_p = FLA_INT_PTR( p );
39 
40  // Use one-based indices for LAPACK.
41  k1_1 = 1;
42  k2_1 = m_p;
43 
44  // Translate FLAME pivot indices to LAPACK-compatible indices. It is
45  // important to note that this conversion, unlike the one done by
46  // FLA_Shift_pivots_to(), is NOT in-place, but rather done separately
47  // in a temporary buffer.
48 #ifdef FLA_ENABLE_WINDOWS_BUILD
49  pivots_lapack = ( int * ) _alloca( m_p * sizeof( int ) );
50 #else
51  pivots_lapack = ( int * ) alloca( m_p * sizeof( int ) );
52 #endif
53 
54  for ( i = 0; i < m_p; i++ )
55  {
56  pivots_lapack[ i ] = buff_p[ i ] + i + 1;
57  }
58 
59  switch ( datatype ){
60 
61  case FLA_FLOAT:
62  {
63  float* buff_A = ( float * ) FLA_FLOAT_PTR( A );
64 
65  F77_slaswp( &n_A,
66  buff_A, &cs_A,
67  &k1_1,
68  &k2_1,
69  pivots_lapack,
70  &inc_p );
71  break;
72  }
73 
74  case FLA_DOUBLE:
75  {
76  double* buff_A = ( double * ) FLA_DOUBLE_PTR( A );
77 
78  F77_dlaswp( &n_A,
79  buff_A, &cs_A,
80  &k1_1,
81  &k2_1,
82  pivots_lapack,
83  &inc_p );
84  break;
85  }
86 
87  case FLA_COMPLEX:
88  {
89  scomplex* buff_A = ( scomplex * ) FLA_COMPLEX_PTR( A );
90 
91  F77_claswp( &n_A,
92  buff_A, &cs_A,
93  &k1_1,
94  &k2_1,
95  pivots_lapack,
96  &inc_p );
97  break;
98  }
99 
100  case FLA_DOUBLE_COMPLEX:
101  {
102  dcomplex* buff_A = ( dcomplex * ) FLA_DOUBLE_COMPLEX_PTR( A );
103 
104  F77_zlaswp( &n_A,
105  buff_A, &cs_A,
106  &k1_1,
107  &k2_1,
108  pivots_lapack,
109  &inc_p );
110  break;
111  }
112 
113  }
114 #else
115  FLA_Check_error_code( FLA_EXTERNAL_LAPACK_NOT_IMPLEMENTED );
116 #endif
117 
118  return FLA_SUCCESS;
119 }
int F77_zlaswp(int *n, dcomplex *a, int *lda, int *k1, int *k2, int *ipiv, int *incx)
int F77_slaswp(int *n, float *a, int *lda, int *k1, int *k2, int *ipiv, int *incx)
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
dim_t FLA_Obj_width(FLA_Obj obj)
Definition: FLA_Query.c:123
Definition: blis_type_defs.h:132
FLA_Error FLA_Apply_pivots_check(FLA_Side side, FLA_Trans trans, FLA_Obj p, FLA_Obj A)
Definition: FLA_Apply_pivots_check.c:13
int F77_dlaswp(int *n, double *a, int *lda, int *k1, int *k2, int *ipiv, int *incx)
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_col_stride(FLA_Obj obj)
Definition: FLA_Query.c:174
int i
Definition: bl1_axmyv2.c:145
dim_t FLA_Obj_vector_inc(FLA_Obj obj)
Definition: FLA_Query.c:145
int F77_claswp(int *n, scomplex *a, int *lda, int *k1, int *k2, int *ipiv, int *incx)
Definition: blis_type_defs.h:137