Changeset 2327
- Timestamp:
- Nov 10, 2004, 1:05:49 PM (22 years ago)
- Location:
- trunk/psLib/src
- Files:
-
- 5 edited
-
dataManip/psFunctions.c (modified) (9 diffs)
-
dataManip/psStats.c (modified) (3 diffs)
-
math/psPolynomial.c (modified) (9 diffs)
-
math/psSpline.c (modified) (9 diffs)
-
math/psStats.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/dataManip/psFunctions.c
r2324 r2327 7 7 * polynomials. It also contains a Gaussian functions. 8 8 * 9 * @version $Revision: 1.6 0$ $Name: not supported by cvs2svn $10 * @date $Date: 2004-11-10 2 2:43:48$9 * @version $Revision: 1.61 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2004-11-10 23:05:49 $ 11 11 * 12 12 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 1887 1887 XXX: name since we don't take psVectors as input. 1888 1888 *****************************************************************************/ 1889 /* 1889 1890 static psS32 vectorBinDisectF32(float *bins, 1890 1891 psS32 numBins, … … 1894 1895 psS32 max; 1895 1896 psS32 mid; 1896 1897 1897 1898 psTrace(".psLib.dataManip.psFunctions.vectorBinDisectF32", 4, 1898 1899 "---- Calling vectorBinDisectF32(%f)\n", x); 1899 1900 1900 1901 if (x < bins[0]) { 1901 1902 psLogMsg(__func__, PS_LOG_WARN, … … 1904 1905 return(-2); 1905 1906 } 1906 1907 1907 1908 if (x > bins[numBins-1]) { 1908 1909 psLogMsg(__func__, PS_LOG_WARN, … … 1911 1912 return(-1); 1912 1913 } 1913 1914 1914 1915 min = 0; 1915 1916 max = numBins-2; 1916 1917 mid = ((max+1)-min)/2; 1917 1918 1918 1919 while (min != max) { 1919 1920 psTrace(".psLib.dataManip.psFunctions.vectorBinDisectF32", 4, 1920 1921 "(min, mid, max) is (%d, %d, %d): (x, bins) is (%f, %f)\n", 1921 1922 min, mid, max, x, bins[mid]); 1922 1923 1923 1924 if (x == bins[mid]) { 1924 1925 psTrace(".psLib.dataManip.psFunctions.vectorBinDisectF32", 4, … … 1932 1933 mid = ((max+1)+min)/2; 1933 1934 } 1934 1935 1935 1936 psTrace(".psLib.dataManip.psFunctions.vectorBinDisectF32", 4, 1936 1937 "---- Exiting vectorBinDisectF32(): bin %d\n", min); 1937 1938 return(min); 1938 1939 } 1939 1940 */ 1940 1941 /***************************************************************************** 1941 1942 vectorBinDisectS32(): integer version of above. 1942 1943 *****************************************************************************/ 1944 /* 1943 1945 static psS32 vectorBinDisectS32(psS32 *bins, 1944 1946 psS32 numBins, … … 1948 1950 psS32 max; 1949 1951 psS32 mid; 1950 1952 1951 1953 psTrace(".psLib.dataManip.psFunctions.vectorBinDisectS32", 4, 1952 1954 "---- Calling vectorBinDisectS32(%f)\n", x); 1953 1955 1954 1956 if ((x < bins[0]) || 1955 1957 (x > bins[numBins-1])) { … … 1959 1961 return(-1); 1960 1962 } 1961 1963 1962 1964 min = 0; 1963 1965 max = numBins-2; 1964 1966 mid = ((max+1)-min)/2; 1965 1967 1966 1968 while (min != max) { 1967 1969 psTrace(".psLib.dataManip.psFunctions.vectorBinDisectS32", 4, 1968 1970 "(min, mid, max) is (%d, %d, %d): (x, bins) is (%f, %f)\n", 1969 1971 min, mid, max, x, bins[mid]); 1970 1972 1971 1973 if (x == bins[mid]) { 1972 1974 psTrace(".psLib.dataManip.psFunctions.vectorBinDisectS32", 4, … … 1980 1982 mid = ((max+1)+min)/2; 1981 1983 } 1982 1984 1983 1985 psTrace(".psLib.dataManip.psFunctions.vectorBinDisectS32", 4, 1984 1986 "---- Exiting vectorBinDisectS32(): bin %d\n", min); 1985 1987 return(min); 1986 1988 } 1989 */ 1990 1991 #define FUNC_MACRO_VECTOR_BIN_DISECT(TYPE) \ 1992 static psS32 vectorBinDisect##TYPE(ps##TYPE *bins, \ 1993 psS32 numBins, \ 1994 ps##TYPE x) \ 1995 { \ 1996 psS32 min; \ 1997 psS32 max; \ 1998 psS32 mid; \ 1999 \ 2000 psTrace(".psLib.dataManip.psFunctions.vectorBinDisect##TYPE", 4, \ 2001 "---- Calling vectorBinDisect##TYPE(%f)\n", x); \ 2002 \ 2003 if (x < bins[0]) { \ 2004 psLogMsg(__func__, PS_LOG_WARN, \ 2005 "vectorBinDisect##TYPE(): ordinate %f is outside vector range (%f - %f).", \ 2006 x, bins[0], bins[numBins-1]); \ 2007 return(-2); \ 2008 } \ 2009 \ 2010 if (x > bins[numBins-1]) { \ 2011 psLogMsg(__func__, PS_LOG_WARN, \ 2012 "vectorBinDisect##TYPE(): ordinate %f is outside vector range (%f - %f).", \ 2013 x, bins[0], bins[numBins-1]); \ 2014 return(-1); \ 2015 } \ 2016 \ 2017 min = 0; \ 2018 max = numBins-2; \ 2019 mid = ((max+1)-min)/2; \ 2020 \ 2021 while (min != max) { \ 2022 psTrace(".psLib.dataManip.psFunctions.vectorBinDisect##TYPE", 4, \ 2023 "(min, mid, max) is (%d, %d, %d): (x, bins) is (%f, %f)\n", \ 2024 min, mid, max, x, bins[mid]); \ 2025 \ 2026 if (x == bins[mid]) { \ 2027 psTrace(".psLib.dataManip.psFunctions.vectorBinDisect##TYPE", 4, \ 2028 "---- Exiting vectorBinDisect##TYPE(): bin %d\n", mid); \ 2029 return(mid); \ 2030 } else if (x < bins[mid]) { \ 2031 max = mid-1; \ 2032 } else { \ 2033 min = mid; \ 2034 } \ 2035 mid = ((max+1)+min)/2; \ 2036 } \ 2037 \ 2038 psTrace(".psLib.dataManip.psFunctions.vectorBinDisect##TYPE", 4, \ 2039 "---- Exiting vectorBinDisect##TYPE(): bin %d\n", min); \ 2040 return(min); \ 2041 } \ 2042 2043 FUNC_MACRO_VECTOR_BIN_DISECT(S8) 2044 FUNC_MACRO_VECTOR_BIN_DISECT(S16) 2045 FUNC_MACRO_VECTOR_BIN_DISECT(S32) 2046 FUNC_MACRO_VECTOR_BIN_DISECT(S64) 2047 FUNC_MACRO_VECTOR_BIN_DISECT(U8) 2048 FUNC_MACRO_VECTOR_BIN_DISECT(U16) 2049 FUNC_MACRO_VECTOR_BIN_DISECT(U32) 2050 FUNC_MACRO_VECTOR_BIN_DISECT(U64) 2051 FUNC_MACRO_VECTOR_BIN_DISECT(F32) 2052 FUNC_MACRO_VECTOR_BIN_DISECT(F64) 1987 2053 1988 2054 /***************************************************************************** -
trunk/psLib/src/dataManip/psStats.c
r2325 r2327 9 9 * @author GLG, MHPCC 10 10 * 11 * @version $Revision: 1.8 7$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-11-10 2 2:45:33$11 * @version $Revision: 1.88 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-11-10 23:05:49 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 353 353 stats 354 354 Returns 355 NULL355 int 356 356 *****************************************************************************/ 357 357 psS32 p_psVectorNValues(const psVector* restrict myVector, … … 360 360 psStats* stats) 361 361 { 362 PS_VECTOR_CHECK_NULL(myVector, -1); 363 PS_PTR_CHECK_NULL(stats, -1); 362 364 psS32 i = 0; // Loop index variable 363 365 psS32 numData = 0; // The number of data points -
trunk/psLib/src/math/psPolynomial.c
r2324 r2327 7 7 * polynomials. It also contains a Gaussian functions. 8 8 * 9 * @version $Revision: 1.6 0$ $Name: not supported by cvs2svn $10 * @date $Date: 2004-11-10 2 2:43:48$9 * @version $Revision: 1.61 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2004-11-10 23:05:49 $ 11 11 * 12 12 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 1887 1887 XXX: name since we don't take psVectors as input. 1888 1888 *****************************************************************************/ 1889 /* 1889 1890 static psS32 vectorBinDisectF32(float *bins, 1890 1891 psS32 numBins, … … 1894 1895 psS32 max; 1895 1896 psS32 mid; 1896 1897 1897 1898 psTrace(".psLib.dataManip.psFunctions.vectorBinDisectF32", 4, 1898 1899 "---- Calling vectorBinDisectF32(%f)\n", x); 1899 1900 1900 1901 if (x < bins[0]) { 1901 1902 psLogMsg(__func__, PS_LOG_WARN, … … 1904 1905 return(-2); 1905 1906 } 1906 1907 1907 1908 if (x > bins[numBins-1]) { 1908 1909 psLogMsg(__func__, PS_LOG_WARN, … … 1911 1912 return(-1); 1912 1913 } 1913 1914 1914 1915 min = 0; 1915 1916 max = numBins-2; 1916 1917 mid = ((max+1)-min)/2; 1917 1918 1918 1919 while (min != max) { 1919 1920 psTrace(".psLib.dataManip.psFunctions.vectorBinDisectF32", 4, 1920 1921 "(min, mid, max) is (%d, %d, %d): (x, bins) is (%f, %f)\n", 1921 1922 min, mid, max, x, bins[mid]); 1922 1923 1923 1924 if (x == bins[mid]) { 1924 1925 psTrace(".psLib.dataManip.psFunctions.vectorBinDisectF32", 4, … … 1932 1933 mid = ((max+1)+min)/2; 1933 1934 } 1934 1935 1935 1936 psTrace(".psLib.dataManip.psFunctions.vectorBinDisectF32", 4, 1936 1937 "---- Exiting vectorBinDisectF32(): bin %d\n", min); 1937 1938 return(min); 1938 1939 } 1939 1940 */ 1940 1941 /***************************************************************************** 1941 1942 vectorBinDisectS32(): integer version of above. 1942 1943 *****************************************************************************/ 1944 /* 1943 1945 static psS32 vectorBinDisectS32(psS32 *bins, 1944 1946 psS32 numBins, … … 1948 1950 psS32 max; 1949 1951 psS32 mid; 1950 1952 1951 1953 psTrace(".psLib.dataManip.psFunctions.vectorBinDisectS32", 4, 1952 1954 "---- Calling vectorBinDisectS32(%f)\n", x); 1953 1955 1954 1956 if ((x < bins[0]) || 1955 1957 (x > bins[numBins-1])) { … … 1959 1961 return(-1); 1960 1962 } 1961 1963 1962 1964 min = 0; 1963 1965 max = numBins-2; 1964 1966 mid = ((max+1)-min)/2; 1965 1967 1966 1968 while (min != max) { 1967 1969 psTrace(".psLib.dataManip.psFunctions.vectorBinDisectS32", 4, 1968 1970 "(min, mid, max) is (%d, %d, %d): (x, bins) is (%f, %f)\n", 1969 1971 min, mid, max, x, bins[mid]); 1970 1972 1971 1973 if (x == bins[mid]) { 1972 1974 psTrace(".psLib.dataManip.psFunctions.vectorBinDisectS32", 4, … … 1980 1982 mid = ((max+1)+min)/2; 1981 1983 } 1982 1984 1983 1985 psTrace(".psLib.dataManip.psFunctions.vectorBinDisectS32", 4, 1984 1986 "---- Exiting vectorBinDisectS32(): bin %d\n", min); 1985 1987 return(min); 1986 1988 } 1989 */ 1990 1991 #define FUNC_MACRO_VECTOR_BIN_DISECT(TYPE) \ 1992 static psS32 vectorBinDisect##TYPE(ps##TYPE *bins, \ 1993 psS32 numBins, \ 1994 ps##TYPE x) \ 1995 { \ 1996 psS32 min; \ 1997 psS32 max; \ 1998 psS32 mid; \ 1999 \ 2000 psTrace(".psLib.dataManip.psFunctions.vectorBinDisect##TYPE", 4, \ 2001 "---- Calling vectorBinDisect##TYPE(%f)\n", x); \ 2002 \ 2003 if (x < bins[0]) { \ 2004 psLogMsg(__func__, PS_LOG_WARN, \ 2005 "vectorBinDisect##TYPE(): ordinate %f is outside vector range (%f - %f).", \ 2006 x, bins[0], bins[numBins-1]); \ 2007 return(-2); \ 2008 } \ 2009 \ 2010 if (x > bins[numBins-1]) { \ 2011 psLogMsg(__func__, PS_LOG_WARN, \ 2012 "vectorBinDisect##TYPE(): ordinate %f is outside vector range (%f - %f).", \ 2013 x, bins[0], bins[numBins-1]); \ 2014 return(-1); \ 2015 } \ 2016 \ 2017 min = 0; \ 2018 max = numBins-2; \ 2019 mid = ((max+1)-min)/2; \ 2020 \ 2021 while (min != max) { \ 2022 psTrace(".psLib.dataManip.psFunctions.vectorBinDisect##TYPE", 4, \ 2023 "(min, mid, max) is (%d, %d, %d): (x, bins) is (%f, %f)\n", \ 2024 min, mid, max, x, bins[mid]); \ 2025 \ 2026 if (x == bins[mid]) { \ 2027 psTrace(".psLib.dataManip.psFunctions.vectorBinDisect##TYPE", 4, \ 2028 "---- Exiting vectorBinDisect##TYPE(): bin %d\n", mid); \ 2029 return(mid); \ 2030 } else if (x < bins[mid]) { \ 2031 max = mid-1; \ 2032 } else { \ 2033 min = mid; \ 2034 } \ 2035 mid = ((max+1)+min)/2; \ 2036 } \ 2037 \ 2038 psTrace(".psLib.dataManip.psFunctions.vectorBinDisect##TYPE", 4, \ 2039 "---- Exiting vectorBinDisect##TYPE(): bin %d\n", min); \ 2040 return(min); \ 2041 } \ 2042 2043 FUNC_MACRO_VECTOR_BIN_DISECT(S8) 2044 FUNC_MACRO_VECTOR_BIN_DISECT(S16) 2045 FUNC_MACRO_VECTOR_BIN_DISECT(S32) 2046 FUNC_MACRO_VECTOR_BIN_DISECT(S64) 2047 FUNC_MACRO_VECTOR_BIN_DISECT(U8) 2048 FUNC_MACRO_VECTOR_BIN_DISECT(U16) 2049 FUNC_MACRO_VECTOR_BIN_DISECT(U32) 2050 FUNC_MACRO_VECTOR_BIN_DISECT(U64) 2051 FUNC_MACRO_VECTOR_BIN_DISECT(F32) 2052 FUNC_MACRO_VECTOR_BIN_DISECT(F64) 1987 2053 1988 2054 /***************************************************************************** -
trunk/psLib/src/math/psSpline.c
r2324 r2327 7 7 * polynomials. It also contains a Gaussian functions. 8 8 * 9 * @version $Revision: 1.6 0$ $Name: not supported by cvs2svn $10 * @date $Date: 2004-11-10 2 2:43:48$9 * @version $Revision: 1.61 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2004-11-10 23:05:49 $ 11 11 * 12 12 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 1887 1887 XXX: name since we don't take psVectors as input. 1888 1888 *****************************************************************************/ 1889 /* 1889 1890 static psS32 vectorBinDisectF32(float *bins, 1890 1891 psS32 numBins, … … 1894 1895 psS32 max; 1895 1896 psS32 mid; 1896 1897 1897 1898 psTrace(".psLib.dataManip.psFunctions.vectorBinDisectF32", 4, 1898 1899 "---- Calling vectorBinDisectF32(%f)\n", x); 1899 1900 1900 1901 if (x < bins[0]) { 1901 1902 psLogMsg(__func__, PS_LOG_WARN, … … 1904 1905 return(-2); 1905 1906 } 1906 1907 1907 1908 if (x > bins[numBins-1]) { 1908 1909 psLogMsg(__func__, PS_LOG_WARN, … … 1911 1912 return(-1); 1912 1913 } 1913 1914 1914 1915 min = 0; 1915 1916 max = numBins-2; 1916 1917 mid = ((max+1)-min)/2; 1917 1918 1918 1919 while (min != max) { 1919 1920 psTrace(".psLib.dataManip.psFunctions.vectorBinDisectF32", 4, 1920 1921 "(min, mid, max) is (%d, %d, %d): (x, bins) is (%f, %f)\n", 1921 1922 min, mid, max, x, bins[mid]); 1922 1923 1923 1924 if (x == bins[mid]) { 1924 1925 psTrace(".psLib.dataManip.psFunctions.vectorBinDisectF32", 4, … … 1932 1933 mid = ((max+1)+min)/2; 1933 1934 } 1934 1935 1935 1936 psTrace(".psLib.dataManip.psFunctions.vectorBinDisectF32", 4, 1936 1937 "---- Exiting vectorBinDisectF32(): bin %d\n", min); 1937 1938 return(min); 1938 1939 } 1939 1940 */ 1940 1941 /***************************************************************************** 1941 1942 vectorBinDisectS32(): integer version of above. 1942 1943 *****************************************************************************/ 1944 /* 1943 1945 static psS32 vectorBinDisectS32(psS32 *bins, 1944 1946 psS32 numBins, … … 1948 1950 psS32 max; 1949 1951 psS32 mid; 1950 1952 1951 1953 psTrace(".psLib.dataManip.psFunctions.vectorBinDisectS32", 4, 1952 1954 "---- Calling vectorBinDisectS32(%f)\n", x); 1953 1955 1954 1956 if ((x < bins[0]) || 1955 1957 (x > bins[numBins-1])) { … … 1959 1961 return(-1); 1960 1962 } 1961 1963 1962 1964 min = 0; 1963 1965 max = numBins-2; 1964 1966 mid = ((max+1)-min)/2; 1965 1967 1966 1968 while (min != max) { 1967 1969 psTrace(".psLib.dataManip.psFunctions.vectorBinDisectS32", 4, 1968 1970 "(min, mid, max) is (%d, %d, %d): (x, bins) is (%f, %f)\n", 1969 1971 min, mid, max, x, bins[mid]); 1970 1972 1971 1973 if (x == bins[mid]) { 1972 1974 psTrace(".psLib.dataManip.psFunctions.vectorBinDisectS32", 4, … … 1980 1982 mid = ((max+1)+min)/2; 1981 1983 } 1982 1984 1983 1985 psTrace(".psLib.dataManip.psFunctions.vectorBinDisectS32", 4, 1984 1986 "---- Exiting vectorBinDisectS32(): bin %d\n", min); 1985 1987 return(min); 1986 1988 } 1989 */ 1990 1991 #define FUNC_MACRO_VECTOR_BIN_DISECT(TYPE) \ 1992 static psS32 vectorBinDisect##TYPE(ps##TYPE *bins, \ 1993 psS32 numBins, \ 1994 ps##TYPE x) \ 1995 { \ 1996 psS32 min; \ 1997 psS32 max; \ 1998 psS32 mid; \ 1999 \ 2000 psTrace(".psLib.dataManip.psFunctions.vectorBinDisect##TYPE", 4, \ 2001 "---- Calling vectorBinDisect##TYPE(%f)\n", x); \ 2002 \ 2003 if (x < bins[0]) { \ 2004 psLogMsg(__func__, PS_LOG_WARN, \ 2005 "vectorBinDisect##TYPE(): ordinate %f is outside vector range (%f - %f).", \ 2006 x, bins[0], bins[numBins-1]); \ 2007 return(-2); \ 2008 } \ 2009 \ 2010 if (x > bins[numBins-1]) { \ 2011 psLogMsg(__func__, PS_LOG_WARN, \ 2012 "vectorBinDisect##TYPE(): ordinate %f is outside vector range (%f - %f).", \ 2013 x, bins[0], bins[numBins-1]); \ 2014 return(-1); \ 2015 } \ 2016 \ 2017 min = 0; \ 2018 max = numBins-2; \ 2019 mid = ((max+1)-min)/2; \ 2020 \ 2021 while (min != max) { \ 2022 psTrace(".psLib.dataManip.psFunctions.vectorBinDisect##TYPE", 4, \ 2023 "(min, mid, max) is (%d, %d, %d): (x, bins) is (%f, %f)\n", \ 2024 min, mid, max, x, bins[mid]); \ 2025 \ 2026 if (x == bins[mid]) { \ 2027 psTrace(".psLib.dataManip.psFunctions.vectorBinDisect##TYPE", 4, \ 2028 "---- Exiting vectorBinDisect##TYPE(): bin %d\n", mid); \ 2029 return(mid); \ 2030 } else if (x < bins[mid]) { \ 2031 max = mid-1; \ 2032 } else { \ 2033 min = mid; \ 2034 } \ 2035 mid = ((max+1)+min)/2; \ 2036 } \ 2037 \ 2038 psTrace(".psLib.dataManip.psFunctions.vectorBinDisect##TYPE", 4, \ 2039 "---- Exiting vectorBinDisect##TYPE(): bin %d\n", min); \ 2040 return(min); \ 2041 } \ 2042 2043 FUNC_MACRO_VECTOR_BIN_DISECT(S8) 2044 FUNC_MACRO_VECTOR_BIN_DISECT(S16) 2045 FUNC_MACRO_VECTOR_BIN_DISECT(S32) 2046 FUNC_MACRO_VECTOR_BIN_DISECT(S64) 2047 FUNC_MACRO_VECTOR_BIN_DISECT(U8) 2048 FUNC_MACRO_VECTOR_BIN_DISECT(U16) 2049 FUNC_MACRO_VECTOR_BIN_DISECT(U32) 2050 FUNC_MACRO_VECTOR_BIN_DISECT(U64) 2051 FUNC_MACRO_VECTOR_BIN_DISECT(F32) 2052 FUNC_MACRO_VECTOR_BIN_DISECT(F64) 1987 2053 1988 2054 /***************************************************************************** -
trunk/psLib/src/math/psStats.c
r2325 r2327 9 9 * @author GLG, MHPCC 10 10 * 11 * @version $Revision: 1.8 7$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-11-10 2 2:45:33$11 * @version $Revision: 1.88 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-11-10 23:05:49 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 353 353 stats 354 354 Returns 355 NULL355 int 356 356 *****************************************************************************/ 357 357 psS32 p_psVectorNValues(const psVector* restrict myVector, … … 360 360 psStats* stats) 361 361 { 362 PS_VECTOR_CHECK_NULL(myVector, -1); 363 PS_PTR_CHECK_NULL(stats, -1); 362 364 psS32 i = 0; // Loop index variable 363 365 psS32 numData = 0; // The number of data points
Note:
See TracChangeset
for help on using the changeset viewer.
