Changeset 5548 for trunk/psLib/src/math/psStats.c
- Timestamp:
- Nov 18, 2005, 10:30:35 AM (21 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/math/psStats.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/math/psStats.c
r5530 r5548 17 17 * 18 18 * 19 * @version $Revision: 1.15 1$ $Name: not supported by cvs2svn $20 * @date $Date: 2005-11-1 6 23:06:19$19 * @version $Revision: 1.152 $ $Name: not supported by cvs2svn $ 20 * @date $Date: 2005-11-18 20:30:35 $ 21 21 * 22 22 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 661 661 call that. Is that possible? 662 662 *****************************************************************************/ 663 psVector *p_psVectorSmoothHistGaussian(psHistogram *histogram, 664 psF32 sigma) 663 psVector *p_psVectorSmoothHistGaussian( 664 psHistogram *histogram, 665 psF32 sigma) 665 666 { 666 667 psTrace(__func__, 4, "---- %s() begin ----\n", __func__); … … 674 675 675 676 psS32 numBins = histogram->nums->n; 676 psS32 numBounds = histogram->bounds->n;677 677 psVector *smooth = psVectorAlloc(numBins, PS_TYPE_F32); 678 psF32 firstBound = histogram->bounds->data.F32[0];679 psF32 lastBound = histogram->bounds->data.F32[numBounds-1];680 psScalar x;681 x.type.type = PS_TYPE_F32;682 678 psS32 jMin = 0; 683 679 psS32 jMax = 0; … … 685 681 if (histogram->uniform == false) { 686 682 // 687 // We get here if the histogram is non-uniform. 683 // We get here if the histogram is non-uniform. This code is not tested. 684 // However, it is also not used anywhere, yet. 688 685 // 686 psLogMsg(__func__, PS_LOG_WARN, "WARNING: p_psVectorSmoothHistGaussian() on non-uniform histograms has not been tested or used.\n"); 689 687 690 688 for (psS32 i = 0; i < numBins; i++) { … … 696 694 // range of data values surrounding iMid. The range is of size: 697 695 // 2*PS_GAUSS_WIDTH*sigma 698 // 699 x.data.F32 = iMid - (PS_GAUSS_WIDTH * sigma); 700 if ((x.data.F32 >= firstBound) && (x.data.F32 <= lastBound)) { 701 jMin = p_psVectorBinDisect( *(psVector* *)&histogram->bounds, &x); 702 if (jMin < 0) { 703 psError(PS_ERR_UNEXPECTED_NULL, 704 false, 705 PS_ERRORTEXT_psStats_STATS_VECTOR_BIN_DISECT_PROBLEM); 706 psTrace(__func__, 4, "---- %s(NULL) end ----\n", __func__); 707 return(NULL); 708 } 709 } else if (x.data.F32 <= firstBound) { 710 jMin = 0; 711 } else if (x.data.F32 >= lastBound) { 712 jMin = histogram->bounds->n - 1; 713 } 714 715 x.data.F32 = iMid + (PS_GAUSS_WIDTH * sigma); 716 if ((x.data.F32 >= firstBound) && (x.data.F32 <= lastBound)) { 717 jMax = p_psVectorBinDisect( *(psVector* *)&histogram->bounds, &x); 718 if (jMax < 0) { 719 psError(PS_ERR_UNEXPECTED_NULL, 720 false, 721 PS_ERRORTEXT_psStats_STATS_VECTOR_BIN_DISECT_PROBLEM); 722 psTrace(__func__, 4, "---- %s(NULL) end ----\n", __func__); 723 return(NULL); 724 } 725 } else if (x.data.F32 <= firstBound) { 726 jMax = 0; 727 } else if (x.data.F32 >= lastBound) { 728 jMax = histogram->bounds->n - 1; 729 } 696 psF32 x = iMid - (PS_GAUSS_WIDTH * sigma); 697 jMin = i; 698 while (jMin > 0) { 699 if ((histogram->bounds->data.F32[jMin] <= x) && 700 (histogram->bounds->data.F32[jMin+1] >= x)) { 701 break; 702 } 703 jMin--; 704 } 705 706 x = iMid + (PS_GAUSS_WIDTH * sigma); 707 jMax = i; 708 while (jMax < (histogram->bounds->n - 1)) { 709 if ((histogram->bounds->data.F32[jMax] <= x) && 710 (histogram->bounds->data.F32[jMax+1] >= x)) { 711 break; 712 } 713 jMax++; 714 } 715 730 716 731 717 //
Note:
See TracChangeset
for help on using the changeset viewer.
