1 #include <../../nrnconf.h>
32 static char rcsid[] =
"zlufctr.c,v 1.1 1997/12/04 17:56:09 hines Exp";
39 #define is_zero(z) ((z).re == 0.0 && (z).im == 0.0)
53 complex **A_v, *A_piv, *A_row, temp;
58 if ( pivot->
size !=
A->m )
76 max1 =
max(max1,dtemp);
83 for (
k=0;
k<k_max;
k++ )
86 max1 = 0.0; i_max = -1;
88 if ( scale->
ve[
i] > 0.0 )
92 { max1 = dtemp; i_max =
i; }
103 for (
j=0;
j<
n;
j++ )
105 temp = A_v[i_max][
j];
106 A_v[i_max][
j] = A_v[
k][
j];
112 for (
i=
k+1;
i<m;
i++ )
115 A_piv = &(A_v[
k][
k+1]);
116 A_row = &(A_v[
i][
k+1]);
141 if (
A->m !=
A->n ||
A->n != b->
dim )
157 if ( ! LU || ! b || ! pivot )
159 if ( LU->m != LU->n || LU->n != b->
dim )
184 if ( ! out || out->m <
A->m || out->n <
A->n )
192 for (
i = 0;
i <
A->n;
i++ )
215 Real cond_est, L_norm, U_norm, norm, sn_inv;
219 if ( ! LU || ! pivot )
221 if ( LU->m != LU->n )
223 if ( LU->n != pivot->
size )
234 for (
i = 0;
i <
n;
i++ )
238 for (
j = 0;
j <
i;
j++ )
242 sn_inv = 1.0 /
zabs(sum);
243 sum.
re += sum.
re * sn_inv;
244 sum.
im += sum.
im * sn_inv;
257 for (
i = 0;
i <
n;
i++ )
260 for (
j =
i;
j <
n;
j++ )
261 norm +=
zabs(LU->me[
i][
j]);
266 for (
i = 0;
i <
n;
i++ )
269 for (
j = 0;
j <
i;
j++ )
270 norm +=
zabs(LU->me[
i][
j]);
#define error(err_num, fn_name)
#define tracecatch(ok_part, function)
static Object ** v_resize(void *v)
PERM * px_transp(PERM *px, u_int i, u_int j)
#define MEM_STAT_REG(var, type)
int const size_t const size_t n
static philox4x32_key_t k
complex zdiv(complex z1, complex z2)
complex zmlt(complex z1, complex z2)
complex zsub(complex z1, complex z2)
ZVEC * zLUsolve(ZMAT *A, PERM *pivot, ZVEC *b, ZVEC *x)
double zLUcondest(ZMAT *LU, PERM *pivot)
ZMAT * zLUfactor(ZMAT *A, PERM *pivot)
ZVEC * zLUAsolve(ZMAT *LU, PERM *pivot, ZVEC *b, ZVEC *x)
ZMAT * zm_inverse(ZMAT *A, ZMAT *out)
void __zmltadd__(complex *zp1, complex *zp2, complex s, int len, int flag)
ZMAT * zset_col(ZMAT *mat, int col, ZVEC *vec)
ZVEC * zUAsolve(ZMAT *U, ZVEC *b, ZVEC *out, double diag)
ZVEC * zUsolve(ZMAT *matrix, ZVEC *b, ZVEC *out, double diag)
ZVEC * zLsolve(ZMAT *matrix, ZVEC *b, ZVEC *out, double diag)
ZVEC * zLAsolve(ZMAT *L, ZVEC *b, ZVEC *out, double diag)
ZVEC * px_zvec(PERM *pi, ZVEC *in, ZVEC *out)
ZVEC * zv_resize(ZVEC *x, int new_dim)
ZVEC * pxinv_zvec(PERM *pi, ZVEC *in, ZVEC *out)
ZMAT * zm_resize(ZMAT *A, int new_m, int new_n)