#include #include "LU.h" double LU_num_flops(int N) { /* rougly 2/3*N^3 */ double Nd = (double) N; return (2.0 * Nd *Nd *Nd/ 3.0); } void LU_copy_matrix(int M, int N, double **lu, double **A) { int i; int j; for (i=0; i t) { jp = i; t = ab; } } pivot[j] = jp; /* jp now has the index of maximum element */ /* of column j, below the diagonal */ if ( A[jp][j] == 0 ) return 1; /* factorization failed because of zero pivot */ if (jp != j) { /* swap rows j and jp */ double *tA = A[j]; A[j] = A[jp]; A[jp] = tA; } if (j