Index: sasmodels/models/lib/j1_cephes.c
===================================================================
--- sasmodels/models/lib/j1_cephes.c	(revision a5af4e1ca0acba8ff274ff823f33faa5a25b0704)
+++ sasmodels/models/lib/j1_cephes.c	(revision fad5dc1e719d8dec9f7d9592debc76d14942f224)
@@ -39,5 +39,99 @@
 Copyright 1984, 1987, 1989, 2000 by Stephen L. Moshier
 */
-double J1(double );
+
+constant double RP[8] = {
+    -8.99971225705559398224E8,
+    4.52228297998194034323E11,
+    -7.27494245221818276015E13,
+    3.68295732863852883286E15,
+    0.0,
+    0.0,
+    0.0,
+    0.0 };
+
+constant double RQ[8] = {
+        6.20836478118054335476E2,
+        2.56987256757748830383E5,
+        8.35146791431949253037E7,
+        2.21511595479792499675E10,
+        4.74914122079991414898E12,
+        7.84369607876235854894E14,
+        8.95222336184627338078E16,
+        5.32278620332680085395E18
+    };
+
+constant double PP[8] = {
+    7.62125616208173112003E-4,
+    7.31397056940917570436E-2,
+    1.12719608129684925192E0,
+    5.11207951146807644818E0,
+    8.42404590141772420927E0,
+    5.21451598682361504063E0,
+    1.00000000000000000254E0,
+    0.0} ;
+
+
+constant double PQ[8] = {
+    5.71323128072548699714E-4,
+    6.88455908754495404082E-2,
+    1.10514232634061696926E0,
+    5.07386386128601488557E0,
+    8.39985554327604159757E0,
+    5.20982848682361821619E0,
+    9.99999999999999997461E-1,
+    0.0 };
+
+constant double QP[8] = {
+    5.10862594750176621635E-2,
+    4.98213872951233449420E0,
+    7.58238284132545283818E1,
+    3.66779609360150777800E2,
+    7.10856304998926107277E2,
+    5.97489612400613639965E2,
+    2.11688757100572135698E2,
+    2.52070205858023719784E1 };
+
+constant double QQ[8] = {
+    7.42373277035675149943E1,
+    1.05644886038262816351E3,
+    4.98641058337653607651E3,
+    9.56231892404756170795E3,
+    7.99704160447350683650E3,
+    2.82619278517639096600E3,
+    3.36093607810698293419E2,
+    0.0 };
+
+constant double JP[8] = {
+        -4.878788132172128E-009,
+        6.009061827883699E-007,
+        -4.541343896997497E-005,
+        1.937383947804541E-003,
+        -3.405537384615824E-002,
+        0.0,
+        0.0,
+        0.0
+    };
+
+constant double MO1[8] = {
+        6.913942741265801E-002,
+        -2.284801500053359E-001,
+        3.138238455499697E-001,
+        -2.102302420403875E-001,
+        5.435364690523026E-003,
+        1.493389585089498E-001,
+        4.976029650847191E-006,
+        7.978845453073848E-001
+    };
+
+constant double PH1[8] = {
+        -4.497014141919556E+001,
+        5.073465654089319E+001,
+        -2.485774108720340E+001,
+        7.222973196770240E+000,
+        -1.544842782180211E+000,
+        3.503787691653334E-001,
+        -1.637986776941202E-001,
+        3.749989509080821E-001
+    };
 
 double J1(double x) {
@@ -60,5 +154,5 @@
 	{
 	    z = x * x;
-	    w = polevlRP( z, 3 ) / p1evlRQ( z, 8 );
+	    w = polevl( z, RP, 3 ) / p1evl( z, RQ, 8 );
 	    w = w * x * (z - Z1) * (z - Z2);
 	    return( w );
@@ -68,6 +162,6 @@
     z = w * w;
 
-    p = polevlPP( z, 6)/polevlPQ( z, 6 );
-    q = polevlQP( z, 7)/p1evlQQ( z, 7 );
+    p = polevl( z, PP, 6)/polevl( z, PQ, 6 );
+    q = polevl( z, QP, 7)/p1evl( z, QQ, 7 );
 
     xn = x - THPIO4;
@@ -95,5 +189,5 @@
 	{
 	    z = xx * xx;
-	    p = (z-Z1) * xx * polevlJP( z, 4 );
+	    p = (z-Z1) * xx * polevl( z, JP, 4 );
 	    return( p );
 	}
@@ -102,7 +196,7 @@
     w = sqrt(q);
 
-    p = w * polevlMO1( q, 7);
+    p = w * polevl( q, MO1, 7);
     w = q*q;
-    xn = q * polevlPH1( w, 7) - THPIO4F;
+    xn = q * polevl( w, PH1, 7) - THPIO4F;
     p = p * cos(xn + xx);
 
@@ -110,2 +204,7 @@
 #endif
 }
+
+
+/*double J1c(double x) {
+    return
+}*/
Index: sasmodels/models/lib/polevl.c
===================================================================
--- sasmodels/models/lib/polevl.c	(revision 3b12dea43e61a0a021f63ec8552eb553b6c45dd2)
+++ sasmodels/models/lib/polevl.c	(revision fad5dc1e719d8dec9f7d9592debc76d14942f224)
@@ -51,208 +51,6 @@
 */
 
-double polevlRP(double x, int N ) {
 
-    double coef[8] = {
-    -8.99971225705559398224E8,
-    4.52228297998194034323E11,
-    -7.27494245221818276015E13,
-    3.68295732863852883286E15,
-    0.0,
-    0.0,
-    0.0,
-    0.0 };
-
-    int i = 0;
-    double ans = coef[i];
-
-    while (i < N) {
-        i++;
-        ans = ans * x + coef[i];
-    }
-    return ans ;
-}
-
-double polevlRQ(double x, int N ) {
-
-    double coef[8] = {
-        6.20836478118054335476E2,
-        2.56987256757748830383E5,
-        8.35146791431949253037E7,
-        2.21511595479792499675E10,
-        4.74914122079991414898E12,
-        7.84369607876235854894E14,
-        8.95222336184627338078E16,
-        5.32278620332680085395E18
-    };
-
-    int i = 0;
-    double ans = coef[i];
-
-    while (i < N) {
-        i++;
-        ans = ans * x + coef[i];
-    }
-    return ans ;
-}
-
-double polevlPP(double x, int N ) {
-
-    double coef[8] = {
-    7.62125616208173112003E-4,
-    7.31397056940917570436E-2,
-    1.12719608129684925192E0,
-    5.11207951146807644818E0,
-    8.42404590141772420927E0,
-    5.21451598682361504063E0,
-    1.00000000000000000254E0,
-    0.0} ;
-
-    int i = 0;
-    double ans = coef[i];
-
-    while (i < N) {
-        i++;
-        ans = ans * x + coef[i];
-    }
-    return ans ;
-}
-
-double polevlPQ(double x, int N ) {
-
-    double coef[8] = {
-    5.71323128072548699714E-4,
-    6.88455908754495404082E-2,
-    1.10514232634061696926E0,
-    5.07386386128601488557E0,
-    8.39985554327604159757E0,
-    5.20982848682361821619E0,
-    9.99999999999999997461E-1,
-    0.0 };
-
-    int i = 0;
-    double ans = coef[i];
-
-    while (i < N) {
-        i++;
-        ans = ans * x + coef[i];
-    }
-    return ans ;
-}
-
-double polevlQP(double x, int N ) {
-
-    double coef[8] = {
-    5.10862594750176621635E-2,
-    4.98213872951233449420E0,
-    7.58238284132545283818E1,
-    3.66779609360150777800E2,
-    7.10856304998926107277E2,
-    5.97489612400613639965E2,
-    2.11688757100572135698E2,
-    2.52070205858023719784E1 };
-
-    int i = 0;
-    double ans = coef[i];
-
-    while (i < N) {
-        i++;
-        ans = ans * x + coef[i];
-    }
-    return ans ;
-
-}
-
-double polevlQQ(double x, int N ) {
-
-    double coef[8] = {
-    7.42373277035675149943E1,
-    1.05644886038262816351E3,
-    4.98641058337653607651E3,
-    9.56231892404756170795E3,
-    7.99704160447350683650E3,
-    2.82619278517639096600E3,
-    3.36093607810698293419E2,
-    0.0 };
-
-    int i = 0;
-    double ans = coef[i];
-
-    while (i < N) {
-        i++;
-        ans = ans * x + coef[i];
-    }
-    return ans ;
-
-}
-
-double polevlJP( double x, int N ) {
-    double coef[8] = {
-        -4.878788132172128E-009,
-        6.009061827883699E-007,
-        -4.541343896997497E-005,
-        1.937383947804541E-003,
-        -3.405537384615824E-002,
-        0.0,
-        0.0,
-        0.0
-    };
-
-    int i = 0;
-    double ans = coef[i];
-
-    while (i < N) {
-        i++;
-        ans = ans * x + coef[i];
-    }
-    return ans ;
-
-}
-
-double polevlMO1( double x, int N ) {
-    double coef[8] = {
-        6.913942741265801E-002,
-        -2.284801500053359E-001,
-        3.138238455499697E-001,
-        -2.102302420403875E-001,
-        5.435364690523026E-003,
-        1.493389585089498E-001,
-        4.976029650847191E-006,
-        7.978845453073848E-001
-    };
-
-    int i = 0;
-    double ans = coef[i];
-
-    while (i < N) {
-        i++;
-        ans = ans * x + coef[i];
-    }
-    return ans ;
-}
-
-double polevlPH1( double x, int N ) {
-
-    double coef[8] = {
-        -4.497014141919556E+001,
-        5.073465654089319E+001,
-        -2.485774108720340E+001,
-        7.222973196770240E+000,
-        -1.544842782180211E+000,
-        3.503787691653334E-001,
-        -1.637986776941202E-001,
-        3.749989509080821E-001
-    };
-
-    int i = 0;
-    double ans = coef[i];
-
-    while (i < N) {
-        i++;
-        ans = ans * x + coef[i];
-    }
-    return ans ;
-}
-
-/*double polevl( double x, double coef[8], int N ) {
+double polevl( double x, constant double *coef, int N ) {
 
     int i = 0;
@@ -266,5 +64,5 @@
     return ans ;
 
-}*/
+}
 
 /*							p1evl()	*/
@@ -274,39 +72,5 @@
  */
 
-double p1evlRP( double x, int N ) {
-    double coef[8] = {
-    -8.99971225705559398224E8,
-    4.52228297998194034323E11,
-    -7.27494245221818276015E13,
-    3.68295732863852883286E15,
-    0.0,
-    0.0,
-    0.0,
-    0.0 };
-
-    int i=0;
-    double ans = x+coef[i];
-
-    while (i < N-1) {
-        i++;
-        ans = ans*x + coef[i];
-    }
-
-    return( ans );
-
-}
-
-double p1evlRQ( double x, int N ) {
-//1: RQ
-    double coef[8] = {
-    6.20836478118054335476E2,
-    2.56987256757748830383E5,
-    8.35146791431949253037E7,
-    2.21511595479792499675E10,
-    4.74914122079991414898E12,
-    7.84369607876235854894E14,
-    8.95222336184627338078E16,
-    5.32278620332680085395E18};
-
+double p1evl( double x, constant double *coef, int N ) {
     int i=0;
     double ans = x+coef[i];
@@ -319,173 +83,2 @@
     return( ans );
 }
-
-double p1evlPP( double x, int N ) {
-//3 : PP
-    double coef[8] = {
-    7.62125616208173112003E-4,
-    7.31397056940917570436E-2,
-    1.12719608129684925192E0,
-    5.11207951146807644818E0,
-    8.42404590141772420927E0,
-    5.21451598682361504063E0,
-    1.00000000000000000254E0,
-    0.0};
-
-    int i=0;
-    double ans = x+coef[i];
-
-    while (i < N-1) {
-        i++;
-        ans = ans*x + coef[i];
-    }
-
-    return( ans );
-}
-
-double p1evlPQ( double x, int N ) {
-//4: PQ
-    double coef[8] = {
-    5.71323128072548699714E-4,
-    6.88455908754495404082E-2,
-    1.10514232634061696926E0,
-    5.07386386128601488557E0,
-    8.39985554327604159757E0,
-    5.20982848682361821619E0,
-    9.99999999999999997461E-1,
-    0.0};
-
-    int i=0;
-    double ans = x+coef[i];
-
-    while (i < N-1) {
-        i++;
-        ans = ans*x + coef[i];
-    }
-
-    return( ans );
-}
-
-double p1evlQP( double x, int N ) {
-//5: QP
-    double coef[8] = {
-    5.10862594750176621635E-2,
-    4.98213872951233449420E0,
-    7.58238284132545283818E1,
-    3.66779609360150777800E2,
-    7.10856304998926107277E2,
-    5.97489612400613639965E2,
-    2.11688757100572135698E2,
-    2.52070205858023719784E1 };
-
-    int i=0;
-    double ans = x+coef[i];
-
-    while (i < N-1) {
-        i++;
-        ans = ans*x + coef[i];
-    }
-
-    return( ans );
-}
-
-double p1evlQQ( double x, int N ) {
-    double coef[8] = {
-    7.42373277035675149943E1,
-    1.05644886038262816351E3,
-    4.98641058337653607651E3,
-    9.56231892404756170795E3,
-    7.99704160447350683650E3,
-    2.82619278517639096600E3,
-    3.36093607810698293419E2,
-    0.0};
-
-    int i=0;
-    double ans = x+coef[i];
-
-    while (i < N-1) {
-        i++;
-        ans = ans*x + coef[i];
-    }
-
-    return( ans );
-
-}
-
-double p1evlJP( double x, int N ) {
-    double coef[8] = {
-        -4.878788132172128E-009,
-        6.009061827883699E-007,
-        -4.541343896997497E-005,
-        1.937383947804541E-003,
-        -3.405537384615824E-002,
-        0.0,
-        0.0,
-        0.0};
-
-    int i=0;
-    double ans = x+coef[i];
-
-    while (i < N-1) {
-        i++;
-        ans = ans*x + coef[i];
-    }
-
-    return( ans );
-}
-
-double p1evlMO1( double x, int N ) {
-    double coef[8] = {
-        6.913942741265801E-002,
-        -2.284801500053359E-001,
-        3.138238455499697E-001,
-        -2.102302420403875E-001,
-        5.435364690523026E-003,
-        1.493389585089498E-001,
-        4.976029650847191E-006,
-        7.978845453073848E-001};
-
-    int i=0;
-    double ans = x+coef[i];
-
-    while (i < N-1) {
-        i++;
-        ans = ans*x + coef[i];
-    }
-
-    return( ans );
-
-}
-
-double p1evlPH1( double x, int N ) {
-    double coef[8] = {
-        -4.497014141919556E+001,
-        5.073465654089319E+001,
-        -2.485774108720340E+001,
-        7.222973196770240E+000,
-        -1.544842782180211E+000,
-        3.503787691653334E-001,
-        -1.637986776941202E-001,
-        3.749989509080821E-001};
-    int i=0;
-    double ans = x+coef[i];
-
-    while (i < N-1) {
-        i++;
-        ans = ans*x + coef[i];
-    }
-
-    return( ans );
-}
-
-/*double p1evl( double x, double coef[8], int N ) {
-    int i=0;
-    double ans = x+coef[i];
-
-    while (i < N-1) {
-        i++;
-        ans = ans*x + coef[i];
-    }
-
-    return( ans );
-
-}*/
