libflame revision_anchor
Functions
FLA_Norm1_tridiag.c File Reference

(r)

Functions

FLA_Error FLA_Norm1_tridiag (FLA_Obj d, FLA_Obj e, FLA_Obj norm)
 
FLA_Error FLA_Norm1_tridiag_ops (int m_A, float *buff_d, int inc_d, float *buff_e, int inc_e, float *norm)
 
FLA_Error FLA_Norm1_tridiag_opd (int m_A, double *buff_d, int inc_d, double *buff_e, int inc_e, double *norm)
 

Function Documentation

◆ FLA_Norm1_tridiag()

FLA_Error FLA_Norm1_tridiag ( FLA_Obj  d,
FLA_Obj  e,
FLA_Obj  norm 
)
14{
15 FLA_Datatype datatype;
16 int m_A;
17 int inc_d;
18 int inc_e;
19
20 datatype = FLA_Obj_datatype( d );
21
23
26
27
28 switch ( datatype )
29 {
30 case FLA_FLOAT:
31 {
32 float* buff_d = FLA_FLOAT_PTR( d );
33 float* buff_e = FLA_FLOAT_PTR( e );
34 float* buff_norm = FLA_FLOAT_PTR( norm );
35
39 buff_norm );
40
41 break;
42 }
43
44 case FLA_DOUBLE:
45 {
46 double* buff_d = FLA_DOUBLE_PTR( d );
47 double* buff_e = FLA_DOUBLE_PTR( e );
48 double* buff_norm = FLA_DOUBLE_PTR( norm );
49
53 buff_norm );
54
55 break;
56 }
57 }
58
59 return FLA_SUCCESS;
60}
FLA_Error FLA_Norm1_tridiag_opd(int m_A, double *buff_d, int inc_d, double *buff_e, int inc_e, double *norm)
Definition FLA_Norm1_tridiag.c:111
FLA_Error FLA_Norm1_tridiag_ops(int m_A, float *buff_d, int inc_d, float *buff_e, int inc_e, float *norm)
Definition FLA_Norm1_tridiag.c:64
dim_t FLA_Obj_vector_inc(FLA_Obj obj)
Definition FLA_Query.c:145
dim_t FLA_Obj_vector_dim(FLA_Obj obj)
Definition FLA_Query.c:137
FLA_Datatype FLA_Obj_datatype(FLA_Obj obj)
Definition FLA_Query.c:13
int FLA_Datatype
Definition FLA_type_defs.h:49
int i
Definition bl1_axmyv2.c:145

References FLA_Norm1_tridiag_opd(), FLA_Norm1_tridiag_ops(), FLA_Obj_datatype(), FLA_Obj_vector_dim(), FLA_Obj_vector_inc(), and i.

◆ FLA_Norm1_tridiag_opd()

FLA_Error FLA_Norm1_tridiag_opd ( int  m_A,
double buff_d,
int  inc_d,
double buff_e,
int  inc_e,
double norm 
)
115{
116 double* d = buff_d;
117 double* e = buff_e;
118 double nm;
119 int i;
120
121 if ( m_A == 1 )
122 {
123 nm = fabs( *d );
124 }
125 else
126 {
127 double d_first = d[ (0 )*inc_d ];
128 double e_first = e[ (0 )*inc_e ];
129 double e_last = e[ (m_A-2)*inc_e ];
130 double d_last = d[ (m_A-1)*inc_d ];
131
132 // Record the maximum of the absolute row/column sums for the
133 // first and last row/columns.
134 nm = max( fabs( d_first ) + fabs( e_first ),
135 fabs( e_last ) + fabs( d_last ) );
136
137 for ( i = 1; i < m_A - 2; ++i )
138 {
139 double e0 = e[ (i-1)*inc_e ];
140 double e1 = e[ (i )*inc_e ];
141 double d1 = d[ (i )*inc_d ];
142
143 // Update nm with the absolute row/column sum for the ith
144 // row/column.
145 nm = max( nm, fabs( e0 ) +
146 fabs( d1 ) +
147 fabs( e1 ) );
148 }
149 }
150
151 *norm = nm;
152
153 return FLA_SUCCESS;
154}

References i.

Referenced by FLA_Norm1_tridiag(), and FLA_Tevd_compute_scaling_opd().

◆ FLA_Norm1_tridiag_ops()

FLA_Error FLA_Norm1_tridiag_ops ( int  m_A,
float buff_d,
int  inc_d,
float buff_e,
int  inc_e,
float norm 
)
68{
69 float* d = buff_d;
70 float* e = buff_e;
71 float nm;
72 int i;
73
74 if ( m_A == 1 )
75 {
76 nm = fabs( *d );
77 }
78 else
79 {
80 float d_first = d[ (0 )*inc_d ];
81 float e_first = e[ (0 )*inc_e ];
82 float e_last = e[ (m_A-2)*inc_e ];
83 float d_last = d[ (m_A-1)*inc_d ];
84
85 // Record the maximum of the absolute row/column sums for the
86 // first and last row/columns.
87 nm = max( fabs( d_first ) + fabs( e_first ),
88 fabs( e_last ) + fabs( d_last ) );
89
90 for ( i = 1; i < m_A - 2; ++i )
91 {
92 float e0 = e[ (i-1)*inc_e ];
93 float e1 = e[ (i )*inc_e ];
94 float d1 = d[ (i )*inc_d ];
95
96 // Update nm with the absolute row/column sum for the ith
97 // row/column.
98 nm = max( nm, fabs( e0 ) +
99 fabs( d1 ) +
100 fabs( e1 ) );
101 }
102 }
103
104 *norm = nm;
105
106 return FLA_SUCCESS;
107}

References i.

Referenced by FLA_Norm1_tridiag(), and FLA_Tevd_compute_scaling_ops().