IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 37690


Ignore:
Timestamp:
Nov 28, 2014, 4:02:50 PM (12 years ago)
Author:
eugene
Message:

add dgaussjordan function with modifyable min pivot

Location:
branches/eam_branches/ipp-20140904/Ohana/src/libohana
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20140904/Ohana/src/libohana/include/ohana.h

    r37546 r37690  
    341341char   *ohana_version          PROTO((void));
    342342
     343int     dgaussjordan_pivot     PROTO((double **A, double **B, int N, int M, double minPivot));
    343344int     dgaussjordan           PROTO((double **A, double **B, int N, int M));
    344345int     fgaussjordan           PROTO((float **A, float **B, int n, int m));
  • branches/eam_branches/ipp-20140904/Ohana/src/libohana/src/gaussj.c

    r37689 r37690  
    33# define VERY_VERBOSE 0
    44# define MAX_RANGE 1.0e16
    5 # define MIN_PIVOT 1.0e-7
    65
    76// Gauss-Jordan elimination using full pivots based on Press et al's description.  Substantially
     
    109// than their implementation.  (largely based on version by William Kahan)
    1110
     11int dgaussjordan (double **A, double **B, int N, int M) {
     12
     13# define myMIN_PIVOT 1.0e-7
     14  int status = dgaussjordan_pivot (A, B, N, M, myMIN_PIVOT);
     15  return status;
     16}
     17
    1218// MAX_RANGE is used to test for ill-conditioned input matrices.  For an ill-conditioned
    1319// matrix, one or more of the pivots trends towards zero.  Rather than allow this to go to the
    1420// numerical precision, I am raising an error if |growth| > 1e8
    15 int dgaussjordan (double **A, double **B, int N, int M) {
     21int dgaussjordan_pivot (double **A, double **B, int N, int M, double MIN_PIVOT) {
    1622
    1723  int *colIndex;
     
    106112    double tmpval = 1.0 / A[maxcol][maxcol];
    107113
     114# if (0)
    108115    if (fabs(A[maxcol][maxcol]) < MIN_PIVOT) {
    109116      // we are ill-conditioned.  set this row & col to 0.0, 1.0 on pivot
     
    115122      continue;
    116123    }
    117 
     124# endif
    118125
    119126    // XXX why is this here (don't I double count this element?) A[maxcol][maxcol] = 1.0;
  • branches/eam_branches/ipp-20140904/Ohana/src/libohana/src/vstats.c

    r37444 r37690  
    189189  for (i = ks; i < ke; i++) {
    190190    M  = SQ (value[i] - Mo);
    191     dM = SQ (dvalue[i]);
     191    dM = dvalue ? SQ (dvalue[i]) : 1.0;
    192192    X2 += M / dM;
    193193    dS += M;
    194194  }
    195   X2 = X2 / (Nm - 1);
     195  X2 = dvalue ? X2 / (Nm - 1) : NAN;
    196196  dS = sqrt (dS / (Nm - 1));
    197197
Note: See TracChangeset for help on using the changeset viewer.