Changeset 5570
- Timestamp:
- Nov 22, 2005, 9:54:55 AM (21 years ago)
- Location:
- branches/eam_rel8_b1/psLib/src/math
- Files:
-
- 2 edited
-
psMinimize.c (modified) (10 diffs)
-
psPolynomial.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_rel8_b1/psLib/src/math/psMinimize.c
r5567 r5570 10 10 * @author EAM, IfA 11 11 * 12 * @version $Revision: 1.142.6. 1$ $Name: not supported by cvs2svn $13 * @date $Date: 2005-11-22 1 8:06:10$12 * @version $Revision: 1.142.6.2 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2005-11-22 19:54:55 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 1441 1441 } 1442 1442 1443 1444 /****************************************************************************** 1445 BuildSums4D(sums, x, y, z, t, nXterm, nYterm, nZterm, nTterm). equiv to 1446 BuildSums2D(). The result is returned as a double **** 1447 *****************************************************************************/ 1448 static psImage *BuildSums4D( 1449 psF64 ****sums, 1450 psF64 x, 1451 psF64 y, 1452 psF64 z, 1453 psF64 t, 1454 psS32 nXterm, 1455 psS32 nYterm, 1456 psS32 nZterm, 1457 psS32 nTterm) 1443 // here is the definition for BuildSums4D. ifdef'ed away until it is used 1444 // by psPolynomial4DFit.. 1445 # if (0) 1446 /****************************************************************************** 1447 BuildSums4D(sums, x, y, z, t, nXterm, nYterm, nZterm, nTterm). equiv to 1448 BuildSums2D(). The result is returned as a double **** 1449 *****************************************************************************/ 1450 static double ****BuildSums4D( 1451 psF64 ****sums, 1452 psF64 x, 1453 psF64 y, 1454 psF64 z, 1455 psF64 t, 1456 psS32 nXterm, 1457 psS32 nYterm, 1458 psS32 nZterm, 1459 psS32 nTterm) 1458 1460 { 1459 1461 psS32 nXsum = 0; … … 1471 1473 nTsum = 2*nTterm; 1472 1474 if (sums == NULL) { 1473 sums = (psF64 ****) psAlloc (nXsum* PSELEMTYPE_SIZEOF(psF64));1475 sums = (psF64 ****) psAlloc (nXsum*sizeof(psF64)); 1474 1476 for (int i = 0; i < nXsum; i++) { 1475 sums[i] = (psF64 ***) psAlloc (nYsum* PSELEMTYPE_SIZEOF(psF64));1477 sums[i] = (psF64 ***) psAlloc (nYsum*sizeof(psF64)); 1476 1478 for (int j = 0; j < nYsum; j++) { 1477 sums[i][j] = (psF64 **) psAlloc (nZsum* PSELEMTYPE_SIZEOF(psF64));1479 sums[i][j] = (psF64 **) psAlloc (nZsum*sizeof(psF64)); 1478 1480 for (int k = 0; k < nZsum; k++) { 1479 sums[i][j][k] = (psF64 *) psAlloc (nTsum* PSELEMTYPE_SIZEOF(psF64));1481 sums[i][j][k] = (psF64 *) psAlloc (nTsum*sizeof(psF64)); 1480 1482 } 1481 1483 } … … 1503 1505 return (sums); 1504 1506 } 1507 # endif /* BuildSums4D */ 1505 1508 1506 1509 /****************************************************************************** … … 1509 1512 in the output vector. This routine works on single-precision polynomials with 1510 1513 double precision data. 1514 1515 XXX EAM : this function is now deprecated: psPolynomial2DEvalVector handles F32 and F64 1511 1516 *****************************************************************************/ 1512 1517 psVector *Polynomial2DEvalVectorD( … … 1899 1904 // assign sequence vector if xIn is NULL 1900 1905 if (xIn == NULL) { 1901 x = psVectorCreate (NULL, 0, f->n, 1, f->type );1906 x = psVectorCreate (NULL, 0, f->n, 1, f->type.type); 1902 1907 } else { 1903 x = xIn;1908 x = (psVector *) xIn; 1904 1909 } 1905 1910 … … 1907 1912 float minClipSigma; 1908 1913 float maxClipSigma; 1909 if ( finite(stats->max)) {1914 if (isfinite(stats->max)) { 1910 1915 maxClipSigma = fabs(stats->clipSigma); 1911 1916 } else { 1912 1917 maxClipSigma = fabs(stats->max); 1913 1918 } 1914 if ( finite(stats->min)) {1919 if (isfinite(stats->min)) { 1915 1920 minClipSigma = fabs(stats->clipSigma); 1916 1921 } else { … … 2055 2060 } else { 2056 2061 // this filters fErr == 0 values 2057 wt = (fErr->data.F64[k] == ) ? 0.0 : 1.0 / PS_SQR(fErr->data.F64[k]);2062 wt = (fErr->data.F64[k] == 0.0) ? 0.0 : 1.0 / PS_SQR(fErr->data.F64[k]); 2058 2063 } 2059 2064 … … 2097 2102 2098 2103 2104 // XXX EAM : I have implemented a single function to handle the mask/nomask cases 2105 // this function can be deprecated 2099 2106 psPolynomial2D* RobustFit2D_nomask( 2100 2107 psPolynomial2D* poly, … … 2382 2389 float minClipSigma; 2383 2390 float maxClipSigma; 2384 if (finite(stats->max)) { 2391 if (isfinite(stats->max)) { 2392 maxClipSigma = fabs(stats->max); 2393 } else { 2385 2394 maxClipSigma = fabs(stats->clipSigma); 2395 } 2396 if (isfinite(stats->min)) { 2397 minClipSigma = fabs(stats->min); 2386 2398 } else { 2387 maxClipSigma = fabs(stats->max);2388 }2389 if (finite(stats->min)) {2390 2399 minClipSigma = fabs(stats->clipSigma); 2391 } else {2392 minClipSigma = fabs(stats->min);2393 2400 } 2394 2401 psVector *fit = NULL; -
branches/eam_rel8_b1/psLib/src/math/psPolynomial.c
r5566 r5570 7 7 * polynomials. It also contains a Gaussian functions. 8 8 * 9 * @version $Revision: 1.130.4.1.2. 1$ $Name: not supported by cvs2svn $10 * @date $Date: 2005-11-22 1 8:04:28$9 * @version $Revision: 1.130.4.1.2.2 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2005-11-22 19:54:55 $ 11 11 * 12 12 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 784 784 } 785 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 786 psF64 psPolynomial1DEval(const psPolynomial1D* poly, 809 787 psF64 x) … … 829 807 PS_ASSERT_POLY_NON_NULL(poly, NULL); 830 808 PS_ASSERT_VECTOR_NON_NULL(x, NULL); 831 // PS_ASSERT_VECTOR_TYPE(x, PS_TYPE_F64, NULL);809 PS_ASSERT_VECTOR_TYPE_F32_OR_F64(x, NULL); 832 810 833 811 psVector *tmp; 834 812 835 switch (x->type ) {813 switch (x->type.type) { 836 814 case PS_TYPE_F64: 837 815 tmp = psVectorAlloc(x->n, PS_TYPE_F64); … … 880 858 PS_ASSERT_POLY_NON_NULL(poly, NULL); 881 859 PS_ASSERT_VECTOR_NON_NULL(x, NULL); 882 PS_ASSERT_VECTOR_TYPE (x, PS_TYPE_F64, NULL);860 PS_ASSERT_VECTOR_TYPE_F32_OR_F64(x, NULL); 883 861 PS_ASSERT_VECTOR_NON_NULL(y, NULL); 884 PS_ASSERT_VECTOR_TYPE (y, PS_TYPE_F64, NULL);862 PS_ASSERT_VECTOR_TYPE_F32_OR_F64(y, NULL); 885 863 886 864 psVector *tmp; … … 892 870 } 893 871 894 switch (x->type ) {872 switch (x->type.type) { 895 873 case PS_TYPE_F32: 896 if (y->type != x->type) {874 if (y->type.type != x->type.type) { 897 875 psError(PS_ERR_UNKNOWN, true, "type mismatch in data vectors"); 898 876 return (NULL); … … 908 886 break; 909 887 case PS_TYPE_F64: 910 if (y->type != x->type) {888 if (y->type.type != x->type.type) { 911 889 psError(PS_ERR_UNKNOWN, true, "type mismatch in data vectors"); 912 890 return (NULL);
Note:
See TracChangeset
for help on using the changeset viewer.
