Changeset 12339 for branches/rel-1_0/psLib/src/math/psPolynomial.c
- Timestamp:
- Mar 8, 2007, 1:23:43 PM (19 years ago)
- File:
-
- 1 edited
-
branches/rel-1_0/psLib/src/math/psPolynomial.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/rel-1_0/psLib/src/math/psPolynomial.c
r10999 r12339 7 7 * polynomials. It also contains a Gaussian functions. 8 8 * 9 * @version $Revision: 1.157 $ $Name: not supported by cvs2svn $10 * @date $Date: 2007-0 1-09 22:38:53 $9 * @version $Revision: 1.157.2.1 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2007-03-08 23:23:43 $ 11 11 * 12 12 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 823 823 } 824 824 825 /************************************************************************************************************/ 826 /* 827 * Return the number of active terms in a polynomial 828 */ 829 int psPolynomial1DNterm(const psPolynomial1D *poly) 830 { 831 PS_ASSERT_POLY_NON_NULL(poly, 0); 832 833 int nterm = 0; 834 for (int i = 0; i <= poly->nX; i++) { 835 if (poly->mask[i] == 0) { 836 nterm++; 837 } 838 } 839 840 return nterm; 841 } 842 843 int psPolynomial2DNterm(const psPolynomial2D *poly) 844 { 845 PS_ASSERT_POLY_NON_NULL(poly, 0); 846 847 int nterm = 0; 848 for (int i = 0; i <= poly->nX; i++) { 849 for (int j = 0; j <= poly->nY; j++) { 850 if (poly->mask[j][i] == 0) { 851 nterm++; 852 } 853 } 854 } 855 856 return nterm; 857 } 858 859 int psPolynomial3DNterm(const psPolynomial3D *poly) 860 { 861 PS_ASSERT_POLY_NON_NULL(poly, 0); 862 863 int nterm = 0; 864 for (int i = 0; i <= poly->nX; i++) { 865 for (int j = 0; j <= poly->nY; j++) { 866 for (int k = 0; k <= poly->nZ; k++) { 867 if (poly->mask[k][j][i] == 0) { 868 nterm++; 869 } 870 } 871 } 872 } 873 874 return nterm; 875 } 876 877 int psPolynomial4DNterm(const psPolynomial4D *poly) 878 { 879 PS_ASSERT_POLY_NON_NULL(poly, 0); 880 881 int nterm = 0; 882 for (int i = 0; i <= poly->nX; i++) { 883 for (int j = 0; j <= poly->nY; j++) { 884 for (int k = 0; k <= poly->nZ; k++) { 885 for (int l = 0; l <= poly->nT; l++) { 886 if (poly->mask[l][k][j][i] == 0) { 887 nterm++; 888 } 889 } 890 } 891 } 892 } 893 894 return nterm; 895 } 896 897 /************************************************************************************************************/ 898 825 899 psF64 psPolynomial1DEval(const psPolynomial1D* poly, 826 900 psF64 x)
Note:
See TracChangeset
for help on using the changeset viewer.
