Index: run.py
===================================================================
--- run.py	(revision 9e531f2d45ba748a75200d6849494152c0ad9383)
+++ run.py	(revision 832fea2242122fcdfebdb7c182d628de342fa304)
@@ -127,13 +127,7 @@
                                   joinpath(build_path, 'sas', 'sascalc', 'calculator', 'core'))
 
-    # Pull the entire sas.models package from the build directory since it contains
-    # a mixture of autogenerated python and C.  Any changes in models will require
-    # a rebuild with setup.py build
-    # sas.models = import_package('sas.models', joinpath(build_path, 'sas', 'models'))
-
     sys.path.append(build_path)
 
     #print "\n".join(sys.path)
-    #from sas.models import SphereModel
 
 if __name__ == "__main__":
Index: smodels/CMakeLists.txt
===================================================================
--- sasmodels/CMakeLists.txt	(revision 3a39c2e89f90377b2d15fa13b9ba9cf3b4144070)
+++ 	(revision )
@@ -1,141 +1,0 @@
-# CMakeLists for SAS models
-cmake_minimum_required (VERSION 2.6)
-project (SasModels)
-
-# Version number
-set (SasModels_VERSION_MAJOR 1)
-set (SasModels_VERSION_MAJOR 0)
-
-set (SRC_FILES
-    src/c_models/barbell.cpp
-    src/c_models/bcc.cpp
-    src/c_models/binaryHS.cpp
-    src/c_models/binaryHS_PSF11.cpp
-    src/c_models/capcyl.cpp
-    src/c_models/corefourshell.cpp
-    src/c_models/coreshellcylinder.cpp
-    src/c_models/coreshellsphere.cpp
-    src/c_models/csparallelepiped.cpp
-    src/c_models/cylinder.cpp
-    src/c_models/DiamCyl.cpp
-    src/c_models/DiamEllip.cpp
-    src/c_models/dispersion_visitor.cpp
-    src/c_models/ellipsoid.cpp
-    src/c_models/ellipticalcylinder.cpp
-    src/c_models/fcc.cpp
-    src/c_models/flexcyl_ellipX.cpp
-    src/c_models/flexiblecylinder.cpp
-    src/c_models/fractal.cpp
-    src/c_models/fuzzysphere.cpp
-    src/c_models/gamma_win.c
-    src/c_models/gaussian.cpp
-    src/c_models/Hardsphere.cpp
-    src/c_models/HayterMSA.cpp
-    src/c_models/hollowcylinder.cpp
-    src/c_models/lamellar.cpp
-    src/c_models/lamellarFF_HG.cpp
-    src/c_models/lamellarPC.cpp
-    src/c_models/lamellarPS.cpp
-    src/c_models/lamellarPS_HG.cpp
-    src/c_models/libfunc.c
-    src/c_models/librefl.c
-    src/c_models/logNormal.cpp
-    src/c_models/lorentzian.cpp
-    src/c_models/multishell.cpp
-    src/c_models/onion.cpp
-    src/c_models/parallelepiped.cpp
-    src/c_models/parameters.cpp
-    src/c_models/pearlnecklace.cpp
-    src/c_models/polygausscoil.cpp
-    src/c_models/refl.cpp
-    src/c_models/refl_adv.cpp
-    src/c_models/rpa.cpp
-    src/c_models/sc.cpp
-    src/c_models/schulz.cpp
-    src/c_models/sld_cal.cpp
-    src/c_models/sphere.cpp
-    src/c_models/spheresld.cpp
-    src/c_models/spheroid.cpp
-    src/c_models/SquareWell.cpp
-    src/c_models/stackeddisks.cpp
-    src/c_models/StickyHS.cpp
-    src/c_models/triaxialellipsoid.cpp
-    src/c_models/vesicle.cpp
-    src/libigor/GaussWeights.c
-    src/libigor/libCylinder.c
-    src/libigor/libSphere.c
-    src/libigor/libStructureFactor.c
-    src/libigor/libTwoPhase.c
-    )
-
-set ( INC_FILES
-    src/c_models/dispersion_visitor.hh
-    src/c_models/gamma_win.h
-    src/c_models/parameters.hh
-    include/barbell.h
-    include/bcc.h
-    include/binaryHS.h
-    include/capcyl.h
-    include/core_shell.h
-    include/core_shell_cylinder.h
-    include/corefourshell.h
-    include/csparallelepiped.h
-    include/cylinder.h
-    include/DiamCyl.h
-    include/DiamEllip.h
-    include/ellipsoid.h
-    include/elliptical_cylinder.h
-    include/fcc.h
-    include/flexcyl_ellipX.h
-    include/flexible_cylinder.h
-    include/fractal.h
-    include/fuzzysphere.h
-    include/gaussian.h
-    include/Hardsphere.h
-    include/HayterMSA.h
-    include/hollow_cylinder.h
-    include/lamellar.h
-    include/lamellarFF_HG.h
-    include/lamellarPC.h
-    include/lamellarPS.h
-    include/lamellarPS_HG.h
-    include/logNormal.h
-    include/lorentzian.h
-    include/multishell.h
-    include/onion.h
-    include/parallelepiped.h
-    include/pearlnecklace.h
-    include/polygausscoil.h
-    include/refl.h
-    include/refl_adv.h
-    include/rpa.h
-    include/sc.h
-    include/schulz.h
-    include/sld_cal.h
-    include/sphere.h
-    include/spheresld.h
-    include/spheroid.h
-    include/SquareWell.h
-    include/stacked_disks.h
-    include/StickyHS.h
-    include/triaxial_ellipsoid.h
-    include/vesicle.h
-    src/libigor/GaussWeights.h
-    src/libigor/libCylinder.h
-    src/libigor/libSASAnalysis.h
-    src/libigor/libSphere.h
-    src/libigor/libStructureFactor.h
-    src/libigor/libTwoPhase.h
-    src/libigor/StandardHeaders.h
-    src/libigor/winFuncs.h
-
-)
-    
-include_directories (src/libigor include src/c_models)
-
-# Add the target for this directory
-add_library ( models ${SRC_FILES} ${INC_FILES})
-add_executable( libraryTest test/library_test.cpp  ${INC_FILES})
-ADD_DEFINITIONS(-D__MODELS_STANDALONE__)
-ADD_DEPENDENCIES(libraryTest models)
-TARGET_LINK_LIBRARIES(libraryTest models)
Index: smodels/MANIFEST.IN
===================================================================
--- sasmodels/MANIFEST.IN	(revision 3a39c2e89f90377b2d15fa13b9ba9cf3b4144070)
+++ 	(revision )
@@ -1,10 +1,0 @@
-
-graft src/sas/models/libigor
-graft src/sas/models/c_smearer
-graft src/sas/models/c_models
-graft src/sas/models/c_extensions
-recursive-include sas *.h
-recursive-include sas *.hh
-include README.txt
-include license.txt
-include release_notes.txt
Index: smodels/generate_cmake.py
===================================================================
--- sasmodels/generate_cmake.py	(revision 3a39c2e89f90377b2d15fa13b9ba9cf3b4144070)
+++ 	(revision )
@@ -1,69 +1,0 @@
-"""
-    Script to generate a CMakeLists.txt file for cmake
-    
-    python generate_cmake.py
-    cd [your build location not in the source tree]
-    cmake [path to directory containing CMakeLists.txt]
-    make
-    
-    That will produce a library libModels.a
-"""
-import os
-f = open("CMakeLists.txt", "w")
-
-cmakelist = """# CMakeLists for SAS models
-cmake_minimum_required (VERSION 2.6)
-project (SasModels)
-
-# Version number
-set (SasModels_VERSION_MAJOR 1)
-set (SasModels_VERSION_MAJOR 0)
-
-set (SRC_FILES
-"""
-
-source_dirs = ["src/c_models",
-               "src/libigor"]
-excluded_src = ["c_models.cpp",
-                "disperser.c",
-                "winFuncs.c"]
-
-for src_dir in source_dirs:
-    for item in os.listdir(src_dir):
-        if item in excluded_src:
-            continue
-        ext = os.path.splitext(item)[1]
-        if ext in [".c",".cpp"]:
-            cmakelist += "    %s\n" % os.path.join(src_dir, item)
-
-cmakelist += "    )\n\n"    
-
-cmakelist += "set ( INC_FILES\n"    
-
-include_dirs = ["src/c_models",
-                "include",
-                "src/libigor"]
-
-for inc_dir in include_dirs:
-    for item in os.listdir(inc_dir):
-        ext = os.path.splitext(item)[1]
-        if ext in [".h",".hh"]:
-            cmakelist += "    %s\n" % os.path.join(inc_dir, item)
-    
-cmakelist += """
-)
-    
-include_directories (src/libigor include src/c_models)
-
-# Add the target for this directory
-add_library ( models ${SRC_FILES} ${INC_FILES})
-add_executable( libraryTest test/library_test.cpp  ${INC_FILES})
-ADD_DEFINITIONS(-D__MODELS_STANDALONE__)
-ADD_DEPENDENCIES(libraryTest models)
-TARGET_LINK_LIBRARIES(libraryTest models)
-"""
-
-f.write(cmakelist)
-f.close()
-
-    
Index: smodels/license.txt
===================================================================
--- sasmodels/license.txt	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,16 +1,0 @@
-This software was developed by the University of Tennessee as part of the
-Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-project funded by the US National Science Foundation. 
-
-If you use this program to do productive scientific research that leads
-to publication, we ask that you acknowledge use of the program by citing
-the following paper in your publication:
-
-P. Butler, M. Doucet, G. Alina, R. Cortes Hernandez, J. Zhou, P. Kienzle,
-Jae Hie Cho, Jessica T. Tumarkin
-"SANS analysis software", to be published.
-
-See the DANSE project web site for license information:
-http://wiki.cacr.caltech.edu/danse/index.php/Main_Page
-
-copyright 2008-2011, University of Tennessee
Index: smodels/setup.py
===================================================================
--- sasmodels/setup.py	(revision 038ccfe6ad2eb536e4120eb8a5bcd1c584ed0260)
+++ 	(revision )
@@ -1,151 +1,0 @@
-"""
- Installation script for SAS models
-"""
-
-import sys
-import os
-import platform
-from numpy.distutils.misc_util import get_numpy_include_dirs
-numpy_incl_path = os.path.join(get_numpy_include_dirs()[0], "numpy")
-   
-# Then build and install the modules
-from distutils.core import Extension, setup
-from distutils.command.build_ext import build_ext
-
-# Manage version number ######################################
-sys.path.append(os.path.join("src", "sas"))
-import models
-VERSION = models.__version__
-print "Building models v%s" % VERSION
-##############################################################
-
-# Options to enable OpenMP
-copt =  {'msvc': ['/openmp'],
-         'mingw32' : ['-fopenmp'],
-         'unix' : ['-fopenmp']}
-lopt =  {'msvc': ['/MANIFEST'],
-         'mingw32' : ['-fopenmp'],
-         'unix' : ['-lgomp']}
-
-# Options for non-openmp builds. MSVC always needs MANIFEST
-if sys.argv[-1] == "-nomp":
-    copt = {}
-    lopt = {'msvc': ['/MANIFEST']}
-
-class build_ext_subclass( build_ext ):
-    def build_extensions(self):
-        # Get 64-bitness
-        if sys.version_info >= (2, 6):
-            is_64bits = sys.maxsize > 2**32
-        else:
-            # 'sys.maxsize' and 64bit: Not supported for python2.5
-            is_64bits = False
-        c = self.compiler.compiler_type
-        print "Compiling with %s (64bit=%s)" % (c, str(is_64bits))
-        
-        if not (sys.platform=='darwin' and not is_64bits):
-            if copt.has_key(c):
-               for e in self.extensions:
-                   e.extra_compile_args = copt[ c ]
-            if lopt.has_key(c):
-                for e in self.extensions:
-                    e.extra_link_args = lopt[ c ]
-                    
-        build_ext.build_extensions(self)
-
-# Build the module name
-includedir  = "include"
-igordir = os.path.join("src", "libigor")
-c_model_dir = os.path.join("src", "c_models")
-smear_dir  = os.path.join("src", "c_smearer")
-wrapper_dir  = os.path.join("src", "python_wrapper", "generated")
-if not os.path.isdir(wrapper_dir):
-    os.makedirs(wrapper_dir)
-
-sys.path.append(os.path.join("src", "python_wrapper"))
-from wrapping import generate_wrappers
-generate_wrappers(header_dir=includedir, 
-                  output_dir=os.path.join("src", "sas", "models"), 
-                  c_wrapper_dir=wrapper_dir)
-
-IGNORED_FILES = [".svn"]
-if not os.name=='nt':
-    IGNORED_FILES.extend(["gamma_win.c","winFuncs.c"])
-
-EXTENSIONS = [".c", ".cpp"]
-
-def append_file(file_list, dir_path):
-    """
-    Add sources file to sources
-    """
-    for f in os.listdir(dir_path):
-        if os.path.isfile(os.path.join(dir_path, f)):
-            _, ext = os.path.splitext(f)
-            if ext.lower() in EXTENSIONS and f not in IGNORED_FILES:
-                file_list.append(os.path.join(dir_path, f)) 
-        elif os.path.isdir(os.path.join(dir_path, f)) and \
-                not f.startswith("."):
-            sub_dir = os.path.join(dir_path, f)
-            for new_f in os.listdir(sub_dir):
-                if os.path.isfile(os.path.join(sub_dir, new_f)):
-                    _, ext = os.path.splitext(new_f)
-                    if ext.lower() in EXTENSIONS and\
-                         new_f not in IGNORED_FILES:
-                        file_list.append(os.path.join(sub_dir, new_f)) 
-        
-model_sources = []
-append_file(file_list=model_sources, dir_path=igordir)
-append_file(file_list=model_sources, dir_path=c_model_dir)
-append_file(file_list=model_sources, dir_path=wrapper_dir)
-smear_sources = []
-append_file(file_list=smear_sources, dir_path=smear_dir)
-
-
-smearer_sources = [os.path.join(smear_dir, "smearer.cpp"),
-                  os.path.join(smear_dir, "smearer_module.cpp")]
-if os.name=='nt':
-    smearer_sources.append(os.path.join(igordir, "winFuncs.c"))
-
-dist = setup(
-    name="sasmodels",
-    version = VERSION,
-    description = "Python module for SAS scattering models",
-    author = "SasView Team",
-    author_email = "developers@sasview.org",
-    url = "https://github.com/SasView/sasview.git",
-    
-    # Place this module under the sas package
-    #ext_package = "sas",
-    
-    # Use the pure python modules
-    package_dir = {"sas":os.path.join("src", "sas"),
-                   "sas.models":os.path.join("src", "sas", "models"),
-                   "sas.models.sas_extension":os.path.join("src", "sas", "models", "sas_extension"),
-                  },
-    package_data={'sas.models': [os.path.join('media', "*")]},
-    packages = ["sas","sas.models",
-                "sas.models.sas_extension",],
-    
-    ext_modules = [ 
-                   
-        Extension("sas.models.sas_extension.c_models",
-                    sources=model_sources,                 
-                    include_dirs=[igordir, includedir, c_model_dir, numpy_incl_path],   
-                    ),
-
-        # Smearer extension
-        Extension("sas.models.sas_extension.smearer",
-                   sources = smearer_sources,
-                   include_dirs=[igordir, smear_dir, numpy_incl_path],
-                   ),
-                   
-        Extension("sas.models.sas_extension.smearer2d_helper",
-                  sources = [os.path.join(smear_dir, 
-                                          "smearer2d_helper_module.cpp"),
-                             os.path.join(smear_dir, "smearer2d_helper.cpp"),],
-                  include_dirs=[smear_dir,numpy_incl_path],
-                  )
-        ],
-    cmdclass = {'build_ext': build_ext_subclass }
-    )
-        
Index: c/sas/models/c_extension/Doxyfile
===================================================================
--- src/sas/models/c_extension/Doxyfile	(revision fd5ac0db8089df5bd882587f157d4bf317cfcf67)
+++ 	(revision )
@@ -1,266 +1,0 @@
-# Doxyfile 1.5.1-p1
-
-#---------------------------------------------------------------------------
-# Project related configuration options
-#---------------------------------------------------------------------------
-PROJECT_NAME           = sasmodeling
-PROJECT_NUMBER         = 
-OUTPUT_DIRECTORY       = ../doc
-CREATE_SUBDIRS         = NO
-OUTPUT_LANGUAGE        = English
-USE_WINDOWS_ENCODING   = NO
-BRIEF_MEMBER_DESC      = YES
-REPEAT_BRIEF           = YES
-ABBREVIATE_BRIEF       = "The $name class" \
-                         "The $name widget" \
-                         "The $name file" \
-                         is \
-                         provides \
-                         specifies \
-                         contains \
-                         represents \
-                         a \
-                         an \
-                         the
-ALWAYS_DETAILED_SEC    = NO
-INLINE_INHERITED_MEMB  = NO
-FULL_PATH_NAMES        = YES
-STRIP_FROM_PATH        = 
-STRIP_FROM_INC_PATH    = 
-SHORT_NAMES            = NO
-JAVADOC_AUTOBRIEF      = NO
-MULTILINE_CPP_IS_BRIEF = NO
-DETAILS_AT_TOP         = NO
-INHERIT_DOCS           = YES
-SEPARATE_MEMBER_PAGES  = NO
-TAB_SIZE               = 4
-ALIASES                = 
-OPTIMIZE_OUTPUT_FOR_C  = NO
-OPTIMIZE_OUTPUT_JAVA   = YES
-BUILTIN_STL_SUPPORT    = NO
-DISTRIBUTE_GROUP_DOC   = NO
-SUBGROUPING            = YES
-#---------------------------------------------------------------------------
-# Build related configuration options
-#---------------------------------------------------------------------------
-EXTRACT_ALL            = NO
-EXTRACT_PRIVATE        = NO
-EXTRACT_STATIC         = NO
-EXTRACT_LOCAL_CLASSES  = YES
-EXTRACT_LOCAL_METHODS  = NO
-HIDE_UNDOC_MEMBERS     = NO
-HIDE_UNDOC_CLASSES     = NO
-HIDE_FRIEND_COMPOUNDS  = NO
-HIDE_IN_BODY_DOCS      = NO
-INTERNAL_DOCS          = NO
-CASE_SENSE_NAMES       = YES
-HIDE_SCOPE_NAMES       = NO
-SHOW_INCLUDE_FILES     = YES
-INLINE_INFO            = YES
-SORT_MEMBER_DOCS       = YES
-SORT_BRIEF_DOCS        = NO
-SORT_BY_SCOPE_NAME     = NO
-GENERATE_TODOLIST      = YES
-GENERATE_TESTLIST      = YES
-GENERATE_BUGLIST       = YES
-GENERATE_DEPRECATEDLIST= YES
-ENABLED_SECTIONS       = 
-MAX_INITIALIZER_LINES  = 30
-SHOW_USED_FILES        = YES
-SHOW_DIRECTORIES       = YES
-FILE_VERSION_FILTER    = 
-#---------------------------------------------------------------------------
-# configuration options related to warning and progress messages
-#---------------------------------------------------------------------------
-QUIET                  = NO
-WARNINGS               = YES
-WARN_IF_UNDOCUMENTED   = YES
-WARN_IF_DOC_ERROR      = YES
-WARN_NO_PARAMDOC       = NO
-WARN_FORMAT            = "$file:$line: $text"
-WARN_LOGFILE           = 
-#---------------------------------------------------------------------------
-# configuration options related to the input files
-#---------------------------------------------------------------------------
-INPUT                  = .
-FILE_PATTERNS          = *.c \
-                         *.cc \
-                         *.cxx \
-                         *.cpp \
-                         *.c++ \
-                         *.d \
-                         *.java \
-                         *.ii \
-                         *.ixx \
-                         *.ipp \
-                         *.i++ \
-                         *.inl \
-                         *.h \
-                         *.hh \
-                         *.hxx \
-                         *.hpp \
-                         *.h++ \
-                         *.idl \
-                         *.odl \
-                         *.cs \
-                         *.php \
-                         *.php3 \
-                         *.inc \
-                         *.m \
-                         *.mm \
-                         *.dox \
-                         *.py
-RECURSIVE              = YES
-EXCLUDE                = build \
-                         dist \
-                         sas/models/test \
-                         libigor \
-                         igor_wrapper \
-                         sas/models/prototypes
-EXCLUDE_SYMLINKS       = NO
-EXCLUDE_PATTERNS       = 
-EXAMPLE_PATH           = 
-EXAMPLE_PATTERNS       = *
-EXAMPLE_RECURSIVE      = NO
-IMAGE_PATH             = ../doc
-INPUT_FILTER           = 
-FILTER_PATTERNS        = 
-FILTER_SOURCE_FILES    = NO
-#---------------------------------------------------------------------------
-# configuration options related to source browsing
-#---------------------------------------------------------------------------
-SOURCE_BROWSER         = NO
-INLINE_SOURCES         = NO
-STRIP_CODE_COMMENTS    = YES
-REFERENCED_BY_RELATION = NO
-REFERENCES_RELATION    = NO
-REFERENCES_LINK_SOURCE = YES
-USE_HTAGS              = NO
-VERBATIM_HEADERS       = YES
-#---------------------------------------------------------------------------
-# configuration options related to the alphabetical class index
-#---------------------------------------------------------------------------
-ALPHABETICAL_INDEX     = NO
-COLS_IN_ALPHA_INDEX    = 5
-IGNORE_PREFIX          = 
-#---------------------------------------------------------------------------
-# configuration options related to the HTML output
-#---------------------------------------------------------------------------
-GENERATE_HTML          = YES
-HTML_OUTPUT            = html
-HTML_FILE_EXTENSION    = .html
-HTML_HEADER            = 
-HTML_FOOTER            = 
-HTML_STYLESHEET        = 
-HTML_ALIGN_MEMBERS     = YES
-GENERATE_HTMLHELP      = NO
-CHM_FILE               = 
-HHC_LOCATION           = 
-GENERATE_CHI           = NO
-BINARY_TOC             = NO
-TOC_EXPAND             = NO
-DISABLE_INDEX          = NO
-ENUM_VALUES_PER_LINE   = 4
-GENERATE_TREEVIEW      = NO
-TREEVIEW_WIDTH         = 250
-#---------------------------------------------------------------------------
-# configuration options related to the LaTeX output
-#---------------------------------------------------------------------------
-GENERATE_LATEX         = NO
-LATEX_OUTPUT           = latex
-LATEX_CMD_NAME         = latex
-MAKEINDEX_CMD_NAME     = makeindex
-COMPACT_LATEX          = NO
-PAPER_TYPE             = a4wide
-EXTRA_PACKAGES         = 
-LATEX_HEADER           = 
-PDF_HYPERLINKS         = NO
-USE_PDFLATEX           = YES
-LATEX_BATCHMODE        = NO
-LATEX_HIDE_INDICES     = NO
-#---------------------------------------------------------------------------
-# configuration options related to the RTF output
-#---------------------------------------------------------------------------
-GENERATE_RTF           = NO
-RTF_OUTPUT             = rtf
-COMPACT_RTF            = NO
-RTF_HYPERLINKS         = NO
-RTF_STYLESHEET_FILE    = 
-RTF_EXTENSIONS_FILE    = 
-#---------------------------------------------------------------------------
-# configuration options related to the man page output
-#---------------------------------------------------------------------------
-GENERATE_MAN           = NO
-MAN_OUTPUT             = man
-MAN_EXTENSION          = .3
-MAN_LINKS              = NO
-#---------------------------------------------------------------------------
-# configuration options related to the XML output
-#---------------------------------------------------------------------------
-GENERATE_XML           = NO
-XML_OUTPUT             = xml
-XML_SCHEMA             = 
-XML_DTD                = 
-XML_PROGRAMLISTING     = YES
-#---------------------------------------------------------------------------
-# configuration options for the AutoGen Definitions output
-#---------------------------------------------------------------------------
-GENERATE_AUTOGEN_DEF   = NO
-#---------------------------------------------------------------------------
-# configuration options related to the Perl module output
-#---------------------------------------------------------------------------
-GENERATE_PERLMOD       = NO
-PERLMOD_LATEX          = NO
-PERLMOD_PRETTY         = YES
-PERLMOD_MAKEVAR_PREFIX = 
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor   
-#---------------------------------------------------------------------------
-ENABLE_PREPROCESSING   = YES
-MACRO_EXPANSION        = NO
-EXPAND_ONLY_PREDEF     = NO
-SEARCH_INCLUDES        = YES
-INCLUDE_PATH           = 
-INCLUDE_FILE_PATTERNS  = 
-PREDEFINED             = 
-EXPAND_AS_DEFINED      = 
-SKIP_FUNCTION_MACROS   = YES
-#---------------------------------------------------------------------------
-# Configuration::additions related to external references   
-#---------------------------------------------------------------------------
-TAGFILES               = 
-GENERATE_TAGFILE       = 
-ALLEXTERNALS           = NO
-EXTERNAL_GROUPS        = YES
-PERL_PATH              = /usr/bin/perl
-#---------------------------------------------------------------------------
-# Configuration options related to the dot tool   
-#---------------------------------------------------------------------------
-CLASS_DIAGRAMS         = YES
-HIDE_UNDOC_RELATIONS   = YES
-HAVE_DOT               = YES
-CLASS_GRAPH            = YES
-COLLABORATION_GRAPH    = NO
-GROUP_GRAPHS           = YES
-UML_LOOK               = YES
-TEMPLATE_RELATIONS     = YES
-INCLUDE_GRAPH          = YES
-INCLUDED_BY_GRAPH      = YES
-CALL_GRAPH             = YES
-CALLER_GRAPH           = YES
-GRAPHICAL_HIERARCHY    = YES
-DIRECTORY_GRAPH        = YES
-DOT_IMAGE_FORMAT       = png
-DOT_PATH               = 
-DOTFILE_DIRS           = 
-MAX_DOT_GRAPH_WIDTH    = 1024
-MAX_DOT_GRAPH_HEIGHT   = 1024
-MAX_DOT_GRAPH_DEPTH    = 1000
-DOT_TRANSPARENT        = NO
-DOT_MULTI_TARGETS      = NO
-GENERATE_LEGEND        = YES
-DOT_CLEANUP            = YES
-#---------------------------------------------------------------------------
-# Configuration::additions related to the search engine   
-#---------------------------------------------------------------------------
-SEARCHENGINE           = NO
Index: c/sas/models/c_extension/c_models/disperser.c
===================================================================
--- src/sas/models/c_extension/c_models/disperser.c	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,470 +1,0 @@
-/** 
- * Disperser
- * 
- * Python class that takes a model and averages its output
- * for a distribution of its parameters.
- * 
- * The parameters to be varied are specified at instantiation time.
- * The distributions are Gaussian, with std deviations specified for
- * each parameter at instantiation time.
- * 
- * @author   M.Doucet / UTK 
- */
-
-#include <Python.h>
-#include "structmember.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <time.h>
-
-/// Error object for raised exceptions
-static PyObject * DisperserError = NULL;
-
-// Class definition
-typedef struct {
-  PyObject_HEAD
-  /// Dictionary of parameters for this class
-  PyObject * params;
-  /// Model object to disperse
-  PyObject * model;
-  /// Array of original values
-  double * centers;
-  /// Number of parameters to disperse
-  int n_pars;
-  /// Coordinate system flag
-  int cylindrical;
-} Disperser;
-
-// Function definitions
-double disperseParam(Disperser *self, int iPar, PyObject * pars);
-double Disperser_readDouble(PyObject *p);
-
-/**
- * Function to deallocate memory for the object
- */
-static void
-Disperser_dealloc(Disperser * self) {
-  free(self->centers);
-  self->ob_type->tp_free((PyObject*)self);
-}
-
-/**
- * Function to create a new Disperser object
- */
-static PyObject *
-Disperser_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
-{
-  Disperser *self;
-
-  self = (Disperser *)type->tp_alloc(type, 0);
-
-  return (PyObject *)self;
-}
-
-/**
- * Initialization of the object (__init__)
- */
-static int
-Disperser_init(Disperser *self, PyObject *args, PyObject *kwds)
-{
-  PyObject * model;
-  PyObject * paramList;
-  PyObject * sigmaList;
-
-  if (self != NULL) {
-
-    // Create parameters
-    self->params = PyDict_New();
-
-    // Get input
-    if ( !PyArg_ParseTuple(args,"OOO",&model, &paramList, &sigmaList) ) {
-      PyErr_SetString(DisperserError,
-          "Disperser: could not parse to initialize. Need Disperser(model, paramList, sigmaList)");
-      return -1;
-    }
-
-    // Check that the lists are of the right type
-    if( PyList_Check(paramList)!=1 || PyList_Check(sigmaList)!=1 ) {
-      PyErr_SetString(DisperserError,
-          "Disperser: bad input parameters; did not find lists.");
-      return -1;
-    }
-
-    // Check that the list lengths are compatible
-    if( PyList_GET_SIZE(paramList) != PyList_GET_SIZE(sigmaList) ) {
-      PyErr_SetString(DisperserError,
-          "Disperser: supplied lists are not of the same length.");
-      return -1;
-    }
-
-    // Set the data members
-    self->model = model;
-
-    // Number of parameters to disperse
-    // Let run() find out since values can change
-    self->n_pars = 0;
-
-    // Set default coordinate system as cartesian
-    self->cylindrical = 0;
-
-    // Initialize parameter dictionary
-    // Store the list of parameter names (strings)
-    PyDict_SetItemString(self->params,"paramList", paramList);
-
-    // Store the list of std deviations (floats)
-    PyDict_SetItemString(self->params,"sigmaList", sigmaList);
-
-    // Set the default number of points to average over
-    PyDict_SetItemString(self->params,"n_pts",Py_BuildValue("i",25));
-  }
-  return 0;
-}
-
-/**
- * List of member to make public
- * Only the parameters and the model are available to python users
- */
-static PyMemberDef Disperser_members[] = {
-    {"params", T_OBJECT, offsetof(Disperser, params), 0,
-        "Parameters"},
-        {"model", T_OBJECT, offsetof(Disperser, model), 0,
-            "Model to disperse"},
-            {NULL}  /* Sentinel */
-};
-
-/** Read double from PyObject
- *	TODO: THIS SHOULD REALLY BE ELSEWHERE!
- *   @param p PyObject
- *   @return double
- */
-double Disperser_readDouble(PyObject *p) {
-  double value = 0.0;
-
-  if (PyFloat_Check(p)==1) {
-    value = (double)(((PyFloatObject *)(p))->ob_fval);
-    //Py_DECREF(p);
-    return value;
-  } else if (PyInt_Check(p)==1) {
-    value = (double)(((PyIntObject *)(p))->ob_ival);
-    //Py_DECREF(p);
-    return value;
-  } else if (PyLong_Check(p)==1) {
-    value = (double)PyLong_AsLong(p);
-    //Py_DECREF(p);
-    return value;
-  } else {
-    //Py_DECREF(p);
-    return 0.0;
-  }
-}
-
-
-/**
- * Function to call to evaluate model
- * @param args: input q or [qx,qy]
- * @return: function value
- */
-static PyObject * runXY(Disperser *self, PyObject *args) {
-  PyObject* pars;
-  int n_pts;
-  int i;
-  double value;
-  PyObject * result;
-  PyObject * temp;
-
-  // Get parameters
-
-  // Check that the lists are of the right type
-  if( PyList_Check(PyDict_GetItemString(self->params, "paramList"))!=1
-      || PyList_Check(PyDict_GetItemString(self->params, "sigmaList"))!=1 ) {
-    PyErr_SetString(DisperserError,
-        "Disperser: bad input parameters; did not find lists.");
-    return NULL;
-  }
-
-  // Reader parameter dictionary
-  n_pts = PyInt_AsLong( PyDict_GetItemString(self->params, "n_pts") );
-
-  // Check that the list lengths are compatible
-  if( PyList_GET_SIZE(PyDict_GetItemString(self->params, "paramList"))
-      != PyList_GET_SIZE(PyDict_GetItemString(self->params, "sigmaList")) ) {
-    PyErr_SetString(DisperserError,
-        "Disperser: supplied lists are not of the same length.");
-    return NULL;
-  }
-
-  // Number of parameters to disperse
-  self->n_pars = PyList_GET_SIZE(PyDict_GetItemString(self->params, "paramList"));
-
-  // Allocate memory for centers
-  free(self->centers);
-  self->centers = (double *)malloc(self->n_pars * sizeof(double));
-  if(self->centers==NULL) {
-    PyErr_SetString(DisperserError,
-        "Disperser.run could not allocate memory.");
-    return NULL;
-  }
-
-  // Store initial values of those parameters
-  for( i=0; i<self->n_pars; i++ ) {
-    result = PyObject_CallMethod(self->model, "getParam", "(O)",
-        PyList_GetItem( PyDict_GetItemString(self->params, "paramList"), i ));
-
-    if( result == NULL ) {
-      PyErr_SetString(DisperserError,
-          "Disperser.run could not get current parameter values.");
-      return NULL;
-    } else {
-      self->centers[i] = Disperser_readDouble(result);
-      Py_DECREF(result);
-    };
-  }
-
-  // Get input and determine whether we have to supply a 1D or 2D return value.
-  if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-    PyErr_SetString(DisperserError,
-        "Disperser.run expects a q value.");
-    return NULL;
-  }
-
-  // Evaluate or calculate average
-  if( self->n_pars > 0 ) {
-    value = disperseParam(self, 0, pars);
-  } else {
-    if (self->cylindrical==1) {
-      result = PyObject_CallMethod(self->model, "run", "(O)",pars);
-    } else {
-      result = PyObject_CallMethod(self->model, "runXY", "(O)",pars);
-    }
-
-    if( result == NULL ) {
-      PyErr_SetString(DisperserError,
-          "Disperser.run failed.");
-      return NULL;
-    } else {
-      Py_DECREF(result);
-      return result;
-    }
-  }
-
-  // Put back the original model parameter values
-  for( i=0; i<self->n_pars; i++ ) {
-    // Maybe we need to decref the double here?
-    temp = Py_BuildValue("d", self->centers[i]);
-    result = PyObject_CallMethod(self->model, "setParam", "(OO)",
-        PyList_GetItem( PyDict_GetItemString(self->params, "paramList"), i ),
-        temp );
-    Py_DECREF(temp);
-
-    if( result == NULL ) {
-      PyErr_SetString(DisperserError,
-          "Disperser.run could not set back original parameter values.");
-      return NULL;
-    } else {
-      Py_DECREF(result);
-    };
-  }
-
-  return Py_BuildValue("d",value);
-
-}
-
-/**
- * Function to call to evaluate model
- * @param args: input q or [q,phi]
- * @return: function value
- */
-static PyObject * run(Disperser *self, PyObject *args) {
-  PyObject * output;
-  self->cylindrical = 1;
-  output = runXY(self, args);
-  self->cylindrical = 0;
-  return output;
-}
-
-
-
-
-/**
- * Gaussian weight
- * @param mean: mean value of the Gaussian
- * @param sigma: standard deviation of the Gaussian
- * @param x: value at which the Gaussian is evaluated
- * @return: value of the Gaussian
- */
-double gaussian_weight(double mean, double sigma, double x) {
-  double vary, expo_value;
-  vary = x-mean;
-  expo_value = -vary*vary/(2*sigma*sigma);
-  //return 1.0;
-  return exp(expo_value);
-}
-
-/**
- * @param iPar: ID of parameter to disperse
- * @param pars: input parameter to the evaluation function
- */
-double disperseParam(Disperser *self, int iPar, PyObject * pars) {
-  double sigma;
-  double min_value, max_value;
-  double step;
-  double prev_value;
-  double value_sum;
-  double gauss_sum;
-  double gauss_value;
-  double func_value;
-  double error_sys;
-  double value;
-  int i, n_pts;
-  PyObject *result;
-  PyObject *temp;
-
-  step = 0.0;
-  n_pts = PyInt_AsLong( PyDict_GetItemString(self->params, "n_pts") );
-
-  // If we exhausted the parameter array, simply evaluate
-  // the model
-  if( iPar < self->n_pars ) {
-
-    // Average over Gaussian distribution (2 sigmas)
-    value_sum = 0.0;
-    gauss_sum = 0.0;
-
-    // Get the standard deviation for this parameter
-    sigma = Disperser_readDouble(PyList_GetItem( PyDict_GetItemString(self->params, "sigmaList"), iPar ));
-
-    // Average over 4 sigmas wide
-    min_value = self->centers[iPar] - 2*sigma;
-    max_value = self->centers[iPar] + 2*sigma;
-
-    // Calculate step size
-    step = (max_value - min_value)/(n_pts-1);
-
-    // If we are not changing the parameter, just return the
-    // value of the function
-    if (step == 0.0) {
-      return disperseParam(self, iPar+1, pars);
-    }
-
-    // Compute average
-    prev_value = 0.0;
-    error_sys  = 0.0;
-    for( i=0; i<n_pts; i++ ) {
-      // Set the parameter value
-      value = min_value + (double)i*step;
-
-      temp = Py_BuildValue("d", value);
-      result = PyObject_CallMethod(self->model, "setParam", "(OO)",
-          PyList_GetItem( PyDict_GetItemString(self->params, "paramList"), iPar ),
-          temp);
-      Py_DECREF(temp);
-
-      if( result == NULL ) {
-        printf("Could not set param %i\n", iPar);
-        // return a value that will create an NAN
-        return 0.0/(step-step);
-      } else {
-        Py_DECREF(result);
-      }
-
-      gauss_value = gaussian_weight(self->centers[iPar], sigma, value);
-      func_value = disperseParam(self, iPar+1, pars);
-
-      value_sum += gauss_value * func_value;
-      gauss_sum += gauss_value;
-    }
-    return value_sum/gauss_sum;
-
-  } else {
-    if (self->cylindrical==1) {
-      result = PyObject_CallMethod(self->model, "run", "(O)",pars);
-    } else {
-      result = PyObject_CallMethod(self->model, "runXY", "(O)",pars);
-    }
-    if( result == NULL ) {
-      printf("Model.run() could not return\n");
-      // return a value that will create an NAN
-      return 0.0/(step-step);
-    } else {
-      value = Disperser_readDouble(result);
-      Py_DECREF(result);
-      return value;
-    }
-  }
-
-}
-
-static PyMethodDef Disperser_methods[] = {
-    {"run",      (PyCFunction)run     , METH_VARARGS,
-        "Evaluate the model at a given input value"},
-        {"runXY",      (PyCFunction)runXY     , METH_VARARGS,
-            "Evaluate the model at a given input value"},
-            {NULL}
-};
-
-static PyTypeObject DisperserType = {
-    PyObject_HEAD_INIT(NULL)
-    0,                         /*ob_size*/
-    "Disperser",             /*tp_name*/
-    sizeof(Disperser),             /*tp_basicsize*/
-    0,                         /*tp_itemsize*/
-    (destructor)Disperser_dealloc, /*tp_dealloc*/
-    0,                         /*tp_print*/
-    0,                         /*tp_getattr*/
-    0,                         /*tp_setattr*/
-    0,                         /*tp_compare*/
-    0,                         /*tp_repr*/
-    0,                         /*tp_as_number*/
-    0,                         /*tp_as_sequence*/
-    0,                         /*tp_as_mapping*/
-    0,                         /*tp_hash */
-    0,                         /*tp_call*/
-    0,                         /*tp_str*/
-    0,                         /*tp_getattro*/
-    0,                         /*tp_setattro*/
-    0,                         /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
-    "Disperser objects",           /* tp_doc */
-    0,		               /* tp_traverse */
-    0,		               /* tp_clear */
-    0,		               /* tp_richcompare */
-    0,		               /* tp_weaklistoffset */
-    0,		               /* tp_iter */
-    0,		               /* tp_iternext */
-    Disperser_methods,             /* tp_methods */
-    Disperser_members,             /* tp_members */
-    0,                         /* tp_getset */
-    0,                         /* tp_base */
-    0,                         /* tp_dict */
-    0,                         /* tp_descr_get */
-    0,                         /* tp_descr_set */
-    0,                         /* tp_dictoffset */
-    (initproc)Disperser_init,      /* tp_init */
-    0,                         /* tp_alloc */
-    Disperser_new,                 /* tp_new */
-};
-
-
-//static PyMethodDef module_methods[] = {
-//    {NULL}
-//};
-
-/**
- * Function used to add the model class to a module
- * @param module: module to add the class to
- */ 
-void addDisperser(PyObject *module) {
-  PyObject *d;
-
-  if (PyType_Ready(&DisperserType) < 0)
-    return;
-
-  Py_INCREF(&DisperserType);
-  PyModule_AddObject(module, "Disperser", (PyObject *)&DisperserType);
-
-  d = PyModule_GetDict(module);
-  DisperserError = PyErr_NewException("Disperser.error", NULL, NULL);
-  PyDict_SetItemString(d, "DisperserError", DisperserError);
-}
-
Index: c/sas/models/c_extension/c_models/dispersion_visitor.hh
===================================================================
--- src/sas/models/c_extension/c_models/dispersion_visitor.hh	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,36 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-#ifndef DISP_VISIT_H
-#define DISP_VISIT_H
-
-class DispersionVisitor {
-public:
-	void dispersion_to_dict(void *, void *);
-	void gaussian_to_dict(void *, void *);
-	void rectangle_to_dict(void *, void *);
-	void lognormal_to_dict(void *, void *);
-	void schulz_to_dict(void*, void *);
-	void array_to_dict(void *, void *);
-
-	void dispersion_from_dict(void*, void *);
-	void gaussian_from_dict(void*, void *);
-	void rectangle_from_dict(void*, void *);
-	void lognormal_from_dict(void*, void *);
-	void schulz_from_dict(void*, void *);
-	void array_from_dict(void*, void *);
-
-};
-
-
-#endif
Index: c/sas/models/c_extension/c_models/gamma_win.c
===================================================================
--- src/sas/models/c_extension/c_models/gamma_win.c	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,141 +1,0 @@
-// Visit http://www.johndcook.com/stand_alone_code.html for the source of this code and more like it.
-// Modified for the DANSE project.
-
-#include <math.h>
-
-#include "gamma_win.h"
-
-// Note that the functions Gamma and LogGamma are mutually dependent.
-
-double gamma(double x)
-{
-  // Split the function domain into three intervals:
-  // (0, 0.001), [0.001, 12), and (12, infinity)
-
-  ///////////////////////////////////////////////////////////////////////////
-  // First interval: (0, 0.001)
-  //
-  // For small x, 1/Gamma(x) has power series x + gamma x^2  - ...
-  // So in this range, 1/Gamma(x) = x + gamma x^2 with error on the order of x^3.
-  // The relative error over this interval is less than 6e-7.
-
-  const double gamma = 0.577215664901532860606512090; // Euler's gamma constant
-  double y;
-  int arg_was_less_than_one = 0;
-  int n = 0;
-  // numerator coefficients for approximation over the interval (1,2)
-  static const double p[] =
-  {
-      -1.71618513886549492533811E+0,
-       2.47656508055759199108314E+1,
-      -3.79804256470945635097577E+2,
-       6.29331155312818442661052E+2,
-       8.66966202790413211295064E+2,
-      -3.14512729688483675254357E+4,
-      -3.61444134186911729807069E+4,
-       6.64561438202405440627855E+4
-  };
-  // denominator coefficients for approximation over the interval (1,2)
-  static const double q[] =
-  {
-      -3.08402300119738975254353E+1,
-       3.15350626979604161529144E+2,
-      -1.01515636749021914166146E+3,
-      -3.10777167157231109440444E+3,
-       2.25381184209801510330112E+4,
-       4.75584627752788110767815E+3,
-      -1.34659959864969306392456E+5,
-      -1.15132259675553483497211E+5
-  };
-  double num = 0.0;
-  double den = 1.0;
-  int i;
-  double z;
-  double result;
-
-  if (x < 0.001)
-      return 1.0/(x*(1.0 + gamma*x));
-
-  ///////////////////////////////////////////////////////////////////////////
-  // Second interval: [0.001, 12)
-
-  if (x < 12.0)
-    {
-      // The algorithm directly approximates gamma over (1,2) and uses
-      // reduction identities to reduce other arguments to this interval.
-
-      y = x;
-
-      if (y < 1.0) arg_was_less_than_one = 1;
-
-      // Add or subtract integers as necessary to bring y into (1,2)
-      // Will correct for this below
-      if (arg_was_less_than_one==1) {
-          y += 1.0;
-      } else {
-          n = (int) (floor(y)) - 1;  // will use n later
-          y -= n;
-      }
-
-      z = y - 1;
-      for (i = 0; i < 8; i++) {
-          num = (num + p[i])*z;
-          den = den*z + q[i];
-      }
-      result = num/den + 1.0;
-
-      // Apply correction if argument was not initially in (1,2)
-      if (arg_was_less_than_one==1) {
-          // Use identity gamma(z) = gamma(z+1)/z
-          // The variable "result" now holds gamma of the original y + 1
-          // Thus we use y-1 to get back the orginal y.
-          result /= (y-1.0);
-      } else {
-          // Use the identity gamma(z+n) = z*(z+1)* ... *(z+n-1)*gamma(z)
-          for (i = 0; i < n; i++)
-              result *= y++;
-      }
-
-      return result;
-    }
-
-    return exp(lgamma(x));
-}
-
-double lgamma (double x)
-{
-  static const double c[8] =
-  {
-   1.0/12.0,
-  -1.0/360.0,
-  1.0/1260.0,
-  -1.0/1680.0,
-  1.0/1188.0,
-  -691.0/360360.0,
-  1.0/156.0,
-  -3617.0/122400.0
-  };
-  double z = 1.0/(x*x);
-  double sum = c[7];
-  static const double halfLogTwoPi = 0.91893853320467274178032973640562;
-  double series;
-  double logGamma;
-  int i;
-
-  if (x < 12.0) {
-     return log(fabs(gamma(x)));
-  }
-
-  // Abramowitz and Stegun 6.1.41
-  // Asymptotic series should be good to at least 11 or 12 figures
-  // For error analysis, see Whittiker and Watson
-  // A Course in Modern Analysis (1927), page 252
-
-  for (i=6; i >= 0; i--) {
-      sum *= z;
-      sum += c[i];
-  }
-  series = sum/x;
-  logGamma = (x - 0.5)*log(x) - x + halfLogTwoPi + series;
-  return logGamma;
-}
Index: c/sas/models/c_extension/c_models/gamma_win.h
===================================================================
--- src/sas/models/c_extension/c_models/gamma_win.h	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,19 +1,0 @@
-// Visit http://www.johndcook.com/stand_alone_code.html for the source of this code and more like it.
-
-#ifndef GAMMA_H
-#define GAMMA_H
-
-// Note that the functions Gamma and LogGamma are mutually dependent.
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-double lgamma(double);
-double gamma(double);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
Index: c/sas/models/c_extension/c_models/parameters.hh
===================================================================
--- src/sas/models/c_extension/c_models/parameters.hh	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,176 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-#ifndef PARAM_CLASS_H
-#define PARAM_CLASS_H
-/**
- * TODO: will need to write a bridge class
- * to convert the dispersion model parameters
- * into dictionary parameters for python.
- */
-#include <vector>
-#include "dispersion_visitor.hh"
-
-using namespace std;
-
-/**
- * Weight point class to hold averaging points
- */
-class WeightPoint {
-public:
-	/// Value of the weight point
-	double value;
-	/// Weight of the weight point
-	double weight;
-
-	WeightPoint();
-	WeightPoint(double, double);
-};
-
-/**
- * Basic averaging model. The class instance will
- * generate a flat distribution of weight points
- * according to the number of points specified
- * and the width of the distribution. The center
- * of the distribution is specified by the
- * Parameter object taken in as a parameter.
- */
-class DispersionModel {
-public:
-	/// Number of points to average over
-	int npts;
-	/// Width of the distribution (step function)
-	double width;
-
-	DispersionModel();
-	/// Method that generates the weight points
-	virtual void operator()(void *, vector<WeightPoint>&);
-	virtual void set_weights(int, double*, double*);
-	virtual void accept_as_source(DispersionVisitor*, void*, void*);
-	virtual void accept_as_destination(DispersionVisitor*, void*, void*);
-};
-
-
-/**
- * Gaussian dispersion model
- */
-class GaussianDispersion: public DispersionModel {
-public:
-	/// Number of sigmas on each side of the mean
-	double nsigmas;
-
-	GaussianDispersion();
-	void operator()(void *, vector<WeightPoint>&);
-	void accept_as_source(DispersionVisitor*, void*, void*);
-	void accept_as_destination(DispersionVisitor*, void*, void*);
-};
-
-/**
- * Flat dispersion model
- */
-class RectangleDispersion: public DispersionModel {
-public:
-	/// Number of sigmas on each side of the mean
-	double nsigmas;
-
-	RectangleDispersion();
-	void operator()(void *, vector<WeightPoint>&);
-	void accept_as_source(DispersionVisitor*, void*, void*);
-	void accept_as_destination(DispersionVisitor*, void*, void*);
-};
-
-/**
- * Schulz dispersion model
- */
-class SchulzDispersion: public DispersionModel {
-public:
-	/// Number of sigmas on each side of the mean
-	double nsigmas;
-
-	SchulzDispersion();
-	void operator()(void *, vector<WeightPoint>&);
-	void accept_as_source(DispersionVisitor*, void*, void*);
-	void accept_as_destination(DispersionVisitor*, void*, void*);
-};
-
-/**
- * LogNormal dispersion model
- */
-class LogNormalDispersion: public DispersionModel {
-public:
-	/// Number of sigmas on each side of the mean
-	double nsigmas;
-
-	LogNormalDispersion();
-	void operator()(void *, vector<WeightPoint>&);
-	void accept_as_source(DispersionVisitor*, void*, void*);
-	void accept_as_destination(DispersionVisitor*, void*, void*);
-};
-
-
-/**
- * Dispersion model based on arrays provided by the user
- */
-class ArrayDispersion: public DispersionModel {
-private:
-	/// Array of values
-	double* _values;
-	/// Array of weights
-	double* _weights;
-
-	/// Method to set the weight points from arrays
-	void set_weights(int, double*, double*);
-	void operator()(void *, vector<WeightPoint>&);
-	void accept_as_source(DispersionVisitor*, void*, void*);
-	void accept_as_destination(DispersionVisitor*, void*, void*);
-public:
-
-};
-
-/**
- * Parameter class to hold information about a
- * parameter.
- */
-class Parameter {
-public:
-	/// Current value of the parameter
-	double value;
-	/// True if the parameter has a minimum bound
-	bool has_min;
-	/// True if the parameter has a maximum bound
-	bool has_max;
-	/// Minimum bound
-	double min;
-	/// Maximum bound
-	double max;
-	/// True if the parameter can be dispersed or averaged
-	bool has_dispersion;
-	/// Pointer to the dispersion model object for this parameter
-	DispersionModel* dispersion;
-
-	Parameter();
-	Parameter(double);
-	Parameter(double, bool);
-
-	/// Method to set a minimum value
-	void set_min(double);
-	/// Method to set a maximum value
-	void set_max(double);
-	/// Method to get weight points for this parameter
-	void get_weights(vector<WeightPoint>&);
-	/// Returns the value of the parameter
-	double operator()();
-	/// Sets the value of the parameter
-	double operator=(double);
-};
-#endif
Index: c/sas/models/c_extension/c_smearer/smearer.cpp
===================================================================
--- src/sas/models/c_extension/c_smearer/smearer.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,373 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2009, University of Tennessee
- */
-#include "smearer.hh"
-#include <stdio.h>
-#include <math.h>
-using namespace std;
-
-#if defined(_MSC_VER)
-extern "C" {
-#include "winFuncs.h"
-}
-#endif
-/**
- * Constructor for BaseSmearer
- *
- * @param qmin: minimum Q value
- * @param qmax: maximum Q value
- * @param nbins: number of Q bins
- */
-BaseSmearer :: BaseSmearer(double qmin, double qmax, int nbins) {
-	// Number of bins
-	this->nbins = nbins;
-	this->qmin = qmin;
-	this->qmax = qmax;
-	// Flag to keep track of whether we have a smearing matrix or
-	// whether we need to compute one
-	has_matrix = false;
-	even_binning = true;
-};
-
-/**
- * Constructor for BaseSmearer
- *
- * Used for uneven binning
- * @param q: array of Q values
- * @param nbins: number of Q bins
- */
-BaseSmearer :: BaseSmearer(double* q, int nbins) {
-	// Number of bins
-	this->nbins = nbins;
-	this->q_values = q;
-	// Flag to keep track of whether we have a smearing matrix or
-	// whether we need to compute one
-	has_matrix = false;
-	even_binning = false;
-};
-
-/**
- * Constructor for SlitSmearer
- *
- * @param width: slit width in Q units
- * @param height: slit height in Q units
- * @param qmin: minimum Q value
- * @param qmax: maximum Q value
- * @param nbins: number of Q bins
- */
-SlitSmearer :: SlitSmearer(double width, double height, double qmin, double qmax, int nbins) :
-	BaseSmearer(qmin, qmax, nbins){
-	this->height = height;
-	this->width = width;
-};
-
-/**
- * Constructor for SlitSmearer
- *
- * @param width: slit width in Q units
- * @param height: slit height in Q units
- * @param q: array of Q values
- * @param nbins: number of Q bins
- */
-SlitSmearer :: SlitSmearer(double width, double height, double* q, int nbins) :
-	BaseSmearer(q, nbins){
-	this->height = height;
-	this->width = width;
-};
-
-/**
- * Constructor for QSmearer
- *
- * @param width: array slit widths for each Q point, in Q units
- * @param qmin: minimum Q value
- * @param qmax: maximum Q value
- * @param nbins: number of Q bins
- */
-QSmearer :: QSmearer(double* width, double qmin, double qmax, int nbins) :
-	BaseSmearer(qmin, qmax, nbins){
-	this->width = width;
-};
-
-/**
- * Constructor for QSmearer
- *
- * @param width: array slit widths for each Q point, in Q units
- * @param q: array of Q values
- * @param nbins: number of Q bins
- */
-QSmearer :: QSmearer(double* width, double* q, int nbins) :
-	BaseSmearer(q, nbins){
-	this->width = width;
-};
-
-/**
- * Compute the slit smearing matrix
- *
- * For even binning (q_min to q_max with nbins):
- *
- *   step = (q_max-q_min)/(nbins-1)
- *   first bin goes from q_min to q_min+step
- *   last bin goes from q_max to q_max+step
- *
- * For binning according to q array:
- *
- * Each q point represents a bin going from half the distance between it
- * and the previous point to half the distance between it and the next point.
- *
- *    Example: bin i goes from (q_values[i-1]+q_values[i])/2 to (q_values[i]+q_values[i+1])/2
- *
- * The exceptions are the first and last bins, which are centered at the first and
- * last q-values, respectively. The width of the first and last bins is the distance between
- * their respective neighboring q-value.
- */
-void SlitSmearer :: compute_matrix(){
-
-	weights = new vector<double>(nbins*nbins,0);
-
-	// Check the length of the data
-	if (nbins<2) return;
-	int npts_h = height>0.0 ? npts : 1;
-	int npts_w = width>0.0 ? npts : 1;
-
-	// If both height and width are great than zero,
-	// modify the number of points in each direction so
-	// that the total number of points is still what
-	// the user would expect (downgrade resolution)
-	//if(npts_h>1 && npts_w>1){
-	//	npts_h = (int)ceil(sqrt((double)npts));
-	//	npts_w = npts_h;
-	//}
-	double shift_h, shift_w, hbin_size, wbin_size;
-	// Make sure height and width are all positive (FWMH/2)
-	// Assumption; height and width are all same for all q points
-	if(npts_h == 1){
-		shift_h = 0.0;
-	} else {
-		shift_h = fabs(height);
-	}
-	if(npts_w == 1){
-		shift_w = 0.0;
-	} else {
-		shift_w = fabs(width);
-	}
-	// size of the h bin and w bin
-	hbin_size = shift_h / nbins;
-	wbin_size = shift_w / nbins;
-
-	// Loop over all q-values
-	double q, q_min, q_max, q_0=0.0;
-	for(int i=0; i<nbins; i++) {
-		// Find Weights
-		// Find q where the resolution smearing calculation of I(q) occurs
-		get_bin_range(i, &q, &q_min, &q_max);
-		// Block q becomes <=0
-		if (q <= 0){
-			continue;
-		}
-		// Find q[0] value to normalize the weight later,
-		//  otherwise, we will have a precision problem.
-		if (i == 0){
-			q_0 = q;
-		}
-		// Loop over all qj-values
-		for(int j=0; j<nbins; j++) {
-			double q_j, q_high, q_low;
-			// Calculate bin size of q_j
-			get_bin_range(j, &q_j, &q_low, &q_high);
-			// Block q_j becomes <=0
-			if (q_j <= 0){
-				continue;
-			}
-			// Check q_low that can not be negative.
-			if (q_low < 0.0){
-				q_low = 0.0;
-			}
-			// default parameter values
-			(*weights)[i*nbins+j] = 0.0;
-			// protect for negative q
-			if (q <= 0.0 || q_j <= 0.0){
-					continue;
-			}
-			double shift_w = 0.0;
-			// Condition: zero slit smear.
-			if (npts_w == 1 && npts_h == 1){
-				if(q_j == q) {
-					(*weights)[i*nbins+j] = 1.0;
-				}
-			}
-			//Condition:Smear weight integration for width >0 when the height (=0) does not present.
-			//Or height << width.
-			else if((npts_w!=1 && npts_h == 1)|| (npts_w!=1 && npts_h != 1 && width/height > 100.0)){
-				shift_w = width;
-				//del_w = width/((double)npts_w-1.0);
-				double q_shifted_low = q - shift_w;
-				// High limit of the resolution range
-				double q_shifted_high = q + shift_w;
-				// Go through all the q_js for weighting those points
-				if(q_j >= q_shifted_low && q_j <= q_shifted_high) {
-					// The weighting factor comes,
-					// Give some weight (delq_bin) for the q_j within the resolution range
-					// Weight should be same for all qs except
-					// for the q bin size at j.
-					// Note that the division by q_0 is only due to the precision problem
-					// where q_high - q_low gets to very small.
-					// Later, it will be normalized again.
-					(*weights)[i*nbins+j] += (q_high - q_low)/q_0 ;
-				}
-			}
-			else{
-				// Loop for width (;Height is analytical.)
-				// Condition: height >>> width, otherwise, below is not accurate enough.
-				// Smear weight numerical iteration for width >0 when the height (>0) presents.
-				// When width = 0, the numerical iteration will be skipped.
-				// The resolution calculation for the height is done by direct integration,
-				// assuming the I(q'=sqrt(q_j^2-(q+shift_w)^2)) is constant within a q' bin, [q_high, q_low].
-				// In general, this weight numerical iteration for width >0 might be a rough approximation,
-				// but it must be good enough when height >>> width.
-				for(int k=(-npts_w + 1); k<npts_w; k++){
-					if(npts_w!=1){
-						shift_w = width/((double)npts_w-1.0)*(double)k;
-					}
-					// For each q-value, compute the weight of each other q-bin
-					// in the I(q) array
-					// Low limit of the resolution range
-					double q_shift = q + shift_w;
-					if (q_shift < 0.0){
-						q_shift = 0.0;
-					}
-					double q_shifted_low = q_shift;
-					// High limit of the resolution range
-					double q_shifted_high = sqrt(q_shift * q_shift + shift_h * shift_h);
-
-
-					// Go through all the q_js for weighting those points
-					if(q_j >= q_shifted_low && q_j <= q_shifted_high) {
-						// The weighting factor comes,
-						// Give some weight (delq_bin) for the q_j within the resolution range
-						// Weight should be same for all qs except
-						// for the q bin size at j.
-						// Note that the division by q_0 is only due to the precision problem
-						// where q_high - q_low gets to very small.
-						// Later, it will be normalized again.
-
-						// The fabs below are not necessary but in case: the weight should never be imaginary.
-						// At the edge of each sub_width. weight += u(at q_high bin) - u(0), where u(0) = 0,
-						// and weighted by (2.0* npts_w -1.0)once for each q.
-						//if (q == q_j) {
-						if (q_low <= q_shift && q_high > q_shift) {
-							//if (k==0)
-								(*weights)[i*nbins+j] += (sqrt(fabs((q_high)*(q_high)-q_shift * q_shift)))/q_0;// * (2.0*double(npts_w)-1.0);
-						}
-						// For the rest of sub_width. weight += u(at q_high bin) - u(at q_low bin)
-						else{// if (u > 0.0){
-							(*weights)[i*nbins+j] += (sqrt(fabs((q_high)*(q_high)- q_shift * q_shift))-sqrt(fabs((q_low)*(q_low)- q_shift * q_shift)))/q_0 ;
-						}
-					}
-				}
-			}
-		}
-	}
-};
-
-/**
- * Compute the point smearing matrix
- */
-void QSmearer :: compute_matrix(){
-	weights = new vector<double>(nbins*nbins,0);
-
-	// Loop over all q-values
-	double q, q_min, q_max;
-	double q_j, q_jmax, q_jmin;
-	for(int i=0; i<nbins; i++) {
-		get_bin_range(i, &q, &q_min, &q_max);
-
-		for(int j=0; j<nbins; j++) {
-			get_bin_range(j, &q_j, &q_jmin, &q_jmax);
-
-			// Compute the fraction of the Gaussian contributing
-			// to the q_j bin between q_jmin and q_jmax
-			long double value =  erf( (q_jmax-q)/(sqrt(2.0)*width[i]) );
-        	value -= erf( (q_jmin-q)/(sqrt(2.0)*width[i]) );
-        	(*weights)[i*nbins+j] += value;
-		}
-	}
-}
-
-/**
- * Computes the Q range of a given bin of the Q distribution.
- * The range is computed according the the data distribution that
- * was given to the object at initialization.
- *
- * @param i: number of the bin in the distribution
- * @param q: q-value of bin i
- * @param q_min: lower bound of the bin
- * @param q_max: higher bound of the bin
- *
- */
-int BaseSmearer :: get_bin_range(int i, double* q, double* q_min, double* q_max) {
-	if (even_binning) {
-		double step = (qmax-qmin)/((double)nbins-1.0);
-		*q = qmin + (double)i*step;
-		*q_min = *q - 0.5*step;
-		*q_max = *q + 0.5*step;
-		return 1;
-	} else if (i>=0 && i<nbins) {
-		*q = q_values[i];
-		if (i==0) {
-			double step = (q_values[1]-q_values[0])/2.0;
-			*q_min = *q - step;
-			*q_max = *q + step;
-		} else if (i==nbins-1) {
-			double step = (q_values[i]-q_values[i-1])/2.0;
-			*q_min = *q - step;
-			*q_max = *q + step;
-		} else {
-			*q_min = *q - (q_values[i]-q_values[i-1])/2.0;
-			*q_max = *q + (q_values[i+1]-q_values[i])/2.0;
-		}
-		return 1;
-	}
-	return -1;
-}
-
-/**
- * Perform smearing by applying the smearing matrix to the input Q array
- */
-void BaseSmearer :: smear(double *iq_in, double *iq_out, int first_bin, int last_bin){
-
-	// If we haven't computed the smearing matrix, do it now
-	if(!has_matrix) {
-		compute_matrix();
-		has_matrix = true;
-	}
-
-	// Loop over q-values and multiply apply matrix
-	for(int q_i=first_bin; q_i<=last_bin; q_i++){
-		double sum = 0.0;
-		double counts = 0.0;
-
-		for(int i=first_bin; i<=last_bin; i++){
-			// Skip if weight is less than 1e-03(this value is much smaller than
-			// the weight at the 3*sigma distance
-			// Will speed up a little bit...
-			if ((*weights)[q_i*nbins+i] < 1.0e-003){
-				continue;
-			}
-			sum += iq_in[i] * (*weights)[q_i*nbins+i];
-			counts += (*weights)[q_i*nbins+i];
-		}
-
-		// Normalize counts
-		iq_out[q_i] = (counts>0.0) ? sum/counts : 0.0;
-	}
-}
Index: c/sas/models/c_extension/c_smearer/smearer.hh
===================================================================
--- src/sas/models/c_extension/c_smearer/smearer.hh	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,97 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2009, University of Tennessee
- */
-#ifndef SMEARER_CLASS_H
-#define SMEARER_CLASS_H
-
-#include <vector>
-
-using namespace std;
-
-/**
- * Base smearer class, implementing the matrix multiplication only
- */
-class BaseSmearer {
-protected:
-	// Internal flag: true when the weights vector is filled
-	bool has_matrix;
-	// True when only qmin, qmax and nbins are given. Bins are equidistant
-	bool even_binning;
-	// Smearing matrix
-	vector<double>* weights;
-	// Q vector
-	double* q_values;
-    // Q_min (Min Q-value for I(q))
-    double qmin;
-    // Q_max (Max Q_value for I(q))
-    double qmax;
-    // Number of Q bins
-    int nbins;
-
-public:
-    // Constructor
-    BaseSmearer(double qmin, double qmax, int nbins);
-    BaseSmearer(double* q, int nbins);
-	// Smear function
-	virtual void smear(double *, double *, int, int);
-	// Compute the smearing matrix
-	virtual void compute_matrix(){};
-	// Utility function to check the number of bins
-	int get_nbins() { return nbins; }
-	// Get the q range of a particular bin
-	virtual int get_bin_range(int, double*, double*, double*);
-};
-
-
-/**
- * Slit smearer class
- */
-class SlitSmearer : public BaseSmearer {
-
-protected:
-    // Number of points used in the smearing computation
-    static const int npts   = 500;
-
-public:
-    // Slit width in Q units
-    double width;
-    // Slit height in Q units
-    double height;
-
-    // Constructor
-	SlitSmearer(double width, double height, double qmin, double qmax, int nbins);
-	SlitSmearer(double width, double height, double* q, int nbins);
-	// Compute the smearing matrix
-	virtual void compute_matrix();
-};
-
-
-/**
- * Point smearer class
- */
-class QSmearer : public BaseSmearer {
-
-protected:
-    // Standard deviation in Q [A-1]
-    double* width;
-
-public:
-
-    // Constructor
-    QSmearer(double* width, double qmin, double qmax, int nbins);
-    QSmearer(double* width, double* q, int nbins);
-	// Compute the smearing matrix
-	virtual void compute_matrix();
-};
-
-#endif
Index: c/sas/models/c_extension/c_smearer/smearer2d_helper.cpp
===================================================================
--- src/sas/models/c_extension/c_smearer/smearer2d_helper.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,76 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2009, University of Tennessee
- */
-#include "smearer2d_helper.hh"
-#include <stdio.h>
-#include <math.h>
-using namespace std;
-
-/**
- * Constructor for BaseSmearer
- *
- * binning
- * @param qx: array of Qx values
- * @param qy: array of Qy values
- * @param nrbins: number of r bins
- * @param nphibins: number of phi bins
- */
-Smearer_helper :: Smearer_helper(int npoints, double* qx, double* qy,
-		double* dqx, double* dqy, double rlimit, int nrbins, int nphibins) {
-	// Number of bins
-	this->npoints = npoints;
-	this->rlimit = rlimit;
-	this->nrbins = nrbins;
-	this->nphibins = nphibins;
-	this->qx_values = qx;
-	this->qy_values = qy;
-	this->dqx_values = dqx;
-	this->dqy_values = dqy;
-};
-
-/**
- * Compute the point smearing matrix
- */
-void Smearer_helper :: smear2d(double *weights, double *qx_out, double *qy_out){
-
-	double rbin_size = rlimit / double(nrbins);
-	double phibin_size = 0.0;
-	double rbin = 0.0;
-	double phibin = 0.0;
-	double qr = 0.0;
-	double qphi = 0.0;
-	double Pi = 4.0*atan(1.0);
-	
-	// Loop over q-values and multiply apply matrix
-	for(int i=0; i<nrbins; i++){
-		rbin = rbin_size * (double(i) + 0.5);
-		for(int j=0; j<nphibins; j++){
-			phibin_size =  2.0 * Pi / double(nphibins);
-			phibin = phibin_size * (double(j));
-			for(int q_i=0; q_i<npoints; q_i++){
-				qr = sqrt(qx_values[q_i]*qx_values[q_i] + qy_values[q_i]*qy_values[q_i]);
-				qphi = atan(qy_values[q_i]/qx_values[q_i]);
-				qx_out[q_i + npoints*(nrbins * j + i)] = (rbin*dqx_values[q_i]*cos(phibin) + qr)*cos(qphi)-
-										rbin*dqy_values[q_i]*sin(phibin)*sin(qphi);
-				qy_out[q_i + npoints*(nrbins * j + i)] = (rbin*dqx_values[q_i]*cos(phibin) + qr)*sin(qphi)+
-										rbin*dqy_values[q_i]*sin(phibin)*cos(qphi);
-				if (q_i==0){
-					weights[nrbins * j + i] = exp(-0.5 * ((rbin - rbin_size / 2.0) *
-							(rbin - rbin_size / 2.0)))- exp(-0.5 * ((rbin + rbin_size / 2.0 ) *
-									(rbin + rbin_size / 2.0)));
-			}
-		}
-	}
-	}
-}
-
Index: c/sas/models/c_extension/c_smearer/smearer2d_helper.hh
===================================================================
--- src/sas/models/c_extension/c_smearer/smearer2d_helper.hh	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2009, University of Tennessee
- */
-#ifndef SMEARER2D_HELPER_CLASS_H
-#define SMEARER2D_HELPER_CLASS_H
-
-#include <vector>
-
-using namespace std;
-
-/**
- * Base smearer class, implementing the matrix multiplication only
- */
-class Smearer_helper {
-protected:
-	// Smearing matrix
-	vector<double>* weights;
-	vector<double>* qx_out;
-	vector<double>* qy_out;
-	// Q vector
-	double* qx_values;
-	double* qy_values;
-	double* dqx_values;
-	double* dqy_values;
-    // r limit
-    double rlimit;
-    // Numbers
-    int npoints;
-    int nrbins;
-    int nphibins;
-
-public:
-    // Constructor
-	Smearer_helper(int npoints, double* qx, double* qy, double* dqx, double* dqy,
-			double rlimit, int nrbins, int nphibins);
-	// Smear function
-	virtual void smear2d(double *weights, double *qx_out, double *qy_out);
-};
-
-#endif
Index: c/sas/models/c_extension/c_smearer/smearer2d_helper_module.cpp
===================================================================
--- src/sas/models/c_extension/c_smearer/smearer2d_helper_module.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,128 +1,0 @@
-/**
-  Smearer module to perform point and slit smearing calculations
-
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	See the license text in license.txt
-
-	copyright 2009, University of Tennessee
- */
-#include <Python.h>
-#include <stdio.h>
-#include <smearer2d_helper.hh>
-
-// Utilities
-#define INVECTOR(obj,buf,len)										\
-    do { \
-        int err = PyObject_AsReadBuffer(obj, (const void **)(&buf), &len); \
-        if (err < 0) return NULL; \
-        len /= sizeof(*buf); \
-    } while (0)
-
-#define OUTVECTOR(obj,buf,len) \
-    do { \
-        int err = PyObject_AsWriteBuffer(obj, (void **)(&buf), &len); \
-        if (err < 0) return NULL; \
-        len /= sizeof(*buf); \
-    } while (0)
-
-
-/**
- * Delete a Smearer2d object
- */
-void del_smearer2d_helper(void *ptr){
-	Smearer_helper* smearer2d_helper = static_cast<Smearer_helper *>(ptr);
-	delete smearer2d_helper;
-	return;
-}
-
-/**
- * Create a QSmearer as a python object by supplying a q array
- */
-PyObject * new_Smearer_helper(PyObject *, PyObject *args) {
-	PyObject *qx_values_obj;
-	PyObject *qy_values_obj;
-	PyObject *dqx_values_obj;
-	PyObject *dqy_values_obj;
-	Py_ssize_t n_q;
-	//PyObject rlimit_obj;
-	//PyObject npoints_obj;
-	//PyObject nrbins_obj;
-	//PyObject nphibins_obj;
-	double* qx_values;
-	double* qy_values;
-	double* dqx_values;
-	double* dqy_values;
-	double rlimit;
-	int npoints;
-	int nrbins;
-	int nphibins;
-
-
-	if (!PyArg_ParseTuple(args, "OOOOdiii", &qx_values_obj, &qy_values_obj, &dqx_values_obj, &dqy_values_obj, &rlimit, &nrbins, &nphibins, &npoints)) return NULL;
-	OUTVECTOR(qx_values_obj, qx_values, n_q);
-	OUTVECTOR(qy_values_obj, qy_values, n_q);
-	OUTVECTOR(dqx_values_obj, dqx_values, n_q);
-	OUTVECTOR(dqy_values_obj, dqy_values, n_q);
-	Smearer_helper* smearer2d_helper = new Smearer_helper(npoints,qx_values,qy_values,dqx_values,dqy_values, rlimit, nrbins, nphibins);
-	return PyCObject_FromVoidPtr(smearer2d_helper, del_smearer2d_helper);
-}
-
-/**
- * Smear the given input according to a given smearer object
- */
-PyObject * smear2d_input(PyObject *, PyObject *args) {
-	PyObject *weights_obj;
-	Py_ssize_t w_out;
-	double *weights;
-	PyObject *qx_out_obj;
-	Py_ssize_t n_out;
-	double *qx_out;
-	PyObject *qy_out_obj;
-	//Py_ssize_t n_out;
-	double *qy_out;
-	PyObject *smear_obj;
-
-	if (!PyArg_ParseTuple(args, "OOOO",  &smear_obj, &weights_obj, &qx_out_obj, &qy_out_obj)) return NULL;
-	OUTVECTOR(weights_obj, weights, w_out);
-	OUTVECTOR(qx_out_obj, qx_out, n_out);
-	OUTVECTOR(qy_out_obj, qy_out, n_out);
-
-	// Sanity check
-	//if(n_in!=n_out) return Py_BuildValue("i",-1);
-
-	// Set the array pointers
-	void *temp = PyCObject_AsVoidPtr(smear_obj);
-	Smearer_helper* s = static_cast<Smearer_helper *>(temp);
-
-	s->smear2d(weights, qx_out, qy_out);
-	//return PyCObject_FromVoidPtr(s, del_smearer2d_helper);
-	return Py_BuildValue("i",1);
-}
-
-
-/**
- * Define module methods
- */
-static PyMethodDef module_methods[] = {
-	{"new_Smearer_helper", (PyCFunction)new_Smearer_helper, METH_VARARGS,
-		  "Create a new Q Smearer object"},
-	{"smearer2d_helper",(PyCFunction)smear2d_input, METH_VARARGS,
-		  "Smear the given input array"},
-    {NULL}
-};
-
-
-#ifndef PyMODINIT_FUNC	/* declarations for DLL import/export */
-#define PyMODINIT_FUNC void
-#endif
-PyMODINIT_FUNC
-initsmearer2d_helper(void)
-{
-    PyObject* m;
-
-    m = Py_InitModule3("smearer2d_helper", module_methods,
-                       "Smearer2d_helper module");
-}
Index: c/sas/models/c_extension/c_smearer/smearer_module.cpp
===================================================================
--- src/sas/models/c_extension/c_smearer/smearer_module.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,205 +1,0 @@
-/**
- *  Smearer module to perform point and slit smearing calculations
-
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	See the license text in license.txt
-
-	copyright 2009, University of Tennessee
- */
-#include <Python.h>
-#include <stdio.h>
-#include <smearer.hh>
-
-// Utilities
-#define INVECTOR(obj,buf,len)										\
-    do { \
-        int err = PyObject_AsReadBuffer(obj, (const void **)(&buf), &len); \
-        if (err < 0) return NULL; \
-        len /= sizeof(*buf); \
-    } while (0)
-
-#define OUTVECTOR(obj,buf,len) \
-    do { \
-        int err = PyObject_AsWriteBuffer(obj, (void **)(&buf), &len); \
-        if (err < 0) return NULL; \
-        len /= sizeof(*buf); \
-    } while (0)
-
-/**
- * Delete a SlitSmearer object
- */
-void del_slit_smearer(void *ptr){
-	SlitSmearer* smearer = static_cast<SlitSmearer *>(ptr);
-	delete smearer;
-	return;
-}
-
-/**
- * Create a SlitSmearer as a python object
- */
-PyObject * new_slit_smearer(PyObject *, PyObject *args) {
-	double width;
-	double height;
-	double qmin;
-	double qmax;
-	int nbins;
-
-	if (!PyArg_ParseTuple(args, "ddddi", &width, &height, &qmin, &qmax, &nbins)) return NULL;
-	SlitSmearer* smearer = new SlitSmearer(width, height, qmin, qmax, nbins);
-	return PyCObject_FromVoidPtr(smearer, del_slit_smearer);
-}
-
-/**
- * Create a SlitSmearer as a python object by supplying a q array
- */
-PyObject * new_slit_smearer_with_q(PyObject *, PyObject *args) {
-	PyObject *qvalues_obj;
-	Py_ssize_t n_q;
-	double* qvalues;
-	double width;
-	double height;
-
-	if (!PyArg_ParseTuple(args, "ddO", &width, &height, &qvalues_obj)) return NULL;
-	OUTVECTOR(qvalues_obj, qvalues, n_q);
-	SlitSmearer* smearer = new SlitSmearer(width, height, qvalues, n_q);
-	return PyCObject_FromVoidPtr(smearer, del_slit_smearer);
-}
-
-/**
- * Delete a QSmearer object
- */
-void del_q_smearer(void *ptr){
-	QSmearer* smearer = static_cast<QSmearer *>(ptr);
-	delete smearer;
-	return;
-}
-
-/**
- * Create a QSmearer as a python object
- */
-PyObject * new_q_smearer(PyObject *, PyObject *args) {
-	PyObject *width_obj;
-	Py_ssize_t n_w;
-	double* width;
-	double qmin;
-	double qmax;
-	int nbins;
-
-	if (!PyArg_ParseTuple(args, "Oddi", &width_obj, &qmin, &qmax, &nbins)) return NULL;
-	OUTVECTOR(width_obj, width, n_w);
-	QSmearer* smearer = new QSmearer(width, qmin, qmax, nbins);
-	return PyCObject_FromVoidPtr(smearer, del_q_smearer);
-}
-
-/**
- * Create a QSmearer as a python object by supplying a q array
- */
-PyObject * new_q_smearer_with_q(PyObject *, PyObject *args) {
-	PyObject *width_obj;
-	Py_ssize_t n_w;
-	double* width;
-	PyObject *qvalues_obj;
-	Py_ssize_t n_q;
-	double* qvalues;
-
-	if (!PyArg_ParseTuple(args, "OO", &width_obj, &qvalues_obj)) return NULL;
-	OUTVECTOR(width_obj, width, n_w);
-	OUTVECTOR(qvalues_obj, qvalues, n_q);
-	QSmearer* smearer = new QSmearer(width, qvalues, n_q);
-	return PyCObject_FromVoidPtr(smearer, del_q_smearer);
-}
-
-/**
- * Smear the given input according to a given smearer object
- */
-PyObject * smear_input(PyObject *, PyObject *args) {
-	PyObject *input_iq_obj;
-	PyObject *output_iq_obj;
-	PyObject *smear_obj;
-	Py_ssize_t n_in;
-	Py_ssize_t n_out;
-	double *input_iq;
-	double *output_iq;
-	int first_bin;
-	int last_bin;
-
-
-	if (!PyArg_ParseTuple(args, "OOOii", &smear_obj, &input_iq_obj, &output_iq_obj, &first_bin, &last_bin)) return NULL;
-	OUTVECTOR(input_iq_obj, input_iq, n_in);
-	OUTVECTOR(output_iq_obj, output_iq, n_out);
-
-	// Sanity check
-	if(n_in!=n_out) return Py_BuildValue("i",-1);
-
-	// Set the array pointers
-	void *temp = PyCObject_AsVoidPtr(smear_obj);
-	BaseSmearer* s = static_cast<BaseSmearer *>(temp);
-
-	if(n_in!=s->get_nbins()) {
-		return Py_BuildValue("i",-2);
-	}
-
-	s->smear(input_iq, output_iq, first_bin, last_bin);
-
-	return Py_BuildValue("i",1);
-}
-
-/**
- * Get the q-value of a given bin
- */
-PyObject * get_q(PyObject *, PyObject *args) {
-	PyObject *smear_obj;
-	int bin;
-
-	if (!PyArg_ParseTuple(args, "Oi", &smear_obj, &bin)) return NULL;
-
-	// Set the array pointers
-	void *temp = PyCObject_AsVoidPtr(smear_obj);
-	BaseSmearer* s = static_cast<BaseSmearer *>(temp);
-
-	if(s->get_nbins()<=0 || s->get_nbins()<=bin) {
-		return NULL;
-	}
-
-	double q, q_min, q_max;
-	if (s->get_bin_range(bin, &q, &q_min, &q_max)<0) {
-		return NULL;
-	}
-	return Py_BuildValue("d", q);
-}
-
-
-/**
- * Define module methods
- */
-static PyMethodDef module_methods[] = {
-	{"new_slit_smearer", (PyCFunction)new_slit_smearer, METH_VARARGS,
-		  "Create a new Slit Smearer object"},
-	{"new_slit_smearer_with_q", (PyCFunction)new_slit_smearer_with_q, METH_VARARGS,
-		  "Create a new Slit Smearer object by supplying an array of Q values"},
-	{"new_q_smearer", (PyCFunction)new_q_smearer, METH_VARARGS,
-		  "Create a new Q Smearer object"},
-	{"new_q_smearer_with_q", (PyCFunction)new_q_smearer_with_q, METH_VARARGS,
-		  "Create a new Q Smearer object by supplying an array of Q values"},
-	{"smear",(PyCFunction)smear_input, METH_VARARGS,
-		  "Smear the given input array"},
-	{"get_q",(PyCFunction)get_q, METH_VARARGS,
-		  "Get the q-value of a given bin"},
-    {NULL}
-};
-
-
-#ifndef PyMODINIT_FUNC	/* declarations for DLL import/export */
-#define PyMODINIT_FUNC void
-#endif
-PyMODINIT_FUNC
-initsmearer(void)
-{
-    PyObject* m;
-
-    m = Py_InitModule3("smearer", module_methods,
-                       "Q Smearing module");
-}
Index: c/sas/models/c_extension/cephes/airy.c
===================================================================
--- src/sas/models/c_extension/cephes/airy.c	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,966 +1,0 @@
-/*							airy.c
- *
- *	Airy function
- *
- *
- *
- * SYNOPSIS:
- *
- * double x, ai, aip, bi, bip;
- * int airy();
- *
- * airy( x, _&ai, _&aip, _&bi, _&bip );
- *
- *
- *
- * DESCRIPTION:
- *
- * Solution of the differential equation
- *
- *	y"(x) = xy.
- *
- * The function returns the two independent solutions Ai, Bi
- * and their first derivatives Ai'(x), Bi'(x).
- *
- * Evaluation is by power series summation for small x,
- * by rational minimax approximations for large x.
- *
- *
- *
- * ACCURACY:
- * Error criterion is absolute when function <= 1, relative
- * when function > 1, except * denotes relative error criterion.
- * For large negative x, the absolute error increases as x^1.5.
- * For large positive x, the relative error increases as x^1.5.
- *
- * Arithmetic  domain   function  # trials      peak         rms
- * IEEE        -10, 0     Ai        10000       1.6e-15     2.7e-16
- * IEEE          0, 10    Ai        10000       2.3e-14*    1.8e-15*
- * IEEE        -10, 0     Ai'       10000       4.6e-15     7.6e-16
- * IEEE          0, 10    Ai'       10000       1.8e-14*    1.5e-15*
- * IEEE        -10, 10    Bi        30000       4.2e-15     5.3e-16
- * IEEE        -10, 10    Bi'       30000       4.9e-15     7.3e-16
- * DEC         -10, 0     Ai         5000       1.7e-16     2.8e-17
- * DEC           0, 10    Ai         5000       2.1e-15*    1.7e-16*
- * DEC         -10, 0     Ai'        5000       4.7e-16     7.8e-17
- * DEC           0, 10    Ai'       12000       1.8e-15*    1.5e-16*
- * DEC         -10, 10    Bi        10000       5.5e-16     6.8e-17
- * DEC         -10, 10    Bi'        7000       5.3e-16     8.7e-17
- *
- */
-
-/*							airy.c */
-
-/*
-Cephes Math Library Release 2.8:  June, 2000
-Copyright 1984, 1987, 1989, 2000 by Stephen L. Moshier
-*/
-
-#include "mconf.h"
-
-static double c1 = 0.35502805388781723926;
-static double c2 = 0.258819403792806798405;
-static double sqrt3 = 1.732050807568877293527;
-static double sqpii = 5.64189583547756286948E-1;
-extern double PI;
-
-extern double MAXNUM, MACHEP;
-#ifdef UNK
-#define MAXAIRY 25.77
-#endif
-#ifdef DEC
-#define MAXAIRY 25.77
-#endif
-#ifdef IBMPC
-#define MAXAIRY 103.892
-#endif
-#ifdef MIEEE
-#define MAXAIRY 103.892
-#endif
-
-
-#ifdef UNK
-static double AN[8] = {
-  3.46538101525629032477E-1,
-  1.20075952739645805542E1,
-  7.62796053615234516538E1,
-  1.68089224934630576269E2,
-  1.59756391350164413639E2,
-  7.05360906840444183113E1,
-  1.40264691163389668864E1,
-  9.99999999999999995305E-1,
-};
-static double AD[8] = {
-  5.67594532638770212846E-1,
-  1.47562562584847203173E1,
-  8.45138970141474626562E1,
-  1.77318088145400459522E2,
-  1.64234692871529701831E2,
-  7.14778400825575695274E1,
-  1.40959135607834029598E1,
-  1.00000000000000000470E0,
-};
-#endif
-#ifdef DEC
-static unsigned short AN[32] = {
-0037661,0066561,0024675,0131301,
-0041100,0017434,0034324,0101466,
-0041630,0107450,0067427,0007430,
-0042050,0013327,0071000,0034737,
-0042037,0140642,0156417,0167366,
-0041615,0011172,0075147,0051165,
-0041140,0066152,0160520,0075146,
-0040200,0000000,0000000,0000000,
-};
-static unsigned short AD[32] = {
-0040021,0046740,0011422,0064606,
-0041154,0014640,0024631,0062450,
-0041651,0003435,0101152,0106401,
-0042061,0050556,0034605,0136602,
-0042044,0036024,0152377,0151414,
-0041616,0172247,0072216,0115374,
-0041141,0104334,0124154,0166007,
-0040200,0000000,0000000,0000000,
-};
-#endif
-#ifdef IBMPC
-static unsigned short AN[32] = {
-0xb658,0x2537,0x2dae,0x3fd6,
-0x9067,0x871a,0x03e3,0x4028,
-0xe1e3,0x0de2,0x11e5,0x4053,
-0x073c,0xee40,0x02da,0x4065,
-0xfddf,0x5ba1,0xf834,0x4063,
-0xea4f,0x4f4c,0xa24f,0x4051,
-0x0f4d,0x5c2a,0x0d8d,0x402c,
-0x0000,0x0000,0x0000,0x3ff0,
-};
-static unsigned short AD[32] = {
-0x4d31,0x0262,0x29bc,0x3fe2,
-0x2ca5,0x0533,0x8334,0x402d,
-0x51a0,0xb04d,0x20e3,0x4055,
-0xb7b0,0xc730,0x2a2d,0x4066,
-0xfa61,0x9a9f,0x8782,0x4064,
-0xd35f,0xee91,0xde94,0x4051,
-0x9d81,0x950d,0x311b,0x402c,
-0x0000,0x0000,0x0000,0x3ff0,
-};
-#endif
-#ifdef MIEEE
-static unsigned short AN[32] = {
-0x3fd6,0x2dae,0x2537,0xb658,
-0x4028,0x03e3,0x871a,0x9067,
-0x4053,0x11e5,0x0de2,0xe1e3,
-0x4065,0x02da,0xee40,0x073c,
-0x4063,0xf834,0x5ba1,0xfddf,
-0x4051,0xa24f,0x4f4c,0xea4f,
-0x402c,0x0d8d,0x5c2a,0x0f4d,
-0x3ff0,0x0000,0x0000,0x0000,
-};
-static unsigned short AD[32] = {
-0x3fe2,0x29bc,0x0262,0x4d31,
-0x402d,0x8334,0x0533,0x2ca5,
-0x4055,0x20e3,0xb04d,0x51a0,
-0x4066,0x2a2d,0xc730,0xb7b0,
-0x4064,0x8782,0x9a9f,0xfa61,
-0x4051,0xde94,0xee91,0xd35f,
-0x402c,0x311b,0x950d,0x9d81,
-0x3ff0,0x0000,0x0000,0x0000,
-};
-#endif
-
-#ifdef UNK
-static double APN[8] = {
-  6.13759184814035759225E-1,
-  1.47454670787755323881E1,
-  8.20584123476060982430E1,
-  1.71184781360976385540E2,
-  1.59317847137141783523E2,
-  6.99778599330103016170E1,
-  1.39470856980481566958E1,
-  1.00000000000000000550E0,
-};
-static double APD[8] = {
-  3.34203677749736953049E-1,
-  1.11810297306158156705E1,
-  7.11727352147859965283E1,
-  1.58778084372838313640E2,
-  1.53206427475809220834E2,
-  6.86752304592780337944E1,
-  1.38498634758259442477E1,
-  9.99999999999999994502E-1,
-};
-#endif
-#ifdef DEC
-static unsigned short APN[32] = {
-0040035,0017522,0065145,0054755,
-0041153,0166556,0161471,0057174,
-0041644,0016750,0034445,0046462,
-0042053,0027515,0152316,0046717,
-0042037,0050536,0067023,0023264,
-0041613,0172252,0007240,0131055,
-0041137,0023503,0052472,0002305,
-0040200,0000000,0000000,0000000,
-};
-static unsigned short APD[32] = {
-0037653,0016276,0112106,0126625,
-0041062,0162577,0067111,0111761,
-0041616,0054160,0140004,0137455,
-0042036,0143460,0104626,0157206,
-0042031,0032330,0067131,0114260,
-0041611,0054667,0147207,0134564,
-0041135,0114412,0070653,0146015,
-0040200,0000000,0000000,0000000,
-};
-#endif
-#ifdef IBMPC
-static unsigned short APN[32] = {
-0xab3e,0x4d4c,0xa3ea,0x3fe3,
-0x2bcf,0xdc67,0x7dad,0x402d,
-0xa9a6,0x0724,0x83bd,0x4054,
-0xc9ba,0xba99,0x65e9,0x4065,
-0x64d7,0xcdc2,0xea2b,0x4063,
-0x1646,0x41d4,0x7e95,0x4051,
-0x4099,0x6aa7,0xe4e8,0x402b,
-0x0000,0x0000,0x0000,0x3ff0,
-};
-static unsigned short APD[32] = {
-0xd5b3,0xd288,0x6397,0x3fd5,
-0x327e,0xedc9,0x5caf,0x4026,
-0x97e6,0x1800,0xcb0e,0x4051,
-0xdbd1,0x1132,0xd8e6,0x4063,
-0x3316,0x0dcb,0x269b,0x4063,
-0xf72f,0xf9d0,0x2b36,0x4051,
-0x7982,0x4e35,0xb321,0x402b,
-0x0000,0x0000,0x0000,0x3ff0,
-};
-#endif
-#ifdef MIEEE
-static unsigned short APN[32] = {
-0x3fe3,0xa3ea,0x4d4c,0xab3e,
-0x402d,0x7dad,0xdc67,0x2bcf,
-0x4054,0x83bd,0x0724,0xa9a6,
-0x4065,0x65e9,0xba99,0xc9ba,
-0x4063,0xea2b,0xcdc2,0x64d7,
-0x4051,0x7e95,0x41d4,0x1646,
-0x402b,0xe4e8,0x6aa7,0x4099,
-0x3ff0,0x0000,0x0000,0x0000,
-};
-static unsigned short APD[32] = {
-0x3fd5,0x6397,0xd288,0xd5b3,
-0x4026,0x5caf,0xedc9,0x327e,
-0x4051,0xcb0e,0x1800,0x97e6,
-0x4063,0xd8e6,0x1132,0xdbd1,
-0x4063,0x269b,0x0dcb,0x3316,
-0x4051,0x2b36,0xf9d0,0xf72f,
-0x402b,0xb321,0x4e35,0x7982,
-0x3ff0,0x0000,0x0000,0x0000,
-};
-#endif
-
-#ifdef UNK
-static double BN16[5] = {
--2.53240795869364152689E-1,
- 5.75285167332467384228E-1,
--3.29907036873225371650E-1,
- 6.44404068948199951727E-2,
--3.82519546641336734394E-3,
-};
-static double BD16[5] = {
-/* 1.00000000000000000000E0,*/
--7.15685095054035237902E0,
- 1.06039580715664694291E1,
--5.23246636471251500874E0,
- 9.57395864378383833152E-1,
--5.50828147163549611107E-2,
-};
-#endif
-#ifdef DEC
-static unsigned short BN16[20] = {
-0137601,0124307,0010213,0035210,
-0040023,0042743,0101621,0016031,
-0137650,0164623,0036056,0074511,
-0037203,0174525,0000473,0142474,
-0136172,0130041,0066726,0064324,
-};
-static unsigned short BD16[20] = {
-/*0040200,0000000,0000000,0000000,*/
-0140745,0002354,0044335,0055276,
-0041051,0124717,0170130,0104013,
-0140647,0070135,0046473,0103501,
-0040165,0013745,0033324,0127766,
-0137141,0117204,0076164,0033107,
-};
-#endif
-#ifdef IBMPC
-static unsigned short BN16[20] = {
-0x6751,0xe211,0x3518,0xbfd0,
-0x2383,0x7072,0x68bc,0x3fe2,
-0xcf29,0x6785,0x1d32,0xbfd5,
-0x78a8,0xa027,0x7f2a,0x3fb0,
-0xcd1b,0x2dba,0x5604,0xbf6f,
-};
-static unsigned short BD16[20] = {
-/*0x0000,0x0000,0x0000,0x3ff0,*/
-0xab58,0x891b,0xa09d,0xc01c,
-0x1101,0xfe0b,0x3539,0x4025,
-0x70e8,0xa9a7,0xee0b,0xc014,
-0x95ff,0xa6da,0xa2fc,0x3fee,
-0x86c9,0x8f8e,0x33d0,0xbfac,
-};
-#endif
-#ifdef MIEEE
-static unsigned short BN16[20] = {
-0xbfd0,0x3518,0xe211,0x6751,
-0x3fe2,0x68bc,0x7072,0x2383,
-0xbfd5,0x1d32,0x6785,0xcf29,
-0x3fb0,0x7f2a,0xa027,0x78a8,
-0xbf6f,0x5604,0x2dba,0xcd1b,
-};
-static unsigned short BD16[20] = {
-/*0x3ff0,0x0000,0x0000,0x0000,*/
-0xc01c,0xa09d,0x891b,0xab58,
-0x4025,0x3539,0xfe0b,0x1101,
-0xc014,0xee0b,0xa9a7,0x70e8,
-0x3fee,0xa2fc,0xa6da,0x95ff,
-0xbfac,0x33d0,0x8f8e,0x86c9,
-};
-#endif
-
-#ifdef UNK
-static double BPPN[5] = {
- 4.65461162774651610328E-1,
--1.08992173800493920734E0,
- 6.38800117371827987759E-1,
--1.26844349553102907034E-1,
- 7.62487844342109852105E-3,
-};
-static double BPPD[5] = {
-/* 1.00000000000000000000E0,*/
--8.70622787633159124240E0,
- 1.38993162704553213172E1,
--7.14116144616431159572E0,
- 1.34008595960680518666E0,
--7.84273211323341930448E-2,
-};
-#endif
-#ifdef DEC
-static unsigned short BPPN[20] = {
-0037756,0050354,0167531,0135731,
-0140213,0101216,0032767,0020375,
-0040043,0104147,0106312,0177632,
-0137401,0161574,0032015,0043714,
-0036371,0155035,0143165,0142262,
-};
-static unsigned short BPPD[20] = {
-/*0040200,0000000,0000000,0000000,*/
-0141013,0046265,0115005,0161053,
-0041136,0061631,0072445,0156131,
-0140744,0102145,0001127,0065304,
-0040253,0103757,0146453,0102513,
-0137240,0117200,0155402,0113500,
-};
-#endif
-#ifdef IBMPC
-static unsigned short BPPN[20] = {
-0x377b,0x9deb,0xca1d,0x3fdd,
-0xe420,0xc6be,0x7051,0xbff1,
-0x5ff3,0xf199,0x710c,0x3fe4,
-0xa8fa,0x8681,0x3c6f,0xbfc0,
-0xb896,0xb8ce,0x3b43,0x3f7f,
-};
-static unsigned short BPPD[20] = {
-/*0x0000,0x0000,0x0000,0x3ff0,*/
-0xbc45,0xb340,0x6996,0xc021,
-0xbb8b,0x2ea4,0xcc73,0x402b,
-0xed59,0xa04a,0x908c,0xc01c,
-0x70a9,0xf9a5,0x70fd,0x3ff5,
-0x52e8,0x1b60,0x13d0,0xbfb4,
-};
-#endif
-#ifdef MIEEE
-static unsigned short BPPN[20] = {
-0x3fdd,0xca1d,0x9deb,0x377b,
-0xbff1,0x7051,0xc6be,0xe420,
-0x3fe4,0x710c,0xf199,0x5ff3,
-0xbfc0,0x3c6f,0x8681,0xa8fa,
-0x3f7f,0x3b43,0xb8ce,0xb896,
-};
-static unsigned short BPPD[20] = {
-/*0x3ff0,0x0000,0x0000,0x0000,*/
-0xc021,0x6996,0xb340,0xbc45,
-0x402b,0xcc73,0x2ea4,0xbb8b,
-0xc01c,0x908c,0xa04a,0xed59,
-0x3ff5,0x70fd,0xf9a5,0x70a9,
-0xbfb4,0x13d0,0x1b60,0x52e8,
-};
-#endif
-
-#ifdef UNK
-static double AFN[9] = {
--1.31696323418331795333E-1,
--6.26456544431912369773E-1,
--6.93158036036933542233E-1,
--2.79779981545119124951E-1,
--4.91900132609500318020E-2,
--4.06265923594885404393E-3,
--1.59276496239262096340E-4,
--2.77649108155232920844E-6,
--1.67787698489114633780E-8,
-};
-static double AFD[9] = {
-/* 1.00000000000000000000E0,*/
- 1.33560420706553243746E1,
- 3.26825032795224613948E1,
- 2.67367040941499554804E1,
- 9.18707402907259625840E0,
- 1.47529146771666414581E0,
- 1.15687173795188044134E-1,
- 4.40291641615211203805E-3,
- 7.54720348287414296618E-5,
- 4.51850092970580378464E-7,
-};
-#endif
-#ifdef DEC
-static unsigned short AFN[36] = {
-0137406,0155546,0124127,0033732,
-0140040,0057564,0141263,0041222,
-0140061,0071316,0013674,0175754,
-0137617,0037522,0056637,0120130,
-0137111,0075567,0121755,0166122,
-0136205,0020016,0043317,0002201,
-0135047,0001565,0075130,0002334,
-0133472,0051700,0165021,0131551,
-0131620,0020347,0132165,0013215,
-};
-static unsigned short AFD[36] = {
-/*0040200,0000000,0000000,0000000,*/
-0041125,0131131,0025627,0067623,
-0041402,0135342,0021703,0154315,
-0041325,0162305,0016671,0120175,
-0041022,0177101,0053114,0141632,
-0040274,0153131,0147364,0114306,
-0037354,0166545,0120042,0150530,
-0036220,0043127,0000727,0130273,
-0034636,0043275,0075667,0034733,
-0032762,0112715,0146250,0142474,
-};
-#endif
-#ifdef IBMPC
-static unsigned short AFN[36] = {
-0xe6fb,0xd50a,0xdb6c,0xbfc0,
-0x6852,0x9856,0x0bee,0xbfe4,
-0x9f7d,0xc2f7,0x2e59,0xbfe6,
-0xf40b,0x4bb3,0xe7ea,0xbfd1,
-0xbd8a,0xf47d,0x2f6e,0xbfa9,
-0xe090,0xc8d9,0xa401,0xbf70,
-0x009c,0xaf4b,0xe06e,0xbf24,
-0x366d,0x1d42,0x4a78,0xbec7,
-0xa2d2,0xf68e,0x041c,0xbe52,
-};
-static unsigned short AFD[36] = {
-/*0x0000,0x0000,0x0000,0x3ff0,*/
-0xedf2,0x2572,0xb64b,0x402a,
-0x7b1a,0x4478,0x575c,0x4040,
-0x3410,0xa3b7,0xbc98,0x403a,
-0x9873,0x2ac9,0x5fc8,0x4022,
-0x9319,0x39de,0x9acb,0x3ff7,
-0x5a2b,0xb404,0x9dac,0x3fbd,
-0xf617,0xe03a,0x08ca,0x3f72,
-0xe73b,0xaf76,0xc8d7,0x3f13,
-0x18a7,0xb995,0x52b9,0x3e9e,
-};
-#endif
-#ifdef MIEEE
-static unsigned short AFN[36] = {
-0xbfc0,0xdb6c,0xd50a,0xe6fb,
-0xbfe4,0x0bee,0x9856,0x6852,
-0xbfe6,0x2e59,0xc2f7,0x9f7d,
-0xbfd1,0xe7ea,0x4bb3,0xf40b,
-0xbfa9,0x2f6e,0xf47d,0xbd8a,
-0xbf70,0xa401,0xc8d9,0xe090,
-0xbf24,0xe06e,0xaf4b,0x009c,
-0xbec7,0x4a78,0x1d42,0x366d,
-0xbe52,0x041c,0xf68e,0xa2d2,
-};
-static unsigned short AFD[36] = {
-/*0x3ff0,0x0000,0x0000,0x0000,*/
-0x402a,0xb64b,0x2572,0xedf2,
-0x4040,0x575c,0x4478,0x7b1a,
-0x403a,0xbc98,0xa3b7,0x3410,
-0x4022,0x5fc8,0x2ac9,0x9873,
-0x3ff7,0x9acb,0x39de,0x9319,
-0x3fbd,0x9dac,0xb404,0x5a2b,
-0x3f72,0x08ca,0xe03a,0xf617,
-0x3f13,0xc8d7,0xaf76,0xe73b,
-0x3e9e,0x52b9,0xb995,0x18a7,
-};
-#endif
-
-#ifdef UNK
-static double AGN[11] = {
-  1.97339932091685679179E-2,
-  3.91103029615688277255E-1,
-  1.06579897599595591108E0,
-  9.39169229816650230044E-1,
-  3.51465656105547619242E-1,
-  6.33888919628925490927E-2,
-  5.85804113048388458567E-3,
-  2.82851600836737019778E-4,
-  6.98793669997260967291E-6,
-  8.11789239554389293311E-8,
-  3.41551784765923618484E-10,
-};
-static double AGD[10] = {
-/*  1.00000000000000000000E0,*/
-  9.30892908077441974853E0,
-  1.98352928718312140417E1,
-  1.55646628932864612953E1,
-  5.47686069422975497931E0,
-  9.54293611618961883998E-1,
-  8.64580826352392193095E-2,
-  4.12656523824222607191E-3,
-  1.01259085116509135510E-4,
-  1.17166733214413521882E-6,
-  4.91834570062930015649E-9,
-};
-#endif
-#ifdef DEC
-static unsigned short AGN[44] = {
-0036641,0124456,0167175,0157354,
-0037710,0037250,0001441,0136671,
-0040210,0066031,0150401,0123532,
-0040160,0066545,0003570,0153133,
-0037663,0171516,0072507,0170345,
-0037201,0151011,0007510,0045702,
-0036277,0172317,0104572,0101030,
-0035224,0045663,0000160,0136422,
-0033752,0074753,0047702,0135160,
-0032256,0052225,0156550,0107103,
-0030273,0142443,0166277,0071720,
-};
-static unsigned short AGD[40] = {
-/*0040200,0000000,0000000,0000000,*/
-0041024,0170537,0117253,0055003,
-0041236,0127256,0003570,0143240,
-0041171,0004333,0172476,0160645,
-0040657,0041161,0055716,0157161,
-0040164,0046226,0006257,0063431,
-0037261,0010357,0065445,0047563,
-0036207,0034043,0057434,0116732,
-0034724,0055416,0130035,0026377,
-0033235,0041056,0154071,0023502,
-0031250,0177071,0167254,0047242,
-};
-#endif
-#ifdef IBMPC
-static unsigned short AGN[44] = {
-0xbbde,0xddcf,0x3525,0x3f94,
-0x37b7,0x0064,0x07d5,0x3fd9,
-0x34eb,0x3a20,0x0d83,0x3ff1,
-0x1acb,0xa0ef,0x0dac,0x3fee,
-0xfe1d,0xcea8,0x7e69,0x3fd6,
-0x0978,0x21e9,0x3a41,0x3fb0,
-0x5043,0xf12f,0xfe99,0x3f77,
-0x17a2,0x600e,0x8976,0x3f32,
-0x574e,0x69f8,0x4f3d,0x3edd,
-0x11c8,0xbbad,0xca92,0x3e75,
-0xee7a,0x7d97,0x78a4,0x3df7,
-};
-static unsigned short AGD[40] = {
-/*0x0000,0x0000,0x0000,0x3ff0,*/
-0x6b40,0xf3d5,0x9e2b,0x4022,
-0x18d4,0xc0ef,0xd5d5,0x4033,
-0xdc35,0x7ea7,0x211b,0x402f,
-0xdbce,0x2b79,0xe84e,0x4015,
-0xece3,0xc195,0x8992,0x3fee,
-0xa9ee,0xed64,0x221d,0x3fb6,
-0x93bb,0x6be3,0xe704,0x3f70,
-0xa5a0,0xd603,0x8b61,0x3f1a,
-0x24e8,0xdb07,0xa845,0x3eb3,
-0x89d4,0x3dd5,0x1fc7,0x3e35,
-};
-#endif
-#ifdef MIEEE
-static unsigned short AGN[44] = {
-0x3f94,0x3525,0xddcf,0xbbde,
-0x3fd9,0x07d5,0x0064,0x37b7,
-0x3ff1,0x0d83,0x3a20,0x34eb,
-0x3fee,0x0dac,0xa0ef,0x1acb,
-0x3fd6,0x7e69,0xcea8,0xfe1d,
-0x3fb0,0x3a41,0x21e9,0x0978,
-0x3f77,0xfe99,0xf12f,0x5043,
-0x3f32,0x8976,0x600e,0x17a2,
-0x3edd,0x4f3d,0x69f8,0x574e,
-0x3e75,0xca92,0xbbad,0x11c8,
-0x3df7,0x78a4,0x7d97,0xee7a,
-};
-static unsigned short AGD[40] = {
-/*0x3ff0,0x0000,0x0000,0x0000,*/
-0x4022,0x9e2b,0xf3d5,0x6b40,
-0x4033,0xd5d5,0xc0ef,0x18d4,
-0x402f,0x211b,0x7ea7,0xdc35,
-0x4015,0xe84e,0x2b79,0xdbce,
-0x3fee,0x8992,0xc195,0xece3,
-0x3fb6,0x221d,0xed64,0xa9ee,
-0x3f70,0xe704,0x6be3,0x93bb,
-0x3f1a,0x8b61,0xd603,0xa5a0,
-0x3eb3,0xa845,0xdb07,0x24e8,
-0x3e35,0x1fc7,0x3dd5,0x89d4,
-};
-#endif
-
-#ifdef UNK
-static double APFN[9] = {
-  1.85365624022535566142E-1,
-  8.86712188052584095637E-1,
-  9.87391981747398547272E-1,
-  4.01241082318003734092E-1,
-  7.10304926289631174579E-2,
-  5.90618657995661810071E-3,
-  2.33051409401776799569E-4,
-  4.08718778289035454598E-6,
-  2.48379932900442457853E-8,
-};
-static double APFD[9] = {
-/*  1.00000000000000000000E0,*/
-  1.47345854687502542552E1,
-  3.75423933435489594466E1,
-  3.14657751203046424330E1,
-  1.09969125207298778536E1,
-  1.78885054766999417817E0,
-  1.41733275753662636873E-1,
-  5.44066067017226003627E-3,
-  9.39421290654511171663E-5,
-  5.65978713036027009243E-7,
-};
-#endif
-#ifdef DEC
-static unsigned short APFN[36] = {
-0037475,0150174,0071752,0166651,
-0040142,0177621,0164246,0101757,
-0040174,0142670,0106760,0006573,
-0037715,0067570,0116274,0022404,
-0037221,0074157,0053341,0117207,
-0036301,0104257,0015075,0004777,
-0035164,0057502,0164034,0001313,
-0033611,0022254,0176000,0112565,
-0031725,0055523,0025153,0166057,
-};
-static unsigned short APFD[36] = {
-/*0040200,0000000,0000000,0000000,*/
-0041153,0140334,0130506,0061402,
-0041426,0025551,0024440,0070611,
-0041373,0134750,0047147,0176702,
-0041057,0171532,0105430,0017674,
-0040344,0174416,0001726,0047754,
-0037421,0021207,0020167,0136264,
-0036262,0043621,0151321,0124324,
-0034705,0001313,0163733,0016407,
-0033027,0166702,0150440,0170561,
-};
-#endif
-#ifdef IBMPC
-static unsigned short APFN[36] = {
-0x5db5,0x8e7d,0xba0f,0x3fc7,
-0xd07e,0x3d14,0x5ff2,0x3fec,
-0x01af,0x11be,0x98b7,0x3fef,
-0x84a1,0x1397,0xadef,0x3fd9,
-0x33d1,0xeadc,0x2f0d,0x3fb2,
-0xa140,0xe347,0x3115,0x3f78,
-0x8059,0x5d03,0x8be8,0x3f2e,
-0x12af,0x9f80,0x2495,0x3ed1,
-0x7d86,0x654d,0xab6a,0x3e5a,
-};
-static unsigned short APFD[36] = {
-/*0x0000,0x0000,0x0000,0x3ff0,*/
-0xcc60,0x9628,0x781b,0x402d,
-0x0e31,0x2524,0xc56d,0x4042,
-0xffb8,0x09cc,0x773d,0x403f,
-0x03f7,0x5163,0xfe6b,0x4025,
-0xc9fd,0xc07a,0x9f21,0x3ffc,
-0xf796,0xe40e,0x2450,0x3fc2,
-0x351a,0x3a5a,0x48f2,0x3f76,
-0x63a1,0x7cfb,0xa059,0x3f18,
-0x1e2e,0x5a24,0xfdb8,0x3ea2,
-};
-#endif
-#ifdef MIEEE
-static unsigned short APFN[36] = {
-0x3fc7,0xba0f,0x8e7d,0x5db5,
-0x3fec,0x5ff2,0x3d14,0xd07e,
-0x3fef,0x98b7,0x11be,0x01af,
-0x3fd9,0xadef,0x1397,0x84a1,
-0x3fb2,0x2f0d,0xeadc,0x33d1,
-0x3f78,0x3115,0xe347,0xa140,
-0x3f2e,0x8be8,0x5d03,0x8059,
-0x3ed1,0x2495,0x9f80,0x12af,
-0x3e5a,0xab6a,0x654d,0x7d86,
-};
-static unsigned short APFD[36] = {
-/*0x3ff0,0x0000,0x0000,0x0000,*/
-0x402d,0x781b,0x9628,0xcc60,
-0x4042,0xc56d,0x2524,0x0e31,
-0x403f,0x773d,0x09cc,0xffb8,
-0x4025,0xfe6b,0x5163,0x03f7,
-0x3ffc,0x9f21,0xc07a,0xc9fd,
-0x3fc2,0x2450,0xe40e,0xf796,
-0x3f76,0x48f2,0x3a5a,0x351a,
-0x3f18,0xa059,0x7cfb,0x63a1,
-0x3ea2,0xfdb8,0x5a24,0x1e2e,
-};
-#endif
-
-#ifdef UNK
-static double APGN[11] = {
--3.55615429033082288335E-2,
--6.37311518129435504426E-1,
--1.70856738884312371053E0,
--1.50221872117316635393E0,
--5.63606665822102676611E-1,
--1.02101031120216891789E-1,
--9.48396695961445269093E-3,
--4.60325307486780994357E-4,
--1.14300836484517375919E-5,
--1.33415518685547420648E-7,
--5.63803833958893494476E-10,
-};
-static double APGD[11] = {
-/*  1.00000000000000000000E0,*/
-  9.85865801696130355144E0,
-  2.16401867356585941885E1,
-  1.73130776389749389525E1,
-  6.17872175280828766327E0,
-  1.08848694396321495475E0,
-  9.95005543440888479402E-2,
-  4.78468199683886610842E-3,
-  1.18159633322838625562E-4,
-  1.37480673554219441465E-6,
-  5.79912514929147598821E-9,
-};
-#endif
-#ifdef DEC
-static unsigned short APGN[44] = {
-0137021,0124372,0176075,0075331,
-0140043,0023330,0177672,0161655,
-0140332,0131126,0010413,0171112,
-0140300,0044263,0175560,0054070,
-0140020,0044206,0142603,0073324,
-0137321,0015130,0066144,0144033,
-0136433,0061243,0175542,0103373,
-0135361,0053721,0020441,0053203,
-0134077,0141725,0160277,0130612,
-0132417,0040372,0100363,0060200,
-0130432,0175052,0171064,0034147,
-};
-static unsigned short APGD[40] = {
-/*0040200,0000000,0000000,0000000,*/
-0041035,0136420,0030124,0140220,
-0041255,0017432,0034447,0162256,
-0041212,0100456,0154544,0006321,
-0040705,0134026,0127154,0123414,
-0040213,0051612,0044470,0172607,
-0037313,0143362,0053273,0157051,
-0036234,0144322,0054536,0007264,
-0034767,0146170,0054265,0170342,
-0033270,0102777,0167362,0073631,
-0031307,0040644,0167103,0021763,
-};
-#endif
-#ifdef IBMPC
-static unsigned short APGN[44] = {
-0xaf5b,0x5f87,0x351f,0xbfa2,
-0x5c76,0x1ff7,0x64db,0xbfe4,
-0x7e49,0xc221,0x564a,0xbffb,
-0x0b07,0x7f6e,0x0916,0xbff8,
-0x6edb,0xd8b0,0x0910,0xbfe2,
-0x9903,0x0d8c,0x234b,0xbfba,
-0x50df,0x7f6c,0x6c54,0xbf83,
-0x2ad0,0x2424,0x2afa,0xbf3e,
-0xf631,0xbc17,0xf87a,0xbee7,
-0x6c10,0x501e,0xe81f,0xbe81,
-0x870d,0x5e46,0x5f45,0xbe03,
-};
-static unsigned short APGD[40] = {
-/*0x0000,0x0000,0x0000,0x3ff0,*/
-0x9812,0x060a,0xb7a2,0x4023,
-0xfc96,0x4724,0xa3e3,0x4035,
-0x819a,0xdb2c,0x5025,0x4031,
-0x94e2,0xd5cd,0xb702,0x4018,
-0x1eb1,0x4927,0x6a71,0x3ff1,
-0x7bc5,0x4ad7,0x78de,0x3fb9,
-0xc1d7,0x4b2b,0x991a,0x3f73,
-0xbe1c,0x0b16,0xf98f,0x3f1e,
-0x4ef3,0xfdde,0x10bf,0x3eb7,
-0x647e,0x9dc8,0xe834,0x3e38,
-};
-#endif
-#ifdef MIEEE
-static unsigned short APGN[44] = {
-0xbfa2,0x351f,0x5f87,0xaf5b,
-0xbfe4,0x64db,0x1ff7,0x5c76,
-0xbffb,0x564a,0xc221,0x7e49,
-0xbff8,0x0916,0x7f6e,0x0b07,
-0xbfe2,0x0910,0xd8b0,0x6edb,
-0xbfba,0x234b,0x0d8c,0x9903,
-0xbf83,0x6c54,0x7f6c,0x50df,
-0xbf3e,0x2afa,0x2424,0x2ad0,
-0xbee7,0xf87a,0xbc17,0xf631,
-0xbe81,0xe81f,0x501e,0x6c10,
-0xbe03,0x5f45,0x5e46,0x870d,
-};
-static unsigned short APGD[40] = {
-/*0x3ff0,0x0000,0x0000,0x0000,*/
-0x4023,0xb7a2,0x060a,0x9812,
-0x4035,0xa3e3,0x4724,0xfc96,
-0x4031,0x5025,0xdb2c,0x819a,
-0x4018,0xb702,0xd5cd,0x94e2,
-0x3ff1,0x6a71,0x4927,0x1eb1,
-0x3fb9,0x78de,0x4ad7,0x7bc5,
-0x3f73,0x991a,0x4b2b,0xc1d7,
-0x3f1e,0xf98f,0x0b16,0xbe1c,
-0x3eb7,0x10bf,0xfdde,0x4ef3,
-0x3e38,0xe834,0x9dc8,0x647e,
-};
-#endif
-
-#ifdef ANSIPROT
-extern double fabs ( double );
-extern double exp ( double );
-extern double sqrt ( double );
-extern double polevl ( double, void *, int );
-extern double p1evl ( double, void *, int );
-extern double sin ( double );
-extern double cos ( double );
-#else
-double fabs(), exp(), sqrt();
-double polevl(), p1evl(), sin(), cos();
-#endif
-
-int airy( x, ai, aip, bi, bip )
-double x, *ai, *aip, *bi, *bip;
-{
-double z, zz, t, f, g, uf, ug, k, zeta, theta;
-int domflg;
-
-domflg = 0;
-if( x > MAXAIRY )
-	{
-	*ai = 0;
-	*aip = 0;
-	*bi = MAXNUM;
-	*bip = MAXNUM;
-	return(-1);
-	}
-
-if( x < -2.09 )
-	{
-	domflg = 15;
-	t = sqrt(-x);
-	zeta = -2.0 * x * t / 3.0;
-	t = sqrt(t);
-	k = sqpii / t;
-	z = 1.0/zeta;
-	zz = z * z;
-	uf = 1.0 + zz * polevl( zz, AFN, 8 ) / p1evl( zz, AFD, 9 );
-	ug = z * polevl( zz, AGN, 10 ) / p1evl( zz, AGD, 10 );
-	theta = zeta + 0.25 * PI;
-	f = sin( theta );
-	g = cos( theta );
-	*ai = k * (f * uf - g * ug);
-	*bi = k * (g * uf + f * ug);
-	uf = 1.0 + zz * polevl( zz, APFN, 8 ) / p1evl( zz, APFD, 9 );
-	ug = z * polevl( zz, APGN, 10 ) / p1evl( zz, APGD, 10 );
-	k = sqpii * t;
-	*aip = -k * (g * uf + f * ug);
-	*bip = k * (f * uf - g * ug);
-	return(0);
-	}
-
-if( x >= 2.09 )	/* cbrt(9) */
-	{
-	domflg = 5;
-	t = sqrt(x);
-	zeta = 2.0 * x * t / 3.0;
-	g = exp( zeta );
-	t = sqrt(t);
-	k = 2.0 * t * g;
-	z = 1.0/zeta;
-	f = polevl( z, AN, 7 ) / polevl( z, AD, 7 );
-	*ai = sqpii * f / k;
-	k = -0.5 * sqpii * t / g;
-	f = polevl( z, APN, 7 ) / polevl( z, APD, 7 );
-	*aip = f * k;
-
-	if( x > 8.3203353 )	/* zeta > 16 */
-		{
-		f = z * polevl( z, BN16, 4 ) / p1evl( z, BD16, 5 );
-		k = sqpii * g;
-		*bi = k * (1.0 + f) / t;
-		f = z * polevl( z, BPPN, 4 ) / p1evl( z, BPPD, 5 );
-		*bip = k * t * (1.0 + f);
-		return(0);
-		}
-	}
-
-f = 1.0;
-g = x;
-t = 1.0;
-uf = 1.0;
-ug = x;
-k = 1.0;
-z = x * x * x;
-while( t > MACHEP )
-	{
-	uf *= z;
-	k += 1.0;
-	uf /=k;
-	ug *= z;
-	k += 1.0;
-	ug /=k;
-	uf /=k;
-	f += uf;
-	k += 1.0;
-	ug /=k;
-	g += ug;
-	t = fabs(uf/f);
-	}
-uf = c1 * f;
-ug = c2 * g;
-if( (domflg & 1) == 0 )
-	*ai = uf - ug;
-if( (domflg & 2) == 0 )
-	*bi = sqrt3 * (uf + ug);
-
-/* the deriviative of ai */
-k = 4.0;
-uf = x * x/2.0;
-ug = z/3.0;
-f = uf;
-g = 1.0 + ug;
-uf /= 3.0;
-t = 1.0;
-
-while( t > MACHEP )
-	{
-	uf *= z;
-	ug /=k;
-	k += 1.0;
-	ug *= z;
-	uf /=k;
-	f += uf;
-	k += 1.0;
-	ug /=k;
-	uf /=k;
-	g += ug;
-	k += 1.0;
-	t = fabs(ug/g);
-	}
-
-uf = c1 * f;
-ug = c2 * g;
-if( (domflg & 4) == 0 )
-	*aip = uf - ug;
-if( (domflg & 8) == 0 )
-	*bip = sqrt3 * (uf + ug);
-return(0);
-}
Index: c/sas/models/c_extension/cephes/bdtr.c
===================================================================
--- src/sas/models/c_extension/cephes/bdtr.c	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,266 +1,0 @@
-/*							bdtr.c
- *
- *	Binomial distribution
- *
- *
- *
- * SYNOPSIS:
- *
- * int k, n;
- * double p, y, bdtr();
- *
- * y = bdtr( k, n, p );
- *
- * DESCRIPTION:
- *
- * Returns the sum of the terms 0 through k of the Binomial
- * probability density:
- *
- *   k
- *   --  ( n )   j      n-j
- *   >   (   )  p  (1-p)
- *   --  ( j )
- *  j=0
- *
- * The terms are not summed directly; instead the incomplete
- * beta integral is employed, according to the formula
- *
- * y = bdtr( k, n, p ) = incbet( n-k, k+1, 1-p ).
- *
- * The arguments must be positive, with p ranging from 0 to 1.
- *
- * ACCURACY:
- *
- * Tested at random points (a,b,p), with p between 0 and 1.
- *
- *               a,b                     Relative error:
- * arithmetic  domain     # trials      peak         rms
- *  For p between 0.001 and 1:
- *    IEEE     0,100       100000      4.3e-15     2.6e-16
- * See also incbet.c.
- *
- * ERROR MESSAGES:
- *
- *   message         condition      value returned
- * bdtr domain         k < 0            0.0
- *                     n < k
- *                     x < 0, x > 1
- */
-
-/*							bdtrc()
- *
- *	Complemented binomial distribution
- *
- *
- *
- * SYNOPSIS:
- *
- * int k, n;
- * double p, y, bdtrc();
- *
- * y = bdtrc( k, n, p );
- *
- * DESCRIPTION:
- *
- * Returns the sum of the terms k+1 through n of the Binomial
- * probability density:
- *
- *   n
- *   --  ( n )   j      n-j
- *   >   (   )  p  (1-p)
- *   --  ( j )
- *  j=k+1
- *
- * The terms are not summed directly; instead the incomplete
- * beta integral is employed, according to the formula
- *
- * y = bdtrc( k, n, p ) = incbet( k+1, n-k, p ).
- *
- * The arguments must be positive, with p ranging from 0 to 1.
- *
- * ACCURACY:
- *
- * Tested at random points (a,b,p).
- *
- *               a,b                     Relative error:
- * arithmetic  domain     # trials      peak         rms
- *  For p between 0.001 and 1:
- *    IEEE     0,100       100000      6.7e-15     8.2e-16
- *  For p between 0 and .001:
- *    IEEE     0,100       100000      1.5e-13     2.7e-15
- *
- * ERROR MESSAGES:
- *
- *   message         condition      value returned
- * bdtrc domain      x<0, x>1, n<k       0.0
- */
-
-/*							bdtri()
- *
- *	Inverse binomial distribution
- *
- *
- *
- * SYNOPSIS:
- *
- * int k, n;
- * double p, y, bdtri();
- *
- * p = bdtr( k, n, y );
- *
- * DESCRIPTION:
- *
- * Finds the event probability p such that the sum of the
- * terms 0 through k of the Binomial probability density
- * is equal to the given cumulative probability y.
- *
- * This is accomplished using the inverse beta integral
- * function and the relation
- *
- * 1 - p = incbi( n-k, k+1, y ).
- *
- * ACCURACY:
- *
- * Tested at random points (a,b,p).
- *
- *               a,b                     Relative error:
- * arithmetic  domain     # trials      peak         rms
- *  For p between 0.001 and 1:
- *    IEEE     0,100       100000      2.3e-14     6.4e-16
- *    IEEE     0,10000     100000      6.6e-12     1.2e-13
- *  For p between 10^-6 and 0.001:
- *    IEEE     0,100       100000      2.0e-12     1.3e-14
- *    IEEE     0,10000     100000      1.5e-12     3.2e-14
- * See also incbi.c.
- *
- * ERROR MESSAGES:
- *
- *   message         condition      value returned
- * bdtri domain     k < 0, n <= k         0.0
- *                  x < 0, x > 1
- */
-
-
-/*								bdtr() */
-
-
-/*
-Cephes Math Library Release 2.8:  June, 2000
-Copyright 1984, 1987, 1995, 2000 by Stephen L. Moshier
-*/
-
-#include "mconf.h"
-#ifdef ANSIPROT
-extern double incbet ( double, double, double );
-extern double incbi ( double, double, double );
-extern double pow ( double, double );
-extern double log1p ( double );
-extern double expm1 ( double );
-#else
-double incbet(), incbi(), pow(), log1p(), expm1();
-#endif
-
-double bdtrc( k, n, p )
-int k, n;
-double p;
-{
-double dk, dn;
-
-if( (p < 0.0) || (p > 1.0) )
-	goto domerr;
-if( k < 0 )
-	return( 1.0 );
-
-if( n < k )
-	{
-domerr:
-	mtherr( "bdtrc", DOMAIN );
-	return( 0.0 );
-	}
-
-if( k == n )
-	return( 0.0 );
-dn = n - k;
-if( k == 0 )
-	{
-	if( p < .01 )
-		dk = -expm1( dn * log1p(-p) );
-	else
-		dk = 1.0 - pow( 1.0-p, dn );
-	}
-else
-	{
-	dk = k + 1;
-	dk = incbet( dk, dn, p );
-	}
-return( dk );
-}
-
-
-
-double bdtr( k, n, p )
-int k, n;
-double p;
-{
-double dk, dn;
-
-if( (p < 0.0) || (p > 1.0) )
-	goto domerr;
-if( (k < 0) || (n < k) )
-	{
-domerr:
-	mtherr( "bdtr", DOMAIN );
-	return( 0.0 );
-	}
-
-if( k == n )
-	return( 1.0 );
-
-dn = n - k;
-if( k == 0 )
-	{
-	dk = pow( 1.0-p, dn );
-	}
-else
-	{
-	dk = k + 1;
-	dk = incbet( dn, dk, 1.0 - p );
-	}
-return( dk );
-}
-
-
-double bdtri( k, n, y )
-int k, n;
-double y;
-{
-double dk, dn, p;
-
-if( (y < 0.0) || (y > 1.0) )
-	goto domerr;
-if( (k < 0) || (n <= k) )
-	{
-domerr:
-	mtherr( "bdtri", DOMAIN );
-	return( 0.0 );
-	}
-
-dn = n - k;
-if( k == 0 )
-	{
-	if( y > 0.8 )
-		p = -expm1( log1p(y-1.0) / dn );
-	else
-		p = 1.0 - pow( y, 1.0/dn );
-	}
-else
-	{
-	dk = k + 1;
-	p = incbet( dn, dk, 0.5 );
-	if( p > 0.5 )
-		p = incbi( dk, dn, 1.0-y );
-	else
-		p = 1.0 - incbi( dn, dk, y );
-	}
-return( p );
-}
Index: c/sas/models/c_extension/cephes/btdtr.c
===================================================================
--- src/sas/models/c_extension/cephes/btdtr.c	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,65 +1,0 @@
-
-/*							btdtr.c
- *
- *	Beta distribution
- *
- *
- *
- * SYNOPSIS:
- *
- * double a, b, x, y, btdtr();
- *
- * y = btdtr( a, b, x );
- *
- *
- *
- * DESCRIPTION:
- *
- * Returns the area from zero to x under the beta density
- * function:
- *
- *
- *                          x
- *            -             -
- *           | (a+b)       | |  a-1      b-1
- * P(x)  =  ----------     |   t    (1-t)    dt
- *           -     -     | |
- *          | (a) | (b)   -
- *                         0
- *
- *
- * This function is identical to the incomplete beta
- * integral function incbet(a, b, x).
- *
- * The complemented function is
- *
- * 1 - P(1-x)  =  incbet( b, a, x );
- *
- *
- * ACCURACY:
- *
- * See incbet.c.
- *
- */
-
-
-/*								btdtr()	*/
-
-
-/*
-Cephes Math Library Release 2.8:  June, 2000
-Copyright 1984, 1987, 1995, 2000 by Stephen L. Moshier
-*/
-#include "mconf.h"
-#ifdef ANSIPROT
-extern double incbet ( double, double, double );
-#else
-double incbet();
-#endif
-
-double btdtr( a, b, x )
-double a, b, x;
-{
-
-return( incbet( a, b, x ) );
-}
Index: c/sas/models/c_extension/cephes/cephes.h
===================================================================
--- src/sas/models/c_extension/cephes/cephes.h	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,10 +1,0 @@
-/*
- * header for the selection of cephes routines here.
- *
- * used for the bessel functions - some of the rest could be removed.
- *
- * AJJ 2013-04-05
- */
-
-#include "mconf.h"
-#include "protos.h"
Index: c/sas/models/c_extension/cephes/chbevl.c
===================================================================
--- src/sas/models/c_extension/cephes/chbevl.c	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,83 +1,0 @@
-/*							chbevl.c
- *
- *	Evaluate Chebyshev series
- *
- *
- *
- * SYNOPSIS:
- *
- * int N;
- * double x, y, coef[N], chebevl();
- *
- * y = chbevl( x, coef, N );
- *
- *
- *
- * DESCRIPTION:
- *
- * Evaluates the series
- *
- *        N-1
- *         - '
- *  y  =   >   coef[i] T (x/2)
- *         -            i
- *        i=0
- *
- * of Chebyshev polynomials Ti at argument x/2.
- *
- * Coefficients are stored in reverse order, i.e. the zero
- * order term is last in the array.  Note N is the number of
- * coefficients, not the order.
- *
- * If coefficients are for the interval a to b, x must
- * have been transformed to x -> 2(2x - b - a)/(b-a) before
- * entering the routine.  This maps x from (a, b) to (-1, 1),
- * over which the Chebyshev polynomials are defined.
- *
- * If the coefficients are for the inverted interval, in
- * which (a, b) is mapped to (1/b, 1/a), the transformation
- * required is x -> 2(2ab/x - b - a)/(b-a).  If b is infinity,
- * this becomes x -> 4a/x - 1.
- *
- *
- *
- * SPEED:
- *
- * Taking advantage of the recurrence properties of the
- * Chebyshev polynomials, the routine requires one more
- * addition per loop than evaluating a nested polynomial of
- * the same degree.
- *
- */
-
-/*							chbevl.c	*/
-
-/*
-Cephes Math Library Release 2.0:  April, 1987
-Copyright 1985, 1987 by Stephen L. Moshier
-Direct inquiries to 30 Frost Street, Cambridge, MA 02140
-*/
-
-double chbevl( x, array, n )
-double x;
-double array[];
-int n;
-{
-double b0, b1, b2, *p;
-int i;
-
-p = array;
-b0 = *p++;
-b1 = 0.0;
-i = n - 1;
-
-do
-	{
-	b2 = b1;
-	b1 = b0;
-	b0 = x * b1  -  b2  + *p++;
-	}
-while( --i );
-
-return( 0.5*(b0-b2) );
-}
Index: c/sas/models/c_extension/cephes/chdtr.c
===================================================================
--- src/sas/models/c_extension/cephes/chdtr.c	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,203 +1,0 @@
-/*							chdtr.c
- *
- *	Chi-square distribution
- *
- *
- *
- * SYNOPSIS:
- *
- * double df, x, y, chdtr();
- *
- * y = chdtr( df, x );
- *
- *
- *
- * DESCRIPTION:
- *
- * Returns the area under the left hand tail (from 0 to x)
- * of the Chi square probability density function with
- * v degrees of freedom.
- *
- *
- *                                  inf.
- *                                    -
- *                        1          | |  v/2-1  -t/2
- *  P( x | v )   =   -----------     |   t      e     dt
- *                    v/2  -       | |
- *                   2    | (v/2)   -
- *                                   x
- *
- * where x is the Chi-square variable.
- *
- * The incomplete gamma integral is used, according to the
- * formula
- *
- *	y = chdtr( v, x ) = igam( v/2.0, x/2.0 ).
- *
- *
- * The arguments must both be positive.
- *
- *
- *
- * ACCURACY:
- *
- * See igam().
- *
- * ERROR MESSAGES:
- *
- *   message         condition      value returned
- * chdtr domain   x < 0 or v < 1        0.0
- */
-
-/*							chdtrc()
- *
- *	Complemented Chi-square distribution
- *
- *
- *
- * SYNOPSIS:
- *
- * double v, x, y, chdtrc();
- *
- * y = chdtrc( v, x );
- *
- *
- *
- * DESCRIPTION:
- *
- * Returns the area under the right hand tail (from x to
- * infinity) of the Chi square probability density function
- * with v degrees of freedom:
- *
- *
- *                                  inf.
- *                                    -
- *                        1          | |  v/2-1  -t/2
- *  P( x | v )   =   -----------     |   t      e     dt
- *                    v/2  -       | |
- *                   2    | (v/2)   -
- *                                   x
- *
- * where x is the Chi-square variable.
- *
- * The incomplete gamma integral is used, according to the
- * formula
- *
- *	y = chdtr( v, x ) = igamc( v/2.0, x/2.0 ).
- *
- *
- * The arguments must both be positive.
- *
- *
- *
- * ACCURACY:
- *
- * See igamc().
- *
- * ERROR MESSAGES:
- *
- *   message         condition      value returned
- * chdtrc domain  x < 0 or v < 1        0.0
- */
-
-/*							chdtri()
- *
- *	Inverse of complemented Chi-square distribution
- *
- *
- *
- * SYNOPSIS:
- *
- * double df, x, y, chdtri();
- *
- * x = chdtri( df, y );
- *
- *
- *
- *
- * DESCRIPTION:
- *
- * Finds the Chi-square argument x such that the integral
- * from x to infinity of the Chi-square density is equal
- * to the given cumulative probability y.
- *
- * This is accomplished using the inverse gamma integral
- * function and the relation
- *
- *    x/2 = igami( df/2, y );
- *
- *
- *
- *
- * ACCURACY:
- *
- * See igami.c.
- *
- * ERROR MESSAGES:
- *
- *   message         condition      value returned
- * chdtri domain   y < 0 or y > 1        0.0
- *                     v < 1
- *
- */
-
-
-/*								chdtr() */
-
-
-/*
-Cephes Math Library Release 2.8:  June, 2000
-Copyright 1984, 1987, 2000 by Stephen L. Moshier
-*/
-
-#include "mconf.h"
-#ifdef ANSIPROT
-extern double igamc ( double, double );
-extern double igam ( double, double );
-extern double igami ( double, double );
-#else
-double igamc(), igam(), igami();
-#endif
-
-double chdtrc(df,x)
-double df, x;
-{
-
-if( (x < 0.0) || (df < 1.0) )
-	{
-	mtherr( "chdtrc", DOMAIN );
-	return(0.0);
-	}
-return( igamc( df/2.0, x/2.0 ) );
-}
-
-
-
-double chdtr(df,x)
-double df, x;
-{
-
-if( (x < 0.0) || (df < 1.0) )
-	{
-	mtherr( "chdtr", DOMAIN );
-	return(0.0);
-	}
-return( igam( df/2.0, x/2.0 ) );
-}
-
-
-
-double chdtri( df, y )
-double df, y;
-{
-double x;
-
-if( (y < 0.0) || (y > 1.0) || (df < 1.0) )
-	{
-	mtherr( "chdtri", DOMAIN );
-	return(0.0);
-	}
-
-x = igami( 0.5 * df, y );
-return( 2.0 * x );
-}
Index: c/sas/models/c_extension/cephes/const.c
===================================================================
--- src/sas/models/c_extension/cephes/const.c	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,253 +1,0 @@
-/*							const.c
- *
- *	Globally declared constants
- *
- *
- *
- * SYNOPSIS:
- *
- * extern double nameofconstant;
- *
- *
- *
- *
- * DESCRIPTION:
- *
- * This file contains a number of mathematical constants and
- * also some needed size parameters of the computer arithmetic.
- * The values are supplied as arrays of hexadecimal integers
- * for IEEE arithmetic; arrays of octal constants for DEC
- * arithmetic; and in a normal decimal scientific notation for
- * other machines.  The particular notation used is determined
- * by a symbol (DEC, IBMPC, or UNK) defined in the include file
- * mconf.h.
- *
- * The default size parameters are as follows.
- *
- * For DEC and UNK modes:
- * MACHEP =  1.38777878078144567553E-17       2**-56
- * MAXLOG =  8.8029691931113054295988E1       log(2**127)
- * MINLOG = -8.872283911167299960540E1        log(2**-128)
- * MAXNUM =  1.701411834604692317316873e38    2**127
- *
- * For IEEE arithmetic (IBMPC):
- * MACHEP =  1.11022302462515654042E-16       2**-53
- * MAXLOG =  7.09782712893383996843E2         log(2**1024)
- * MINLOG = -7.08396418532264106224E2         log(2**-1022)
- * MAXNUM =  1.7976931348623158E308           2**1024
- *
- * The global symbols for mathematical constants are
- * PI     =  3.14159265358979323846           pi
- * PIO2   =  1.57079632679489661923           pi/2
- * PIO4   =  7.85398163397448309616E-1        pi/4
- * SQRT2  =  1.41421356237309504880           sqrt(2)
- * SQRTH  =  7.07106781186547524401E-1        sqrt(2)/2
- * LOG2E  =  1.4426950408889634073599         1/log(2)
- * SQ2OPI =  7.9788456080286535587989E-1      sqrt( 2/pi )
- * LOGE2  =  6.93147180559945309417E-1        log(2)
- * LOGSQ2 =  3.46573590279972654709E-1        log(2)/2
- * THPIO4 =  2.35619449019234492885           3*pi/4
- * TWOOPI =  6.36619772367581343075535E-1     2/pi
- *
- * These lists are subject to change.
- */
-
-
-/*							const.c */
-
-/*
-Cephes Math Library Release 2.3:  March, 1995
-Copyright 1984, 1995 by Stephen L. Moshier
-*/
-
-#include "mconf.h"
-
-#ifdef UNK
-#if 1
-double MACHEP =  1.11022302462515654042E-16;   /* 2**-53 */
-#else
-double MACHEP =  1.38777878078144567553E-17;   /* 2**-56 */
-#endif
-double UFLOWTHRESH =  2.22507385850720138309E-308; /* 2**-1022 */
-#ifdef DENORMAL
-double MAXLOG =  7.09782712893383996732E2;     /* log(MAXNUM) */
-/* double MINLOG = -7.44440071921381262314E2; */     /* log(2**-1074) */
-double MINLOG = -7.451332191019412076235E2;     /* log(2**-1075) */
-#else
-double MAXLOG =  7.08396418532264106224E2;     /* log 2**1022 */
-double MINLOG = -7.08396418532264106224E2;     /* log 2**-1022 */
-#endif
-double MAXNUM =  1.79769313486231570815E308;    /* 2**1024*(1-MACHEP) */
-double PI     =  3.14159265358979323846;       /* pi */
-double PIO2   =  1.57079632679489661923;       /* pi/2 */
-double PIO4   =  7.85398163397448309616E-1;    /* pi/4 */
-double SQRT2  =  1.41421356237309504880;       /* sqrt(2) */
-double SQRTH  =  7.07106781186547524401E-1;    /* sqrt(2)/2 */
-double LOG2E  =  1.4426950408889634073599;     /* 1/log(2) */
-double SQ2OPI =  7.9788456080286535587989E-1;  /* sqrt( 2/pi ) */
-double LOGE2  =  6.93147180559945309417E-1;    /* log(2) */
-double LOGSQ2 =  3.46573590279972654709E-1;    /* log(2)/2 */
-double THPIO4 =  2.35619449019234492885;       /* 3*pi/4 */
-double TWOOPI =  6.36619772367581343075535E-1; /* 2/pi */
-#ifdef INFINITIES
-double INFINITY = 1.0/0.0;  /* 99e999; */
-#else
-double INFINITY =  1.79769313486231570815E308;    /* 2**1024*(1-MACHEP) */
-#endif
-#ifdef NANS
-double NAN = 1.0/0.0 - 1.0/0.0;
-#else
-double NAN = 0.0;
-#endif
-#ifdef MINUSZERO
-double NEGZERO = -0.0;
-#else
-double NEGZERO = 0.0;
-#endif
-#endif
-
-#ifdef IBMPC
-			/* 2**-53 =  1.11022302462515654042E-16 */
-unsigned short MACHEP[4] = {0x0000,0x0000,0x0000,0x3ca0};
-unsigned short UFLOWTHRESH[4] = {0x0000,0x0000,0x0000,0x0010};
-#ifdef DENORMAL
-			/* log(MAXNUM) =  7.09782712893383996732224E2 */
-unsigned short MAXLOG[4] = {0x39ef,0xfefa,0x2e42,0x4086};
-			/* log(2**-1074) = - -7.44440071921381262314E2 */
-/*unsigned short MINLOG[4] = {0x71c3,0x446d,0x4385,0xc087};*/
-unsigned short MINLOG[4] = {0x3052,0xd52d,0x4910,0xc087};
-#else
-			/* log(2**1022) =   7.08396418532264106224E2 */
-unsigned short MAXLOG[4] = {0xbcd2,0xdd7a,0x232b,0x4086};
-			/* log(2**-1022) = - 7.08396418532264106224E2 */
-unsigned short MINLOG[4] = {0xbcd2,0xdd7a,0x232b,0xc086};
-#endif
-			/* 2**1024*(1-MACHEP) =  1.7976931348623158E308 */
-unsigned short MAXNUM[4] = {0xffff,0xffff,0xffff,0x7fef};
-unsigned short PI[4]     = {0x2d18,0x5444,0x21fb,0x4009};
-unsigned short PIO2[4]   = {0x2d18,0x5444,0x21fb,0x3ff9};
-unsigned short PIO4[4]   = {0x2d18,0x5444,0x21fb,0x3fe9};
-unsigned short SQRT2[4]  = {0x3bcd,0x667f,0xa09e,0x3ff6};
-unsigned short SQRTH[4]  = {0x3bcd,0x667f,0xa09e,0x3fe6};
-unsigned short LOG2E[4]  = {0x82fe,0x652b,0x1547,0x3ff7};
-unsigned short SQ2OPI[4] = {0x3651,0x33d4,0x8845,0x3fe9};
-unsigned short LOGE2[4]  = {0x39ef,0xfefa,0x2e42,0x3fe6};
-unsigned short LOGSQ2[4] = {0x39ef,0xfefa,0x2e42,0x3fd6};
-unsigned short THPIO4[4] = {0x21d2,0x7f33,0xd97c,0x4002};
-unsigned short TWOOPI[4] = {0xc883,0x6dc9,0x5f30,0x3fe4};
-#ifdef INFINITIES
-unsigned short INFINITY[4] = {0x0000,0x0000,0x0000,0x7ff0};
-#else
-unsigned short INFINITY[4] = {0xffff,0xffff,0xffff,0x7fef};
-#endif
-#ifdef NANS
-unsigned short NAN[4] = {0x0000,0x0000,0x0000,0x7ffc};
-#else
-unsigned short NAN[4] = {0x0000,0x0000,0x0000,0x0000};
-#endif
-#ifdef MINUSZERO
-unsigned short NEGZERO[4] = {0x0000,0x0000,0x0000,0x8000};
-#else
-unsigned short NEGZERO[4] = {0x0000,0x0000,0x0000,0x0000};
-#endif
-#endif
-
-#ifdef MIEEE
-			/* 2**-53 =  1.11022302462515654042E-16 */
-unsigned short MACHEP[4] = {0x3ca0,0x0000,0x0000,0x0000};
-unsigned short UFLOWTHRESH[4] = {0x0010,0x0000,0x0000,0x0000};
-#ifdef DENORMAL
-			/* log(2**1024) =   7.09782712893383996843E2 */
-unsigned short MAXLOG[4] = {0x4086,0x2e42,0xfefa,0x39ef};
-			/* log(2**-1074) = - -7.44440071921381262314E2 */
-/* unsigned short MINLOG[4] = {0xc087,0x4385,0x446d,0x71c3}; */
-unsigned short MINLOG[4] = {0xc087,0x4910,0xd52d,0x3052};
-#else
-			/* log(2**1022) =  7.08396418532264106224E2 */
-unsigned short MAXLOG[4] = {0x4086,0x232b,0xdd7a,0xbcd2};
-			/* log(2**-1022) = - 7.08396418532264106224E2 */
-unsigned short MINLOG[4] = {0xc086,0x232b,0xdd7a,0xbcd2};
-#endif
-			/* 2**1024*(1-MACHEP) =  1.7976931348623158E308 */
-unsigned short MAXNUM[4] = {0x7fef,0xffff,0xffff,0xffff};
-unsigned short PI[4]     = {0x4009,0x21fb,0x5444,0x2d18};
-unsigned short PIO2[4]   = {0x3ff9,0x21fb,0x5444,0x2d18};
-unsigned short PIO4[4]   = {0x3fe9,0x21fb,0x5444,0x2d18};
-unsigned short SQRT2[4]  = {0x3ff6,0xa09e,0x667f,0x3bcd};
-unsigned short SQRTH[4]  = {0x3fe6,0xa09e,0x667f,0x3bcd};
-unsigned short LOG2E[4]  = {0x3ff7,0x1547,0x652b,0x82fe};
-unsigned short SQ2OPI[4] = {0x3fe9,0x8845,0x33d4,0x3651};
-unsigned short LOGE2[4]  = {0x3fe6,0x2e42,0xfefa,0x39ef};
-unsigned short LOGSQ2[4] = {0x3fd6,0x2e42,0xfefa,0x39ef};
-unsigned short THPIO4[4] = {0x4002,0xd97c,0x7f33,0x21d2};
-unsigned short TWOOPI[4] = {0x3fe4,0x5f30,0x6dc9,0xc883};
-#ifdef INFINITIES
-unsigned short INFINITY[4] = {0x7ff0,0x0000,0x0000,0x0000};
-#else
-unsigned short INFINITY[4] = {0x7fef,0xffff,0xffff,0xffff};
-#endif
-#ifdef NANS
-unsigned short NAN[4] = {0x7ff8,0x0000,0x0000,0x0000};
-#else
-unsigned short NAN[4] = {0x0000,0x0000,0x0000,0x0000};
-#endif
-#ifdef MINUSZERO
-unsigned short NEGZERO[4] = {0x8000,0x0000,0x0000,0x0000};
-#else
-unsigned short NEGZERO[4] = {0x0000,0x0000,0x0000,0x0000};
-#endif
-#endif
-
-#ifdef DEC
-			/* 2**-56 =  1.38777878078144567553E-17 */
-unsigned short MACHEP[4] = {0022200,0000000,0000000,0000000};
-unsigned short UFLOWTHRESH[4] = {0x0080,0x0000,0x0000,0x0000};
-			/* log 2**127 = 88.029691931113054295988 */
-unsigned short MAXLOG[4] = {041660,007463,0143742,025733,};
-			/* log 2**-128 = -88.72283911167299960540 */
-unsigned short MINLOG[4] = {0141661,071027,0173721,0147572,};
-			/* 2**127 = 1.701411834604692317316873e38 */
-unsigned short MAXNUM[4] = {077777,0177777,0177777,0177777,};
-unsigned short PI[4]     = {040511,007732,0121041,064302,};
-unsigned short PIO2[4]   = {040311,007732,0121041,064302,};
-unsigned short PIO4[4]   = {040111,007732,0121041,064302,};
-unsigned short SQRT2[4]  = {040265,002363,031771,0157145,};
-unsigned short SQRTH[4]  = {040065,002363,031771,0157144,};
-unsigned short LOG2E[4]  = {040270,0125073,024534,013761,};
-unsigned short SQ2OPI[4] = {040114,041051,0117241,0131204,};
-unsigned short LOGE2[4]  = {040061,071027,0173721,0147572,};
-unsigned short LOGSQ2[4] = {037661,071027,0173721,0147572,};
-unsigned short THPIO4[4] = {040426,0145743,0174631,007222,};
-unsigned short TWOOPI[4] = {040042,0174603,067116,042025,};
-/* Approximate infinity by MAXNUM.  */
-unsigned short INFINITY[4] = {077777,0177777,0177777,0177777,};
-unsigned short NAN[4] = {0000000,0000000,0000000,0000000};
-#ifdef MINUSZERO
-unsigned short NEGZERO[4] = {0000000,0000000,0000000,0100000};
-#else
-unsigned short NEGZERO[4] = {0000000,0000000,0000000,0000000};
-#endif
-#endif
-
-#ifndef UNK
-extern unsigned short MACHEP[];
-extern unsigned short UFLOWTHRESH[];
-extern unsigned short MAXLOG[];
-extern unsigned short UNDLOG[];
-extern unsigned short MINLOG[];
-extern unsigned short MAXNUM[];
-extern unsigned short PI[];
-extern unsigned short PIO2[];
-extern unsigned short PIO4[];
-extern unsigned short SQRT2[];
-extern unsigned short SQRTH[];
-extern unsigned short LOG2E[];
-extern unsigned short SQ2OPI[];
-extern unsigned short LOGE2[];
-extern unsigned short LOGSQ2[];
-extern unsigned short THPIO4[];
-extern unsigned short TWOOPI[];
-extern unsigned short INFINITY[];
-extern unsigned short NAN[];
-extern unsigned short NEGZERO[];
-#endif
Index: c/sas/models/c_extension/cephes/cprob.mak
===================================================================
--- src/sas/models/c_extension/cephes/cprob.mak	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,14 +1,0 @@
-# Makefile for probability integrals.
-# Be sure to set the type of computer and endianness in mconf.h.
-
-CC = gcc
-CFLAGS = -O2 -Wall
-INCS = mconf.h
-
-OBJS = bdtr.o btdtr.o chdtr.o drand.o expx2.o fdtr.o gamma.o gdtr.o \
-igam.o igami.o incbet.o incbi.o mtherr.o nbdtr.o ndtr.o ndtri.o pdtr.o \
-stdtr.o unity.o polevl.o const.o
-
-libprob.a: $(OBJS) $(INCS)
-	ar rv libprob.a $(OBJS)
-	ranlib libprob.a
Index: c/sas/models/c_extension/cephes/drand.c
===================================================================
--- src/sas/models/c_extension/cephes/drand.c	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,163 +1,0 @@
-/*							drand.c
- *
- *	Pseudorandom number generator
- *
- *
- *
- * SYNOPSIS:
- *
- * double y, drand();
- *
- * drand( &y );
- *
- *
- *
- * DESCRIPTION:
- *
- * Yields a random number 1.0 <= y < 2.0.
- *
- * The three-generator congruential algorithm by Brian
- * Wichmann and David Hill (BYTE magazine, March, 1987,
- * pp 127-8) is used. The period, given by them, is
- * 6953607871644.
- *
- * Versions invoked by the different arithmetic compile
- * time options DEC, IBMPC, and MIEEE, produce
- * approximately the same sequences, differing only in the
- * least significant bits of the numbers. The UNK option
- * implements the algorithm as recommended in the BYTE
- * article.  It may be used on all computers. However,
- * the low order bits of a double precision number may
- * not be adequately random, and may vary due to arithmetic
- * implementation details on different computers.
- *
- * The other compile options generate an additional random
- * integer that overwrites the low order bits of the double
- * precision number.  This reduces the period by a factor of
- * two but tends to overcome the problems mentioned.
- *
- */
-
-
-
-/*  Three-generator random number algorithm
- * of Brian Wichmann and David Hill
- * BYTE magazine, March, 1987 pp 127-8
- *
- * The period, given by them, is (p-1)(q-1)(r-1)/4 = 6.95e12.
- */
-
-#include "mconf.h"
-#ifdef ANSIPROT
-static int ranwh ( void );
-#else
-static int ranwh();
-#endif
-
-static int sx = 1;
-static int sy = 10000;
-static int sz = 3000;
-
-static union {
- double d;
- unsigned short s[4];
-} unkans;
-
-/* This function implements the three
- * congruential generators.
- */
- 
-static int ranwh()
-{
-int r, s;
-
-/*  sx = sx * 171 mod 30269 */
-r = sx/177;
-s = sx - 177 * r;
-sx = 171 * s - 2 * r;
-if( sx < 0 )
-	sx += 30269;
-
-
-/* sy = sy * 172 mod 30307 */
-r = sy/176;
-s = sy - 176 * r;
-sy = 172 * s - 35 * r;
-if( sy < 0 )
-	sy += 30307;
-
-/* sz = 170 * sz mod 30323 */
-r = sz/178;
-s = sz - 178 * r;
-sz = 170 * s - 63 * r;
-if( sz < 0 )
-	sz += 30323;
-/* The results are in static sx, sy, sz. */
-return 0;
-}
-
-
-/*	drand.c
- *
- * Random double precision floating point number between 1 and 2.
- *
- * C callable:
- *	drand( &x );
- */
-
-int drand( a )
-double *a;
-{
-unsigned short r;
-#ifdef DEC
-unsigned short s, t;
-#endif
-
-/* This algorithm of Wichmann and Hill computes a floating point
- * result:
- */
-ranwh();
-unkans.d = sx/30269.0  +  sy/30307.0  +  sz/30323.0;
-r = unkans.d;
-unkans.d -= r;
-unkans.d += 1.0;
-
-/* if UNK option, do nothing further.
- * Otherwise, make a random 16 bit integer
- * to overwrite the least significant word
- * of unkans.
- */
-#ifdef UNK
-/* do nothing */
-#else
-ranwh();
-r = sx * sy + sz;
-#endif
-
-#ifdef DEC
-/* To make the numbers as similar as possible
- * in all arithmetics, the random integer has
- * to be inserted 3 bits higher up in a DEC number.
- * An alternative would be put it 3 bits lower down
- * in all the other number types.
- */
-s = unkans.s[2];
-t = s & 07;	/* save these bits to put in at the bottom */
-s &= 0177770;
-s |= (r >> 13) & 07;
-unkans.s[2] = s;
-t |= r << 3;
-unkans.s[3] = t;
-#endif
-
-#ifdef IBMPC
-unkans.s[0] = r;
-#endif
-
-#ifdef MIEEE
-unkans.s[3] = r;
-#endif
-
-*a = unkans.d;
-return 0;
-}
Index: c/sas/models/c_extension/cephes/expx2.c
===================================================================
--- src/sas/models/c_extension/cephes/expx2.c	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,93 +1,0 @@
-/*							expx2.c
- *
- *	Exponential of squared argument
- *
- *
- *
- * SYNOPSIS:
- *
- * double x, y, expx2();
- * int sign;
- *
- * y = expx2( x, sign );
- *
- *
- *
- * DESCRIPTION:
- *
- * Computes y = exp(x*x) while suppressing error amplification
- * that would ordinarily arise from the inexactness of the
- * exponential argument x*x.
- *
- * If sign < 0, the result is inverted; i.e., y = exp(-x*x) .
- * 
- *
- * ACCURACY:
- *
- *                      Relative error:
- * arithmetic    domain     # trials      peak         rms
- *   IEEE      -26.6, 26.6    10^7       3.9e-16     8.9e-17
- *
- */
-
-/*
-Cephes Math Library Release 2.9:  June, 2000
-Copyright 2000 by Stephen L. Moshier
-*/
-
-#include "mconf.h"
-
-#ifdef ANSIPROT
-extern double fabs (double);
-extern double floor (double);
-extern double exp (double);
-#else
-double fabs();
-double floor();
-double exp();
-#endif
-
-#ifdef DEC
-#define M 32.0
-#define MINV .03125
-#else
-#define M 128.0
-#define MINV .0078125
-#endif
-
-extern double MAXLOG;
-extern double INFINITY;
-
-double expx2 (x, sign)
-     double x;
-     int sign;
-{
-  double u, u1, m, f;
-
-  x = fabs (x);
-  if (sign < 0)
-    x = -x;
-
-  /* Represent x as an exact multiple of M plus a residual.
-     M is a power of 2 chosen so that exp(m * m) does not overflow
-     or underflow and so that |x - m| is small.  */
-  m = MINV * floor(M * x + 0.5);
-  f = x - m;
-
-  /* x^2 = m^2 + 2mf + f^2 */
-  u = m * m;
-  u1 = 2 * m * f  +  f * f;
-
-  if (sign < 0)
-    {
-      u = -u;
-      u1 = -u1;
-    }
-
-  if ((u+u1) > MAXLOG)
-    return (INFINITY);
-
-  /* u is exact, u1 is small.  */
-  u = exp(u) * exp(u1);
-  return(u);
-}
Index: c/sas/models/c_extension/cephes/fdtr.c
===================================================================
--- src/sas/models/c_extension/cephes/fdtr.c	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,240 +1,0 @@
-/*							fdtr.c
- *
- *	F distribution
- *
- *
- *
- * SYNOPSIS:
- *
- * int df1, df2;
- * double x, y, fdtr();
- *
- * y = fdtr( df1, df2, x );
- *
- * DESCRIPTION:
- *
- * Returns the area from zero to x under the F density
- * function (also known as Snedcor's density or the
- * variance ratio density).  This is the density
- * of x = (u1/df1)/(u2/df2), where u1 and u2 are random
- * variables having Chi square distributions with df1
- * and df2 degrees of freedom, respectively.
- *
- * The incomplete beta integral is used, according to the
- * formula
- *
- *	P(x) = incbet( df1/2, df2/2, (df1*x/(df2 + df1*x) ).
- *
- *
- * The arguments a and b are greater than zero, and x is
- * nonnegative.
- *
- * ACCURACY:
- *
- * Tested at random points (a,b,x).
- *
- *                x     a,b                     Relative error:
- * arithmetic  domain  domain     # trials      peak         rms
- *    IEEE      0,1    0,100       100000      9.8e-15     1.7e-15
- *    IEEE      1,5    0,100       100000      6.5e-15     3.5e-16
- *    IEEE      0,1    1,10000     100000      2.2e-11     3.3e-12
- *    IEEE      1,5    1,10000     100000      1.1e-11     1.7e-13
- * See also incbet.c.
- *
- *
- * ERROR MESSAGES:
- *
- *   message         condition      value returned
- * fdtr domain     a<0, b<0, x<0         0.0
- *
- */
-
-/*							fdtrc()
- *
- *	Complemented F distribution
- *
- *
- *
- * SYNOPSIS:
- *
- * int df1, df2;
- * double x, y, fdtrc();
- *
- * y = fdtrc( df1, df2, x );
- *
- * DESCRIPTION:
- *
- * Returns the area from x to infinity under the F density
- * function (also known as Snedcor's density or the
- * variance ratio density).
- *
- *
- *                      inf.
- *                       -
- *              1       | |  a-1      b-1
- * 1-P(x)  =  ------    |   t    (1-t)    dt
- *            B(a,b)  | |
- *                     -
- *                      x
- *
- *
- * The incomplete beta integral is used, according to the
- * formula
- *
- *	P(x) = incbet( df2/2, df1/2, (df2/(df2 + df1*x) ).
- *
- *
- * ACCURACY:
- *
- * Tested at random points (a,b,x) in the indicated intervals.
- *                x     a,b                     Relative error:
- * arithmetic  domain  domain     # trials      peak         rms
- *    IEEE      0,1    1,100       100000      3.7e-14     5.9e-16
- *    IEEE      1,5    1,100       100000      8.0e-15     1.6e-15
- *    IEEE      0,1    1,10000     100000      1.8e-11     3.5e-13
- *    IEEE      1,5    1,10000     100000      2.0e-11     3.0e-12
- * See also incbet.c.
- *
- * ERROR MESSAGES:
- *
- *   message         condition      value returned
- * fdtrc domain    a<0, b<0, x<0         0.0
- *
- */
-
-/*							fdtri()
- *
- *	Inverse of complemented F distribution
- *
- *
- *
- * SYNOPSIS:
- *
- * int df1, df2;
- * double x, p, fdtri();
- *
- * x = fdtri( df1, df2, p );
- *
- * DESCRIPTION:
- *
- * Finds the F density argument x such that the integral
- * from x to infinity of the F density is equal to the
- * given probability p.
- *
- * This is accomplished using the inverse beta integral
- * function and the relations
- *
- *      z = incbi( df2/2, df1/2, p )
- *      x = df2 (1-z) / (df1 z).
- *
- * Note: the following relations hold for the inverse of
- * the uncomplemented F distribution:
- *
- *      z = incbi( df1/2, df2/2, p )
- *      x = df2 z / (df1 (1-z)).
- *
- * ACCURACY:
- *
- * Tested at random points (a,b,p).
- *
- *              a,b                     Relative error:
- * arithmetic  domain     # trials      peak         rms
- *  For p between .001 and 1:
- *    IEEE     1,100       100000      8.3e-15     4.7e-16
- *    IEEE     1,10000     100000      2.1e-11     1.4e-13
- *  For p between 10^-6 and 10^-3:
- *    IEEE     1,100        50000      1.3e-12     8.4e-15
- *    IEEE     1,10000      50000      3.0e-12     4.8e-14
- * See also fdtrc.c.
- *
- * ERROR MESSAGES:
- *
- *   message         condition      value returned
- * fdtri domain   p <= 0 or p > 1       0.0
- *                     v < 1
- *
- */
-
-
-
-/*
-Cephes Math Library Release 2.8:  June, 2000
-Copyright 1984, 1987, 1995, 2000 by Stephen L. Moshier
-*/
-
-
-#include "mconf.h"
-#ifdef ANSIPROT
-extern double incbet ( double, double, double );
-extern double incbi ( double, double, double );
-#else
-double incbet(), incbi();
-#endif
-
-double fdtrc( ia, ib, x )
-int ia, ib;
-double x;
-{
-double a, b, w;
-
-if( (ia < 1) || (ib < 1) || (x < 0.0) )
-	{
-	mtherr( "fdtrc", DOMAIN );
-	return( 0.0 );
-	}
-a = ia;
-b = ib;
-w = b / (b + a * x);
-return( incbet( 0.5*b, 0.5*a, w ) );
-}
-
-
-
-double fdtr( ia, ib, x )
-int ia, ib;
-double x;
-{
-double a, b, w;
-
-if( (ia < 1) || (ib < 1) || (x < 0.0) )
-	{
-	mtherr( "fdtr", DOMAIN );
-	return( 0.0 );
-	}
-a = ia;
-b = ib;
-w = a * x;
-w = w / (b + w);
-return( incbet(0.5*a, 0.5*b, w) );
-}
-
-
-double fdtri( ia, ib, y )
-int ia, ib;
-double y;
-{
-double a, b, w, x;
-
-if( (ia < 1) || (ib < 1) || (y <= 0.0) || (y > 1.0) )
-	{
-	mtherr( "fdtri", DOMAIN );
-	return( 0.0 );
-	}
-a = ia;
-b = ib;
-/* Compute probability for x = 0.5.  */
-w = incbet( 0.5*b, 0.5*a, 0.5 );
-/* If that is greater than y, then the solution w < .5.
-   Otherwise, solve at 1-y to remove cancellation in (b - b*w).  */
-if( w > y || y < 0.001)
-	{
-	w = incbi( 0.5*b, 0.5*a, y );
-	x = (b - b*w)/(a*w);
-	}
-else
-	{
-	w = incbi( 0.5*a, 0.5*b, 1.0-y );
-	x = b*w/(a*(1.0-w));
-	}
-return(x);
-}
Index: c/sas/models/c_extension/cephes/gamma.c
===================================================================
--- src/sas/models/c_extension/cephes/gamma.c	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,687 +1,0 @@
-/*							gamma.c
- *
- *	Gamma function
- *
- *
- *
- * SYNOPSIS:
- *
- * double x, y, gamma();
- * extern int sgngam;
- *
- * y = gamma( x );
- *
- *
- *
- * DESCRIPTION:
- *
- * Returns gamma function of the argument.  The result is
- * correctly signed, and the sign (+1 or -1) is also
- * returned in a global (extern) variable named sgngam.
- * This variable is also filled in by the logarithmic gamma
- * function lgam().
- *
- * Arguments |x| <= 34 are reduced by recurrence and the function
- * approximated by a rational function of degree 6/7 in the
- * interval (2,3).  Large arguments are handled by Stirling's
- * formula. Large negative arguments are made positive using
- * a reflection formula.  
- *
- *
- * ACCURACY:
- *
- *                      Relative error:
- * arithmetic   domain     # trials      peak         rms
- *    DEC      -34, 34      10000       1.3e-16     2.5e-17
- *    IEEE    -170,-33      20000       2.3e-15     3.3e-16
- *    IEEE     -33,  33     20000       9.4e-16     2.2e-16
- *    IEEE      33, 171.6   20000       2.3e-15     3.2e-16
- *
- * Error for arguments outside the test range will be larger
- * owing to error amplification by the exponential function.
- *
- */
-
-/*							lgam()
- *
- *	Natural logarithm of gamma function
- *
- *
- *
- * SYNOPSIS:
- *
- * double x, y, lgam();
- * extern int sgngam;
- *
- * y = lgam( x );
- *
- *
- *
- * DESCRIPTION:
- *
- * Returns the base e (2.718...) logarithm of the absolute
- * value of the gamma function of the argument.
- * The sign (+1 or -1) of the gamma function is returned in a
- * global (extern) variable named sgngam.
- *
- * For arguments greater than 13, the logarithm of the gamma
- * function is approximated by the logarithmic version of
- * Stirling's formula using a polynomial approximation of
- * degree 4. Arguments between -33 and +33 are reduced by
- * recurrence to the interval [2,3] of a rational approximation.
- * The cosecant reflection formula is employed for arguments
- * less than -33.
- *
- * Arguments greater than MAXLGM return MAXNUM and an error
- * message.  MAXLGM = 2.035093e36 for DEC
- * arithmetic or 2.556348e305 for IEEE arithmetic.
- *
- *
- *
- * ACCURACY:
- *
- *
- * arithmetic      domain        # trials     peak         rms
- *    DEC     0, 3                  7000     5.2e-17     1.3e-17
- *    DEC     2.718, 2.035e36       5000     3.9e-17     9.9e-18
- *    IEEE    0, 3                 28000     5.4e-16     1.1e-16
- *    IEEE    2.718, 2.556e305     40000     3.5e-16     8.3e-17
- * The error criterion was relative when the function magnitude
- * was greater than one but absolute when it was less than one.
- *
- * The following test used the relative error criterion, though
- * at certain points the relative error could be much higher than
- * indicated.
- *    IEEE    -200, -4             10000     4.8e-16     1.3e-16
- *
- */
-
-
-/*							gamma.c	*/
-/*	gamma function	*/
-
-/*
-Cephes Math Library Release 2.8:  June, 2000
-Copyright 1984, 1987, 1989, 1992, 2000 by Stephen L. Moshier
-*/
-
-
-#include "mconf.h"
-
-#ifdef UNK
-static double P[] = {
-  1.60119522476751861407E-4,
-  1.19135147006586384913E-3,
-  1.04213797561761569935E-2,
-  4.76367800457137231464E-2,
-  2.07448227648435975150E-1,
-  4.94214826801497100753E-1,
-  9.99999999999999996796E-1
-};
-static double Q[] = {
--2.31581873324120129819E-5,
- 5.39605580493303397842E-4,
--4.45641913851797240494E-3,
- 1.18139785222060435552E-2,
- 3.58236398605498653373E-2,
--2.34591795718243348568E-1,
- 7.14304917030273074085E-2,
- 1.00000000000000000320E0
-};
-#define MAXGAM 171.624376956302725
-static double LOGPI = 1.14472988584940017414;
-#endif
-
-#ifdef DEC
-static unsigned short P[] = {
-0035047,0162701,0146301,0005234,
-0035634,0023437,0032065,0176530,
-0036452,0137157,0047330,0122574,
-0037103,0017310,0143041,0017232,
-0037524,0066516,0162563,0164605,
-0037775,0004671,0146237,0014222,
-0040200,0000000,0000000,0000000
-};
-static unsigned short Q[] = {
-0134302,0041724,0020006,0116565,
-0035415,0072121,0044251,0025634,
-0136222,0003447,0035205,0121114,
-0036501,0107552,0154335,0104271,
-0037022,0135717,0014776,0171471,
-0137560,0034324,0165024,0037021,
-0037222,0045046,0047151,0161213,
-0040200,0000000,0000000,0000000
-};
-#define MAXGAM 34.84425627277176174
-static unsigned short LPI[4] = {
-0040222,0103202,0043475,0006750,
-};
-#define LOGPI *(double *)LPI
-#endif
-
-#ifdef IBMPC
-static unsigned short P[] = {
-0x2153,0x3998,0xfcb8,0x3f24,
-0xbfab,0xe686,0x84e3,0x3f53,
-0x14b0,0xe9db,0x57cd,0x3f85,
-0x23d3,0x18c4,0x63d9,0x3fa8,
-0x7d31,0xdcae,0x8da9,0x3fca,
-0xe312,0x3993,0xa137,0x3fdf,
-0x0000,0x0000,0x0000,0x3ff0
-};
-static unsigned short Q[] = {
-0xd3af,0x8400,0x487a,0xbef8,
-0x2573,0x2915,0xae8a,0x3f41,
-0xb44a,0xe750,0x40e4,0xbf72,
-0xb117,0x5b1b,0x31ed,0x3f88,
-0xde67,0xe33f,0x5779,0x3fa2,
-0x87c2,0x9d42,0x071a,0xbfce,
-0x3c51,0xc9cd,0x4944,0x3fb2,
-0x0000,0x0000,0x0000,0x3ff0
-};
-#define MAXGAM 171.624376956302725
-static unsigned short LPI[4] = {
-0xa1bd,0x48e7,0x50d0,0x3ff2,
-};
-#define LOGPI *(double *)LPI
-#endif 
-
-#ifdef MIEEE
-static unsigned short P[] = {
-0x3f24,0xfcb8,0x3998,0x2153,
-0x3f53,0x84e3,0xe686,0xbfab,
-0x3f85,0x57cd,0xe9db,0x14b0,
-0x3fa8,0x63d9,0x18c4,0x23d3,
-0x3fca,0x8da9,0xdcae,0x7d31,
-0x3fdf,0xa137,0x3993,0xe312,
-0x3ff0,0x0000,0x0000,0x0000
-};
-static unsigned short Q[] = {
-0xbef8,0x487a,0x8400,0xd3af,
-0x3f41,0xae8a,0x2915,0x2573,
-0xbf72,0x40e4,0xe750,0xb44a,
-0x3f88,0x31ed,0x5b1b,0xb117,
-0x3fa2,0x5779,0xe33f,0xde67,
-0xbfce,0x071a,0x9d42,0x87c2,
-0x3fb2,0x4944,0xc9cd,0x3c51,
-0x3ff0,0x0000,0x0000,0x0000
-};
-#define MAXGAM 171.624376956302725
-static unsigned short LPI[4] = {
-0x3ff2,0x50d0,0x48e7,0xa1bd,
-};
-#define LOGPI *(double *)LPI
-#endif 
-
-/* Stirling's formula for the gamma function */
-#if UNK
-static double STIR[5] = {
- 7.87311395793093628397E-4,
--2.29549961613378126380E-4,
--2.68132617805781232825E-3,
- 3.47222221605458667310E-3,
- 8.33333333333482257126E-2,
-};
-#define MAXSTIR 143.01608
-static double SQTPI = 2.50662827463100050242E0;
-#endif
-#if DEC
-static unsigned short STIR[20] = {
-0035516,0061622,0144553,0112224,
-0135160,0131531,0037460,0165740,
-0136057,0134460,0037242,0077270,
-0036143,0107070,0156306,0027751,
-0037252,0125252,0125252,0146064,
-};
-#define MAXSTIR 26.77
-static unsigned short SQT[4] = {
-0040440,0066230,0177661,0034055,
-};
-#define SQTPI *(double *)SQT
-#endif
-#if IBMPC
-static unsigned short STIR[20] = {
-0x7293,0x592d,0xcc72,0x3f49,
-0x1d7c,0x27e6,0x166b,0xbf2e,
-0x4fd7,0x07d4,0xf726,0xbf65,
-0xc5fd,0x1b98,0x71c7,0x3f6c,
-0x5986,0x5555,0x5555,0x3fb5,
-};
-#define MAXSTIR 143.01608
-static unsigned short SQT[4] = {
-0x2706,0x1ff6,0x0d93,0x4004,
-};
-#define SQTPI *(double *)SQT
-#endif
-#if MIEEE
-static unsigned short STIR[20] = {
-0x3f49,0xcc72,0x592d,0x7293,
-0xbf2e,0x166b,0x27e6,0x1d7c,
-0xbf65,0xf726,0x07d4,0x4fd7,
-0x3f6c,0x71c7,0x1b98,0xc5fd,
-0x3fb5,0x5555,0x5555,0x5986,
-};
-#define MAXSTIR 143.01608
-static unsigned short SQT[4] = {
-0x4004,0x0d93,0x1ff6,0x2706,
-};
-#define SQTPI *(double *)SQT
-#endif
-
-int sgngam = 0;
-extern int sgngam;
-extern double MAXLOG, MAXNUM, PI;
-#ifdef ANSIPROT
-extern double pow ( double, double );
-extern double log ( double );
-extern double exp ( double );
-extern double sin ( double );
-extern double polevl ( double, void *, int );
-extern double p1evl ( double, void *, int );
-extern double floor ( double );
-extern double fabs ( double );
-extern int isnan ( double );
-extern int isfinite ( double );
-static double stirf ( double );
-double lgam ( double );
-#else
-double pow(), log(), exp(), sin(), polevl(), p1evl(), floor(), fabs();
-int isnan(), isfinite();
-static double stirf();
-double lgam();
-#endif
-#ifdef INFINITIES
-extern double INFINITY;
-#endif
-#ifdef NANS
-extern double NAN;
-#endif
-
-/* Gamma function computed by Stirling's formula.
- * The polynomial STIR is valid for 33 <= x <= 172.
- */
-static double stirf(x)
-double x;
-{
-double y, w, v;
-
-w = 1.0/x;
-w = 1.0 + w * polevl( w, STIR, 4 );
-y = exp(x);
-if( x > MAXSTIR )
-	{ /* Avoid overflow in pow() */
-	v = pow( x, 0.5 * x - 0.25 );
-	y = v * (v / y);
-	}
-else
-	{
-	y = pow( x, x - 0.5 ) / y;
-	}
-y = SQTPI * y * w;
-return( y );
-}
-
-
-
-double gamma(x)
-double x;
-{
-double p, q, z;
-int i;
-
-sgngam = 1;
-#ifdef NANS
-if( isnan(x) )
-	return(x);
-#endif
-#ifdef INFINITIES
-#ifdef NANS
-if( x == INFINITY )
-	return(x);
-if( x == -INFINITY )
-	return(NAN);
-#else
-if( !isfinite(x) )
-	return(x);
-#endif
-#endif
-q = fabs(x);
-
-if( q > 33.0 )
-	{
-	if( x < 0.0 )
-		{
-		p = floor(q);
-		if( p == q )
-			{
-#ifdef NANS
-gamnan:
-			mtherr( "gamma", DOMAIN );
-			return (NAN);
-#else
-			goto goverf;
-#endif
-			}
-		i = p;
-		if( (i & 1) == 0 )
-			sgngam = -1;
-		z = q - p;
-		if( z > 0.5 )
-			{
-			p += 1.0;
-			z = q - p;
-			}
-		z = q * sin( PI * z );
-		if( z == 0.0 )
-			{
-#ifdef INFINITIES
-			return( sgngam * INFINITY);
-#else
-goverf:
-			mtherr( "gamma", OVERFLOW );
-			return( sgngam * MAXNUM);
-#endif
-			}
-		z = fabs(z);
-		z = PI/(z * stirf(q) );
-		}
-	else
-		{
-		z = stirf(x);
-		}
-	return( sgngam * z );
-	}
-
-z = 1.0;
-while( x >= 3.0 )
-	{
-	x -= 1.0;
-	z *= x;
-	}
-
-while( x < 0.0 )
-	{
-	if( x > -1.E-9 )
-		goto small;
-	z /= x;
-	x += 1.0;
-	}
-
-while( x < 2.0 )
-	{
-	if( x < 1.e-9 )
-		goto small;
-	z /= x;
-	x += 1.0;
-	}
-
-if( x == 2.0 )
-	return(z);
-
-x -= 2.0;
-p = polevl( x, P, 6 );
-q = polevl( x, Q, 7 );
-return( z * p / q );
-
-small:
-if( x == 0.0 )
-	{
-#ifdef INFINITIES
-#ifdef NANS
-	  goto gamnan;
-#else
-	  return( INFINITY );
-#endif
-#else
-	mtherr( "gamma", SING );
-	return( MAXNUM );
-#endif
-	}
-else
-	return( z/((1.0 + 0.5772156649015329 * x) * x) );
-}
-
-
-
-/* A[]: Stirling's formula expansion of log gamma
- * B[], C[]: log gamma function between 2 and 3
- */
-#ifdef UNK
-static double A[] = {
- 8.11614167470508450300E-4,
--5.95061904284301438324E-4,
- 7.93650340457716943945E-4,
--2.77777777730099687205E-3,
- 8.33333333333331927722E-2
-};
-static double B[] = {
--1.37825152569120859100E3,
--3.88016315134637840924E4,
--3.31612992738871184744E5,
--1.16237097492762307383E6,
--1.72173700820839662146E6,
--8.53555664245765465627E5
-};
-static double C[] = {
-/* 1.00000000000000000000E0, */
--3.51815701436523470549E2,
--1.70642106651881159223E4,
--2.20528590553854454839E5,
--1.13933444367982507207E6,
--2.53252307177582951285E6,
--2.01889141433532773231E6
-};
-/* log( sqrt( 2*pi ) ) */
-static double LS2PI  =  0.91893853320467274178;
-#define MAXLGM 2.556348e305
-#endif
-
-#ifdef DEC
-static unsigned short A[] = {
-0035524,0141201,0034633,0031405,
-0135433,0176755,0126007,0045030,
-0035520,0006371,0003342,0172730,
-0136066,0005540,0132605,0026407,
-0037252,0125252,0125252,0125132
-};
-static unsigned short B[] = {
-0142654,0044014,0077633,0035410,
-0144027,0110641,0125335,0144760,
-0144641,0165637,0142204,0047447,
-0145215,0162027,0146246,0155211,
-0145322,0026110,0010317,0110130,
-0145120,0061472,0120300,0025363
-};
-static unsigned short C[] = {
-/*0040200,0000000,0000000,0000000*/
-0142257,0164150,0163630,0112622,
-0143605,0050153,0156116,0135272,
-0144527,0056045,0145642,0062332,
-0145213,0012063,0106250,0001025,
-0145432,0111254,0044577,0115142,
-0145366,0071133,0050217,0005122
-};
-/* log( sqrt( 2*pi ) ) */
-static unsigned short LS2P[] = {040153,037616,041445,0172645,};
-#define LS2PI *(double *)LS2P
-#define MAXLGM 2.035093e36
-#endif
-
-#ifdef IBMPC
-static unsigned short A[] = {
-0x6661,0x2733,0x9850,0x3f4a,
-0xe943,0xb580,0x7fbd,0xbf43,
-0x5ebb,0x20dc,0x019f,0x3f4a,
-0xa5a1,0x16b0,0xc16c,0xbf66,
-0x554b,0x5555,0x5555,0x3fb5
-};
-static unsigned short B[] = {
-0x6761,0x8ff3,0x8901,0xc095,
-0xb93e,0x355b,0xf234,0xc0e2,
-0x89e5,0xf890,0x3d73,0xc114,
-0xdb51,0xf994,0xbc82,0xc131,
-0xf20b,0x0219,0x4589,0xc13a,
-0x055e,0x5418,0x0c67,0xc12a
-};
-static unsigned short C[] = {
-/*0x0000,0x0000,0x0000,0x3ff0,*/
-0x12b2,0x1cf3,0xfd0d,0xc075,
-0xd757,0x7b89,0xaa0d,0xc0d0,
-0x4c9b,0xb974,0xeb84,0xc10a,
-0x0043,0x7195,0x6286,0xc131,
-0xf34c,0x892f,0x5255,0xc143,
-0xe14a,0x6a11,0xce4b,0xc13e
-};
-/* log( sqrt( 2*pi ) ) */
-static unsigned short LS2P[] = {
-0xbeb5,0xc864,0x67f1,0x3fed
-};
-#define LS2PI *(double *)LS2P
-#define MAXLGM 2.556348e305
-#endif
-
-#ifdef MIEEE
-static unsigned short A[] = {
-0x3f4a,0x9850,0x2733,0x6661,
-0xbf43,0x7fbd,0xb580,0xe943,
-0x3f4a,0x019f,0x20dc,0x5ebb,
-0xbf66,0xc16c,0x16b0,0xa5a1,
-0x3fb5,0x5555,0x5555,0x554b
-};
-static unsigned short B[] = {
-0xc095,0x8901,0x8ff3,0x6761,
-0xc0e2,0xf234,0x355b,0xb93e,
-0xc114,0x3d73,0xf890,0x89e5,
-0xc131,0xbc82,0xf994,0xdb51,
-0xc13a,0x4589,0x0219,0xf20b,
-0xc12a,0x0c67,0x5418,0x055e
-};
-static unsigned short C[] = {
-0xc075,0xfd0d,0x1cf3,0x12b2,
-0xc0d0,0xaa0d,0x7b89,0xd757,
-0xc10a,0xeb84,0xb974,0x4c9b,
-0xc131,0x6286,0x7195,0x0043,
-0xc143,0x5255,0x892f,0xf34c,
-0xc13e,0xce4b,0x6a11,0xe14a
-};
-/* log( sqrt( 2*pi ) ) */
-static unsigned short LS2P[] = {
-0x3fed,0x67f1,0xc864,0xbeb5
-};
-#define LS2PI *(double *)LS2P
-#define MAXLGM 2.556348e305
-#endif
-
-
-/* Logarithm of gamma function */
-
-
-double lgam(x)
-double x;
-{
-double p, q, u, w, z;
-int i;
-
-sgngam = 1;
-#ifdef NANS
-if( isnan(x) )
-	return(x);
-#endif
-
-#ifdef INFINITIES
-if( !isfinite(x) )
-	return(INFINITY);
-#endif
-
-if( x < -34.0 )
-	{
-	q = -x;
-	w = lgam(q); /* note this modifies sgngam! */
-	p = floor(q);
-	if( p == q )
-		{
-lgsing:
-#ifdef INFINITIES
-		mtherr( "lgam", SING );
-		return (INFINITY);
-#else
-		goto loverf;
-#endif
-		}
-	i = p;
-	if( (i & 1) == 0 )
-		sgngam = -1;
-	else
-		sgngam = 1;
-	z = q - p;
-	if( z > 0.5 )
-		{
-		p += 1.0;
-		z = p - q;
-		}
-	z = q * sin( PI * z );
-	if( z == 0.0 )
-		goto lgsing;
-/*	z = log(PI) - log( z ) - w;*/
-	z = LOGPI - log( z ) - w;
-	return( z );
-	}
-
-if( x < 13.0 )
-	{
-	z = 1.0;
-	p = 0.0;
-	u = x;
-	while( u >= 3.0 )
-		{
-		p -= 1.0;
-		u = x + p;
-		z *= u;
-		}
-	while( u < 2.0 )
-		{
-		if( u == 0.0 )
-			goto lgsing;
-		z /= u;
-		p += 1.0;
-		u = x + p;
-		}
-	if( z < 0.0 )
-		{
-		sgngam = -1;
-		z = -z;
-		}
-	else
-		sgngam = 1;
-	if( u == 2.0 )
-		return( log(z) );
-	p -= 2.0;
-	x = x + p;
-	p = x * polevl( x, B, 5 ) / p1evl( x, C, 6);
-	return( log(z) + p );
-	}
-
-if( x > MAXLGM )
-	{
-#ifdef INFINITIES
-	return( sgngam * INFINITY );
-#else
-loverf:
-	mtherr( "lgam", OVERFLOW );
-	return( sgngam * MAXNUM );
-#endif
-	}
-
-q = ( x - 0.5 ) * log(x) - x + LS2PI;
-if( x > 1.0e8 )
-	return( q );
-
-p = 1.0/(x*x);
-if( x >= 1000.0 )
-	q += ((   7.9365079365079365079365e-4 * p
-		- 2.7777777777777777777778e-3) *p
-		+ 0.0833333333333333333333) / x;
-else
-	q += polevl( p, A, 4 ) / x;
-return( q );
-}
Index: c/sas/models/c_extension/cephes/gdtr.c
===================================================================
--- src/sas/models/c_extension/cephes/gdtr.c	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,132 +1,0 @@
-/*							gdtr.c
- *
- *	Gamma distribution function
- *
- *
- *
- * SYNOPSIS:
- *
- * double a, b, x, y, gdtr();
- *
- * y = gdtr( a, b, x );
- *
- *
- *
- * DESCRIPTION:
- *
- * Returns the integral from zero to x of the gamma probability
- * density function:
- *
- *
- *                x
- *        b       -
- *       a       | |   b-1  -at
- * y =  -----    |    t    e    dt
- *       -     | |
- *      | (b)   -
- *               0
- *
- *  The incomplete gamma integral is used, according to the
- * relation
- *
- * y = igam( b, ax ).
- *
- *
- * ACCURACY:
- *
- * See igam().
- *
- * ERROR MESSAGES:
- *
- *   message         condition      value returned
- * gdtr domain         x < 0            0.0
- *
- */
-
-/*							gdtrc.c
- *
- *	Complemented gamma distribution function
- *
- *
- *
- * SYNOPSIS:
- *
- * double a, b, x, y, gdtrc();
- *
- * y = gdtrc( a, b, x );
- *
- *
- *
- * DESCRIPTION:
- *
- * Returns the integral from x to infinity of the gamma
- * probability density function:
- *
- *
- *               inf.
- *        b       -
- *       a       | |   b-1  -at
- * y =  -----    |    t    e    dt
- *       -     | |
- *      | (b)   -
- *               x
- *
- *  The incomplete gamma integral is used, according to the
- * relation
- *
- * y = igamc( b, ax ).
- *
- *
- * ACCURACY:
- *
- * See igamc().
- *
- * ERROR MESSAGES:
- *
- *   message         condition      value returned
- * gdtrc domain         x < 0            0.0
- *
- */
-
-
-/*							gdtr()  */
-
-
-/*
-Cephes Math Library Release 2.8:  June, 2000
-Copyright 1984, 1987, 1995, 2000 by Stephen L. Moshier
-*/
-
-#include "mconf.h"
-#ifdef ANSIPROT
-extern double igam ( double, double );
-extern double igamc ( double, double );
-#else
-double igam(), igamc();
-#endif
-
-double gdtr( a, b, x )
-double a, b, x;
-{
-
-if( x < 0.0 )
-	{
-	mtherr( "gdtr", DOMAIN );
-	return( 0.0 );
-	}
-return(  igam( b, a * x )  );
-}
-
-
-
-double gdtrc( a, b, x )
-double a, b, x;
-{
-
-if( x < 0.0 )
-	{
-	mtherr( "gdtrc", DOMAIN );
-	return( 0.0 );
-	}
-return(  igamc( b, a * x )  );
-}
Index: c/sas/models/c_extension/cephes/hyp2f1.c
===================================================================
--- src/sas/models/c_extension/cephes/hyp2f1.c	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,461 +1,0 @@
-/*							hyp2f1.c
- *
- *	Gauss hypergeometric function   F
- *	                               2 1
- *
- *
- * SYNOPSIS:
- *
- * double a, b, c, x, y, hyp2f1();
- *
- * y = hyp2f1( a, b, c, x );
- *
- *
- * DESCRIPTION:
- *
- *
- *  hyp2f1( a, b, c, x )  =   F ( a, b; c; x )
- *                           2 1
- *
- *           inf.
- *            -   a(a+1)...(a+k) b(b+1)...(b+k)   k+1
- *   =  1 +   >   -----------------------------  x   .
- *            -         c(c+1)...(c+k) (k+1)!
- *          k = 0
- *
- *  Cases addressed are
- *	Tests and escapes for negative integer a, b, or c
- *	Linear transformation if c - a or c - b negative integer
- *	Special case c = a or c = b
- *	Linear transformation for  x near +1
- *	Transformation for x < -0.5
- *	Psi function expansion if x > 0.5 and c - a - b integer
- *      Conditionally, a recurrence on c to make c-a-b > 0
- *
- * |x| > 1 is rejected.
- *
- * The parameters a, b, c are considered to be integer
- * valued if they are within 1.0e-14 of the nearest integer
- * (1.0e-13 for IEEE arithmetic).
- *
- * ACCURACY:
- *
- *
- *               Relative error (-1 < x < 1):
- * arithmetic   domain     # trials      peak         rms
- *    IEEE      -1,7        230000      1.2e-11     5.2e-14
- *
- * Several special cases also tested with a, b, c in
- * the range -7 to 7.
- *
- * ERROR MESSAGES:
- *
- * A "partial loss of precision" message is printed if
- * the internally estimated relative error exceeds 1^-12.
- * A "singularity" message is printed on overflow or
- * in cases not addressed (such as x < -1).
- */
-
-
-/*							hyp2f1	*/
-
-
-/*
-Cephes Math Library Release 2.8:  June, 2000
-Copyright 1984, 1987, 1992, 2000 by Stephen L. Moshier
-*/
-
-
-#include "mconf.h"
-
-#ifdef DEC
-#define EPS 1.0e-14
-#define EPS2 1.0e-11
-#endif
-
-#ifdef IBMPC
-#define EPS 1.0e-13
-#define EPS2 1.0e-10
-#endif
-
-#ifdef MIEEE
-#define EPS 1.0e-13
-#define EPS2 1.0e-10
-#endif
-
-#ifdef UNK
-#define EPS 1.0e-13
-#define EPS2 1.0e-10
-#endif
-
-#define ETHRESH 1.0e-12
-
-#ifdef ANSIPROT
-extern double fabs ( double );
-extern double pow ( double, double );
-extern double round ( double );
-extern double gamma ( double );
-extern double log ( double );
-extern double exp ( double );
-extern double psi ( double );
-static double hyt2f1(double, double, double, double, double *);
-static double hys2f1(double, double, double, double, double *);
-double hyp2f1(double, double, double, double);
-#else
-double fabs(), pow(), round(), gamma(), log(), exp(), psi();
-static double hyt2f1();
-static double hys2f1();
-double hyp2f1();
-#endif
-extern double MAXNUM, MACHEP;
-
-double hyp2f1( a, b, c, x )
-double a, b, c, x;
-{
-double d, d1, d2, e;
-double p, q, r, s, y, ax;
-double ia, ib, ic, id, err;
-int flag, i, aid;
-
-err = 0.0;
-ax = fabs(x);
-s = 1.0 - x;
-flag = 0;
-ia = round(a); /* nearest integer to a */
-ib = round(b);
-
-if( a <= 0 )
-	{
-	if( fabs(a-ia) < EPS )		/* a is a negative integer */
-		flag |= 1;
-	}
-
-if( b <= 0 )
-	{
-	if( fabs(b-ib) < EPS )		/* b is a negative integer */
-		flag |= 2;
-	}
-
-if( ax < 1.0 )
-	{
-	if( fabs(b-c) < EPS )		/* b = c */
-		{
-		y = pow( s, -a );	/* s to the -a power */
-		goto hypdon;
-		}
-	if( fabs(a-c) < EPS )		/* a = c */
-		{
-		y = pow( s, -b );	/* s to the -b power */
-		goto hypdon;
-		}
-	}
-
-
-
-if( c <= 0.0 )
-	{
-	ic = round(c); 	/* nearest integer to c */
-	if( fabs(c-ic) < EPS )		/* c is a negative integer */
-		{
-		/* check if termination before explosion */
-		if( (flag & 1) && (ia > ic) )
-			goto hypok;
-		if( (flag & 2) && (ib > ic) )
-			goto hypok;
-		goto hypdiv;
-		}
-	}
-
-if( flag )			/* function is a polynomial */
-	goto hypok;
-
-if( ax > 1.0 )			/* series diverges	*/
-	goto hypdiv;
-
-p = c - a;
-ia = round(p); /* nearest integer to c-a */
-if( (ia <= 0.0) && (fabs(p-ia) < EPS) )	/* negative int c - a */
-	flag |= 4;
-
-r = c - b;
-ib = round(r); /* nearest integer to c-b */
-if( (ib <= 0.0) && (fabs(r-ib) < EPS) )	/* negative int c - b */
-	flag |= 8;
-
-d = c - a - b;
-id = round(d); /* nearest integer to d */
-q = fabs(d-id);
-
-/* Thanks to Christian Burger <BURGER@DMRHRZ11.HRZ.Uni-Marburg.DE>
- * for reporting a bug here.  */
-if( fabs(ax-1.0) < EPS )			/* |x| == 1.0	*/
-	{
-	if( x > 0.0 )
-		{
-		if( flag & 12 ) /* negative int c-a or c-b */
-			{
-			if( d >= 0.0 )
-				goto hypf;
-			else
-				goto hypdiv;
-			}
-		if( d <= 0.0 )
-			goto hypdiv;
-		y = gamma(c)*gamma(d)/(gamma(p)*gamma(r));
-		goto hypdon;
-		}
-
-	if( d <= -1.0 )
-		goto hypdiv;
-
-	}
-
-/* Conditionally make d > 0 by recurrence on c
- * AMS55 #15.2.27
- */
-if( d < 0.0 )
-	{
-/* Try the power series first */
-	y = hyt2f1( a, b, c, x, &err );
-	if( err < ETHRESH )
-		goto hypdon;
-/* Apply the recurrence if power series fails */
-	err = 0.0;
-	aid = 2 - id;
-	e = c + aid;
-	d2 = hyp2f1(a,b,e,x);
-	d1 = hyp2f1(a,b,e+1.0,x);
-	q = a + b + 1.0;
-	for( i=0; i<aid; i++ )
-		{
-		r = e - 1.0;
-		y = (e*(r-(2.0*e-q)*x)*d2 + (e-a)*(e-b)*x*d1)/(e*r*s);
-		e = r;
-		d1 = d2;
-		d2 = y;
-		}
-	goto hypdon;
-	}
-
-
-if( flag & 12 )
-	goto hypf; /* negative integer c-a or c-b */
-
-hypok:
-y = hyt2f1( a, b, c, x, &err );
-
-
-hypdon:
-if( err > ETHRESH )
-	{
-	mtherr( "hyp2f1", PLOSS );
-/*	printf( "Estimated err = %.2e\n", err ); */
-	}
-return(y);
-
-/* The transformation for c-a or c-b negative integer
- * AMS55 #15.3.3
- */
-hypf:
-y = pow( s, d ) * hys2f1( c-a, c-b, c, x, &err );
-goto hypdon;
-
-/* The alarm exit */
-hypdiv:
-mtherr( "hyp2f1", OVERFLOW );
-return( MAXNUM );
-}
-
-
-
-
-
-
-/* Apply transformations for |x| near 1
- * then call the power series
- */
-static double hyt2f1( a, b, c, x, loss )
-double a, b, c, x;
-double *loss;
-{
-double p, q, r, s, t, y, d, err, err1;
-double ax, id, d1, d2, e, y1;
-int i, aid;
-
-err = 0.0;
-s = 1.0 - x;
-if( x < -0.5 )
-	{
-	if( b > a )
-		y = pow( s, -a ) * hys2f1( a, c-b, c, -x/s, &err );
-
-	else
-		y = pow( s, -b ) * hys2f1( c-a, b, c, -x/s, &err );
-
-	goto done;
-	}
-
-d = c - a - b;
-id = round(d);	/* nearest integer to d */
-
-if( x > 0.9 )
-{
-if( fabs(d-id) > EPS ) /* test for integer c-a-b */
-	{
-/* Try the power series first */
-	y = hys2f1( a, b, c, x, &err );
-	if( err < ETHRESH )
-		goto done;
-/* If power series fails, then apply AMS55 #15.3.6 */
-	q = hys2f1( a, b, 1.0-d, s, &err );	
-	q *= gamma(d) /(gamma(c-a) * gamma(c-b));
-	r = pow(s,d) * hys2f1( c-a, c-b, d+1.0, s, &err1 );
-	r *= gamma(-d)/(gamma(a) * gamma(b));
-	y = q + r;
-
-	q = fabs(q); /* estimate cancellation error */
-	r = fabs(r);
-	if( q > r )
-		r = q;
-	err += err1 + (MACHEP*r)/y;
-
-	y *= gamma(c);
-	goto done;
-	}
-else
-	{
-/* Psi function expansion, AMS55 #15.3.10, #15.3.11, #15.3.12 */
-	if( id >= 0.0 )
-		{
-		e = d;
-		d1 = d;
-		d2 = 0.0;
-		aid = id;
-		}
-	else
-		{
-		e = -d;
-		d1 = 0.0;
-		d2 = d;
-		aid = -id;
-		}
-
-	ax = log(s);
-
-	/* sum for t = 0 */
-	y = psi(1.0) + psi(1.0+e) - psi(a+d1) - psi(b+d1) - ax;
-	y /= gamma(e+1.0);
-
-	p = (a+d1) * (b+d1) * s / gamma(e+2.0);	/* Poch for t=1 */
-	t = 1.0;
-	do
-		{
-		r = psi(1.0+t) + psi(1.0+t+e) - psi(a+t+d1)
-			- psi(b+t+d1) - ax;
-		q = p * r;
-		y += q;
-		p *= s * (a+t+d1) / (t+1.0);
-		p *= (b+t+d1) / (t+1.0+e);
-		t += 1.0;
-		}
-	while( fabs(q/y) > EPS );
-
-
-	if( id == 0.0 )
-		{
-		y *= gamma(c)/(gamma(a)*gamma(b));
-		goto psidon;
-		}
-
-	y1 = 1.0;
-
-	if( aid == 1 )
-		goto nosum;
-
-	t = 0.0;
-	p = 1.0;
-	for( i=1; i<aid; i++ )
-		{
-		r = 1.0-e+t;
-		p *= s * (a+t+d2) * (b+t+d2) / r;
-		t += 1.0;
-		p /= t;
-		y1 += p;
-		}
-nosum:
-	p = gamma(c);
-	y1 *= gamma(e) * p / (gamma(a+d1) * gamma(b+d1));
-
-	y *= p / (gamma(a+d2) * gamma(b+d2));
-	if( (aid & 1) != 0 )
-		y = -y;
-
-	q = pow( s, id );	/* s to the id power */
-	if( id > 0.0 )
-		y *= q;
-	else
-		y1 *= q;
-
-	y += y1;
-psidon:
-	goto done;
-	}
-
-}
-
-/* Use defining power series if no special cases */
-y = hys2f1( a, b, c, x, &err );
-
-done:
-*loss = err;
-return(y);
-}
-
-
-
-
-
-/* Defining power series expansion of Gauss hypergeometric function */
-
-static double hys2f1( a, b, c, x, loss )
-double a, b, c, x;
-double *loss; /* estimates loss of significance */
-{
-double f, g, h, k, m, s, u, umax;
-int i;
-
-i = 0;
-umax = 0.0;
-f = a;
-g = b;
-h = c;
-s = 1.0;
-u = 1.0;
-k = 0.0;
-do
-	{
-	if( fabs(h) < EPS )
-		{
-		*loss = 1.0;
-		return( MAXNUM );
-		}
-	m = k + 1.0;
-	u = u * ((f+k) * (g+k) * x / ((h+k) * m));
-	s += u;
-	k = fabs(u);  /* remember largest term summed */
-	if( k > umax )
-		umax = k;
-	k = m;
-	if( ++i > 10000 ) /* should never happen */
-		{
-		*loss = 1.0;
-		return(s);
-		}
-	}
-while( fabs(u/s) > MACHEP );
-
-/* return estimated relative error */
-*loss = (MACHEP*umax)/fabs(s) + (MACHEP*i);
-
-return(s);
-}
Index: c/sas/models/c_extension/cephes/hyperg.c
===================================================================
--- src/sas/models/c_extension/cephes/hyperg.c	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,388 +1,0 @@
-/*							hyperg.c
- *
- *	Confluent hypergeometric function
- *
- *
- *
- * SYNOPSIS:
- *
- * double a, b, x, y, hyperg();
- *
- * y = hyperg( a, b, x );
- *
- *
- *
- * DESCRIPTION:
- *
- * Computes the confluent hypergeometric function
- *
- *                          1           2
- *                       a x    a(a+1) x
- *   F ( a,b;x )  =  1 + ---- + --------- + ...
- *  1 1                  b 1!   b(b+1) 2!
- *
- * Many higher transcendental functions are special cases of
- * this power series.
- *
- * As is evident from the formula, b must not be a negative
- * integer or zero unless a is an integer with 0 >= a > b.
- *
- * The routine attempts both a direct summation of the series
- * and an asymptotic expansion.  In each case error due to
- * roundoff, cancellation, and nonconvergence is estimated.
- * The result with smaller estimated error is returned.
- *
- *
- *
- * ACCURACY:
- *
- * Tested at random points (a, b, x), all three variables
- * ranging from 0 to 30.
- *                      Relative error:
- * arithmetic   domain     # trials      peak         rms
- *    DEC       0,30         2000       1.2e-15     1.3e-16
- qtst1:
- 21800   max =  1.4200E-14   rms =  1.0841E-15  ave = -5.3640E-17 
- ltstd:
- 25500   max = 1.2759e-14   rms = 3.7155e-16  ave = 1.5384e-18 
- *    IEEE      0,30        30000       1.8e-14     1.1e-15
- *
- * Larger errors can be observed when b is near a negative
- * integer or zero.  Certain combinations of arguments yield
- * serious cancellation error in the power series summation
- * and also are not in the region of near convergence of the
- * asymptotic series.  An error message is printed if the
- * self-estimated relative error is greater than 1.0e-12.
- *
- */
-
-
-/*							hyperg.c */
-
-
-/*
-Cephes Math Library Release 2.8:  June, 2000
-Copyright 1984, 1987, 1988, 2000 by Stephen L. Moshier
-*/
-
-#include "mconf.h"
-
-#ifdef ANSIPROT
-extern double exp ( double );
-extern double log ( double );
-extern double gamma ( double );
-extern double lgam ( double );
-extern double fabs ( double );
-double hyp2f0 ( double, double, double, int, double * );
-static double hy1f1p(double, double, double, double *);
-static double hy1f1a(double, double, double, double *);
-double hyperg (double, double, double);
-#else
-double exp(), log(), gamma(), lgam(), fabs(), hyp2f0();
-static double hy1f1p();
-static double hy1f1a();
-double hyperg();
-#endif
-extern double MAXNUM, MACHEP;
-
-double hyperg( a, b, x)
-double a, b, x;
-{
-double asum, psum, acanc, pcanc, temp;
-
-/* See if a Kummer transformation will help */
-temp = b - a;
-if( fabs(temp) < 0.001 * fabs(a) )
-	return( exp(x) * hyperg( temp, b, -x )  );
-
-
-psum = hy1f1p( a, b, x, &pcanc );
-if( pcanc < 1.0e-15 )
-	goto done;
-
-
-/* try asymptotic series */
-
-asum = hy1f1a( a, b, x, &acanc );
-
-
-/* Pick the result with less estimated error */
-
-if( acanc < pcanc )
-	{
-	pcanc = acanc;
-	psum = asum;
-	}
-
-done:
-if( pcanc > 1.0e-12 )
-	mtherr( "hyperg", PLOSS );
-
-return( psum );
-}
-
-
-
-
-/* Power series summation for confluent hypergeometric function		*/
-
-
-static double hy1f1p( a, b, x, err )
-double a, b, x;
-double *err;
-{
-double n, a0, sum, t, u, temp;
-double an, bn, maxt, pcanc;
-
-
-/* set up for power series summation */
-an = a;
-bn = b;
-a0 = 1.0;
-sum = 1.0;
-n = 1.0;
-t = 1.0;
-maxt = 0.0;
-
-
-while( t > MACHEP )
-	{
-	if( bn == 0 )			/* check bn first since if both	*/
-		{
-		mtherr( "hyperg", SING );
-		return( MAXNUM );	/* an and bn are zero it is	*/
-		}
-	if( an == 0 )			/* a singularity		*/
-		return( sum );
-	if( n > 200 )
-		goto pdone;
-	u = x * ( an / (bn * n) );
-
-	/* check for blowup */
-	temp = fabs(u);
-	if( (temp > 1.0 ) && (maxt > (MAXNUM/temp)) )
-		{
-		pcanc = 1.0;	/* estimate 100% error */
-		goto blowup;
-		}
-
-	a0 *= u;
-	sum += a0;
-	t = fabs(a0);
-	if( t > maxt )
-		maxt = t;
-/*
-	if( (maxt/fabs(sum)) > 1.0e17 )
-		{
-		pcanc = 1.0;
-		goto blowup;
-		}
-*/
-	an += 1.0;
-	bn += 1.0;
-	n += 1.0;
-	}
-
-pdone:
-
-/* estimate error due to roundoff and cancellation */
-if( sum != 0.0 )
-	maxt /= fabs(sum);
-maxt *= MACHEP; 	/* this way avoids multiply overflow */
-pcanc = fabs( MACHEP * n  +  maxt );
-
-blowup:
-
-*err = pcanc;
-
-return( sum );
-}
-
-
-/*							hy1f1a()	*/
-/* asymptotic formula for hypergeometric function:
- *
- *        (    -a                         
- *  --    ( |z|                           
- * |  (b) ( -------- 2f0( a, 1+a-b, -1/x )
- *        (  --                           
- *        ( |  (b-a)                      
- *
- *
- *                                x    a-b                     )
- *                               e  |x|                        )
- *                             + -------- 2f0( b-a, 1-a, 1/x ) )
- *                                --                           )
- *                               |  (a)                        )
- */
-
-static double hy1f1a( a, b, x, err )
-double a, b, x;
-double *err;
-{
-double h1, h2, t, u, temp, acanc, asum, err1, err2;
-
-if( x == 0 )
-	{
-	acanc = 1.0;
-	asum = MAXNUM;
-	goto adone;
-	}
-temp = log( fabs(x) );
-t = x + temp * (a-b);
-u = -temp * a;
-
-if( b > 0 )
-	{
-	temp = lgam(b);
-	t += temp;
-	u += temp;
-	}
-
-h1 = hyp2f0( a, a-b+1, -1.0/x, 1, &err1 );
-
-temp = exp(u) / gamma(b-a);
-h1 *= temp;
-err1 *= temp;
-
-h2 = hyp2f0( b-a, 1.0-a, 1.0/x, 2, &err2 );
-
-if( a < 0 )
-	temp = exp(t) / gamma(a);
-else
-	temp = exp( t - lgam(a) );
-
-h2 *= temp;
-err2 *= temp;
-
-if( x < 0.0 )
-	asum = h1;
-else
-	asum = h2;
-
-acanc = fabs(err1) + fabs(err2);
-
-
-if( b < 0 )
-	{
-	temp = gamma(b);
-	asum *= temp;
-	acanc *= fabs(temp);
-	}
-
-
-if( asum != 0.0 )
-	acanc /= fabs(asum);
-
-acanc *= 30.0;	/* fudge factor, since error of asymptotic formula
-		 * often seems this much larger than advertised */
-
-adone:
-
-
-*err = acanc;
-return( asum );
-}
-
-
-/*							hyp2f0()	*/
-
-double hyp2f0( a, b, x, type, err )
-double a, b, x;
-int type;	/* determines what converging factor to use */
-double *err;
-{
-double a0, alast, t, tlast, maxt;
-double n, an, bn, u, sum, temp;
-
-an = a;
-bn = b;
-a0 = 1.0e0;
-alast = 1.0e0;
-sum = 0.0;
-n = 1.0e0;
-t = 1.0e0;
-tlast = 1.0e9;
-maxt = 0.0;
-
-do
-	{
-	if( an == 0 )
-		goto pdone;
-	if( bn == 0 )
-		goto pdone;
-
-	u = an * (bn * x / n);
-
-	/* check for blowup */
-	temp = fabs(u);
-	if( (temp > 1.0 ) && (maxt > (MAXNUM/temp)) )
-		goto error;
-
-	a0 *= u;
-	t = fabs(a0);
-
-	/* terminating condition for asymptotic series */
-	if( t > tlast )
-		goto ndone;
-
-	tlast = t;
-	sum += alast;	/* the sum is one term behind */
-	alast = a0;
-
-	if( n > 200 )
-		goto ndone;
-
-	an += 1.0e0;
-	bn += 1.0e0;
-	n += 1.0e0;
-	if( t > maxt )
-		maxt = t;
-	}
-while( t > MACHEP );
-
-
-pdone:	/* series converged! */
-
-/* estimate error due to roundoff and cancellation */
-*err = fabs(  MACHEP * (n + maxt)  );
-
-alast = a0;
-goto done;
-
-ndone:	/* series did not converge */
-
-/* The following "Converging factors" are supposed to improve accuracy,
- * but do not actually seem to accomplish very much. */
-
-n -= 1.0;
-x = 1.0/x;
-
-switch( type )	/* "type" given as subroutine argument */
-{
-case 1:
-	alast *= ( 0.5 + (0.125 + 0.25*b - 0.5*a + 0.25*x - 0.25*n)/x );
-	break;
-
-case 2:
-	alast *= 2.0/3.0 - b + 2.0*a + x - n;
-	break;
-
-default:
-	;
-}
-
-/* estimate error due to roundoff, cancellation, and nonconvergence */
-*err = MACHEP * (n + maxt)  +  fabs ( a0 );
-
-
-done:
-sum += alast;
-return( sum );
-
-/* series blew up: */
-error:
-*err = MAXNUM;
-mtherr( "hyperg", TLOSS );
-return( sum );
-}
Index: c/sas/models/c_extension/cephes/i0.c
===================================================================
--- src/sas/models/c_extension/cephes/i0.c	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,399 +1,0 @@
-/*							i0.c
- *
- *	Modified Bessel function of order zero
- *
- *
- *
- * SYNOPSIS:
- *
- * double x, y, i0();
- *
- * y = i0( x );
- *
- *
- *
- * DESCRIPTION:
- *
- * Returns modified Bessel function of order zero of the
- * argument.
- *
- * The function is defined as i0(x) = j0( ix ).
- *
- * The range is partitioned into the two intervals [0,8] and
- * (8, infinity).  Chebyshev polynomial expansions are employed
- * in each interval.
- *
- *
- *
- * ACCURACY:
- *
- *                      Relative error:
- * arithmetic   domain     # trials      peak         rms
- *    DEC       0,30         6000       8.2e-17     1.9e-17
- *    IEEE      0,30        30000       5.8e-16     1.4e-16
- *
- */
-
-/*							i0e.c
- *
- *	Modified Bessel function of order zero,
- *	exponentially scaled
- *
- *
- *
- * SYNOPSIS:
- *
- * double x, y, i0e();
- *
- * y = i0e( x );
- *
- *
- *
- * DESCRIPTION:
- *
- * Returns exponentially scaled modified Bessel function
- * of order zero of the argument.
- *
- * The function is defined as i0e(x) = exp(-|x|) j0( ix ).
- *
- *
- *
- * ACCURACY:
- *
- *                      Relative error:
- * arithmetic   domain     # trials      peak         rms
- *    IEEE      0,30        30000       5.4e-16     1.2e-16
- * See i0().
- *
- */
-
-
-/*							i0.c		*/
-
-
-/*
-Cephes Math Library Release 2.8:  June, 2000
-Copyright 1984, 1987, 2000 by Stephen L. Moshier
-*/
-
-#include "mconf.h"
-
-/* Chebyshev coefficients for exp(-x) I0(x)
- * in the interval [0,8].
- *
- * lim(x->0){ exp(-x) I0(x) } = 1.
- */
-
-#ifdef UNK
-static double A[] =
-{
--4.41534164647933937950E-18,
- 3.33079451882223809783E-17,
--2.43127984654795469359E-16,
- 1.71539128555513303061E-15,
--1.16853328779934516808E-14,
- 7.67618549860493561688E-14,
--4.85644678311192946090E-13,
- 2.95505266312963983461E-12,
--1.72682629144155570723E-11,
- 9.67580903537323691224E-11,
--5.18979560163526290666E-10,
- 2.65982372468238665035E-9,
--1.30002500998624804212E-8,
- 6.04699502254191894932E-8,
--2.67079385394061173391E-7,
- 1.11738753912010371815E-6,
--4.41673835845875056359E-6,
- 1.64484480707288970893E-5,
--5.75419501008210370398E-5,
- 1.88502885095841655729E-4,
--5.76375574538582365885E-4,
- 1.63947561694133579842E-3,
--4.32430999505057594430E-3,
- 1.05464603945949983183E-2,
--2.37374148058994688156E-2,
- 4.93052842396707084878E-2,
--9.49010970480476444210E-2,
- 1.71620901522208775349E-1,
--3.04682672343198398683E-1,
- 6.76795274409476084995E-1
-};
-#endif
-
-#ifdef DEC
-static unsigned short A[] = {
-0121642,0162671,0004646,0103567,
-0022431,0115424,0135755,0026104,
-0123214,0023533,0110365,0156635,
-0023767,0033304,0117662,0172716,
-0124522,0100426,0012277,0157531,
-0025254,0155062,0054461,0030465,
-0126010,0131143,0013560,0153604,
-0026517,0170577,0006336,0114437,
-0127227,0162253,0152243,0052734,
-0027724,0142766,0061641,0160200,
-0130416,0123760,0116564,0125262,
-0031066,0144035,0021246,0054641,
-0131537,0053664,0060131,0102530,
-0032201,0155664,0165153,0020652,
-0132617,0061434,0074423,0176145,
-0033225,0174444,0136147,0122542,
-0133624,0031576,0056453,0020470,
-0034211,0175305,0172321,0041314,
-0134561,0054462,0147040,0165315,
-0035105,0124333,0120203,0162532,
-0135427,0013750,0174257,0055221,
-0035726,0161654,0050220,0100162,
-0136215,0131361,0000325,0041110,
-0036454,0145417,0117357,0017352,
-0136702,0072367,0104415,0133574,
-0037111,0172126,0072505,0014544,
-0137302,0055601,0120550,0033523,
-0037457,0136543,0136544,0043002,
-0137633,0177536,0001276,0066150,
-0040055,0041164,0100655,0010521
-};
-#endif
-
-#ifdef IBMPC
-static unsigned short A[] = {
-0xd0ef,0x2134,0x5cb7,0xbc54,
-0xa589,0x977d,0x3362,0x3c83,
-0xbbb4,0x721e,0x84eb,0xbcb1,
-0x5eba,0x93f6,0xe6d8,0x3cde,
-0xfbeb,0xc297,0x5022,0xbd0a,
-0x2627,0x4b26,0x9b46,0x3d35,
-0x1af0,0x62ee,0x164c,0xbd61,
-0xd324,0xe19b,0xfe2f,0x3d89,
-0x6abc,0x7a94,0xfc95,0xbdb2,
-0x3c10,0xcc74,0x98be,0x3dda,
-0x9556,0x13ae,0xd4fe,0xbe01,
-0xcb34,0xa454,0xd903,0x3e26,
-0x30ab,0x8c0b,0xeaf6,0xbe4b,
-0x6435,0x9d4d,0x3b76,0x3e70,
-0x7f8d,0x8f22,0xec63,0xbe91,
-0xf4ac,0x978c,0xbf24,0x3eb2,
-0x6427,0xcba5,0x866f,0xbed2,
-0x2859,0xbe9a,0x3f58,0x3ef1,
-0x1d5a,0x59c4,0x2b26,0xbf0e,
-0x7cab,0x7410,0xb51b,0x3f28,
-0xeb52,0x1f15,0xe2fd,0xbf42,
-0x100e,0x8a12,0xdc75,0x3f5a,
-0xa849,0x201a,0xb65e,0xbf71,
-0xe3dd,0xf3dd,0x9961,0x3f85,
-0xb6f0,0xf121,0x4e9e,0xbf98,
-0xa32d,0xcea8,0x3e8a,0x3fa9,
-0x06ea,0x342d,0x4b70,0xbfb8,
-0x88c0,0x77ac,0xf7ac,0x3fc5,
-0xcd8d,0xc057,0x7feb,0xbfd3,
-0xa22a,0x9035,0xa84e,0x3fe5,
-};
-#endif
-
-#ifdef MIEEE
-static unsigned short A[] = {
-0xbc54,0x5cb7,0x2134,0xd0ef,
-0x3c83,0x3362,0x977d,0xa589,
-0xbcb1,0x84eb,0x721e,0xbbb4,
-0x3cde,0xe6d8,0x93f6,0x5eba,
-0xbd0a,0x5022,0xc297,0xfbeb,
-0x3d35,0x9b46,0x4b26,0x2627,
-0xbd61,0x164c,0x62ee,0x1af0,
-0x3d89,0xfe2f,0xe19b,0xd324,
-0xbdb2,0xfc95,0x7a94,0x6abc,
-0x3dda,0x98be,0xcc74,0x3c10,
-0xbe01,0xd4fe,0x13ae,0x9556,
-0x3e26,0xd903,0xa454,0xcb34,
-0xbe4b,0xeaf6,0x8c0b,0x30ab,
-0x3e70,0x3b76,0x9d4d,0x6435,
-0xbe91,0xec63,0x8f22,0x7f8d,
-0x3eb2,0xbf24,0x978c,0xf4ac,
-0xbed2,0x866f,0xcba5,0x6427,
-0x3ef1,0x3f58,0xbe9a,0x2859,
-0xbf0e,0x2b26,0x59c4,0x1d5a,
-0x3f28,0xb51b,0x7410,0x7cab,
-0xbf42,0xe2fd,0x1f15,0xeb52,
-0x3f5a,0xdc75,0x8a12,0x100e,
-0xbf71,0xb65e,0x201a,0xa849,
-0x3f85,0x9961,0xf3dd,0xe3dd,
-0xbf98,0x4e9e,0xf121,0xb6f0,
-0x3fa9,0x3e8a,0xcea8,0xa32d,
-0xbfb8,0x4b70,0x342d,0x06ea,
-0x3fc5,0xf7ac,0x77ac,0x88c0,
-0xbfd3,0x7feb,0xc057,0xcd8d,
-0x3fe5,0xa84e,0x9035,0xa22a
-};
-#endif
-
-
-/* Chebyshev coefficients for exp(-x) sqrt(x) I0(x)
- * in the inverted interval [8,infinity].
- *
- * lim(x->inf){ exp(-x) sqrt(x) I0(x) } = 1/sqrt(2pi).
- */
-
-#ifdef UNK
-static double B[] =
-{
--7.23318048787475395456E-18,
--4.83050448594418207126E-18,
- 4.46562142029675999901E-17,
- 3.46122286769746109310E-17,
--2.82762398051658348494E-16,
--3.42548561967721913462E-16,
- 1.77256013305652638360E-15,
- 3.81168066935262242075E-15,
--9.55484669882830764870E-15,
--4.15056934728722208663E-14,
- 1.54008621752140982691E-14,
- 3.85277838274214270114E-13,
- 7.18012445138366623367E-13,
--1.79417853150680611778E-12,
--1.32158118404477131188E-11,
--3.14991652796324136454E-11,
- 1.18891471078464383424E-11,
- 4.94060238822496958910E-10,
- 3.39623202570838634515E-9,
- 2.26666899049817806459E-8,
- 2.04891858946906374183E-7,
- 2.89137052083475648297E-6,
- 6.88975834691682398426E-5,
- 3.36911647825569408990E-3,
- 8.04490411014108831608E-1
-};
-#endif
-
-#ifdef DEC
-static unsigned short B[] = {
-0122005,0066672,0123124,0054311,
-0121662,0033323,0030214,0104602,
-0022515,0170300,0113314,0020413,
-0022437,0117350,0035402,0007146,
-0123243,0000135,0057220,0177435,
-0123305,0073476,0144106,0170702,
-0023777,0071755,0017527,0154373,
-0024211,0052214,0102247,0033270,
-0124454,0017763,0171453,0012322,
-0125072,0166316,0075505,0154616,
-0024612,0133770,0065376,0025045,
-0025730,0162143,0056036,0001632,
-0026112,0015077,0150464,0063542,
-0126374,0101030,0014274,0065457,
-0127150,0077271,0125763,0157617,
-0127412,0104350,0040713,0120445,
-0027121,0023765,0057500,0001165,
-0030407,0147146,0003643,0075644,
-0031151,0061445,0044422,0156065,
-0031702,0132224,0003266,0125551,
-0032534,0000076,0147153,0005555,
-0033502,0004536,0004016,0026055,
-0034620,0076433,0142314,0171215,
-0036134,0146145,0013454,0101104,
-0040115,0171425,0062500,0047133
-};
-#endif
-
-#ifdef IBMPC
-static unsigned short B[] = {
-0x8b19,0x54ca,0xadb7,0xbc60,
-0x9130,0x6611,0x46da,0xbc56,
-0x8421,0x12d9,0xbe18,0x3c89,
-0x41cd,0x0760,0xf3dd,0x3c83,
-0x1fe4,0xabd2,0x600b,0xbcb4,
-0xde38,0xd908,0xaee7,0xbcb8,
-0xfb1f,0xa3ea,0xee7d,0x3cdf,
-0xe6d7,0x9094,0x2a91,0x3cf1,
-0x629a,0x7e65,0x83fe,0xbd05,
-0xbb32,0xcf68,0x5d99,0xbd27,
-0xc545,0x0d5f,0x56ff,0x3d11,
-0xc073,0x6b83,0x1c8c,0x3d5b,
-0x8cec,0xfa26,0x4347,0x3d69,
-0x8d66,0x0317,0x9043,0xbd7f,
-0x7bf2,0x357e,0x0fd7,0xbdad,
-0x7425,0x0839,0x511d,0xbdc1,
-0x004f,0xabe8,0x24fe,0x3daa,
-0x6f75,0xc0f4,0xf9cc,0x3e00,
-0x5b87,0xa922,0x2c64,0x3e2d,
-0xd56d,0x80d6,0x5692,0x3e58,
-0x616e,0xd9cd,0x8007,0x3e8b,
-0xc586,0xc101,0x412b,0x3ec8,
-0x9e52,0x7899,0x0fa3,0x3f12,
-0x9049,0xa2e5,0x998c,0x3f6b,
-0x09cb,0xaca8,0xbe62,0x3fe9
-};
-#endif
-
-#ifdef MIEEE
-static unsigned short B[] = {
-0xbc60,0xadb7,0x54ca,0x8b19,
-0xbc56,0x46da,0x6611,0x9130,
-0x3c89,0xbe18,0x12d9,0x8421,
-0x3c83,0xf3dd,0x0760,0x41cd,
-0xbcb4,0x600b,0xabd2,0x1fe4,
-0xbcb8,0xaee7,0xd908,0xde38,
-0x3cdf,0xee7d,0xa3ea,0xfb1f,
-0x3cf1,0x2a91,0x9094,0xe6d7,
-0xbd05,0x83fe,0x7e65,0x629a,
-0xbd27,0x5d99,0xcf68,0xbb32,
-0x3d11,0x56ff,0x0d5f,0xc545,
-0x3d5b,0x1c8c,0x6b83,0xc073,
-0x3d69,0x4347,0xfa26,0x8cec,
-0xbd7f,0x9043,0x0317,0x8d66,
-0xbdad,0x0fd7,0x357e,0x7bf2,
-0xbdc1,0x511d,0x0839,0x7425,
-0x3daa,0x24fe,0xabe8,0x004f,
-0x3e00,0xf9cc,0xc0f4,0x6f75,
-0x3e2d,0x2c64,0xa922,0x5b87,
-0x3e58,0x5692,0x80d6,0xd56d,
-0x3e8b,0x8007,0xd9cd,0x616e,
-0x3ec8,0x412b,0xc101,0xc586,
-0x3f12,0x0fa3,0x7899,0x9e52,
-0x3f6b,0x998c,0xa2e5,0x9049,
-0x3fe9,0xbe62,0xaca8,0x09cb
-};
-#endif
-
-#ifdef ANSIPROT
-extern double chbevl ( double, void *, int );
-extern double exp ( double );
-extern double sqrt ( double );
-#else
-double chbevl(), exp(), sqrt();
-#endif
-
-double i0(x)
-double x;
-{
-double y;
-
-if( x < 0 )
-	x = -x;
-if( x <= 8.0 )
-	{
-	y = (x/2.0) - 2.0;
-	return( exp(x) * chbevl( y, A, 30 ) );
-	}
-
-return(  exp(x) * chbevl( 32.0/x - 2.0, B, 25 ) / sqrt(x) );
-
-}
-
-
-
-
-double i0e( x )
-double x;
-{
-double y;
-
-if( x < 0 )
-	x = -x;
-if( x <= 8.0 )
-	{
-	y = (x/2.0) - 2.0;
-	return( chbevl( y, A, 30 ) );
-	}
-
-return(  chbevl( 32.0/x - 2.0, B, 25 ) / sqrt(x) );
-
-}
Index: c/sas/models/c_extension/cephes/i1.c
===================================================================
--- src/sas/models/c_extension/cephes/i1.c	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,407 +1,0 @@
-/*							i1.c
- *
- *	Modified Bessel function of order one
- *
- *
- *
- * SYNOPSIS:
- *
- * double x, y, i1();
- *
- * y = i1( x );
- *
- *
- *
- * DESCRIPTION:
- *
- * Returns modified Bessel function of order one of the
- * argument.
- *
- * The function is defined as i1(x) = -i j1( ix ).
- *
- * The range is partitioned into the two intervals [0,8] and
- * (8, infinity).  Chebyshev polynomial expansions are employed
- * in each interval.
- *
- *
- *
- * ACCURACY:
- *
- *                      Relative error:
- * arithmetic   domain     # trials      peak         rms
- *    DEC       0, 30        3400       1.2e-16     2.3e-17
- *    IEEE      0, 30       30000       1.9e-15     2.1e-16
- *
- *
- */
-
-/*							i1e.c
- *
- *	Modified Bessel function of order one,
- *	exponentially scaled
- *
- *
- *
- * SYNOPSIS:
- *
- * double x, y, i1e();
- *
- * y = i1e( x );
- *
- *
- *
- * DESCRIPTION:
- *
- * Returns exponentially scaled modified Bessel function
- * of order one of the argument.
- *
- * The function is defined as i1(x) = -i exp(-|x|) j1( ix ).
- *
- *
- *
- * ACCURACY:
- *
- *                      Relative error:
- * arithmetic   domain     # trials      peak         rms
- *    IEEE      0, 30       30000       2.0e-15     2.0e-16
- * See i1().
- *
- */
-
-
-/*							i1.c 2		*/
-
-
-/*
-Cephes Math Library Release 2.8:  June, 2000
-Copyright 1985, 1987, 2000 by Stephen L. Moshier
-*/
-
-#include "mconf.h"
-
-/* Chebyshev coefficients for exp(-x) I1(x) / x
- * in the interval [0,8].
- *
- * lim(x->0){ exp(-x) I1(x) / x } = 1/2.
- */
-
-#ifdef UNK
-static double A[] =
-{
- 2.77791411276104639959E-18,
--2.11142121435816608115E-17,
- 1.55363195773620046921E-16,
--1.10559694773538630805E-15,
- 7.60068429473540693410E-15,
--5.04218550472791168711E-14,
- 3.22379336594557470981E-13,
--1.98397439776494371520E-12,
- 1.17361862988909016308E-11,
--6.66348972350202774223E-11,
- 3.62559028155211703701E-10,
--1.88724975172282928790E-9,
- 9.38153738649577178388E-9,
--4.44505912879632808065E-8,
- 2.00329475355213526229E-7,
--8.56872026469545474066E-7,
- 3.47025130813767847674E-6,
--1.32731636560394358279E-5,
- 4.78156510755005422638E-5,
--1.61760815825896745588E-4,
- 5.12285956168575772895E-4,
--1.51357245063125314899E-3,
- 4.15642294431288815669E-3,
--1.05640848946261981558E-2,
- 2.47264490306265168283E-2,
--5.29459812080949914269E-2,
- 1.02643658689847095384E-1,
--1.76416518357834055153E-1,
- 2.52587186443633654823E-1
-};
-#endif
-
-#ifdef DEC
-static unsigned short A[] = {
-0021514,0174520,0060742,0000241,
-0122302,0137206,0016120,0025663,
-0023063,0017437,0026235,0176536,
-0123637,0052523,0170150,0125632,
-0024410,0165770,0030251,0044134,
-0125143,0012160,0162170,0054727,
-0025665,0075702,0035716,0145247,
-0126413,0116032,0176670,0015462,
-0027116,0073425,0110351,0105242,
-0127622,0104034,0137530,0037364,
-0030307,0050645,0120776,0175535,
-0131001,0130331,0043523,0037455,
-0031441,0026160,0010712,0100174,
-0132076,0164761,0022706,0017500,
-0032527,0015045,0115076,0104076,
-0133146,0001714,0015434,0144520,
-0033550,0161166,0124215,0077050,
-0134136,0127715,0143365,0157170,
-0034510,0106652,0013070,0064130,
-0135051,0117126,0117264,0123761,
-0035406,0045355,0133066,0175751,
-0135706,0061420,0054746,0122440,
-0036210,0031232,0047235,0006640,
-0136455,0012373,0144235,0011523,
-0036712,0107437,0036731,0015111,
-0137130,0156742,0115744,0172743,
-0037322,0033326,0124667,0124740,
-0137464,0123210,0021510,0144556,
-0037601,0051433,0111123,0177721
-};
-#endif
-
-#ifdef IBMPC
-static unsigned short A[] = {
-0x4014,0x0c3c,0x9f2a,0x3c49,
-0x0576,0xc38a,0x57d0,0xbc78,
-0xbfac,0xe593,0x63e3,0x3ca6,
-0x1573,0x7e0d,0xeaaa,0xbcd3,
-0x290c,0x0615,0x1d7f,0x3d01,
-0x0b3b,0x1c8f,0x628e,0xbd2c,
-0xd955,0x4779,0xaf78,0x3d56,
-0x0366,0x5fb7,0x7383,0xbd81,
-0x3154,0xb21d,0xcee2,0x3da9,
-0x07de,0x97eb,0x5103,0xbdd2,
-0xdf6c,0xb43f,0xea34,0x3df8,
-0x67e6,0x28ea,0x361b,0xbe20,
-0x5010,0x0239,0x258e,0x3e44,
-0xc3e8,0x24b8,0xdd3e,0xbe67,
-0xd108,0xb347,0xe344,0x3e8a,
-0x992a,0x8363,0xc079,0xbeac,
-0xafc5,0xd511,0x1c4e,0x3ecd,
-0xbbcf,0xb8de,0xd5f9,0xbeeb,
-0x0d0b,0x42c7,0x11b5,0x3f09,
-0x94fe,0xd3d6,0x33ca,0xbf25,
-0xdf7d,0xb6c6,0xc95d,0x3f40,
-0xd4a4,0x0b3c,0xcc62,0xbf58,
-0xa1b4,0x49d3,0x0653,0x3f71,
-0xa26a,0x7913,0xa29f,0xbf85,
-0x2349,0xe7bb,0x51e3,0x3f99,
-0x9ebc,0x537c,0x1bbc,0xbfab,
-0xf53c,0xd536,0x46da,0x3fba,
-0x192e,0x0469,0x94d1,0xbfc6,
-0x7ffa,0x724a,0x2a63,0x3fd0
-};
-#endif
-
-#ifdef MIEEE
-static unsigned short A[] = {
-0x3c49,0x9f2a,0x0c3c,0x4014,
-0xbc78,0x57d0,0xc38a,0x0576,
-0x3ca6,0x63e3,0xe593,0xbfac,
-0xbcd3,0xeaaa,0x7e0d,0x1573,
-0x3d01,0x1d7f,0x0615,0x290c,
-0xbd2c,0x628e,0x1c8f,0x0b3b,
-0x3d56,0xaf78,0x4779,0xd955,
-0xbd81,0x7383,0x5fb7,0x0366,
-0x3da9,0xcee2,0xb21d,0x3154,
-0xbdd2,0x5103,0x97eb,0x07de,
-0x3df8,0xea34,0xb43f,0xdf6c,
-0xbe20,0x361b,0x28ea,0x67e6,
-0x3e44,0x258e,0x0239,0x5010,
-0xbe67,0xdd3e,0x24b8,0xc3e8,
-0x3e8a,0xe344,0xb347,0xd108,
-0xbeac,0xc079,0x8363,0x992a,
-0x3ecd,0x1c4e,0xd511,0xafc5,
-0xbeeb,0xd5f9,0xb8de,0xbbcf,
-0x3f09,0x11b5,0x42c7,0x0d0b,
-0xbf25,0x33ca,0xd3d6,0x94fe,
-0x3f40,0xc95d,0xb6c6,0xdf7d,
-0xbf58,0xcc62,0x0b3c,0xd4a4,
-0x3f71,0x0653,0x49d3,0xa1b4,
-0xbf85,0xa29f,0x7913,0xa26a,
-0x3f99,0x51e3,0xe7bb,0x2349,
-0xbfab,0x1bbc,0x537c,0x9ebc,
-0x3fba,0x46da,0xd536,0xf53c,
-0xbfc6,0x94d1,0x0469,0x192e,
-0x3fd0,0x2a63,0x724a,0x7ffa
-};
-#endif
-
-
-/*							i1.c	*/
-
-/* Chebyshev coefficients for exp(-x) sqrt(x) I1(x)
- * in the inverted interval [8,infinity].
- *
- * lim(x->inf){ exp(-x) sqrt(x) I1(x) } = 1/sqrt(2pi).
- */
-
-#ifdef UNK
-static double B[] =
-{
- 7.51729631084210481353E-18,
- 4.41434832307170791151E-18,
--4.65030536848935832153E-17,
--3.20952592199342395980E-17,
- 2.96262899764595013876E-16,
- 3.30820231092092828324E-16,
--1.88035477551078244854E-15,
--3.81440307243700780478E-15,
- 1.04202769841288027642E-14,
- 4.27244001671195135429E-14,
--2.10154184277266431302E-14,
--4.08355111109219731823E-13,
--7.19855177624590851209E-13,
- 2.03562854414708950722E-12,
- 1.41258074366137813316E-11,
- 3.25260358301548823856E-11,
--1.89749581235054123450E-11,
--5.58974346219658380687E-10,
--3.83538038596423702205E-9,
--2.63146884688951950684E-8,
--2.51223623787020892529E-7,
--3.88256480887769039346E-6,
--1.10588938762623716291E-4,
--9.76109749136146840777E-3,
- 7.78576235018280120474E-1
-};
-#endif
-
-#ifdef DEC
-static unsigned short B[] = {
-0022012,0125555,0115227,0043456,
-0021642,0156127,0052075,0145203,
-0122526,0072435,0111231,0011664,
-0122424,0001544,0161671,0114403,
-0023252,0144257,0163532,0142121,
-0023276,0132162,0174045,0013204,
-0124007,0077154,0057046,0110517,
-0124211,0066650,0116127,0157073,
-0024473,0133413,0130551,0107504,
-0025100,0064741,0032631,0040364,
-0124675,0045101,0071551,0012400,
-0125745,0161054,0071637,0011247,
-0126112,0117410,0035525,0122231,
-0026417,0037237,0131034,0176427,
-0027170,0100373,0024742,0025725,
-0027417,0006417,0105303,0141446,
-0127246,0163716,0121202,0060137,
-0130431,0123122,0120436,0166000,
-0131203,0144134,0153251,0124500,
-0131742,0005234,0122732,0033006,
-0132606,0157751,0072362,0121031,
-0133602,0043372,0047120,0015626,
-0134747,0165774,0001125,0046462,
-0136437,0166402,0117746,0155137,
-0040107,0050305,0125330,0124241
-};
-#endif
-
-#ifdef IBMPC
-static unsigned short B[] = {
-0xe8e6,0xb352,0x556d,0x3c61,
-0xb950,0xea87,0x5b8a,0x3c54,
-0x2277,0xb253,0xcea3,0xbc8a,
-0x3320,0x9c77,0x806c,0xbc82,
-0x588a,0xfceb,0x5915,0x3cb5,
-0xa2d1,0x5f04,0xd68e,0x3cb7,
-0xd22a,0x8bc4,0xefcd,0xbce0,
-0xfbc7,0x138a,0x2db5,0xbcf1,
-0x31e8,0x762d,0x76e1,0x3d07,
-0x281e,0x26b3,0x0d3c,0x3d28,
-0x22a0,0x2e6d,0xa948,0xbd17,
-0xe255,0x8e73,0xbc45,0xbd5c,
-0xb493,0x076a,0x53e1,0xbd69,
-0x9fa3,0xf643,0xe7d3,0x3d81,
-0x457b,0x653c,0x101f,0x3daf,
-0x7865,0xf158,0xe1a1,0x3dc1,
-0x4c0c,0xd450,0xdcf9,0xbdb4,
-0xdd80,0x5423,0x34ca,0xbe03,
-0x3528,0x9ad5,0x790b,0xbe30,
-0x46c1,0x94bb,0x4153,0xbe5c,
-0x5443,0x2e9e,0xdbfd,0xbe90,
-0x0373,0x49ca,0x48df,0xbed0,
-0xa9a6,0x804a,0xfd7f,0xbf1c,
-0xdb4c,0x53fc,0xfda0,0xbf83,
-0x1514,0xb55b,0xea18,0x3fe8
-};
-#endif
-
-#ifdef MIEEE
-static unsigned short B[] = {
-0x3c61,0x556d,0xb352,0xe8e6,
-0x3c54,0x5b8a,0xea87,0xb950,
-0xbc8a,0xcea3,0xb253,0x2277,
-0xbc82,0x806c,0x9c77,0x3320,
-0x3cb5,0x5915,0xfceb,0x588a,
-0x3cb7,0xd68e,0x5f04,0xa2d1,
-0xbce0,0xefcd,0x8bc4,0xd22a,
-0xbcf1,0x2db5,0x138a,0xfbc7,
-0x3d07,0x76e1,0x762d,0x31e8,
-0x3d28,0x0d3c,0x26b3,0x281e,
-0xbd17,0xa948,0x2e6d,0x22a0,
-0xbd5c,0xbc45,0x8e73,0xe255,
-0xbd69,0x53e1,0x076a,0xb493,
-0x3d81,0xe7d3,0xf643,0x9fa3,
-0x3daf,0x101f,0x653c,0x457b,
-0x3dc1,0xe1a1,0xf158,0x7865,
-0xbdb4,0xdcf9,0xd450,0x4c0c,
-0xbe03,0x34ca,0x5423,0xdd80,
-0xbe30,0x790b,0x9ad5,0x3528,
-0xbe5c,0x4153,0x94bb,0x46c1,
-0xbe90,0xdbfd,0x2e9e,0x5443,
-0xbed0,0x48df,0x49ca,0x0373,
-0xbf1c,0xfd7f,0x804a,0xa9a6,
-0xbf83,0xfda0,0x53fc,0xdb4c,
-0x3fe8,0xea18,0xb55b,0x1514
-};
-#endif
-
-
-/*							i1.c	*/
-#ifdef ANSIPROT
-extern double chbevl ( double, void *, int );
-extern double exp ( double );
-extern double sqrt ( double );
-extern double fabs ( double );
-#else
-double chbevl(), exp(), sqrt(), fabs();
-#endif
-
-double i1(x)
-double x;
-{ 
-double y, z;
-
-z = fabs(x);
-if( z <= 8.0 )
-	{
-	y = (z/2.0) - 2.0;
-	z = chbevl( y, A, 29 ) * z * exp(z);
-	}
-else
-	{
-	z = exp(z) * chbevl( 32.0/z - 2.0, B, 25 ) / sqrt(z);
-	}
-if( x < 0.0 )
-	z = -z;
-return( z );
-}
-
-
-/*							i1e()	*/
-
-double i1e( x )
-double x;
-{ 
-double y, z;
-
-z = fabs(x);
-if( z <= 8.0 )
-	{
-	y = (z/2.0) - 2.0;
-	z = chbevl( y, A, 29 ) * z;
-	}
-else
-	{
-	z = chbevl( 32.0/z - 2.0, B, 25 ) / sqrt(z);
-	}
-if( x < 0.0 )
-	z = -z;
-return( z );
-}
Index: c/sas/models/c_extension/cephes/igam.c
===================================================================
--- src/sas/models/c_extension/cephes/igam.c	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,212 +1,0 @@
-/*							igam.c
- *
- *	Incomplete gamma integral
- *
- *
- *
- * SYNOPSIS:
- *
- * double a, x, y, igam();
- *
- * y = igam( a, x );
- *
- * DESCRIPTION:
- *
- * The function is defined by
- *
- *                           x
- *                            -
- *                   1       | |  -t  a-1
- *  igam(a,x)  =   -----     |   e   t   dt.
- *                  -      | |
- *                 | (a)    -
- *                           0
- *
- *
- * In this implementation both arguments must be positive.
- * The integral is evaluated by either a power series or
- * continued fraction expansion, depending on the relative
- * values of a and x.
- *
- * ACCURACY:
- *
- *                      Relative error:
- * arithmetic   domain     # trials      peak         rms
- *    IEEE      0,30       200000       3.6e-14     2.9e-15
- *    IEEE      0,100      300000       9.9e-14     1.5e-14
- */
-
-/*							igamc()
- *
- *	Complemented incomplete gamma integral
- *
- *
- *
- * SYNOPSIS:
- *
- * double a, x, y, igamc();
- *
- * y = igamc( a, x );
- *
- * DESCRIPTION:
- *
- * The function is defined by
- *
- *
- *  igamc(a,x)   =   1 - igam(a,x)
- *
- *                            inf.
- *                              -
- *                     1       | |  -t  a-1
- *               =   -----     |   e   t   dt.
- *                    -      | |
- *                   | (a)    -
- *                             x
- *
- *
- * In this implementation both arguments must be positive.
- * The integral is evaluated by either a power series or
- * continued fraction expansion, depending on the relative
- * values of a and x.
- *
- * ACCURACY:
- *
- * Tested at random a, x.
- *                a         x                      Relative error:
- * arithmetic   domain   domain     # trials      peak         rms
- *    IEEE     0.5,100   0,100      200000       1.9e-14     1.7e-15
- *    IEEE     0.01,0.5  0,100      200000       1.4e-13     1.6e-15
- */
-
-
-/*
-Cephes Math Library Release 2.8:  June, 2000
-Copyright 1985, 1987, 2000 by Stephen L. Moshier
-*/
-
-#include "mconf.h"
-#ifdef ANSIPROT
-extern double lgam ( double );
-extern double exp ( double );
-extern double log ( double );
-extern double fabs ( double );
-extern double igam ( double, double );
-extern double igamc ( double, double );
-#else
-double lgam(), exp(), log(), fabs(), igam(), igamc();
-#endif
-
-extern double MACHEP, MAXLOG;
-static double big = 4.503599627370496e15;
-static double biginv =  2.22044604925031308085e-16;
-
-double igamc( a, x )
-double a, x;
-{
-double ans, ax, c, yc, r, t, y, z;
-double pk, pkm1, pkm2, qk, qkm1, qkm2;
-
-if( (x <= 0) || ( a <= 0) )
-	return( 1.0 );
-
-if( (x < 1.0) || (x < a) )
-	return( 1.0 - igam(a,x) );
-
-ax = a * log(x) - x - lgam(a);
-if( ax < -MAXLOG )
-	{
-	mtherr( "igamc", UNDERFLOW );
-	return( 0.0 );
-	}
-ax = exp(ax);
-
-/* continued fraction */
-y = 1.0 - a;
-z = x + y + 1.0;
-c = 0.0;
-pkm2 = 1.0;
-qkm2 = x;
-pkm1 = x + 1.0;
-qkm1 = z * x;
-ans = pkm1/qkm1;
-
-do
-	{
-	c += 1.0;
-	y += 1.0;
-	z += 2.0;
-	yc = y * c;
-	pk = pkm1 * z  -  pkm2 * yc;
-	qk = qkm1 * z  -  qkm2 * yc;
-	if( qk != 0 )
-		{
-		r = pk/qk;
-		t = fabs( (ans - r)/r );
-		ans = r;
-		}
-	else
-		t = 1.0;
-	pkm2 = pkm1;
-	pkm1 = pk;
-	qkm2 = qkm1;
-	qkm1 = qk;
-	if( fabs(pk) > big )
-		{
-		pkm2 *= biginv;
-		pkm1 *= biginv;
-		qkm2 *= biginv;
-		qkm1 *= biginv;
-		}
-	}
-while( t > MACHEP );
-
-return( ans * ax );
-}
-
-
-
-/* left tail of incomplete gamma function:
- *
- *          inf.      k
- *   a  -x   -       x
- *  x  e     >   ----------
- *           -     -
- *          k=0   | (a+k+1)
- *
- */
-
-double igam( a, x )
-double a, x;
-{
-double ans, ax, c, r;
-
-if( (x <= 0) || ( a <= 0) )
-	return( 0.0 );
-
-if( (x > 1.0) && (x > a ) )
-	return( 1.0 - igamc(a,x) );
-
-/* Compute  x**a * exp(-x) / gamma(a)  */
-ax = a * log(x) - x - lgam(a);
-if( ax < -MAXLOG )
-	{
-	mtherr( "igam", UNDERFLOW );
-	return( 0.0 );
-	}
-ax = exp(ax);
-
-/* power series */
-r = a;
-c = 1.0;
-ans = 1.0;
-
-do
-	{
-	r += 1.0;
-	c *= x/r;
-	ans += c;
-	}
-while( c/ans > MACHEP );
-
-return( ans * ax/a );
-}
Index: c/sas/models/c_extension/cephes/igami.c
===================================================================
--- src/sas/models/c_extension/cephes/igami.c	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,188 +1,0 @@
-/*							igami()
- *
- *      Inverse of complemented imcomplete gamma integral
- *
- *
- *
- * SYNOPSIS:
- *
- * double a, x, p, igami();
- *
- * x = igami( a, p );
- *
- * DESCRIPTION:
- *
- * Given p, the function finds x such that
- *
- *  igamc( a, x ) = p.
- *
- * Starting with the approximate value
- *
- *         3
- *  x = a t
- *
- *  where
- *
- *  t = 1 - d - ndtri(p) sqrt(d)
- * 
- * and
- *
- *  d = 1/9a,
- *
- * the routine performs up to 10 Newton iterations to find the
- * root of igamc(a,x) - p = 0.
- *
- * ACCURACY:
- *
- * Tested at random a, p in the intervals indicated.
- *
- *                a        p                      Relative error:
- * arithmetic   domain   domain     # trials      peak         rms
- *    IEEE     0.5,100   0,0.5       100000       1.0e-14     1.7e-15
- *    IEEE     0.01,0.5  0,0.5       100000       9.0e-14     3.4e-15
- *    IEEE    0.5,10000  0,0.5        20000       2.3e-13     3.8e-14
- */
-
-
-/*
-Cephes Math Library Release 2.8:  June, 2000
-Copyright 1984, 1987, 1995, 2000 by Stephen L. Moshier
-*/
-
-#include "mconf.h"
-
-extern double MACHEP, MAXNUM, MAXLOG, MINLOG;
-#ifdef ANSIPROT
-extern double igamc ( double, double );
-extern double ndtri ( double );
-extern double exp ( double );
-extern double fabs ( double );
-extern double log ( double );
-extern double sqrt ( double );
-extern double lgam ( double );
-#else
-double igamc(), ndtri(), exp(), fabs(), log(), sqrt(), lgam();
-#endif
-
-double igami( a, y0 )
-double a, y0;
-{
-double x0, x1, x, yl, yh, y, d, lgm, dithresh;
-int i, dir;
-
-/* bound the solution */
-x0 = MAXNUM;
-yl = 0;
-x1 = 0;
-yh = 1.0;
-dithresh = 5.0 * MACHEP;
-
-/* approximation to inverse function */
-d = 1.0/(9.0*a);
-y = ( 1.0 - d - ndtri(y0) * sqrt(d) );
-x = a * y * y * y;
-
-lgm = lgam(a);
-
-for( i=0; i<10; i++ )
-	{
-	if( x > x0 || x < x1 )
-		goto ihalve;
-	y = igamc(a,x);
-	if( y < yl || y > yh )
-		goto ihalve;
-	if( y < y0 )
-		{
-		x0 = x;
-		yl = y;
-		}
-	else
-		{
-		x1 = x;
-		yh = y;
-		}
-/* compute the derivative of the function at this point */
-	d = (a - 1.0) * log(x) - x - lgm;
-	if( d < -MAXLOG )
-		goto ihalve;
-	d = -exp(d);
-/* compute the step to the next approximation of x */
-	d = (y - y0)/d;
-	if( fabs(d/x) < MACHEP )
-		goto done;
-	x = x - d;
-	}
-
-/* Resort to interval halving if Newton iteration did not converge. */
-ihalve:
-
-d = 0.0625;
-if( x0 == MAXNUM )
-	{
-	if( x <= 0.0 )
-		x = 1.0;
-	while( x0 == MAXNUM )
-		{
-		x = (1.0 + d) * x;
-		y = igamc( a, x );
-		if( y < y0 )
-			{
-			x0 = x;
-			yl = y;
-			break;
-			}
-		d = d + d;
-		}
-	}
-d = 0.5;
-dir = 0;
-
-for( i=0; i<400; i++ )
-	{
-	x = x1  +  d * (x0 - x1);
-	y = igamc( a, x );
-	lgm = (x0 - x1)/(x1 + x0);
-	if( fabs(lgm) < dithresh )
-		break;
-	lgm = (y - y0)/y0;
-	if( fabs(lgm) < dithresh )
-		break;
-	if( x <= 0.0 )
-		break;
-	if( y >= y0 )
-		{
-		x1 = x;
-		yh = y;
-		if( dir < 0 )
-			{
-			dir = 0;
-			d = 0.5;
-			}
-		else if( dir > 1 )
-			d = 0.5 * d + 0.5; 
-		else
-			d = (y0 - yl)/(yh - yl);
-		dir += 1;
-		}
-	else
-		{
-		x0 = x;
-		yl = y;
-		if( dir > 0 )
-			{
-			dir = 0;
-			d = 0.5;
-			}
-		else if( dir < -1 )
-			d = 0.5 * d;
-		else
-			d = (y0 - yl)/(yh - yl);
-		dir -= 1;
-		}
-	}
-if( x == 0.0 )
-	mtherr( "igami", UNDERFLOW );
-
-done:
-return( x );
-}
Index: c/sas/models/c_extension/cephes/incbet.c
===================================================================
--- src/sas/models/c_extension/cephes/incbet.c	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,413 +1,0 @@
-/*							incbet.c
- *
- *	Incomplete beta integral
- *
- *
- * SYNOPSIS:
- *
- * double a, b, x, y, incbet();
- *
- * y = incbet( a, b, x );
- *
- *
- * DESCRIPTION:
- *
- * Returns incomplete beta integral of the arguments, evaluated
- * from zero to x.  The function is defined as
- *
- *                  x
- *     -            -
- *    | (a+b)      | |  a-1     b-1
- *  -----------    |   t   (1-t)   dt.
- *   -     -     | |
- *  | (a) | (b)   -
- *                 0
- *
- * The domain of definition is 0 <= x <= 1.  In this
- * implementation a and b are restricted to positive values.
- * The integral from x to 1 may be obtained by the symmetry
- * relation
- *
- *    1 - incbet( a, b, x )  =  incbet( b, a, 1-x ).
- *
- * The integral is evaluated by a continued fraction expansion
- * or, when b*x is small, by a power series.
- *
- * ACCURACY:
- *
- * Tested at uniformly distributed random points (a,b,x) with a and b
- * in "domain" and x between 0 and 1.
- *                                        Relative error
- * arithmetic   domain     # trials      peak         rms
- *    IEEE      0,5         10000       6.9e-15     4.5e-16
- *    IEEE      0,85       250000       2.2e-13     1.7e-14
- *    IEEE      0,1000      30000       5.3e-12     6.3e-13
- *    IEEE      0,10000    250000       9.3e-11     7.1e-12
- *    IEEE      0,100000    10000       8.7e-10     4.8e-11
- * Outputs smaller than the IEEE gradual underflow threshold
- * were excluded from these statistics.
- *
- * ERROR MESSAGES:
- *   message         condition      value returned
- * incbet domain      x<0, x>1          0.0
- * incbet underflow                     0.0
- */
-
-
-
-/*
-Cephes Math Library, Release 2.8:  June, 2000
-Copyright 1984, 1995, 2000 by Stephen L. Moshier
-*/
-
-#include "mconf.h"
-
-#ifdef DEC
-#define MAXGAM 34.84425627277176174
-#else
-#define MAXGAM 171.624376956302725
-#endif
-
-extern double MACHEP, MINLOG, MAXLOG;
-#ifdef ANSIPROT
-extern double gamma ( double );
-extern double lgam ( double );
-extern double exp ( double );
-extern double log ( double );
-extern double pow ( double, double );
-extern double fabs ( double );
-static double incbcf(double, double, double);
-static double incbd(double, double, double);
-static double pseries(double, double, double);
-#else
-double gamma(), lgam(), exp(), log(), pow(), fabs();
-static double incbcf(), incbd(), pseries();
-#endif
-
-static double big = 4.503599627370496e15;
-static double biginv =  2.22044604925031308085e-16;
-
-
-double incbet( aa, bb, xx )
-double aa, bb, xx;
-{
-double a, b, t, x, xc, w, y;
-int flag;
-
-if( aa <= 0.0 || bb <= 0.0 )
-	goto domerr;
-
-if( (xx <= 0.0) || ( xx >= 1.0) )
-	{
-	if( xx == 0.0 )
-		return(0.0);
-	if( xx == 1.0 )
-		return( 1.0 );
-domerr:
-	mtherr( "incbet", DOMAIN );
-	return( 0.0 );
-	}
-
-flag = 0;
-if( (bb * xx) <= 1.0 && xx <= 0.95)
-	{
-	t = pseries(aa, bb, xx);
-		goto done;
-	}
-
-w = 1.0 - xx;
-
-/* Reverse a and b if x is greater than the mean. */
-if( xx > (aa/(aa+bb)) )
-	{
-	flag = 1;
-	a = bb;
-	b = aa;
-	xc = xx;
-	x = w;
-	}
-else
-	{
-	a = aa;
-	b = bb;
-	xc = w;
-	x = xx;
-	}
-
-if( flag == 1 && (b * x) <= 1.0 && x <= 0.95)
-	{
-	t = pseries(a, b, x);
-	goto done;
-	}
-
-/* Choose expansion for better convergence. */
-y = x * (a+b-2.0) - (a-1.0);
-if( y < 0.0 )
-	w = incbcf( a, b, x );
-else
-	w = incbd( a, b, x ) / xc;
-
-/* Multiply w by the factor
-     a      b   _             _     _
-    x  (1-x)   | (a+b) / ( a | (a) | (b) ) .   */
-
-y = a * log(x);
-t = b * log(xc);
-if( (a+b) < MAXGAM && fabs(y) < MAXLOG && fabs(t) < MAXLOG )
-	{
-	t = pow(xc,b);
-	t *= pow(x,a);
-	t /= a;
-	t *= w;
-	t *= gamma(a+b) / (gamma(a) * gamma(b));
-	goto done;
-	}
-/* Resort to logarithms.  */
-y += t + lgam(a+b) - lgam(a) - lgam(b);
-y += log(w/a);
-if( y < MINLOG )
-	t = 0.0;
-else
-	t = exp(y);
-
-done:
-
-if( flag == 1 )
-	{
-	if( t <= MACHEP )
-		t = 1.0 - MACHEP;
-	else
-		t = 1.0 - t;
-	}
-return( t );
-}
-
-
-/* Continued fraction expansion #1
- * for incomplete beta integral
- */
-
-static double incbcf( a, b, x )
-double a, b, x;
-{
-double xk, pk, pkm1, pkm2, qk, qkm1, qkm2;
-double k1, k2, k3, k4, k5, k6, k7, k8;
-double r, t, ans, thresh;
-int n;
-
-k1 = a;
-k2 = a + b;
-k3 = a;
-k4 = a + 1.0;
-k5 = 1.0;
-k6 = b - 1.0;
-k7 = k4;
-k8 = a + 2.0;
-
-pkm2 = 0.0;
-qkm2 = 1.0;
-pkm1 = 1.0;
-qkm1 = 1.0;
-ans = 1.0;
-r = 1.0;
-n = 0;
-thresh = 3.0 * MACHEP;
-do
-	{
-	
-	xk = -( x * k1 * k2 )/( k3 * k4 );
-	pk = pkm1 +  pkm2 * xk;
-	qk = qkm1 +  qkm2 * xk;
-	pkm2 = pkm1;
-	pkm1 = pk;
-	qkm2 = qkm1;
-	qkm1 = qk;
-
-	xk = ( x * k5 * k6 )/( k7 * k8 );
-	pk = pkm1 +  pkm2 * xk;
-	qk = qkm1 +  qkm2 * xk;
-	pkm2 = pkm1;
-	pkm1 = pk;
-	qkm2 = qkm1;
-	qkm1 = qk;
-
-	if( qk != 0 )
-		r = pk/qk;
-	if( r != 0 )
-		{
-		t = fabs( (ans - r)/r );
-		ans = r;
-		}
-	else
-		t = 1.0;
-
-	if( t < thresh )
-		goto cdone;
-
-	k1 += 1.0;
-	k2 += 1.0;
-	k3 += 2.0;
-	k4 += 2.0;
-	k5 += 1.0;
-	k6 -= 1.0;
-	k7 += 2.0;
-	k8 += 2.0;
-
-	if( (fabs(qk) + fabs(pk)) > big )
-		{
-		pkm2 *= biginv;
-		pkm1 *= biginv;
-		qkm2 *= biginv;
-		qkm1 *= biginv;
-		}
-	if( (fabs(qk) < biginv) || (fabs(pk) < biginv) )
-		{
-		pkm2 *= big;
-		pkm1 *= big;
-		qkm2 *= big;
-		qkm1 *= big;
-		}
-	}
-while( ++n < 300 );
-
-cdone:
-return(ans);
-}
-
-
-
-/* Continued fraction expansion #2
- * for incomplete beta integral
- */
-
-static double incbd( a, b, x )
-double a, b, x;
-{
-double xk, pk, pkm1, pkm2, qk, qkm1, qkm2;
-double k1, k2, k3, k4, k5, k6, k7, k8;
-double r, t, ans, z, thresh;
-int n;
-
-k1 = a;
-k2 = b - 1.0;
-k3 = a;
-k4 = a + 1.0;
-k5 = 1.0;
-k6 = a + b;
-k7 = a + 1.0;;
-k8 = a + 2.0;
-
-pkm2 = 0.0;
-qkm2 = 1.0;
-pkm1 = 1.0;
-qkm1 = 1.0;
-z = x / (1.0-x);
-ans = 1.0;
-r = 1.0;
-n = 0;
-thresh = 3.0 * MACHEP;
-do
-	{
-	
-	xk = -( z * k1 * k2 )/( k3 * k4 );
-	pk = pkm1 +  pkm2 * xk;
-	qk = qkm1 +  qkm2 * xk;
-	pkm2 = pkm1;
-	pkm1 = pk;
-	qkm2 = qkm1;
-	qkm1 = qk;
-
-	xk = ( z * k5 * k6 )/( k7 * k8 );
-	pk = pkm1 +  pkm2 * xk;
-	qk = qkm1 +  qkm2 * xk;
-	pkm2 = pkm1;
-	pkm1 = pk;
-	qkm2 = qkm1;
-	qkm1 = qk;
-
-	if( qk != 0 )
-		r = pk/qk;
-	if( r != 0 )
-		{
-		t = fabs( (ans - r)/r );
-		ans = r;
-		}
-	else
-		t = 1.0;
-
-	if( t < thresh )
-		goto cdone;
-
-	k1 += 1.0;
-	k2 -= 1.0;
-	k3 += 2.0;
-	k4 += 2.0;
-	k5 += 1.0;
-	k6 += 1.0;
-	k7 += 2.0;
-	k8 += 2.0;
-
-	if( (fabs(qk) + fabs(pk)) > big )
-		{
-		pkm2 *= biginv;
-		pkm1 *= biginv;
-		qkm2 *= biginv;
-		qkm1 *= biginv;
-		}
-	if( (fabs(qk) < biginv) || (fabs(pk) < biginv) )
-		{
-		pkm2 *= big;
-		pkm1 *= big;
-		qkm2 *= big;
-		qkm1 *= big;
-		}
-	}
-while( ++n < 300 );
-cdone:
-return(ans);
-}
-
-
-/* Power series for incomplete beta integral.
-   Use when b*x is small and x not too close to 1.  */
-
-static double pseries( a, b, x )
-double a, b, x;
-{
-double s, t, u, v, n, t1, z, ai;
-
-ai = 1.0 / a;
-u = (1.0 - b) * x;
-v = u / (a + 1.0);
-t1 = v;
-t = u;
-n = 2.0;
-s = 0.0;
-z = MACHEP * ai;
-while( fabs(v) > z )
-	{
-	u = (n - b) * x / n;
-	t *= u;
-	v = t / (a + n);
-	s += v; 
-	n += 1.0;
-	}
-s += t1;
-s += ai;
-
-u = a * log(x);
-if( (a+b) < MAXGAM && fabs(u) < MAXLOG )
-	{
-	t = gamma(a+b)/(gamma(a)*gamma(b));
-	s = s * t * pow(x,a);
-	}
-else
-	{
-	t = lgam(a+b) - lgam(a) - lgam(b) + u + log(s);
-	if( t < MINLOG )
-		s = 0.0;
-	else
-	s = exp(t);
-	}
-return(s);
-}
Index: c/sas/models/c_extension/cephes/incbi.c
===================================================================
--- src/sas/models/c_extension/cephes/incbi.c	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,314 +1,0 @@
-/*							incbi()
- *
- *      Inverse of imcomplete beta integral
- *
- *
- *
- * SYNOPSIS:
- *
- * double a, b, x, y, incbi();
- *
- * x = incbi( a, b, y );
- *
- *
- *
- * DESCRIPTION:
- *
- * Given y, the function finds x such that
- *
- *  incbet( a, b, x ) = y .
- *
- * The routine performs interval halving or Newton iterations to find the
- * root of incbet(a,b,x) - y = 0.
- *
- *
- * ACCURACY:
- *
- *                      Relative error:
- *                x     a,b
- * arithmetic   domain  domain  # trials    peak       rms
- *    IEEE      0,1    .5,10000   50000    5.8e-12   1.3e-13
- *    IEEE      0,1   .25,100    100000    1.8e-13   3.9e-15
- *    IEEE      0,1     0,5       50000    1.1e-12   5.5e-15
- *    VAX       0,1    .5,100     25000    3.5e-14   1.1e-15
- * With a and b constrained to half-integer or integer values:
- *    IEEE      0,1    .5,10000   50000    5.8e-12   1.1e-13
- *    IEEE      0,1    .5,100    100000    1.7e-14   7.9e-16
- * With a = .5, b constrained to half-integer or integer values:
- *    IEEE      0,1    .5,10000   10000    8.3e-11   1.0e-11
- */
-
-
-
-/*
-Cephes Math Library Release 2.8:  June, 2000
-Copyright 1984, 1996, 2000 by Stephen L. Moshier
-*/
-
-#include "mconf.h"
-
-extern double MACHEP, MAXNUM, MAXLOG, MINLOG;
-#ifdef ANSIPROT
-extern double ndtri ( double );
-extern double exp ( double );
-extern double fabs ( double );
-extern double log ( double );
-extern double sqrt ( double );
-extern double lgam ( double );
-extern double incbet ( double, double, double );
-#else
-double ndtri(), exp(), fabs(), log(), sqrt(), lgam(), incbet();
-#endif
-
-double incbi( aa, bb, yy0 )
-double aa, bb, yy0;
-{
-double a, b, y0, d, y, x, x0, x1, lgm, yp, di, dithresh, yl, yh, xt;
-int i, rflg, dir, nflg;
-
-
-i = 0;
-if( yy0 <= 0 )
-	return(0.0);
-if( yy0 >= 1.0 )
-	return(1.0);
-x0 = 0.0;
-yl = 0.0;
-x1 = 1.0;
-yh = 1.0;
-nflg = 0;
-
-if( aa <= 1.0 || bb <= 1.0 )
-	{
-	dithresh = 1.0e-6;
-	rflg = 0;
-	a = aa;
-	b = bb;
-	y0 = yy0;
-	x = a/(a+b);
-	y = incbet( a, b, x );
-	goto ihalve;
-	}
-else
-	{
-	dithresh = 1.0e-4;
-	}
-/* approximation to inverse function */
-
-yp = -ndtri(yy0);
-
-if( yy0 > 0.5 )
-	{
-	rflg = 1;
-	a = bb;
-	b = aa;
-	y0 = 1.0 - yy0;
-	yp = -yp;
-	}
-else
-	{
-	rflg = 0;
-	a = aa;
-	b = bb;
-	y0 = yy0;
-	}
-
-lgm = (yp * yp - 3.0)/6.0;
-x = 2.0/( 1.0/(2.0*a-1.0)  +  1.0/(2.0*b-1.0) );
-d = yp * sqrt( x + lgm ) / x
-	- ( 1.0/(2.0*b-1.0) - 1.0/(2.0*a-1.0) )
-	* (lgm + 5.0/6.0 - 2.0/(3.0*x));
-d = 2.0 * d;
-if( d < MINLOG )
-	{
-	x = 1.0;
-	goto under;
-	}
-x = a/( a + b * exp(d) );
-y = incbet( a, b, x );
-yp = (y - y0)/y0;
-if( fabs(yp) < 0.2 )
-	goto newt;
-
-/* Resort to interval halving if not close enough. */
-ihalve:
-
-dir = 0;
-di = 0.5;
-for( i=0; i<100; i++ )
-	{
-	if( i != 0 )
-		{
-		x = x0  +  di * (x1 - x0);
-		if( x == 1.0 )
-			x = 1.0 - MACHEP;
-		if( x == 0.0 )
-			{
-			di = 0.5;
-			x = x0  +  di * (x1 - x0);
-			if( x == 0.0 )
-				goto under;
-			}
-		y = incbet( a, b, x );
-		yp = (x1 - x0)/(x1 + x0);
-		if( fabs(yp) < dithresh )
-			goto newt;
-		yp = (y-y0)/y0;
-		if( fabs(yp) < dithresh )
-			goto newt;
-		}
-	if( y < y0 )
-		{
-		x0 = x;
-		yl = y;
-		if( dir < 0 )
-			{
-			dir = 0;
-			di = 0.5;
-			}
-		else if( dir > 3 )
-			di = 1.0 - (1.0 - di) * (1.0 - di);
-		else if( dir > 1 )
-			di = 0.5 * di + 0.5; 
-		else
-			di = (y0 - y)/(yh - yl);
-		dir += 1;
-		if( x0 > 0.75 )
-			{
-			if( rflg == 1 )
-				{
-				rflg = 0;
-				a = aa;
-				b = bb;
-				y0 = yy0;
-				}
-			else
-				{
-				rflg = 1;
-				a = bb;
-				b = aa;
-				y0 = 1.0 - yy0;
-				}
-			x = 1.0 - x;
-			y = incbet( a, b, x );
-			x0 = 0.0;
-			yl = 0.0;
-			x1 = 1.0;
-			yh = 1.0;
-			goto ihalve;
-			}
-		}
-	else
-		{
-		x1 = x;
-		if( rflg == 1 && x1 < MACHEP )
-			{
-			x = 0.0;
-			goto done;
-			}
-		yh = y;
-		if( dir > 0 )
-			{
-			dir = 0;
-			di = 0.5;
-			}
-		else if( dir < -3 )
-			di = di * di;
-		else if( dir < -1 )
-			di = 0.5 * di;
-		else
-			di = (y - y0)/(yh - yl);
-		dir -= 1;
-		}
-	}
-mtherr( "incbi", PLOSS );
-if( x0 >= 1.0 )
-	{
-	x = 1.0 - MACHEP;
-	goto done;
-	}
-if( x <= 0.0 )
-	{
-under:
-	mtherr( "incbi", UNDERFLOW );
-	x = 0.0;
-	goto done;
-	}
-
-newt:
-
-if( nflg )
-	goto done;
-nflg = 1;
-lgm = lgam(a+b) - lgam(a) - lgam(b);
-
-for( i=0; i<8; i++ )
-	{
-	/* Compute the function at this point. */
-	if( i != 0 )
-		y = incbet(a,b,x);
-	if( y < yl )
-		{
-		x = x0;
-		y = yl;
-		}
-	else if( y > yh )
-		{
-		x = x1;
-		y = yh;
-		}
-	else if( y < y0 )
-		{
-		x0 = x;
-		yl = y;
-		}
-	else
-		{
-		x1 = x;
-		yh = y;
-		}
-	if( x == 1.0 || x == 0.0 )
-		break;
-	/* Compute the derivative of the function at this point. */
-	d = (a - 1.0) * log(x) + (b - 1.0) * log(1.0-x) + lgm;
-	if( d < MINLOG )
-		goto done;
-	if( d > MAXLOG )
-		break;
-	d = exp(d);
-	/* Compute the step to the next approximation of x. */
-	d = (y - y0)/d;
-	xt = x - d;
-	if( xt <= x0 )
-		{
-		y = (x - x0) / (x1 - x0);
-		xt = x0 + 0.5 * y * (x - x0);
-		if( xt <= 0.0 )
-			break;
-		}
-	if( xt >= x1 )
-		{
-		y = (x1 - x) / (x1 - x0);
-		xt = x1 - 0.5 * y * (x1 - x);
-		if( xt >= 1.0 )
-			break;
-		}
-	x = xt;
-	if( fabs(d/x) < 128.0 * MACHEP )
-		goto done;
-	}
-/* Did not converge.  */
-dithresh = 256.0 * MACHEP;
-goto ihalve;
-
-done:
-
-if( rflg )
-	{
-	if( x <= MACHEP )
-		x = 1.0 - MACHEP;
-	else
-		x = 1.0 - x;
-	}
-return( x );
-}
Index: c/sas/models/c_extension/cephes/iv.c
===================================================================
--- src/sas/models/c_extension/cephes/iv.c	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,117 +1,0 @@
-/*							iv.c
- *
- *	Modified Bessel function of noninteger order
- *
- *
- *
- * SYNOPSIS:
- *
- * double v, x, y, iv();
- *
- * y = iv( v, x );
- *
- *
- *
- * DESCRIPTION:
- *
- * Returns modified Bessel function of order v of the
- * argument.  If x is negative, v must be integer valued.
- *
- * The function is defined as Iv(x) = Jv( ix ).  It is
- * here computed in terms of the confluent hypergeometric
- * function, according to the formula
- *
- *              v  -x
- * Iv(x) = (x/2)  e   hyperg( v+0.5, 2v+1, 2x ) / gamma(v+1)
- *
- * If v is a negative integer, then v is replaced by -v.
- *
- *
- * ACCURACY:
- *
- * Tested at random points (v, x), with v between 0 and
- * 30, x between 0 and 28.
- *                      Relative error:
- * arithmetic   domain     # trials      peak         rms
- *    DEC       0,30          2000      3.1e-15     5.4e-16
- *    IEEE      0,30         10000      1.7e-14     2.7e-15
- *
- * Accuracy is diminished if v is near a negative integer.
- *
- * See also hyperg.c.
- *
- */
-
-/*							iv.c	*/
-/*	Modified Bessel function of noninteger order		*/
-/* If x < 0, then v must be an integer. */
-
-
-/*
-Cephes Math Library Release 2.8:  June, 2000
-Copyright 1984, 1987, 1988, 2000 by Stephen L. Moshier
-*/
-
-
-#include "mconf.h"
-#ifdef ANSIPROT
-extern double hyperg ( double, double, double );
-extern double exp ( double );
-extern double gamma ( double );
-extern double log ( double );
-extern double fabs ( double );
-extern double floor ( double );
-#else
-double hyperg(), exp(), gamma(), log(), fabs(), floor();
-#endif
-extern double MACHEP, MAXNUM;
-
-double iv( v, x )
-double v, x;
-{
-int sign;
-double t, ax;
-
-/* If v is a negative integer, invoke symmetry */
-t = floor(v);
-if( v < 0.0 )
-	{
-	if( t == v )
-		{
-		v = -v;	/* symmetry */
-		t = -t;
-		}
-	}
-/* If x is negative, require v to be an integer */
-sign = 1;
-if( x < 0.0 )
-	{
-	if( t != v )
-		{
-		mtherr( "iv", DOMAIN );
-		return( 0.0 );
-		}
-	if( v != 2.0 * floor(v/2.0) )
-		sign = -1;
-	}
-
-/* Avoid logarithm singularity */
-if( x == 0.0 )
-	{
-	if( v == 0.0 )
-		return( 1.0 );
-	if( v < 0.0 )
-		{
-		mtherr( "iv", OVERFLOW );
-		return( MAXNUM );
-		}
-	else
-		return( 0.0 );
-	}
-
-ax = fabs(x);
-t = v * log( 0.5 * ax )  -  x;
-t = sign * exp(t) / gamma( v + 1.0 );
-ax = v + 0.5;
-return( t * hyperg( ax,  2.0 * ax,  2.0 * x ) );
-}
Index: c/sas/models/c_extension/cephes/j0.c
===================================================================
--- src/sas/models/c_extension/cephes/j0.c	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,546 +1,0 @@
-/*							j0.c
- *
- *	Bessel function of order zero
- *
- *
- *
- * SYNOPSIS:
- *
- * double x, y, j0();
- *
- * y = j0( x );
- *
- *
- *
- * DESCRIPTION:
- *
- * Returns Bessel function of order zero of the argument.
- *
- * The domain is divided into the intervals [0, 5] and
- * (5, infinity). In the first interval the following rational
- * approximation is used:
- *
- *
- *        2         2
- * (w - r  ) (w - r  ) P (w) / Q (w)
- *       1         2    3       8
- *
- *            2
- * where w = x  and the two r's are zeros of the function.
- *
- * In the second interval, the Hankel asymptotic expansion
- * is employed with two rational functions of degree 6/6
- * and 7/7.
- *
- *
- *
- * ACCURACY:
- *
- *                      Absolute error:
- * arithmetic   domain     # trials      peak         rms
- *    DEC       0, 30       10000       4.4e-17     6.3e-18
- *    IEEE      0, 30       60000       4.2e-16     1.1e-16
- *
- */
-
-/*							y0.c
- *
- *	Bessel function of the second kind, order zero
- *
- *
- *
- * SYNOPSIS:
- *
- * double x, y, y0();
- *
- * y = y0( x );
- *
- *
- *
- * DESCRIPTION:
- *
- * Returns Bessel function of the second kind, of order
- * zero, of the argument.
- *
- * The domain is divided into the intervals [0, 5] and
- * (5, infinity). In the first interval a rational approximation
- * R(x) is employed to compute
- *   y0(x)  = R(x)  +   2 * log(x) * j0(x) / PI.
- * Thus a call to j0() is required.
- *
- * In the second interval, the Hankel asymptotic expansion
- * is employed with two rational functions of degree 6/6
- * and 7/7.
- *
- *
- *
- * ACCURACY:
- *
- *  Absolute error, when y0(x) < 1; else relative error:
- *
- * arithmetic   domain     # trials      peak         rms
- *    DEC       0, 30        9400       7.0e-17     7.9e-18
- *    IEEE      0, 30       30000       1.3e-15     1.6e-16
- *
- */
-
-
-/*
-Cephes Math Library Release 2.8:  June, 2000
-Copyright 1984, 1987, 1989, 2000 by Stephen L. Moshier
-*/
-
-/* Note: all coefficients satisfy the relative error criterion
- * except YP, YQ which are designed for absolute error. */
-
-#include "mconf.h"
-
-#ifdef UNK
-static double PP[7] = {
-  7.96936729297347051624E-4,
-  8.28352392107440799803E-2,
-  1.23953371646414299388E0,
-  5.44725003058768775090E0,
-  8.74716500199817011941E0,
-  5.30324038235394892183E0,
-  9.99999999999999997821E-1,
-};
-static double PQ[7] = {
-  9.24408810558863637013E-4,
-  8.56288474354474431428E-2,
-  1.25352743901058953537E0,
-  5.47097740330417105182E0,
-  8.76190883237069594232E0,
-  5.30605288235394617618E0,
-  1.00000000000000000218E0,
-};
-#endif
-#ifdef DEC
-static unsigned short PP[28] = {
-0035520,0164604,0140733,0054470,
-0037251,0122605,0115356,0107170,
-0040236,0124412,0071500,0056303,
-0040656,0047737,0045720,0045263,
-0041013,0172143,0045004,0142103,
-0040651,0132045,0026241,0026406,
-0040200,0000000,0000000,0000000,
-};
-static unsigned short PQ[28] = {
-0035562,0052006,0070034,0134666,
-0037257,0057055,0055242,0123424,
-0040240,0071626,0046630,0032371,
-0040657,0011077,0032013,0012731,
-0041014,0030307,0050331,0006414,
-0040651,0145457,0065021,0150304,
-0040200,0000000,0000000,0000000,
-};
-#endif
-#ifdef IBMPC
-static unsigned short PP[28] = {
-0x6b27,0x983b,0x1d30,0x3f4a,
-0xd1cf,0xb35d,0x34b0,0x3fb5,
-0x0b98,0x4e68,0xd521,0x3ff3,
-0x0956,0xe97a,0xc9fb,0x4015,
-0x9888,0x6940,0x7e8c,0x4021,
-0x25a1,0xa594,0x3684,0x4015,
-0x0000,0x0000,0x0000,0x3ff0,
-};
-static unsigned short PQ[28] = {
-0x9737,0xce03,0x4a80,0x3f4e,
-0x54e3,0xab54,0xebc5,0x3fb5,
-0x069f,0xc9b3,0x0e72,0x3ff4,
-0x62bb,0xe681,0xe247,0x4015,
-0x21a1,0xea1b,0x8618,0x4021,
-0x3a19,0xed42,0x3965,0x4015,
-0x0000,0x0000,0x0000,0x3ff0,
-};
-#endif
-#ifdef MIEEE
-static unsigned short PP[28] = {
-0x3f4a,0x1d30,0x983b,0x6b27,
-0x3fb5,0x34b0,0xb35d,0xd1cf,
-0x3ff3,0xd521,0x4e68,0x0b98,
-0x4015,0xc9fb,0xe97a,0x0956,
-0x4021,0x7e8c,0x6940,0x9888,
-0x4015,0x3684,0xa594,0x25a1,
-0x3ff0,0x0000,0x0000,0x0000,
-};
-static unsigned short PQ[28] = {
-0x3f4e,0x4a80,0xce03,0x9737,
-0x3fb5,0xebc5,0xab54,0x54e3,
-0x3ff4,0x0e72,0xc9b3,0x069f,
-0x4015,0xe247,0xe681,0x62bb,
-0x4021,0x8618,0xea1b,0x21a1,
-0x4015,0x3965,0xed42,0x3a19,
-0x3ff0,0x0000,0x0000,0x0000,
-};
-#endif
-
-#ifdef UNK
-static double QP[8] = {
--1.13663838898469149931E-2,
--1.28252718670509318512E0,
--1.95539544257735972385E1,
--9.32060152123768231369E1,
--1.77681167980488050595E2,
--1.47077505154951170175E2,
--5.14105326766599330220E1,
--6.05014350600728481186E0,
-};
-static double QQ[7] = {
-/*  1.00000000000000000000E0,*/
-  6.43178256118178023184E1,
-  8.56430025976980587198E2,
-  3.88240183605401609683E3,
-  7.24046774195652478189E3,
-  5.93072701187316984827E3,
-  2.06209331660327847417E3,
-  2.42005740240291393179E2,
-};
-#endif
-#ifdef DEC
-static unsigned short QP[32] = {
-0136472,0035021,0142451,0141115,
-0140244,0024731,0150620,0105642,
-0141234,0067177,0124161,0060141,
-0141672,0064572,0151557,0043036,
-0142061,0127141,0003127,0043517,
-0142023,0011727,0060271,0144544,
-0141515,0122142,0126620,0143150,
-0140701,0115306,0106715,0007344,
-};
-static unsigned short QQ[28] = {
-/*0040200,0000000,0000000,0000000,*/
-0041600,0121272,0004741,0026544,
-0042526,0015605,0105654,0161771,
-0043162,0123155,0165644,0062645,
-0043342,0041675,0167576,0130756,
-0043271,0052720,0165631,0154214,
-0043000,0160576,0034614,0172024,
-0042162,0000570,0030500,0051235,
-};
-#endif
-#ifdef IBMPC
-static unsigned short QP[32] = {
-0x384a,0x38a5,0x4742,0xbf87,
-0x1174,0x3a32,0x853b,0xbff4,
-0x2c0c,0xf50e,0x8dcf,0xc033,
-0xe8c4,0x5a6d,0x4d2f,0xc057,
-0xe8ea,0x20ca,0x35cc,0xc066,
-0x392d,0xec17,0x627a,0xc062,
-0x18cd,0x55b2,0xb48c,0xc049,
-0xa1dd,0xd1b9,0x3358,0xc018,
-};
-static unsigned short QQ[28] = {
-/*0x0000,0x0000,0x0000,0x3ff0,*/
-0x25ac,0x413c,0x1457,0x4050,
-0x9c7f,0xb175,0xc370,0x408a,
-0x8cb5,0xbd74,0x54cd,0x40ae,
-0xd63e,0xbdef,0x4877,0x40bc,
-0x3b11,0x1d73,0x2aba,0x40b7,
-0x9e82,0xc731,0x1c2f,0x40a0,
-0x0a54,0x0628,0x402f,0x406e,
-};
-#endif
-#ifdef MIEEE
-static unsigned short QP[32] = {
-0xbf87,0x4742,0x38a5,0x384a,
-0xbff4,0x853b,0x3a32,0x1174,
-0xc033,0x8dcf,0xf50e,0x2c0c,
-0xc057,0x4d2f,0x5a6d,0xe8c4,
-0xc066,0x35cc,0x20ca,0xe8ea,
-0xc062,0x627a,0xec17,0x392d,
-0xc049,0xb48c,0x55b2,0x18cd,
-0xc018,0x3358,0xd1b9,0xa1dd,
-};
-static unsigned short QQ[28] = {
-/*0x3ff0,0x0000,0x0000,0x0000,*/
-0x4050,0x1457,0x413c,0x25ac,
-0x408a,0xc370,0xb175,0x9c7f,
-0x40ae,0x54cd,0xbd74,0x8cb5,
-0x40bc,0x4877,0xbdef,0xd63e,
-0x40b7,0x2aba,0x1d73,0x3b11,
-0x40a0,0x1c2f,0xc731,0x9e82,
-0x406e,0x402f,0x0628,0x0a54,
-};
-#endif
-
-
-#ifdef UNK
-static double YP[8] = {
- 1.55924367855235737965E4,
--1.46639295903971606143E7,
- 5.43526477051876500413E9,
--9.82136065717911466409E11,
- 8.75906394395366999549E13,
--3.46628303384729719441E15,
- 4.42733268572569800351E16,
--1.84950800436986690637E16,
-};
-static double YQ[7] = {
-/* 1.00000000000000000000E0,*/
- 1.04128353664259848412E3,
- 6.26107330137134956842E5,
- 2.68919633393814121987E8,
- 8.64002487103935000337E10,
- 2.02979612750105546709E13,
- 3.17157752842975028269E15,
- 2.50596256172653059228E17,
-};
-#endif
-#ifdef DEC
-static unsigned short YP[32] = {
-0043563,0120677,0042264,0046166,
-0146137,0140371,0113444,0042260,
-0050241,0175707,0100502,0063344,
-0152144,0125737,0007265,0164526,
-0053637,0051621,0163035,0060546,
-0155105,0004416,0107306,0060023,
-0056035,0045133,0030132,0000024,
-0155603,0065132,0144061,0131732,
-};
-static unsigned short YQ[28] = {
-/*0040200,0000000,0000000,0000000,*/
-0042602,0024422,0135557,0162663,
-0045030,0155665,0044075,0160135,
-0047200,0035432,0105446,0104005,
-0051240,0167331,0056063,0022743,
-0053223,0127746,0025764,0012160,
-0055064,0044206,0177532,0145545,
-0056536,0111375,0163715,0127201,
-};
-#endif
-#ifdef IBMPC
-static unsigned short YP[32] = {
-0x898f,0xe896,0x7437,0x40ce,
-0x8896,0x32e4,0xf81f,0xc16b,
-0x4cdd,0xf028,0x3f78,0x41f4,
-0xbd2b,0xe1d6,0x957b,0xc26c,
-0xac2d,0x3cc3,0xea72,0x42d3,
-0xcc02,0xd1d8,0xa121,0xc328,
-0x4003,0x660b,0xa94b,0x4363,
-0x367b,0x5906,0x6d4b,0xc350,
-};
-static unsigned short YQ[28] = {
-/*0x0000,0x0000,0x0000,0x3ff0,*/
-0xfcb6,0x576d,0x4522,0x4090,
-0xbc0c,0xa907,0x1b76,0x4123,
-0xd101,0x5164,0x0763,0x41b0,
-0x64bc,0x2b86,0x1ddb,0x4234,
-0x828e,0xc57e,0x75fc,0x42b2,
-0x596d,0xdfeb,0x8910,0x4326,
-0xb5d0,0xbcf9,0xd25f,0x438b,
-};
-#endif
-#ifdef MIEEE
-static unsigned short YP[32] = {
-0x40ce,0x7437,0xe896,0x898f,
-0xc16b,0xf81f,0x32e4,0x8896,
-0x41f4,0x3f78,0xf028,0x4cdd,
-0xc26c,0x957b,0xe1d6,0xbd2b,
-0x42d3,0xea72,0x3cc3,0xac2d,
-0xc328,0xa121,0xd1d8,0xcc02,
-0x4363,0xa94b,0x660b,0x4003,
-0xc350,0x6d4b,0x5906,0x367b,
-};
-static unsigned short YQ[28] = {
-/*0x3ff0,0x0000,0x0000,0x0000,*/
-0x4090,0x4522,0x576d,0xfcb6,
-0x4123,0x1b76,0xa907,0xbc0c,
-0x41b0,0x0763,0x5164,0xd101,
-0x4234,0x1ddb,0x2b86,0x64bc,
-0x42b2,0x75fc,0xc57e,0x828e,
-0x4326,0x8910,0xdfeb,0x596d,
-0x438b,0xd25f,0xbcf9,0xb5d0,
-};
-#endif
-
-#ifdef UNK
-/*  5.783185962946784521175995758455807035071 */
-static double DR1 = 5.78318596294678452118E0;
-/* 30.47126234366208639907816317502275584842 */
-static double DR2 = 3.04712623436620863991E1;
-#endif
-
-#ifdef DEC
-static unsigned short R1[] = {0040671,0007734,0001061,0056734};
-#define DR1 *(double *)R1
-static unsigned short R2[] = {0041363,0142445,0030416,0165567};
-#define DR2 *(double *)R2
-#endif
-
-#ifdef IBMPC
-static unsigned short R1[] = {0x2bbb,0x8046,0x21fb,0x4017};
-#define DR1 *(double *)R1
-static unsigned short R2[] = {0xdd6f,0xa621,0x78a4,0x403e};
-#define DR2 *(double *)R2
-#endif
-
-#ifdef MIEEE
-static unsigned short R1[] = {0x4017,0x21fb,0x8046,0x2bbb};
-#define DR1 *(double *)R1
-static unsigned short R2[] = {0x403e,0x78a4,0xa621,0xdd6f};
-#define DR2 *(double *)R2
-#endif
-
-#ifdef UNK
-static double RP[4] = {
--4.79443220978201773821E9,
- 1.95617491946556577543E12,
--2.49248344360967716204E14,
- 9.70862251047306323952E15,
-};
-static double RQ[8] = {
-/* 1.00000000000000000000E0,*/
- 4.99563147152651017219E2,
- 1.73785401676374683123E5,
- 4.84409658339962045305E7,
- 1.11855537045356834862E10,
- 2.11277520115489217587E12,
- 3.10518229857422583814E14,
- 3.18121955943204943306E16,
- 1.71086294081043136091E18,
-};
-#endif
-#ifdef DEC
-static unsigned short RP[16] = {
-0150216,0161235,0064344,0014450,
-0052343,0135216,0035624,0144153,
-0154142,0130247,0003310,0003667,
-0055411,0173703,0047772,0176635,
-};
-static unsigned short RQ[32] = {
-/*0040200,0000000,0000000,0000000,*/
-0042371,0144025,0032265,0136137,
-0044451,0133131,0132420,0151466,
-0046470,0144641,0072540,0030636,
-0050446,0126600,0045042,0044243,
-0052365,0172633,0110301,0071063,
-0054215,0032424,0062272,0043513,
-0055742,0005013,0171731,0072335,
-0057275,0170646,0036663,0013134,
-};
-#endif
-#ifdef IBMPC
-static unsigned short RP[16] = {
-0x8325,0xad1c,0xdc53,0xc1f1,
-0x990d,0xc772,0x7751,0x427c,
-0x00f7,0xe0d9,0x5614,0xc2ec,
-0x5fb4,0x69ff,0x3ef8,0x4341,
-};
-static unsigned short RQ[32] = {
-/*0x0000,0x0000,0x0000,0x3ff0,*/
-0xb78c,0xa696,0x3902,0x407f,
-0x1a67,0x36a2,0x36cb,0x4105,
-0x0634,0x2eac,0x1934,0x4187,
-0x4914,0x0944,0xd5b0,0x4204,
-0x2e46,0x7218,0xbeb3,0x427e,
-0x48e9,0x8c97,0xa6a2,0x42f1,
-0x2e9c,0x7e7b,0x4141,0x435c,
-0x62cc,0xc7b6,0xbe34,0x43b7,
-};
-#endif
-#ifdef MIEEE
-static unsigned short RP[16] = {
-0xc1f1,0xdc53,0xad1c,0x8325,
-0x427c,0x7751,0xc772,0x990d,
-0xc2ec,0x5614,0xe0d9,0x00f7,
-0x4341,0x3ef8,0x69ff,0x5fb4,
-};
-static unsigned short RQ[32] = {
-/*0x3ff0,0x0000,0x0000,0x0000,*/
-0x407f,0x3902,0xa696,0xb78c,
-0x4105,0x36cb,0x36a2,0x1a67,
-0x4187,0x1934,0x2eac,0x0634,
-0x4204,0xd5b0,0x0944,0x4914,
-0x427e,0xbeb3,0x7218,0x2e46,
-0x42f1,0xa6a2,0x8c97,0x48e9,
-0x435c,0x4141,0x7e7b,0x2e9c,
-0x43b7,0xbe34,0xc7b6,0x62cc,
-};
-#endif
-
-#ifdef ANSIPROT
-extern double polevl ( double, void *, int );
-extern double p1evl ( double, void *, int );
-extern double log ( double );
-extern double sin ( double );
-extern double cos ( double );
-extern double sqrt ( double );
-double j0 ( double );
-#else
-double polevl(), p1evl(), log(), sin(), cos(), sqrt();
-double j0();
-#endif
-extern double TWOOPI, SQ2OPI, PIO4;
-
-double j0(x)
-double x;
-{
-double w, z, p, q, xn;
-
-if( x < 0 )
-	x = -x;
-
-if( x <= 5.0 )
-	{
-	z = x * x;
-	if( x < 1.0e-5 )
-		return( 1.0 - z/4.0 );
-
-	p = (z - DR1) * (z - DR2);
-	p = p * polevl( z, RP, 3)/p1evl( z, RQ, 8 );
-	return( p );
-	}
-
-w = 5.0/x;
-q = 25.0/(x*x);
-p = polevl( q, PP, 6)/polevl( q, PQ, 6 );
-q = polevl( q, QP, 7)/p1evl( q, QQ, 7 );
-xn = x - PIO4;
-p = p * cos(xn) - w * q * sin(xn);
-return( p * SQ2OPI / sqrt(x) );
-}
-
-
-/*							y0() 2	*/
-/* Bessel function of second kind, order zero	*/
-
-/* Rational approximation coefficients YP[], YQ[] are used here.
- * The function computed is  y0(x)  -  2 * log(x) * j0(x) / PI,
- * whose value at x = 0 is  2 * ( log(0.5) + EUL ) / PI
- * = 0.073804295108687225.
- */
-
-/*
-#define PIO4 .78539816339744830962
-#define SQ2OPI .79788456080286535588
-*/
-extern double MAXNUM;
-
-double y0(x)
-double x;
-{
-double w, z, p, q, xn;
-
-if( x <= 5.0 )
-	{
-	if( x <= 0.0 )
-		{
-		mtherr( "y0", DOMAIN );
-		return( -MAXNUM );
-		}
-	z = x * x;
-	w = polevl( z, YP, 7) / p1evl( z, YQ, 7 );
-	w += TWOOPI * log(x) * j0(x);
-	return( w );
-	}
-
-w = 5.0/x;
-z = 25.0 / (x * x);
-p = polevl( z, PP, 6)/polevl( z, PQ, 6 );
-q = polevl( z, QP, 7)/p1evl( z, QQ, 7 );
-xn = x - PIO4;
-p = p * sin(xn) + w * q * cos(xn);
-return( p * SQ2OPI / sqrt(x) );
-}
Index: c/sas/models/c_extension/cephes/j1.c
===================================================================
--- src/sas/models/c_extension/cephes/j1.c	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,517 +1,0 @@
-/*							j1.c
- *
- *	Bessel function of order one
- *
- *
- *
- * SYNOPSIS:
- *
- * double x, y, j1();
- *
- * y = j1( x );
- *
- *
- *
- * DESCRIPTION:
- *
- * Returns Bessel function of order one of the argument.
- *
- * The domain is divided into the intervals [0, 8] and
- * (8, infinity). In the first interval a 24 term Chebyshev
- * expansion is used. In the second, the asymptotic
- * trigonometric representation is employed using two
- * rational functions of degree 5/5.
- *
- *
- *
- * ACCURACY:
- *
- *                      Absolute error:
- * arithmetic   domain      # trials      peak         rms
- *    DEC       0, 30       10000       4.0e-17     1.1e-17
- *    IEEE      0, 30       30000       2.6e-16     1.1e-16
- *
- *
- */
-
-/*							y1.c
- *
- *	Bessel function of second kind of order one
- *
- *
- *
- * SYNOPSIS:
- *
- * double x, y, y1();
- *
- * y = y1( x );
- *
- *
- *
- * DESCRIPTION:
- *
- * Returns Bessel function of the second kind of order one
- * of the argument.
- *
- * The domain is divided into the intervals [0, 8] and
- * (8, infinity). In the first interval a 25 term Chebyshev
- * expansion is used, and a call to j1() is required.
- * In the second, the asymptotic trigonometric representation
- * is employed using two rational functions of degree 5/5.
- *
- *
- *
- * ACCURACY:
- *
- *                      Absolute error:
- * arithmetic   domain      # trials      peak         rms
- *    DEC       0, 30       10000       8.6e-17     1.3e-17
- *    IEEE      0, 30       30000       1.0e-15     1.3e-16
- *
- * (error criterion relative when |y1| > 1).
- *
- */
-
-
-
-/*
-Cephes Math Library Release 2.8:  June, 2000
-Copyright 1984, 1987, 1989, 2000 by Stephen L. Moshier
-*/
-
-/*
-#define PIO4 .78539816339744830962
-#define THPIO4 2.35619449019234492885
-#define SQ2OPI .79788456080286535588
-*/
-
-#include "mconf.h"
-
-#ifdef UNK
-static double RP[4] = {
--8.99971225705559398224E8,
- 4.52228297998194034323E11,
--7.27494245221818276015E13,
- 3.68295732863852883286E15,
-};
-static double RQ[8] = {
-/* 1.00000000000000000000E0,*/
- 6.20836478118054335476E2,
- 2.56987256757748830383E5,
- 8.35146791431949253037E7,
- 2.21511595479792499675E10,
- 4.74914122079991414898E12,
- 7.84369607876235854894E14,
- 8.95222336184627338078E16,
- 5.32278620332680085395E18,
-};
-#endif
-#ifdef DEC
-static unsigned short RP[16] = {
-0147526,0110742,0063322,0077052,
-0051722,0112720,0065034,0061530,
-0153604,0052227,0033147,0105650,
-0055121,0055025,0032276,0022015,
-};
-static unsigned short RQ[32] = {
-/*0040200,0000000,0000000,0000000,*/
-0042433,0032610,0155604,0033473,
-0044572,0173320,0067270,0006616,
-0046637,0045246,0162225,0006606,
-0050645,0004773,0157577,0053004,
-0052612,0033734,0001667,0176501,
-0054462,0054121,0173147,0121367,
-0056237,0002777,0121451,0176007,
-0057623,0136253,0131601,0044710,
-};
-#endif
-#ifdef IBMPC
-static unsigned short RP[16] = {
-0x4fc5,0x4cda,0xd23c,0xc1ca,
-0x8c6b,0x0d43,0x52ba,0x425a,
-0xf175,0xe6cc,0x8a92,0xc2d0,
-0xc482,0xa697,0x2b42,0x432a,
-};
-static unsigned short RQ[32] = {
-/*0x0000,0x0000,0x0000,0x3ff0,*/
-0x86e7,0x1b70,0x66b1,0x4083,
-0x01b2,0x0dd7,0x5eda,0x410f,
-0xa1b1,0xdc92,0xe954,0x4193,
-0xeac1,0x7bef,0xa13f,0x4214,
-0xffa8,0x8076,0x46fb,0x4291,
-0xf45f,0x3ecc,0x4b0a,0x4306,
-0x3f81,0xf465,0xe0bf,0x4373,
-0x2939,0x7670,0x7795,0x43d2,
-};
-#endif
-#ifdef MIEEE
-static unsigned short RP[16] = {
-0xc1ca,0xd23c,0x4cda,0x4fc5,
-0x425a,0x52ba,0x0d43,0x8c6b,
-0xc2d0,0x8a92,0xe6cc,0xf175,
-0x432a,0x2b42,0xa697,0xc482,
-};
-static unsigned short RQ[32] = {
-/*0x3ff0,0x0000,0x0000,0x0000,*/
-0x4083,0x66b1,0x1b70,0x86e7,
-0x410f,0x5eda,0x0dd7,0x01b2,
-0x4193,0xe954,0xdc92,0xa1b1,
-0x4214,0xa13f,0x7bef,0xeac1,
-0x4291,0x46fb,0x8076,0xffa8,
-0x4306,0x4b0a,0x3ecc,0xf45f,
-0x4373,0xe0bf,0xf465,0x3f81,
-0x43d2,0x7795,0x7670,0x2939,
-};
-#endif
-
-#ifdef UNK
-static double PP[7] = {
- 7.62125616208173112003E-4,
- 7.31397056940917570436E-2,
- 1.12719608129684925192E0,
- 5.11207951146807644818E0,
- 8.42404590141772420927E0,
- 5.21451598682361504063E0,
- 1.00000000000000000254E0,
-};
-static double PQ[7] = {
- 5.71323128072548699714E-4,
- 6.88455908754495404082E-2,
- 1.10514232634061696926E0,
- 5.07386386128601488557E0,
- 8.39985554327604159757E0,
- 5.20982848682361821619E0,
- 9.99999999999999997461E-1,
-};
-#endif
-#ifdef DEC
-static unsigned short PP[28] = {
-0035507,0144542,0061543,0024326,
-0037225,0145105,0017766,0022661,
-0040220,0043766,0010254,0133255,
-0040643,0113047,0142611,0151521,
-0041006,0144344,0055351,0074261,
-0040646,0156520,0120574,0006416,
-0040200,0000000,0000000,0000000,
-};
-static unsigned short PQ[28] = {
-0035425,0142330,0115041,0165514,
-0037214,0177352,0145105,0052026,
-0040215,0072515,0141207,0073255,
-0040642,0056427,0137222,0106405,
-0041006,0062716,0166427,0165450,
-0040646,0133352,0035425,0123304,
-0040200,0000000,0000000,0000000,
-};
-#endif
-#ifdef IBMPC
-static unsigned short PP[28] = {
-0x651b,0x4c6c,0xf92c,0x3f48,
-0xc4b6,0xa3fe,0xb948,0x3fb2,
-0x96d6,0xc215,0x08fe,0x3ff2,
-0x3a6a,0xf8b1,0x72c4,0x4014,
-0x2f16,0x8b5d,0xd91c,0x4020,
-0x81a2,0x142f,0xdbaa,0x4014,
-0x0000,0x0000,0x0000,0x3ff0,
-};
-static unsigned short PQ[28] = {
-0x3d69,0x1344,0xb89b,0x3f42,
-0xaa83,0x5948,0x9fdd,0x3fb1,
-0xeed6,0xb850,0xaea9,0x3ff1,
-0x51a1,0xf7d2,0x4ba2,0x4014,
-0xfd65,0xdda2,0xccb9,0x4020,
-0xb4d9,0x4762,0xd6dd,0x4014,
-0x0000,0x0000,0x0000,0x3ff0,
-};
-#endif
-#ifdef MIEEE
-static unsigned short PP[28] = {
-0x3f48,0xf92c,0x4c6c,0x651b,
-0x3fb2,0xb948,0xa3fe,0xc4b6,
-0x3ff2,0x08fe,0xc215,0x96d6,
-0x4014,0x72c4,0xf8b1,0x3a6a,
-0x4020,0xd91c,0x8b5d,0x2f16,
-0x4014,0xdbaa,0x142f,0x81a2,
-0x3ff0,0x0000,0x0000,0x0000,
-};
-static unsigned short PQ[28] = {
-0x3f42,0xb89b,0x1344,0x3d69,
-0x3fb1,0x9fdd,0x5948,0xaa83,
-0x3ff1,0xaea9,0xb850,0xeed6,
-0x4014,0x4ba2,0xf7d2,0x51a1,
-0x4020,0xccb9,0xdda2,0xfd65,
-0x4014,0xd6dd,0x4762,0xb4d9,
-0x3ff0,0x0000,0x0000,0x0000,
-};
-#endif
-
-#ifdef UNK
-static double QP[8] = {
- 5.10862594750176621635E-2,
- 4.98213872951233449420E0,
- 7.58238284132545283818E1,
- 3.66779609360150777800E2,
- 7.10856304998926107277E2,
- 5.97489612400613639965E2,
- 2.11688757100572135698E2,
- 2.52070205858023719784E1,
-};
-static double QQ[7] = {
-/* 1.00000000000000000000E0,*/
- 7.42373277035675149943E1,
- 1.05644886038262816351E3,
- 4.98641058337653607651E3,
- 9.56231892404756170795E3,
- 7.99704160447350683650E3,
- 2.82619278517639096600E3,
- 3.36093607810698293419E2,
-};
-#endif
-#ifdef DEC
-static unsigned short QP[32] = {
-0037121,0037723,0055605,0151004,
-0040637,0066656,0031554,0077264,
-0041627,0122714,0153170,0161466,
-0042267,0061712,0036520,0140145,
-0042461,0133315,0131573,0071176,
-0042425,0057525,0147500,0013201,
-0042123,0130122,0061245,0154131,
-0041311,0123772,0064254,0172650,
-};
-static unsigned short QQ[28] = {
-/*0040200,0000000,0000000,0000000,*/
-0041624,0074603,0002112,0101670,
-0042604,0007135,0010162,0175565,
-0043233,0151510,0157757,0172010,
-0043425,0064506,0112006,0104276,
-0043371,0164125,0032271,0164242,
-0043060,0121425,0122750,0136013,
-0042250,0005773,0053472,0146267,
-};
-#endif
-#ifdef IBMPC
-static unsigned short QP[32] = {
-0xba40,0x6b70,0x27fa,0x3faa,
-0x8fd6,0xc66d,0xedb5,0x4013,
-0x1c67,0x9acf,0xf4b9,0x4052,
-0x180d,0x47aa,0xec79,0x4076,
-0x6e50,0xb66f,0x36d9,0x4086,
-0x02d0,0xb9e8,0xabea,0x4082,
-0xbb0b,0x4c54,0x760a,0x406a,
-0x9eb5,0x4d15,0x34ff,0x4039,
-};
-static unsigned short QQ[28] = {
-/*0x0000,0x0000,0x0000,0x3ff0,*/
-0x5077,0x6089,0x8f30,0x4052,
-0x5f6f,0xa20e,0x81cb,0x4090,
-0xfe81,0x1bfd,0x7a69,0x40b3,
-0xd118,0xd280,0xad28,0x40c2,
-0x3d14,0xa697,0x3d0a,0x40bf,
-0x1781,0xb4bd,0x1462,0x40a6,
-0x5997,0x6ae7,0x017f,0x4075,
-};
-#endif
-#ifdef MIEEE
-static unsigned short QP[32] = {
-0x3faa,0x27fa,0x6b70,0xba40,
-0x4013,0xedb5,0xc66d,0x8fd6,
-0x4052,0xf4b9,0x9acf,0x1c67,
-0x4076,0xec79,0x47aa,0x180d,
-0x4086,0x36d9,0xb66f,0x6e50,
-0x4082,0xabea,0xb9e8,0x02d0,
-0x406a,0x760a,0x4c54,0xbb0b,
-0x4039,0x34ff,0x4d15,0x9eb5,
-};
-static unsigned short QQ[28] = {
-/*0x3ff0,0x0000,0x0000,0x0000,*/
-0x4052,0x8f30,0x6089,0x5077,
-0x4090,0x81cb,0xa20e,0x5f6f,
-0x40b3,0x7a69,0x1bfd,0xfe81,
-0x40c2,0xad28,0xd280,0xd118,
-0x40bf,0x3d0a,0xa697,0x3d14,
-0x40a6,0x1462,0xb4bd,0x1781,
-0x4075,0x017f,0x6ae7,0x5997,
-};
-#endif
-
-#ifdef UNK
-static double YP[6] = {
- 1.26320474790178026440E9,
--6.47355876379160291031E11,
- 1.14509511541823727583E14,
--8.12770255501325109621E15,
- 2.02439475713594898196E17,
--7.78877196265950026825E17,
-};
-static double YQ[8] = {
-/* 1.00000000000000000000E0,*/
- 5.94301592346128195359E2,
- 2.35564092943068577943E5,
- 7.34811944459721705660E7,
- 1.87601316108706159478E10,
- 3.88231277496238566008E12,
- 6.20557727146953693363E14,
- 6.87141087355300489866E16,
- 3.97270608116560655612E18,
-};
-#endif
-#ifdef DEC
-static unsigned short YP[24] = {
-0047626,0112763,0013715,0133045,
-0152026,0134552,0142033,0024411,
-0053720,0045245,0102210,0077565,
-0155347,0000321,0136415,0102031,
-0056463,0146550,0055633,0032605,
-0157054,0171012,0167361,0054265,
-};
-static unsigned short YQ[32] = {
-/*0040200,0000000,0000000,0000000,*/
-0042424,0111515,0044773,0153014,
-0044546,0005405,0171307,0075774,
-0046614,0023575,0047105,0063556,
-0050613,0143034,0101533,0156026,
-0052541,0175367,0166514,0114257,
-0054415,0014466,0134350,0171154,
-0056164,0017436,0025075,0022101,
-0057534,0103614,0103663,0121772,
-};
-#endif
-#ifdef IBMPC
-static unsigned short YP[24] = {
-0xb6c5,0x62f9,0xd2be,0x41d2,
-0x6521,0x5883,0xd72d,0xc262,
-0x0fef,0xb091,0x0954,0x42da,
-0xb083,0x37a1,0xe01a,0xc33c,
-0x66b1,0x0b73,0x79ad,0x4386,
-0x2b17,0x5dde,0x9e41,0xc3a5,
-};
-static unsigned short YQ[32] = {
-/*0x0000,0x0000,0x0000,0x3ff0,*/
-0x7ac2,0xa93f,0x9269,0x4082,
-0xef7f,0xbe58,0xc160,0x410c,
-0xacee,0xa9c8,0x84ef,0x4191,
-0x7b83,0x906b,0x78c3,0x4211,
-0x9316,0xfda9,0x3f5e,0x428c,
-0x1e4e,0xd71d,0xa326,0x4301,
-0xa488,0xc547,0x83e3,0x436e,
-0x747f,0x90f6,0x90f1,0x43cb,
-};
-#endif
-#ifdef MIEEE
-static unsigned short YP[24] = {
-0x41d2,0xd2be,0x62f9,0xb6c5,
-0xc262,0xd72d,0x5883,0x6521,
-0x42da,0x0954,0xb091,0x0fef,
-0xc33c,0xe01a,0x37a1,0xb083,
-0x4386,0x79ad,0x0b73,0x66b1,
-0xc3a5,0x9e41,0x5dde,0x2b17,
-};
-static unsigned short YQ[32] = {
-/*0x3ff0,0x0000,0x0000,0x0000,*/
-0x4082,0x9269,0xa93f,0x7ac2,
-0x410c,0xc160,0xbe58,0xef7f,
-0x4191,0x84ef,0xa9c8,0xacee,
-0x4211,0x78c3,0x906b,0x7b83,
-0x428c,0x3f5e,0xfda9,0x9316,
-0x4301,0xa326,0xd71d,0x1e4e,
-0x436e,0x83e3,0xc547,0xa488,
-0x43cb,0x90f1,0x90f6,0x747f,
-};
-#endif
-
-
-#ifdef UNK
-static double Z1 = 1.46819706421238932572E1;
-static double Z2 = 4.92184563216946036703E1;
-#endif
-
-#ifdef DEC
-static unsigned short DZ1[] = {0041152,0164532,0006114,0010540};
-static unsigned short DZ2[] = {0041504,0157663,0001625,0020621};
-#define Z1 (*(double *)DZ1)
-#define Z2 (*(double *)DZ2)
-#endif
-
-#ifdef IBMPC
-static unsigned short DZ1[] = {0x822c,0x4189,0x5d2b,0x402d};
-static unsigned short DZ2[] = {0xa432,0x6072,0x9bf6,0x4048};
-#define Z1 (*(double *)DZ1)
-#define Z2 (*(double *)DZ2)
-#endif
-
-#ifdef MIEEE
-static unsigned short DZ1[] = {0x402d,0x5d2b,0x4189,0x822c};
-static unsigned short DZ2[] = {0x4048,0x9bf6,0x6072,0xa432};
-#define Z1 (*(double *)DZ1)
-#define Z2 (*(double *)DZ2)
-#endif
-
-#ifdef ANSIPROT
-extern double polevl ( double, void *, int );
-extern double p1evl ( double, void *, int );
-extern double log ( double );
-extern double sin ( double );
-extern double cos ( double );
-extern double sqrt ( double );
-double j1 ( double );
-#else
-double polevl(), p1evl(), log(), sin(), cos(), sqrt();
-double j1();
-#endif
-extern double TWOOPI, THPIO4, SQ2OPI;
-
-double j1(x)
-double x;
-{
-double w, z, p, q, xn;
-
-w = x;
-if( x < 0 )
-	w = -x;
-
-if( w <= 5.0 )
-	{
-	z = x * x;	
-	w = polevl( z, RP, 3 ) / p1evl( z, RQ, 8 );
-	w = w * x * (z - Z1) * (z - Z2);
-	return( w );
-	}
-
-w = 5.0/x;
-z = w * w;
-p = polevl( z, PP, 6)/polevl( z, PQ, 6 );
-q = polevl( z, QP, 7)/p1evl( z, QQ, 7 );
-xn = x - THPIO4;
-p = p * cos(xn) - w * q * sin(xn);
-return( p * SQ2OPI / sqrt(x) );
-}
-
-
-extern double MAXNUM;
-
-double y1(x)
-double x;
-{
-double w, z, p, q, xn;
-
-if( x <= 5.0 )
-	{
-	if( x <= 0.0 )
-		{
-		mtherr( "y1", DOMAIN );
-		return( -MAXNUM );
-		}
-	z = x * x;
-	w = x * (polevl( z, YP, 5 ) / p1evl( z, YQ, 8 ));
-	w += TWOOPI * ( j1(x) * log(x)  -  1.0/x );
-	return( w );
-	}
-
-w = 5.0/x;
-z = w * w;
-p = polevl( z, PP, 6)/polevl( z, PQ, 6 );
-q = polevl( z, QP, 7)/p1evl( z, QQ, 7 );
-xn = x - THPIO4;
-p = p * sin(xn) + w * q * cos(xn);
-return( p * SQ2OPI / sqrt(x) );
-}
Index: c/sas/models/c_extension/cephes/jn.c
===================================================================
--- src/sas/models/c_extension/cephes/jn.c	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,134 +1,0 @@
-/*							jn.c
- *
- *	Bessel function of integer order
- *
- *
- *
- * SYNOPSIS:
- *
- * int n;
- * double x, y, jn();
- *
- * y = jn( n, x );
- *
- *
- *
- * DESCRIPTION:
- *
- * Returns Bessel function of order n, where n is a
- * (possibly negative) integer.
- *
- * The ratio of jn(x) to j0(x) is computed by backward
- * recurrence.  First the ratio jn/jn-1 is found by a
- * continued fraction expansion.  Then the recurrence
- * relating successive orders is applied until j0 or j1 is
- * reached.
- *
- * If n = 0 or 1 the routine for j0 or j1 is called
- * directly.
- *
- *
- *
- * ACCURACY:
- *
- *                      Absolute error:
- * arithmetic   range      # trials      peak         rms
- *    DEC       0, 30        5500       6.9e-17     9.3e-18
- *    IEEE      0, 30        5000       4.4e-16     7.9e-17
- *
- *
- * Not suitable for large n or x. Use jv() instead.
- *
- */
-
-
-/*							jn.c
-Cephes Math Library Release 2.8:  June, 2000
-Copyright 1984, 1987, 2000 by Stephen L. Moshier
-*/
-#include "mconf.h"
-#ifdef ANSIPROT
-extern double fabs ( double );
-extern double j0 ( double );
-extern double j1 ( double );
-#else
-double fabs(), j0(), j1();
-#endif
-extern double MACHEP;
-
-double jn( n, x )
-int n;
-double x;
-{
-double pkm2, pkm1, pk, xk, r, ans;
-int k, sign;
-
-if( n < 0 )
-	{
-	n = -n;
-	if( (n & 1) == 0 )	/* -1**n */
-		sign = 1;
-	else
-		sign = -1;
-	}
-else
-	sign = 1;
-
-if( x < 0.0 )
-	{
-	if( n & 1 )
-		sign = -sign;
-	x = -x;
-	}
-
-if( n == 0 )
-	return( sign * j0(x) );
-if( n == 1 )
-	return( sign * j1(x) );
-if( n == 2 )
-	return( sign * (2.0 * j1(x) / x  -  j0(x)) );
-
-if( x < MACHEP )
-	return( 0.0 );
-
-/* continued fraction */
-#ifdef DEC
-k = 56;
-#else
-k = 53;
-#endif
-
-pk = 2 * (n + k);
-ans = pk;
-xk = x * x;
-
-do
-	{
-	pk -= 2.0;
-	ans = pk - (xk/ans);
-	}
-while( --k > 0 );
-ans = x/ans;
-
-/* backward recurrence */
-
-pk = 1.0;
-pkm1 = 1.0/ans;
-k = n-1;
-r = 2 * k;
-
-do
-	{
-	pkm2 = (pkm1 * r  -  pk * x) / x;
-	pk = pkm1;
-	pkm1 = pkm2;
-	r -= 2.0;
-	}
-while( --k > 0 );
-
-if( fabs(pk) > fabs(pkm1) )
-	ans = j1(x)/pk;
-else
-	ans = j0(x)/pkm1;
-return( sign * ans );
-}
Index: c/sas/models/c_extension/cephes/jv.c
===================================================================
--- src/sas/models/c_extension/cephes/jv.c	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,889 +1,0 @@
-/*							jv.c
- *
- *	Bessel function of noninteger order
- *
- *
- *
- * SYNOPSIS:
- *
- * double v, x, y, jv();
- *
- * y = jv( v, x );
- *
- *
- *
- * DESCRIPTION:
- *
- * Returns Bessel function of order v of the argument,
- * where v is real.  Negative x is allowed if v is an integer.
- *
- * Several expansions are included: the ascending power
- * series, the Hankel expansion, and two transitional
- * expansions for large v.  If v is not too large, it
- * is reduced by recurrence to a region of best accuracy.
- * The transitional expansions give 12D accuracy for v > 500.
- *
- *
- *
- * ACCURACY:
- * Results for integer v are indicated by *, where x and v
- * both vary from -125 to +125.  Otherwise,
- * x ranges from 0 to 125, v ranges as indicated by "domain."
- * Error criterion is absolute, except relative when |jv()| > 1.
- *
- * arithmetic  v domain  x domain    # trials      peak       rms
- *    IEEE      0,125     0,125      100000      4.6e-15    2.2e-16
- *    IEEE   -125,0       0,125       40000      5.4e-11    3.7e-13
- *    IEEE      0,500     0,500       20000      4.4e-15    4.0e-16
- * Integer v:
- *    IEEE   -125,125   -125,125      50000      3.5e-15*   1.9e-16*
- *
- */
-
-
-
-/*
-Cephes Math Library Release 2.8:  June, 2000
-Copyright 1984, 1987, 1989, 1992, 2000 by Stephen L. Moshier
-*/
-
-
-#include "mconf.h"
-#define DEBUG 0
-
-#ifdef DEC
-#define MAXGAM 34.84425627277176174
-#else
-#define MAXGAM 171.624376956302725
-#endif
-
-#ifdef ANSIPROT
-extern int airy ( double, double *, double *, double *, double * );
-extern double fabs ( double );
-extern double floor ( double );
-extern double frexp ( double, int * );
-extern double polevl ( double, void *, int );
-extern double j0 ( double );
-extern double j1 ( double );
-extern double sqrt ( double );
-extern double cbrt ( double );
-extern double exp ( double );
-extern double log ( double );
-extern double sin ( double );
-extern double cos ( double );
-extern double acos ( double );
-extern double pow ( double, double );
-extern double gamma ( double );
-extern double lgam ( double );
-static double recur(double *, double, double *, int);
-static double jvs(double, double);
-static double hankel(double, double);
-static double jnx(double, double);
-static double jnt(double, double);
-#else
-int airy();
-double fabs(), floor(), frexp(), polevl(), j0(), j1(), sqrt(), cbrt();
-double exp(), log(), sin(), cos(), acos(), pow(), gamma(), lgam();
-static double recur(), jvs(), hankel(), jnx(), jnt();
-#endif
-
-extern double MAXNUM, MACHEP, MINLOG, MAXLOG;
-#define BIG  1.44115188075855872E+17
-
-double jv( n, x )
-double n, x;
-{
-double k, q, t, y, an;
-int i, sign, nint;
-
-nint = 0;	/* Flag for integer n */
-sign = 1;	/* Flag for sign inversion */
-an = fabs( n );
-y = floor( an );
-if( y == an )
-	{
-	nint = 1;
-	i = an - 16384.0 * floor( an/16384.0 );
-	if( n < 0.0 )
-		{
-		if( i & 1 )
-			sign = -sign;
-		n = an;
-		}
-	if( x < 0.0 )
-		{
-		if( i & 1 )
-			sign = -sign;
-		x = -x;
-		}
-	if( n == 0.0 )
-		return( j0(x) );
-	if( n == 1.0 )
-		return( sign * j1(x) );
-	}
-
-if( (x < 0.0) && (y != an) )
-	{
-	mtherr( "Jv", DOMAIN );
-	y = 0.0;
-	goto done;
- 	}
-
-y = fabs(x);
-
-if( y < MACHEP )
-	goto underf;
-
-k = 3.6 * sqrt(y);
-t = 3.6 * sqrt(an);
-if( (y < t) && (an > 21.0) )
-	return( sign * jvs(n,x) );
-if( (an < k) && (y > 21.0) )
-	return( sign * hankel(n,x) );
-
-if( an < 500.0 )
-	{
-/* Note: if x is too large, the continued
- * fraction will fail; but then the
- * Hankel expansion can be used.
- */
-	if( nint != 0 )
-		{
-		k = 0.0;
-		q = recur( &n, x, &k, 1 );
-		if( k == 0.0 )
-			{
-			y = j0(x)/q;
-			goto done;
-			}
-		if( k == 1.0 )
-			{
-			y = j1(x)/q;
-			goto done;
-			}
-		}
-
-if( an > 2.0 * y )
-	goto rlarger;
-
-	if( (n >= 0.0) && (n < 20.0)
-		&& (y > 6.0) && (y < 20.0) )
-		{
-/* Recur backwards from a larger value of n
- */
-rlarger:
-		k = n;
-
-		y = y + an + 1.0;
-		if( y < 30.0 )
-			y = 30.0;
-		y = n + floor(y-n);
-		q = recur( &y, x, &k, 0 );
-		y = jvs(y,x) * q;
-		goto done;
-		}
-
-	if( k <= 30.0 )
-		{
-		k = 2.0;
-		}
-	else if( k < 90.0 )
-		{
-		k = (3*k)/4;
-		}
-	if( an > (k + 3.0) )
-		{
-		if( n < 0.0 )
-			k = -k;
-		q = n - floor(n);
-		k = floor(k) + q;
-		if( n > 0.0 )
-			q = recur( &n, x, &k, 1 );
-		else
-			{
-			t = k;
-			k = n;
-			q = recur( &t, x, &k, 1 );
-			k = t;
-			}
-		if( q == 0.0 )
-			{
-underf:
-			y = 0.0;
-			goto done;
-			}
-		}
-	else
-		{
-		k = n;
-		q = 1.0;
-		}
-
-/* boundary between convergence of
- * power series and Hankel expansion
- */
-	y = fabs(k);
-	if( y < 26.0 )
-		t = (0.0083*y + 0.09)*y + 12.9;
-	else
-		t = 0.9 * y;
-
-	if( x > t )
-		y = hankel(k,x);
-	else
-		y = jvs(k,x);
-#if DEBUG
-printf( "y = %.16e, recur q = %.16e\n", y, q );
-#endif
-	if( n > 0.0 )
-		y /= q;
-	else
-		y *= q;
-	}
-
-else
-	{
-/* For large n, use the uniform expansion
- * or the transitional expansion.
- * But if x is of the order of n**2,
- * these may blow up, whereas the
- * Hankel expansion will then work.
- */
-	if( n < 0.0 )
-		{
-		mtherr( "Jv", TLOSS );
-		y = 0.0;
-		goto done;
-		}
-	t = x/n;
-	t /= n;
-	if( t > 0.3 )
-		y = hankel(n,x);
-	else
-		y = jnx(n,x);
-	}
-
-done:	return( sign * y);
-}
-
-
-/* Reduce the order by backward recurrence.
- * AMS55 #9.1.27 and 9.1.73.
- */
-
-static double recur( n, x, newn, cancel )
-double *n;
-double x;
-double *newn;
-int cancel;
-{
-double pkm2, pkm1, pk, qkm2, qkm1;
-/* double pkp1; */
-double k, ans, qk, xk, yk, r, t, kf;
-static double big = BIG;
-int nflag, ctr;
-
-/* continued fraction for Jn(x)/Jn-1(x)  */
-if( *n < 0.0 )
-	nflag = 1;
-else
-	nflag = 0;
-
-fstart:
-
-#if DEBUG
-printf( "recur: n = %.6e, newn = %.6e, cfrac = ", *n, *newn );
-#endif
-
-pkm2 = 0.0;
-qkm2 = 1.0;
-pkm1 = x;
-qkm1 = *n + *n;
-xk = -x * x;
-yk = qkm1;
-ans = 1.0;
-ctr = 0;
-do
-	{
-	yk += 2.0;
-	pk = pkm1 * yk +  pkm2 * xk;
-	qk = qkm1 * yk +  qkm2 * xk;
-	pkm2 = pkm1;
-	pkm1 = pk;
-	qkm2 = qkm1;
-	qkm1 = qk;
-	if( qk != 0 )
-		r = pk/qk;
-	else
-		r = 0.0;
-	if( r != 0 )
-		{
-		t = fabs( (ans - r)/r );
-		ans = r;
-		}
-	else
-		t = 1.0;
-
-	if( ++ctr > 1000 )
-		{
-		mtherr( "jv", UNDERFLOW );
-		goto done;
-		}
-	if( t < MACHEP )
-		goto done;
-
-	if( fabs(pk) > big )
-		{
-		pkm2 /= big;
-		pkm1 /= big;
-		qkm2 /= big;
-		qkm1 /= big;
-		}
-	}
-while( t > MACHEP );
-
-done:
-
-#if DEBUG
-printf( "%.6e\n", ans );
-#endif
-
-/* Change n to n-1 if n < 0 and the continued fraction is small
- */
-if( nflag > 0 )
-	{
-	if( fabs(ans) < 0.125 )
-		{
-		nflag = -1;
-		*n = *n - 1.0;
-		goto fstart;
-		}
-	}
-
-
-kf = *newn;
-
-/* backward recurrence
- *              2k
- *  J   (x)  =  --- J (x)  -  J   (x)
- *   k-1         x   k         k+1
- */
-
-pk = 1.0;
-pkm1 = 1.0/ans;
-k = *n - 1.0;
-r = 2 * k;
-do
-	{
-	pkm2 = (pkm1 * r  -  pk * x) / x;
-	/*	pkp1 = pk; */
-	pk = pkm1;
-	pkm1 = pkm2;
-	r -= 2.0;
-/*
-	t = fabs(pkp1) + fabs(pk);
-	if( (k > (kf + 2.5)) && (fabs(pkm1) < 0.25*t) )
-		{
-		k -= 1.0;
-		t = x*x;
-		pkm2 = ( (r*(r+2.0)-t)*pk - r*x*pkp1 )/t;
-		pkp1 = pk;
-		pk = pkm1;
-		pkm1 = pkm2;
-		r -= 2.0;
-		}
-*/
-	k -= 1.0;
-	}
-while( k > (kf + 0.5) );
-
-/* Take the larger of the last two iterates
- * on the theory that it may have less cancellation error.
- */
-
-if( cancel )
-	{
-	if( (kf >= 0.0) && (fabs(pk) > fabs(pkm1)) )
-		{
-		k += 1.0;
-		pkm2 = pk;
-		}
-	}
-*newn = k;
-#if DEBUG
-printf( "newn %.6e rans %.6e\n", k, pkm2 );
-#endif
-return( pkm2 );
-}
-
-
-
-/* Ascending power series for Jv(x).
- * AMS55 #9.1.10.
- */
-
-extern double PI;
-extern int sgngam;
-
-static double jvs( n, x )
-double n, x;
-{
-double t, u, y, z, k;
-int ex;
-
-z = -x * x / 4.0;
-u = 1.0;
-y = u;
-k = 1.0;
-t = 1.0;
-
-while( t > MACHEP )
-	{
-	u *= z / (k * (n+k));
-	y += u;
-	k += 1.0;
-	if( y != 0 )
-		t = fabs( u/y );
-	}
-#if DEBUG
-printf( "power series=%.5e ", y );
-#endif
-t = frexp( 0.5*x, &ex );
-ex = ex * n;
-if(  (ex > -1023)
-  && (ex < 1023) 
-  && (n > 0.0)
-  && (n < (MAXGAM-1.0)) )
-	{
-	t = pow( 0.5*x, n ) / gamma( n + 1.0 );
-#if DEBUG
-printf( "pow(.5*x, %.4e)/gamma(n+1)=%.5e\n", n, t );
-#endif
-	y *= t;
-	}
-else
-	{
-#if DEBUG
-	z = n * log(0.5*x);
-	k = lgam( n+1.0 );
-	t = z - k;
-	printf( "log pow=%.5e, lgam(%.4e)=%.5e\n", z, n+1.0, k );
-#else
-	t = n * log(0.5*x) - lgam(n + 1.0);
-#endif
-	if( y < 0 )
-		{
-		sgngam = -sgngam;
-		y = -y;
-		}
-	t += log(y);
-#if DEBUG
-printf( "log y=%.5e\n", log(y) );
-#endif
-	if( t < -MAXLOG )
-		{
-		return( 0.0 );
-		}
-	if( t > MAXLOG )
-		{
-		mtherr( "Jv", OVERFLOW );
-		return( MAXNUM );
-		}
-	y = sgngam * exp( t );
-	}
-return(y);
-}
-
-
-/* Hankel's asymptotic expansion
- * for large x.
- * AMS55 #9.2.5.
- */
-
-static double hankel( n, x )
-double n, x;
-{
-double t, u, z, k, sign, conv;
-double p, q, j, m, pp, qq;
-int flag;
-
-m = 4.0*n*n;
-j = 1.0;
-z = 8.0 * x;
-k = 1.0;
-p = 1.0;
-u = (m - 1.0)/z;
-q = u;
-sign = 1.0;
-conv = 1.0;
-flag = 0;
-t = 1.0;
-pp = 1.0e38;
-qq = 1.0e38;
-
-while( t > MACHEP )
-	{
-	k += 2.0;
-	j += 1.0;
-	sign = -sign;
-	u *= (m - k * k)/(j * z);
-	p += sign * u;
-	k += 2.0;
-	j += 1.0;
-	u *= (m - k * k)/(j * z);
-	q += sign * u;
-	t = fabs(u/p);
-	if( t < conv )
-		{
-		conv = t;
-		qq = q;
-		pp = p;
-		flag = 1;
-		}
-/* stop if the terms start getting larger */
-	if( (flag != 0) && (t > conv) )
-		{
-#if DEBUG
-		printf( "Hankel: convergence to %.4E\n", conv );
-#endif
-		goto hank1;
-		}
-	}	
-
-hank1:
-u = x - (0.5*n + 0.25) * PI;
-t = sqrt( 2.0/(PI*x) ) * ( pp * cos(u) - qq * sin(u) );
-#if DEBUG
-printf( "hank: %.6e\n", t );
-#endif
-return( t );
-}
-
-
-
-/* Asymptotic expansion for large n.
- * AMS55 #9.3.35.
- */
-
-static double lambda[] = {
-  1.0,
-  1.041666666666666666666667E-1,
-  8.355034722222222222222222E-2,
-  1.282265745563271604938272E-1,
-  2.918490264641404642489712E-1,
-  8.816272674437576524187671E-1,
-  3.321408281862767544702647E+0,
-  1.499576298686255465867237E+1,
-  7.892301301158651813848139E+1,
-  4.744515388682643231611949E+2,
-  3.207490090890661934704328E+3
-};
-static double mu[] = {
-  1.0,
- -1.458333333333333333333333E-1,
- -9.874131944444444444444444E-2,
- -1.433120539158950617283951E-1,
- -3.172272026784135480967078E-1,
- -9.424291479571202491373028E-1,
- -3.511203040826354261542798E+0,
- -1.572726362036804512982712E+1,
- -8.228143909718594444224656E+1,
- -4.923553705236705240352022E+2,
- -3.316218568547972508762102E+3
-};
-static double P1[] = {
- -2.083333333333333333333333E-1,
-  1.250000000000000000000000E-1
-};
-static double P2[] = {
-  3.342013888888888888888889E-1,
- -4.010416666666666666666667E-1,
-  7.031250000000000000000000E-2
-};
-static double P3[] = {
- -1.025812596450617283950617E+0,
-  1.846462673611111111111111E+0,
- -8.912109375000000000000000E-1,
-  7.324218750000000000000000E-2
-};
-static double P4[] = {
-  4.669584423426247427983539E+0,
- -1.120700261622299382716049E+1,
-  8.789123535156250000000000E+0,
- -2.364086914062500000000000E+0,
-  1.121520996093750000000000E-1
-};
-static double P5[] = {
- -2.8212072558200244877E1,
-  8.4636217674600734632E1,
- -9.1818241543240017361E1,
-  4.2534998745388454861E1,
- -7.3687943594796316964E0,
-  2.27108001708984375E-1
-};
-static double P6[] = {
-  2.1257013003921712286E2,
- -7.6525246814118164230E2,
-  1.0599904525279998779E3,
- -6.9957962737613254123E2,
-  2.1819051174421159048E2,
- -2.6491430486951555525E1,
-  5.7250142097473144531E-1
-};
-static double P7[] = {
- -1.9194576623184069963E3,
-  8.0617221817373093845E3,
- -1.3586550006434137439E4,
-  1.1655393336864533248E4,
- -5.3056469786134031084E3,
-  1.2009029132163524628E3,
- -1.0809091978839465550E2,
-  1.7277275025844573975E0
-};
-
-
-static double jnx( n, x )
-double n, x;
-{
-double zeta, sqz, zz, zp, np;
-double cbn, n23, t, z, sz;
-double pp, qq, z32i, zzi;
-double ak, bk, akl, bkl;
-int sign, doa, dob, nflg, k, s, tk, tkp1, m;
-static double u[8];
-static double ai, aip, bi, bip;
-
-/* Test for x very close to n.
- * Use expansion for transition region if so.
- */
-cbn = cbrt(n);
-z = (x - n)/cbn;
-if( fabs(z) <= 0.7 )
-	return( jnt(n,x) );
-
-z = x/n;
-zz = 1.0 - z*z;
-if( zz == 0.0 )
-	return(0.0);
-
-if( zz > 0.0 )
-	{
-	sz = sqrt( zz );
-	t = 1.5 * (log( (1.0+sz)/z ) - sz );	/* zeta ** 3/2		*/
-	zeta = cbrt( t * t );
-	nflg = 1;
-	}
-else
-	{
-	sz = sqrt(-zz);
-	t = 1.5 * (sz - acos(1.0/z));
-	zeta = -cbrt( t * t );
-	nflg = -1;
-	}
-z32i = fabs(1.0/t);
-sqz = cbrt(t);
-
-/* Airy function */
-n23 = cbrt( n * n );
-t = n23 * zeta;
-
-#if DEBUG
-printf("zeta %.5E, Airy(%.5E)\n", zeta, t );
-#endif
-airy( t, &ai, &aip, &bi, &bip );
-
-/* polynomials in expansion */
-u[0] = 1.0;
-zzi = 1.0/zz;
-u[1] = polevl( zzi, P1, 1 )/sz;
-u[2] = polevl( zzi, P2, 2 )/zz;
-u[3] = polevl( zzi, P3, 3 )/(sz*zz);
-pp = zz*zz;
-u[4] = polevl( zzi, P4, 4 )/pp;
-u[5] = polevl( zzi, P5, 5 )/(pp*sz);
-pp *= zz;
-u[6] = polevl( zzi, P6, 6 )/pp;
-u[7] = polevl( zzi, P7, 7 )/(pp*sz);
-
-#if DEBUG
-for( k=0; k<=7; k++ )
-	printf( "u[%d] = %.5E\n", k, u[k] );
-#endif
-
-pp = 0.0;
-qq = 0.0;
-np = 1.0;
-/* flags to stop when terms get larger */
-doa = 1;
-dob = 1;
-akl = MAXNUM;
-bkl = MAXNUM;
-
-for( k=0; k<=3; k++ )
-	{
-	tk = 2 * k;
-	tkp1 = tk + 1;
-	zp = 1.0;
-	ak = 0.0;
-	bk = 0.0;
-	for( s=0; s<=tk; s++ )
-		{
-		if( doa )
-			{
-			if( (s & 3) > 1 )
-				sign = nflg;
-			else
-				sign = 1;
-			ak += sign * mu[s] * zp * u[tk-s];
-			}
-
-		if( dob )
-			{
-			m = tkp1 - s;
-			if( ((m+1) & 3) > 1 )
-				sign = nflg;
-			else
-				sign = 1;
-			bk += sign * lambda[s] * zp * u[m];
-			}
-		zp *= z32i;
-		}
-
-	if( doa )
-		{
-		ak *= np;
-		t = fabs(ak);
-		if( t < akl )
-			{
-			akl = t;
-			pp += ak;
-			}
-		else
-			doa = 0;
-		}
-
-	if( dob )
-		{
-		bk += lambda[tkp1] * zp * u[0];
-		bk *= -np/sqz;
-		t = fabs(bk);
-		if( t < bkl )
-			{
-			bkl = t;
-			qq += bk;
-			}
-		else
-			dob = 0;
-		}
-#if DEBUG
-	printf("a[%d] %.5E, b[%d] %.5E\n", k, ak, k, bk );
-#endif
-	if( np < MACHEP )
-		break;
-	np /= n*n;
-	}
-
-/* normalizing factor ( 4*zeta/(1 - z**2) )**1/4	*/
-t = 4.0 * zeta/zz;
-t = sqrt( sqrt(t) );
-
-t *= ai*pp/cbrt(n)  +  aip*qq/(n23*n);
-return(t);
-}
-
-
-/* Asymptotic expansion for transition region,
- * n large and x close to n.
- * AMS55 #9.3.23.
- */
-
-static double PF2[] = {
- -9.0000000000000000000e-2,
-  8.5714285714285714286e-2
-};
-static double PF3[] = {
-  1.3671428571428571429e-1,
- -5.4920634920634920635e-2,
- -4.4444444444444444444e-3
-};
-static double PF4[] = {
-  1.3500000000000000000e-3,
- -1.6036054421768707483e-1,
-  4.2590187590187590188e-2,
-  2.7330447330447330447e-3
-};
-static double PG1[] = {
- -2.4285714285714285714e-1,
-  1.4285714285714285714e-2
-};
-static double PG2[] = {
- -9.0000000000000000000e-3,
-  1.9396825396825396825e-1,
- -1.1746031746031746032e-2
-};
-static double PG3[] = {
-  1.9607142857142857143e-2,
- -1.5983694083694083694e-1,
-  6.3838383838383838384e-3
-};
-
-
-static double jnt( n, x )
-double n, x;
-{
-double z, zz, z3;
-double cbn, n23, cbtwo;
-double ai, aip, bi, bip;	/* Airy functions */
-double nk, fk, gk, pp, qq;
-double F[5], G[4];
-int k;
-
-cbn = cbrt(n);
-z = (x - n)/cbn;
-cbtwo = cbrt( 2.0 );
-
-/* Airy function */
-zz = -cbtwo * z;
-airy( zz, &ai, &aip, &bi, &bip );
-
-/* polynomials in expansion */
-zz = z * z;
-z3 = zz * z;
-F[0] = 1.0;
-F[1] = -z/5.0;
-F[2] = polevl( z3, PF2, 1 ) * zz;
-F[3] = polevl( z3, PF3, 2 );
-F[4] = polevl( z3, PF4, 3 ) * z;
-G[0] = 0.3 * zz;
-G[1] = polevl( z3, PG1, 1 );
-G[2] = polevl( z3, PG2, 2 ) * z;
-G[3] = polevl( z3, PG3, 2 ) * zz;
-#if DEBUG
-for( k=0; k<=4; k++ )
-	printf( "F[%d] = %.5E\n", k, F[k] );
-for( k=0; k<=3; k++ )
-	printf( "G[%d] = %.5E\n", k, G[k] );
-#endif
-pp = 0.0;
-qq = 0.0;
-nk = 1.0;
-n23 = cbrt( n * n );
-
-for( k=0; k<=4; k++ )
-	{
-	fk = F[k]*nk;
-	pp += fk;
-	if( k != 4 )
-		{
-		gk = G[k]*nk;
-		qq += gk;
-		}
-#if DEBUG
-	printf("fk[%d] %.5E, gk[%d] %.5E\n", k, fk, k, gk );
-#endif
-	nk /= n23;
-	}
-
-fk = cbtwo * ai * pp/cbn  +  cbrt(4.0) * aip * qq/n;
-return(fk);
-}
Index: c/sas/models/c_extension/cephes/k0.c
===================================================================
--- src/sas/models/c_extension/cephes/k0.c	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,335 +1,0 @@
-/*							k0.c
- *
- *	Modified Bessel function, third kind, order zero
- *
- *
- *
- * SYNOPSIS:
- *
- * double x, y, k0();
- *
- * y = k0( x );
- *
- *
- *
- * DESCRIPTION:
- *
- * Returns modified Bessel function of the third kind
- * of order zero of the argument.
- *
- * The range is partitioned into the two intervals [0,8] and
- * (8, infinity).  Chebyshev polynomial expansions are employed
- * in each interval.
- *
- *
- *
- * ACCURACY:
- *
- * Tested at 2000 random points between 0 and 8.  Peak absolute
- * error (relative when K0 > 1) was 1.46e-14; rms, 4.26e-15.
- *                      Relative error:
- * arithmetic   domain     # trials      peak         rms
- *    DEC       0, 30        3100       1.3e-16     2.1e-17
- *    IEEE      0, 30       30000       1.2e-15     1.6e-16
- *
- * ERROR MESSAGES:
- *
- *   message         condition      value returned
- *  K0 domain          x <= 0          MAXNUM
- *
- */
-
-/*							k0e()
- *
- *	Modified Bessel function, third kind, order zero,
- *	exponentially scaled
- *
- *
- *
- * SYNOPSIS:
- *
- * double x, y, k0e();
- *
- * y = k0e( x );
- *
- *
- *
- * DESCRIPTION:
- *
- * Returns exponentially scaled modified Bessel function
- * of the third kind of order zero of the argument.
- *
- *
- *
- * ACCURACY:
- *
- *                      Relative error:
- * arithmetic   domain     # trials      peak         rms
- *    IEEE      0, 30       30000       1.4e-15     1.4e-16
- * See k0().
- *
- */
-
-
-/*
-Cephes Math Library Release 2.8:  June, 2000
-Copyright 1984, 1987, 2000 by Stephen L. Moshier
-*/
-
-#include "mconf.h"
-
-/* Chebyshev coefficients for K0(x) + log(x/2) I0(x)
- * in the interval [0,2].  The odd order coefficients are all
- * zero; only the even order coefficients are listed.
- * 
- * lim(x->0){ K0(x) + log(x/2) I0(x) } = -EUL.
- */
-
-#ifdef UNK
-static double A[] =
-{
- 1.37446543561352307156E-16,
- 4.25981614279661018399E-14,
- 1.03496952576338420167E-11,
- 1.90451637722020886025E-9,
- 2.53479107902614945675E-7,
- 2.28621210311945178607E-5,
- 1.26461541144692592338E-3,
- 3.59799365153615016266E-2,
- 3.44289899924628486886E-1,
--5.35327393233902768720E-1
-};
-#endif
-
-#ifdef DEC
-static unsigned short A[] = {
-0023036,0073417,0032477,0165673,
-0025077,0154126,0016046,0012517,
-0027066,0011342,0035211,0005041,
-0031002,0160233,0037454,0050224,
-0032610,0012747,0037712,0173741,
-0034277,0144007,0172147,0162375,
-0035645,0140563,0125431,0165626,
-0037023,0057662,0125124,0102051,
-0037660,0043304,0004411,0166707,
-0140011,0005467,0047227,0130370
-};
-#endif
-
-#ifdef IBMPC
-static unsigned short A[] = {
-0xfd77,0xe6a7,0xcee1,0x3ca3,
-0xc2aa,0xc384,0xfb0a,0x3d27,
-0x2144,0x4751,0xc25c,0x3da6,
-0x8a13,0x67e5,0x5c13,0x3e20,
-0x5efc,0xe7f9,0x02bc,0x3e91,
-0xfca0,0xfe8c,0xf900,0x3ef7,
-0x3d73,0x7563,0xb82e,0x3f54,
-0x9085,0x554a,0x6bf6,0x3fa2,
-0x3db9,0x8121,0x08d8,0x3fd6,
-0xf61f,0xe9d2,0x2166,0xbfe1
-};
-#endif
-
-#ifdef MIEEE
-static unsigned short A[] = {
-0x3ca3,0xcee1,0xe6a7,0xfd77,
-0x3d27,0xfb0a,0xc384,0xc2aa,
-0x3da6,0xc25c,0x4751,0x2144,
-0x3e20,0x5c13,0x67e5,0x8a13,
-0x3e91,0x02bc,0xe7f9,0x5efc,
-0x3ef7,0xf900,0xfe8c,0xfca0,
-0x3f54,0xb82e,0x7563,0x3d73,
-0x3fa2,0x6bf6,0x554a,0x9085,
-0x3fd6,0x08d8,0x8121,0x3db9,
-0xbfe1,0x2166,0xe9d2,0xf61f
-};
-#endif
-
-
-
-/* Chebyshev coefficients for exp(x) sqrt(x) K0(x)
- * in the inverted interval [2,infinity].
- * 
- * lim(x->inf){ exp(x) sqrt(x) K0(x) } = sqrt(pi/2).
- */
-
-#ifdef UNK
-static double B[] = {
- 5.30043377268626276149E-18,
--1.64758043015242134646E-17,
- 5.21039150503902756861E-17,
--1.67823109680541210385E-16,
- 5.51205597852431940784E-16,
--1.84859337734377901440E-15,
- 6.34007647740507060557E-15,
--2.22751332699166985548E-14,
- 8.03289077536357521100E-14,
--2.98009692317273043925E-13,
- 1.14034058820847496303E-12,
--4.51459788337394416547E-12,
- 1.85594911495471785253E-11,
--7.95748924447710747776E-11,
- 3.57739728140030116597E-10,
--1.69753450938905987466E-9,
- 8.57403401741422608519E-9,
--4.66048989768794782956E-8,
- 2.76681363944501510342E-7,
--1.83175552271911948767E-6,
- 1.39498137188764993662E-5,
--1.28495495816278026384E-4,
- 1.56988388573005337491E-3,
--3.14481013119645005427E-2,
- 2.44030308206595545468E0
-};
-#endif
-
-#ifdef DEC
-static unsigned short B[] = {
-0021703,0106456,0076144,0173406,
-0122227,0173144,0116011,0030033,
-0022560,0044562,0006506,0067642,
-0123101,0076243,0123273,0131013,
-0023436,0157713,0056243,0141331,
-0124005,0032207,0063726,0164664,
-0024344,0066342,0051756,0162300,
-0124710,0121365,0154053,0077022,
-0025264,0161166,0066246,0077420,
-0125647,0141671,0006443,0103212,
-0026240,0076431,0077147,0160445,
-0126636,0153741,0174002,0105031,
-0027243,0040102,0035375,0163073,
-0127656,0176256,0113476,0044653,
-0030304,0125544,0006377,0130104,
-0130751,0047257,0110537,0127324,
-0031423,0046400,0014772,0012164,
-0132110,0025240,0155247,0112570,
-0032624,0105314,0007437,0021574,
-0133365,0155243,0174306,0116506,
-0034152,0004776,0061643,0102504,
-0135006,0136277,0036104,0175023,
-0035715,0142217,0162474,0115022,
-0137000,0147671,0065177,0134356,
-0040434,0026754,0175163,0044070
-};
-#endif
-
-#ifdef IBMPC
-static unsigned short B[] = {
-0x9ee1,0xcf8c,0x71a5,0x3c58,
-0x2603,0x9381,0xfecc,0xbc72,
-0xcdf4,0x41a8,0x092e,0x3c8e,
-0x7641,0x74d7,0x2f94,0xbca8,
-0x785b,0x6b94,0xdbf9,0x3cc3,
-0xdd36,0xecfa,0xa690,0xbce0,
-0xdc98,0x4a7d,0x8d9c,0x3cfc,
-0x6fc2,0xbb05,0x145e,0xbd19,
-0xcfe2,0xcd94,0x9c4e,0x3d36,
-0x70d1,0x21a4,0xf877,0xbd54,
-0xfc25,0x2fcc,0x0fa3,0x3d74,
-0x5143,0x3f00,0xdafc,0xbd93,
-0xbcc7,0x475f,0x6808,0x3db4,
-0xc935,0xd2e7,0xdf95,0xbdd5,
-0xf608,0x819f,0x956c,0x3df8,
-0xf5db,0xf22b,0x29d5,0xbe1d,
-0x428e,0x033f,0x69a0,0x3e42,
-0xf2af,0x1b54,0x0554,0xbe69,
-0xe46f,0x81e3,0x9159,0x3e92,
-0xd3a9,0x7f18,0xbb54,0xbebe,
-0x70a9,0xcc74,0x413f,0x3eed,
-0x9f42,0xe788,0xd797,0xbf20,
-0x9342,0xfca7,0xb891,0x3f59,
-0xf71e,0x2d4f,0x19f7,0xbfa0,
-0x6907,0x9f4e,0x85bd,0x4003
-};
-#endif
-
-#ifdef MIEEE
-static unsigned short B[] = {
-0x3c58,0x71a5,0xcf8c,0x9ee1,
-0xbc72,0xfecc,0x9381,0x2603,
-0x3c8e,0x092e,0x41a8,0xcdf4,
-0xbca8,0x2f94,0x74d7,0x7641,
-0x3cc3,0xdbf9,0x6b94,0x785b,
-0xbce0,0xa690,0xecfa,0xdd36,
-0x3cfc,0x8d9c,0x4a7d,0xdc98,
-0xbd19,0x145e,0xbb05,0x6fc2,
-0x3d36,0x9c4e,0xcd94,0xcfe2,
-0xbd54,0xf877,0x21a4,0x70d1,
-0x3d74,0x0fa3,0x2fcc,0xfc25,
-0xbd93,0xdafc,0x3f00,0x5143,
-0x3db4,0x6808,0x475f,0xbcc7,
-0xbdd5,0xdf95,0xd2e7,0xc935,
-0x3df8,0x956c,0x819f,0xf608,
-0xbe1d,0x29d5,0xf22b,0xf5db,
-0x3e42,0x69a0,0x033f,0x428e,
-0xbe69,0x0554,0x1b54,0xf2af,
-0x3e92,0x9159,0x81e3,0xe46f,
-0xbebe,0xbb54,0x7f18,0xd3a9,
-0x3eed,0x413f,0xcc74,0x70a9,
-0xbf20,0xd797,0xe788,0x9f42,
-0x3f59,0xb891,0xfca7,0x9342,
-0xbfa0,0x19f7,0x2d4f,0xf71e,
-0x4003,0x85bd,0x9f4e,0x6907
-};
-#endif
-
-/*							k0.c	*/
-#ifdef ANSIPROT 
-extern double chbevl ( double, void *, int );
-extern double exp ( double );
-extern double i0 ( double );
-extern double log ( double );
-extern double sqrt ( double );
-#else
-double chbevl(), exp(), i0(), log(), sqrt();
-#endif
-extern double PI;
-extern double MAXNUM;
-
-double k0(x)
-double x;
-{
-double y, z;
-
-if( x <= 0.0 )
-	{
-	mtherr( "k0", DOMAIN );
-	return( MAXNUM );
-	}
-
-if( x <= 2.0 )
-	{
-	y = x * x - 2.0;
-	y = chbevl( y, A, 10 ) - log( 0.5 * x ) * i0(x);
-	return( y );
-	}
-z = 8.0/x - 2.0;
-y = exp(-x) * chbevl( z, B, 25 ) / sqrt(x);
-return(y);
-}
-
-
-
-
-double k0e( x )
-double x;
-{
-double y;
-
-if( x <= 0.0 )
-	{
-	mtherr( "k0e", DOMAIN );
-	return( MAXNUM );
-	}
-
-if( x <= 2.0 )
-	{
-	y = x * x - 2.0;
-	y = chbevl( y, A, 10 ) - log( 0.5 * x ) * i0(x);
-	return( y * exp(x) );
-	}
-
-y = chbevl( 8.0/x - 2.0, B, 25 ) / sqrt(x);
-return(y);
-}
Index: c/sas/models/c_extension/cephes/k1.c
===================================================================
--- src/sas/models/c_extension/cephes/k1.c	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,337 +1,0 @@
-/*							k1.c
- *
- *	Modified Bessel function, third kind, order one
- *
- *
- *
- * SYNOPSIS:
- *
- * double x, y, k1();
- *
- * y = k1( x );
- *
- *
- *
- * DESCRIPTION:
- *
- * Computes the modified Bessel function of the third kind
- * of order one of the argument.
- *
- * The range is partitioned into the two intervals [0,2] and
- * (2, infinity).  Chebyshev polynomial expansions are employed
- * in each interval.
- *
- *
- *
- * ACCURACY:
- *
- *                      Relative error:
- * arithmetic   domain     # trials      peak         rms
- *    DEC       0, 30        3300       8.9e-17     2.2e-17
- *    IEEE      0, 30       30000       1.2e-15     1.6e-16
- *
- * ERROR MESSAGES:
- *
- *   message         condition      value returned
- * k1 domain          x <= 0          MAXNUM
- *
- */
-
-/*							k1e.c
- *
- *	Modified Bessel function, third kind, order one,
- *	exponentially scaled
- *
- *
- *
- * SYNOPSIS:
- *
- * double x, y, k1e();
- *
- * y = k1e( x );
- *
- *
- *
- * DESCRIPTION:
- *
- * Returns exponentially scaled modified Bessel function
- * of the third kind of order one of the argument:
- *
- *      k1e(x) = exp(x) * k1(x).
- *
- *
- *
- * ACCURACY:
- *
- *                      Relative error:
- * arithmetic   domain     # trials      peak         rms
- *    IEEE      0, 30       30000       7.8e-16     1.2e-16
- * See k1().
- *
- */
-
-
-/*
-Cephes Math Library Release 2.8:  June, 2000
-Copyright 1984, 1987, 2000 by Stephen L. Moshier
-*/
-
-#include "mconf.h"
-
-/* Chebyshev coefficients for x(K1(x) - log(x/2) I1(x))
- * in the interval [0,2].
- * 
- * lim(x->0){ x(K1(x) - log(x/2) I1(x)) } = 1.
- */
-
-#ifdef UNK
-static double A[] =
-{
--7.02386347938628759343E-18,
--2.42744985051936593393E-15,
--6.66690169419932900609E-13,
--1.41148839263352776110E-10,
--2.21338763073472585583E-8,
--2.43340614156596823496E-6,
--1.73028895751305206302E-4,
--6.97572385963986435018E-3,
--1.22611180822657148235E-1,
--3.53155960776544875667E-1,
- 1.52530022733894777053E0
-};
-#endif
-
-#ifdef DEC
-static unsigned short A[] = {
-0122001,0110501,0164746,0151255,
-0124056,0165213,0150034,0147377,
-0126073,0124026,0167207,0001044,
-0130033,0030735,0141061,0033116,
-0131676,0020350,0121341,0107175,
-0133443,0046631,0062031,0070716,
-0135065,0067427,0026435,0164022,
-0136344,0112234,0165752,0006222,
-0137373,0015622,0017016,0155636,
-0137664,0150333,0125730,0067240,
-0040303,0036411,0130200,0043120
-};
-#endif
-
-#ifdef IBMPC
-static unsigned short A[] = {
-0xda56,0x3d3c,0x3228,0xbc60,
-0x99e0,0x7a03,0xdd51,0xbce5,
-0xe045,0xddd0,0x7502,0xbd67,
-0x26ca,0xb846,0x663b,0xbde3,
-0x31d0,0x145c,0xc41d,0xbe57,
-0x2e3a,0x2c83,0x69b3,0xbec4,
-0xbd02,0xe5a3,0xade2,0xbf26,
-0x4192,0x9d7d,0x9293,0xbf7c,
-0xdb74,0x43c1,0x6372,0xbfbf,
-0x0dd4,0x757b,0x9a1b,0xbfd6,
-0x08ca,0x3610,0x67a1,0x3ff8
-};
-#endif
-
-#ifdef MIEEE
-static unsigned short A[] = {
-0xbc60,0x3228,0x3d3c,0xda56,
-0xbce5,0xdd51,0x7a03,0x99e0,
-0xbd67,0x7502,0xddd0,0xe045,
-0xbde3,0x663b,0xb846,0x26ca,
-0xbe57,0xc41d,0x145c,0x31d0,
-0xbec4,0x69b3,0x2c83,0x2e3a,
-0xbf26,0xade2,0xe5a3,0xbd02,
-0xbf7c,0x9293,0x9d7d,0x4192,
-0xbfbf,0x6372,0x43c1,0xdb74,
-0xbfd6,0x9a1b,0x757b,0x0dd4,
-0x3ff8,0x67a1,0x3610,0x08ca
-};
-#endif
-
-
-
-/* Chebyshev coefficients for exp(x) sqrt(x) K1(x)
- * in the interval [2,infinity].
- *
- * lim(x->inf){ exp(x) sqrt(x) K1(x) } = sqrt(pi/2).
- */
-
-#ifdef UNK
-static double B[] =
-{
--5.75674448366501715755E-18,
- 1.79405087314755922667E-17,
--5.68946255844285935196E-17,
- 1.83809354436663880070E-16,
--6.05704724837331885336E-16,
- 2.03870316562433424052E-15,
--7.01983709041831346144E-15,
- 2.47715442448130437068E-14,
--8.97670518232499435011E-14,
- 3.34841966607842919884E-13,
--1.28917396095102890680E-12,
- 5.13963967348173025100E-12,
--2.12996783842756842877E-11,
- 9.21831518760500529508E-11,
--4.19035475934189648750E-10,
- 2.01504975519703286596E-9,
--1.03457624656780970260E-8,
- 5.74108412545004946722E-8,
--3.50196060308781257119E-7,
- 2.40648494783721712015E-6,
--1.93619797416608296024E-5,
- 1.95215518471351631108E-4,
--2.85781685962277938680E-3,
- 1.03923736576817238437E-1,
- 2.72062619048444266945E0
-};
-#endif
-
-#ifdef DEC
-static unsigned short B[] = {
-0121724,0061352,0013041,0150076,
-0022245,0074324,0016172,0173232,
-0122603,0030250,0135670,0165221,
-0023123,0165362,0023561,0060124,
-0123456,0112436,0141654,0073623,
-0024022,0163557,0077564,0006753,
-0124374,0165221,0131014,0026524,
-0024737,0017512,0144250,0175451,
-0125312,0021456,0123136,0076633,
-0025674,0077720,0020125,0102607,
-0126265,0067543,0007744,0043701,
-0026664,0152702,0033002,0074202,
-0127273,0055234,0120016,0071733,
-0027712,0133200,0042441,0075515,
-0130346,0057000,0015456,0074470,
-0031012,0074441,0051636,0111155,
-0131461,0136444,0177417,0002101,
-0032166,0111743,0032176,0021410,
-0132674,0001224,0076555,0027060,
-0033441,0077430,0135226,0106663,
-0134242,0065610,0167155,0113447,
-0035114,0131304,0043664,0102163,
-0136073,0045065,0171465,0122123,
-0037324,0152767,0147401,0017732,
-0040456,0017275,0050061,0062120,
-};
-#endif
-
-#ifdef IBMPC
-static unsigned short B[] = {
-0x3a08,0x42c4,0x8c5d,0xbc5a,
-0x5ed3,0x838f,0xaf1a,0x3c74,
-0x1d52,0x1777,0x6615,0xbc90,
-0x2c0b,0x44ee,0x7d5e,0x3caa,
-0x8ef2,0xd875,0xd2a3,0xbcc5,
-0x81bd,0xefee,0x5ced,0x3ce2,
-0x85ab,0x3641,0x9d52,0xbcff,
-0x1f65,0x5915,0xe3e9,0x3d1b,
-0xcfb3,0xd4cb,0x4465,0xbd39,
-0xb0b1,0x040a,0x8ffa,0x3d57,
-0x88f8,0x61fc,0xadec,0xbd76,
-0x4f10,0x46c0,0x9ab8,0x3d96,
-0xce7b,0x9401,0x6b53,0xbdb7,
-0x2f6a,0x08a4,0x56d0,0x3dd9,
-0xcf27,0x0365,0xcbc0,0xbdfc,
-0xd24e,0x2a73,0x4f24,0x3e21,
-0xe088,0x9fe1,0x37a4,0xbe46,
-0xc461,0x668f,0xd27c,0x3e6e,
-0xa5c6,0x8fad,0x8052,0xbe97,
-0xd1b6,0x1752,0x2fe3,0x3ec4,
-0xb2e5,0x1dcd,0x4d71,0xbef4,
-0x908e,0x88f6,0x9658,0x3f29,
-0xb48a,0xbe66,0x6946,0xbf67,
-0x23fb,0xf9e0,0x9abe,0x3fba,
-0x2c8a,0xaa06,0xc3d7,0x4005
-};
-#endif
-
-#ifdef MIEEE
-static unsigned short B[] = {
-0xbc5a,0x8c5d,0x42c4,0x3a08,
-0x3c74,0xaf1a,0x838f,0x5ed3,
-0xbc90,0x6615,0x1777,0x1d52,
-0x3caa,0x7d5e,0x44ee,0x2c0b,
-0xbcc5,0xd2a3,0xd875,0x8ef2,
-0x3ce2,0x5ced,0xefee,0x81bd,
-0xbcff,0x9d52,0x3641,0x85ab,
-0x3d1b,0xe3e9,0x5915,0x1f65,
-0xbd39,0x4465,0xd4cb,0xcfb3,
-0x3d57,0x8ffa,0x040a,0xb0b1,
-0xbd76,0xadec,0x61fc,0x88f8,
-0x3d96,0x9ab8,0x46c0,0x4f10,
-0xbdb7,0x6b53,0x9401,0xce7b,
-0x3dd9,0x56d0,0x08a4,0x2f6a,
-0xbdfc,0xcbc0,0x0365,0xcf27,
-0x3e21,0x4f24,0x2a73,0xd24e,
-0xbe46,0x37a4,0x9fe1,0xe088,
-0x3e6e,0xd27c,0x668f,0xc461,
-0xbe97,0x8052,0x8fad,0xa5c6,
-0x3ec4,0x2fe3,0x1752,0xd1b6,
-0xbef4,0x4d71,0x1dcd,0xb2e5,
-0x3f29,0x9658,0x88f6,0x908e,
-0xbf67,0x6946,0xbe66,0xb48a,
-0x3fba,0x9abe,0xf9e0,0x23fb,
-0x4005,0xc3d7,0xaa06,0x2c8a
-};
-#endif
-
-#ifdef ANSIPROT
-extern double chbevl ( double, void *, int );
-extern double exp ( double );
-extern double i1 ( double );
-extern double log ( double );
-extern double sqrt ( double );
-#else
-double chbevl(), exp(), i1(), log(), sqrt();
-#endif
-extern double PI;
-extern double MINLOG, MAXNUM;
-
-double k1(x)
-double x;
-{
-double y, z;
-
-z = 0.5 * x;
-if( z <= 0.0 )
-	{
-	mtherr( "k1", DOMAIN );
-	return( MAXNUM );
-	}
-
-if( x <= 2.0 )
-	{
-	y = x * x - 2.0;
-	y =  log(z) * i1(x)  +  chbevl( y, A, 11 ) / x;
-	return( y );
-	}
-
-return(  exp(-x) * chbevl( 8.0/x - 2.0, B, 25 ) / sqrt(x) );
-}
-
-
-
-
-double k1e( x )
-double x;
-{
-double y;
-
-if( x <= 0.0 )
-	{
-	mtherr( "k1e", DOMAIN );
-	return( MAXNUM );
-	}
-
-if( x <= 2.0 )
-	{
-	y = x * x - 2.0;
-	y =  log( 0.5 * x ) * i1(x)  +  chbevl( y, A, 11 ) / x;
-	return( y * exp(x) );
-	}
-
-return(  chbevl( 8.0/x - 2.0, B, 25 ) / sqrt(x) );
-}
Index: c/sas/models/c_extension/cephes/kn.c
===================================================================
--- src/sas/models/c_extension/cephes/kn.c	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,257 +1,0 @@
-/*							kn.c
- *
- *	Modified Bessel function, third kind, integer order
- *
- *
- *
- * SYNOPSIS:
- *
- * double x, y, kn();
- * int n;
- *
- * y = kn( n, x );
- *
- *
- *
- * DESCRIPTION:
- *
- * Returns modified Bessel function of the third kind
- * of order n of the argument.
- *
- * The range is partitioned into the two intervals [0,9.55] and
- * (9.55, infinity).  An ascending power series is used in the
- * low range, and an asymptotic expansion in the high range.
- *
- *
- *
- * ACCURACY:
- *
- *                      Relative error:
- * arithmetic   domain     # trials      peak         rms
- *    DEC       0,30         3000       1.3e-9      5.8e-11
- *    IEEE      0,30        90000       1.8e-8      3.0e-10
- *
- *  Error is high only near the crossover point x = 9.55
- * between the two expansions used.
- */
-
-
-
-/*
-Cephes Math Library Release 2.8:  June, 2000
-Copyright 1984, 1987, 1988, 2000 by Stephen L. Moshier
-*/
-
-
-/*
-Algorithm for Kn.
-                       n-1 
-                   -n   -  (n-k-1)!    2   k
-K (x)  =  0.5 (x/2)     >  -------- (-x /4)
- n                      -     k!
-                       k=0
-
-                    inf.                                   2   k
-       n         n   -                                   (x /4)
- + (-1)  0.5(x/2)    >  {p(k+1) + p(n+k+1) - 2log(x/2)} ---------
-                     -                                  k! (n+k)!
-                    k=0
-
-where  p(m) is the psi function: p(1) = -EUL and
-
-                      m-1
-                       -
-      p(m)  =  -EUL +  >  1/k
-                       -
-                      k=1
-
-For large x,
-                                         2        2     2
-                                      u-1     (u-1 )(u-3 )
-K (z)  =  sqrt(pi/2z) exp(-z) { 1 + ------- + ------------ + ...}
- v                                        1            2
-                                    1! (8z)     2! (8z)
-asymptotically, where
-
-           2
-    u = 4 v .
-
-*/
-
-
-#include "mconf.h"
-
-#define EUL 5.772156649015328606065e-1
-#define MAXFAC 31
-#ifdef ANSIPROT
-extern double fabs ( double );
-extern double exp ( double );
-extern double log ( double );
-extern double sqrt ( double );
-#else
-double fabs(), exp(), log(), sqrt();
-#endif
-extern double MACHEP, MAXNUM, MAXLOG, PI;
-
-double kn( nn, x )
-int nn;
-double x;
-{
-double k, kf, nk1f, nkf, zn, t, s, z0, z;
-double ans, fn, pn, pk, zmn, tlg, tox;
-int i, n;
-
-if( nn < 0 )
-	n = -nn;
-else
-	n = nn;
-
-if( n > MAXFAC )
-	{
-overf:
-	mtherr( "kn", OVERFLOW );
-	return( MAXNUM );
-	}
-
-if( x <= 0.0 )
-	{
-	if( x < 0.0 )
-		mtherr( "kn", DOMAIN );
-	else
-		mtherr( "kn", SING );
-	return( MAXNUM );
-	}
-
-
-if( x > 9.55 )
-	goto asymp;
-
-ans = 0.0;
-z0 = 0.25 * x * x;
-fn = 1.0;
-pn = 0.0;
-zmn = 1.0;
-tox = 2.0/x;
-
-if( n > 0 )
-	{
-	/* compute factorial of n and psi(n) */
-	pn = -EUL;
-	k = 1.0;
-	for( i=1; i<n; i++ )
-		{
-		pn += 1.0/k;
-		k += 1.0;
-		fn *= k;
-		}
-
-	zmn = tox;
-
-	if( n == 1 )
-		{
-		ans = 1.0/x;
-		}
-	else
-		{
-		nk1f = fn/n;
-		kf = 1.0;
-		s = nk1f;
-		z = -z0;
-		zn = 1.0;
-		for( i=1; i<n; i++ )
-			{
-			nk1f = nk1f/(n-i);
-			kf = kf * i;
-			zn *= z;
-			t = nk1f * zn / kf;
-			s += t;   
-			if( (MAXNUM - fabs(t)) < fabs(s) )
-				goto overf;
-			if( (tox > 1.0) && ((MAXNUM/tox) < zmn) )
-				goto overf;
-			zmn *= tox;
-			}
-		s *= 0.5;
-		t = fabs(s);
-		if( (zmn > 1.0) && ((MAXNUM/zmn) < t) )
-			goto overf;
-		if( (t > 1.0) && ((MAXNUM/t) < zmn) )
-			goto overf;
-		ans = s * zmn;
-		}
-	}
-
-
-tlg = 2.0 * log( 0.5 * x );
-pk = -EUL;
-if( n == 0 )
-	{
-	pn = pk;
-	t = 1.0;
-	}
-else
-	{
-	pn = pn + 1.0/n;
-	t = 1.0/fn;
-	}
-s = (pk+pn-tlg)*t;
-k = 1.0;
-do
-	{
-	t *= z0 / (k * (k+n));
-	pk += 1.0/k;
-	pn += 1.0/(k+n);
-	s += (pk+pn-tlg)*t;
-	k += 1.0;
-	}
-while( fabs(t/s) > MACHEP );
-
-s = 0.5 * s / zmn;
-if( n & 1 )
-	s = -s;
-ans += s;
-
-return(ans);
-
-
-
-/* Asymptotic expansion for Kn(x) */
-/* Converges to 1.4e-17 for x > 18.4 */
-
-asymp:
-
-if( x > MAXLOG )
-	{
-	mtherr( "kn", UNDERFLOW );
-	return(0.0);
-	}
-k = n;
-pn = 4.0 * k * k;
-pk = 1.0;
-z0 = 8.0 * x;
-fn = 1.0;
-t = 1.0;
-s = t;
-nkf = MAXNUM;
-i = 0;
-do
-	{
-	z = pn - pk * pk;
-	t = t * z /(fn * z0);
-	nk1f = fabs(t);
-	if( (i >= n) && (nk1f > nkf) )
-		{
-		goto adone;
-		}
-	nkf = nk1f;
-	s += t;
-	fn += 1.0;
-	pk += 2.0;
-	i += 1;
-	}
-while( fabs(t/s) > MACHEP );
-
-adone:
-ans = exp(-x) * sqrt( PI/(2.0*x) ) * s;
-return(ans);
-}
Index: c/sas/models/c_extension/cephes/kolmogorov.c
===================================================================
--- src/sas/models/c_extension/cephes/kolmogorov.c	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,243 +1,0 @@
-
-/* Re Kolmogorov statistics, here is Birnbaum and Tingey's formula for the
-   distribution of D+, the maximum of all positive deviations between a
-   theoretical distribution function P(x) and an empirical one Sn(x)
-   from n samples.
-
-     +
-    D  =         sup     [P(x) - S (x)]
-     n     -inf < x < inf         n
-
-
-                  [n(1-e)]
-        +            -                    v-1              n-v
-    Pr{D   > e} =    >    C    e (e + v/n)    (1 - e - v/n)
-        n            -   n v
-                    v=0
-
-    [n(1-e)] is the largest integer not exceeding n(1-e).
-    nCv is the number of combinations of n things taken v at a time.  */
-
-
-#include "mconf.h"
-#ifdef ANSIPROT
-extern double pow ( double, double );
-extern double floor ( double );
-extern double lgam ( double );
-extern double exp ( double );
-extern double sqrt ( double );
-extern double log ( double );
-extern double fabs ( double );
-double smirnov ( int, double );
-double kolmogorov ( double );
-#else
-double pow (), floor (), lgam (), exp (), sqrt (), log (), fabs ();
-double smirnov (), kolmogorov ();
-#endif
-extern double MAXLOG;
-
-/* Exact Smirnov statistic, for one-sided test.  */
-double
-smirnov (n, e)
-     int n;
-     double e;
-{
-  int v, nn;
-  double evn, omevn, p, t, c, lgamnp1;
-
-  if (n <= 0 || e < 0.0 || e > 1.0)
-    return (-1.0);
-  nn = floor ((double) n * (1.0 - e));
-  p = 0.0;
-  if (n < 1013)
-    {
-      c = 1.0;
-      for (v = 0; v <= nn; v++)
-	{
-	  evn = e + ((double) v) / n;
-	  p += c * pow (evn, (double) (v - 1))
-	    * pow (1.0 - evn, (double) (n - v));
-	  /* Next combinatorial term; worst case error = 4e-15.  */
-	  c *= ((double) (n - v)) / (v + 1);
-	}
-    }
-  else
-    {
-      lgamnp1 = lgam ((double) (n + 1));
-      for (v = 0; v <= nn; v++)
-	{
-	  evn = e + ((double) v) / n;
-	  omevn = 1.0 - evn;
-	  if (fabs (omevn) > 0.0)
-	    {
-	      t = lgamnp1
-		- lgam ((double) (v + 1))
-		- lgam ((double) (n - v + 1))
-		+ (v - 1) * log (evn)
-		+ (n - v) * log (omevn);
-	      if (t > -MAXLOG)
-		p += exp (t);
-	    }
-	}
-    }
-  return (p * e);
-}
-
-
-/* Kolmogorov's limiting distribution of two-sided test, returns
-   probability that sqrt(n) * max deviation > y,
-   or that max deviation > y/sqrt(n).
-   The approximation is useful for the tail of the distribution
-   when n is large.  */
-double
-kolmogorov (y)
-     double y;
-{
-  double p, t, r, sign, x;
-
-  x = -2.0 * y * y;
-  sign = 1.0;
-  p = 0.0;
-  r = 1.0;
-  do
-    {
-      t = exp (x * r * r);
-      p += sign * t;
-      if (t == 0.0)
-	break;
-      r += 1.0;
-      sign = -sign;
-    }
-  while ((t / p) > 1.1e-16);
-  return (p + p);
-}
-
-/* Functional inverse of Smirnov distribution
-   finds e such that smirnov(n,e) = p.  */
-double
-smirnovi (n, p)
-     int n;
-     double p;
-{
-  double e, t, dpde;
-
-  if (p <= 0.0 || p > 1.0)
-    {
-      mtherr ("smirnovi", DOMAIN);
-      return 0.0;
-    }
-  /* Start with approximation p = exp(-2 n e^2).  */
-  e = sqrt (-log (p) / (2.0 * n));
-  do
-    {
-      /* Use approximate derivative in Newton iteration. */
-      t = -2.0 * n * e;
-      dpde = 2.0 * t * exp (t * e);
-      if (fabs (dpde) > 0.0)
-	t = (p - smirnov (n, e)) / dpde;
-      else
-	{
-	  mtherr ("smirnovi", UNDERFLOW);
-	  return 0.0;
-	}
-      e = e + t;
-      if (e >= 1.0 || e <= 0.0)
-	{
-	  mtherr ("smirnovi", OVERFLOW);
-	  return 0.0;
-	}
-    }
-  while (fabs (t / e) > 1e-10);
-  return (e);
-}
-
-
-/* Functional inverse of Kolmogorov statistic for two-sided test.
-   Finds y such that kolmogorov(y) = p.
-   If e = smirnovi (n,p), then kolmogi(2 * p) / sqrt(n) should
-   be close to e.  */
-double
-kolmogi (p)
-     double p;
-{
-  double y, t, dpdy;
-
-  if (p <= 0.0 || p > 1.0)
-    {
-      mtherr ("kolmogi", DOMAIN);
-      return 0.0;
-    }
-  /* Start with approximation p = 2 exp(-2 y^2).  */
-  y = sqrt (-0.5 * log (0.5 * p));
-  do
-    {
-      /* Use approximate derivative in Newton iteration. */
-      t = -2.0 * y;
-      dpdy = 4.0 * t * exp (t * y);
-      if (fabs (dpdy) > 0.0)
-	t = (p - kolmogorov (y)) / dpdy;
-      else
-	{
-	  mtherr ("kolmogi", UNDERFLOW);
-	  return 0.0;
-	}
-      y = y + t;
-    }
-  while (fabs (t / y) > 1e-10);
-  return (y);
-}
-
-
-#ifdef SALONE
-/* Type in a number.  */
-void
-getnum (s, px)
-     char *s;
-     double *px;
-{
-  char str[30];
-
-  printf (" %s (%.15e) ? ", s, *px);
-  gets (str);
-  if (str[0] == '\0' || str[0] == '\n')
-    return;
-  sscanf (str, "%lf", px);
-  printf ("%.15e\n", *px);
-}
-
-/* Type in values, get answers.  */
-void
-main ()
-{
-  int n;
-  double e, p, ps, pk, ek, y;
-
-  n = 5;
-  e = 0.0;
-  p = 0.1;
-loop:
-  ps = n;
-  getnum ("n", &ps);
-  n = ps;
-  if (n <= 0)
-    {
-      printf ("? Operator error.\n");
-      goto loop;
-    }
-  /*
-  getnum ("e", &e);
-  ps = smirnov (n, e);
-  y = sqrt ((double) n) * e;
-  printf ("y = %.4e\n", y);
-  pk = kolmogorov (y);
-  printf ("Smirnov = %.15e, Kolmogorov/2 = %.15e\n", ps, pk / 2.0);
-*/
-  getnum ("p", &p);
-  e = smirnovi (n, p);
-  printf ("Smirnov e = %.15e\n", e);
-  y = kolmogi (2.0 * p);
-  ek = y / sqrt ((double) n);
-  printf ("Kolmogorov e = %.15e\n", ek);
-  goto loop;
-}
-#endif
Index: c/sas/models/c_extension/cephes/mconf.h
===================================================================
--- src/sas/models/c_extension/cephes/mconf.h	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,200 +1,0 @@
-/*							mconf.h
- *
- *	Common include file for math routines
- *
- *
- *
- * SYNOPSIS:
- *
- * #include "mconf.h"
- *
- *
- *
- * DESCRIPTION:
- *
- * This file contains definitions for error codes that are
- * passed to the common error handling routine mtherr()
- * (which see).
- *
- * The file also includes a conditional assembly definition
- * for the type of computer arithmetic (IEEE, DEC, Motorola
- * IEEE, or UNKnown).
- * 
- * For Digital Equipment PDP-11 and VAX computers, certain
- * IBM systems, and others that use numbers with a 56-bit
- * significand, the symbol DEC should be defined.  In this
- * mode, most floating point constants are given as arrays
- * of octal integers to eliminate decimal to binary conversion
- * errors that might be introduced by the compiler.
- *
- * For little-endian computers, such as IBM PC, that follow the
- * IEEE Standard for Binary Floating Point Arithmetic (ANSI/IEEE
- * Std 754-1985), the symbol IBMPC should be defined.  These
- * numbers have 53-bit significands.  In this mode, constants
- * are provided as arrays of hexadecimal 16 bit integers.
- *
- * Big-endian IEEE format is denoted MIEEE.  On some RISC
- * systems such as Sun SPARC, double precision constants
- * must be stored on 8-byte address boundaries.  Since integer
- * arrays may be aligned differently, the MIEEE configuration
- * may fail on such machines.
- *
- * To accommodate other types of computer arithmetic, all
- * constants are also provided in a normal decimal radix
- * which one can hope are correctly converted to a suitable
- * format by the available C language compiler.  To invoke
- * this mode, define the symbol UNK.
- *
- * An important difference among these modes is a predefined
- * set of machine arithmetic constants for each.  The numbers
- * MACHEP (the machine roundoff error), MAXNUM (largest number
- * represented), and several other parameters are preset by
- * the configuration symbol.  Check the file const.c to
- * ensure that these values are correct for your computer.
- *
- * Configurations NANS, INFINITIES, MINUSZERO, and DENORMAL
- * may fail on many systems.  Verify that they are supposed
- * to work on your computer.
- */
-/*
-Cephes Math Library Release 2.3:  June, 1995
-Copyright 1984, 1987, 1989, 1995 by Stephen L. Moshier
-*/
-
-
-
-/* Define if the `long double' type works.  */
-#define HAVE_LONG_DOUBLE 1
-
-/* Define as the return type of signal handlers (int or void).  */
-#define RETSIGTYPE void
-
-/* Define if you have the ANSI C header files.  */
-#define STDC_HEADERS 1
-
-/* Define if your processor stores words with the most significant
-   byte first (like Motorola and SPARC, unlike Intel and VAX).  */
-/* #undef WORDS_BIGENDIAN */
-
-/* Define if floating point words are bigendian.  */
-/* #undef FLOAT_WORDS_BIGENDIAN */
-
-/* The number of bytes in a int.  */
-#define SIZEOF_INT 4
-
-/* Define if you have the <string.h> header file.  */
-#define HAVE_STRING_H 1
-
-/* Name of package */
-#define PACKAGE "cephes"
-
-/* Version number of package */
-#define VERSION "2.7"
-
-/* Constant definitions for math error conditions
- */
-
-#define DOMAIN		1	/* argument domain error */
-#define SING		2	/* argument singularity */
-#define OVERFLOW	3	/* overflow range error */
-#define UNDERFLOW	4	/* underflow range error */
-#define TLOSS		5	/* total loss of precision */
-#define PLOSS		6	/* partial loss of precision */
-
-#define EDOM		33
-#define ERANGE		34
-/* Complex numeral.  */
-typedef struct
-	{
-	double r;
-	double i;
-	} cmplx;
-
-#ifdef HAVE_LONG_DOUBLE
-/* Long double complex numeral.  */
-typedef struct
-	{
-	long double r;
-	long double i;
-	} cmplxl;
-#endif
-
-
-/* Type of computer arithmetic */
-
-/* PDP-11, Pro350, VAX:
- */
-/* #define DEC 1 */
-
-/* Intel IEEE, low order words come first:
- */
-/* #define IBMPC 1 */
-
-/* Motorola IEEE, high order words come first
- * (Sun 680x0 workstation):
- */
-/* #define MIEEE 1 */
-
-/* UNKnown arithmetic, invokes coefficients given in
- * normal decimal format.  Beware of range boundary
- * problems (MACHEP, MAXLOG, etc. in const.c) and
- * roundoff problems in pow.c:
- * (Sun SPARCstation)
- */
-#define UNK 1
-
-/* If you define UNK, then be sure to set BIGENDIAN properly. */
-#ifdef FLOAT_WORDS_BIGENDIAN
-#define BIGENDIAN 1
-#else
-#define BIGENDIAN 0
-#endif
-/* Define this `volatile' if your compiler thinks
- * that floating point arithmetic obeys the associative
- * and distributive laws.  It will defeat some optimizations
- * (but probably not enough of them).
- *
- * #define VOLATILE volatile
- */
-#define VOLATILE
-
-/* For 12-byte long doubles on an i386, pad a 16-bit short 0
- * to the end of real constants initialized by integer arrays.
- *
- * #define XPD 0,
- *
- * Otherwise, the type is 10 bytes long and XPD should be
- * defined blank (e.g., Microsoft C).
- *
- * #define XPD
- */
-#define XPD 0,
-
-/* Define to support tiny denormal numbers, else undefine. */
-#define DENORMAL 1
-
-/* Define to ask for infinity support, else undefine. */
-#define INFINITIES 1
-
-/* Define to ask for support of numbers that are Not-a-Number,
-   else undefine.  This may automatically define INFINITIES in some files. */
-#define NANS 1
-
-/* Define to distinguish between -0.0 and +0.0.  */
-#define MINUSZERO 1
-
-/* Define 1 for ANSI C atan2() function
-   See atan.c and clog.c. */
-#define ANSIC 1
-
-/* Get ANSI function prototypes, if you want them. */
-#if 1
-/* #ifdef __STDC__ */
-#define ANSIPROT 1
-int mtherr ( char *, int );
-#else
-int mtherr();
-#endif
-
-/* Variable for error reporting.  See mtherr.c.  */
-extern int merror;
Index: c/sas/models/c_extension/cephes/msc.mak
===================================================================
--- src/sas/models/c_extension/cephes/msc.mak	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,83 +1,0 @@
-# MSDOS Microsoft C makefile for probability integrals.
-# Be sure to disable the XPD pad for long double constants
-# and set the type of computer to IBMPC in mconf.h.
-#
-CC = cl
-
-CFLAGS = /c
-# For large memory model:
-#CFLAGS=/c /AL
-
-INCS = mconf.h
-
-OBJS = bdtr.obj btdtr.obj chdtr.obj const.obj drand.obj fdtr.obj \
-gamma.obj gdtr.obj igam.obj igami.obj incbet.obj incbi.obj \
-mtherr.obj nbdtr.obj ndtr.obj ndtri.obj pdtr.obj polevl.obj \
-stdtr.obj unity.obj
-
-bdtr.obj: bdtr.c $(INCS)
-	$(CC) $(CFLAGS) bdtr.c
-
-btdtr.obj: btdtr.c $(INCS)
-	$(CC) $(CFLAGS) btdtr.c
-
-chdtr.obj: chdtr.c $(INCS)
-	$(CC) $(CFLAGS) chdtr.c
-
-const.obj: const.c $(INCS)
-	$(CC) $(CFLAGS) const.c
-
-drand.obj: drand.c $(INCS)
-	$(CC) $(CFLAGS) drand.c
-
-expx2.obj: expx2.c $(INCS)
-	$(CC) $(CFLAGS) expx2.c
-
-fdtr.obj: fdtr.c $(INCS)
-	$(CC) $(CFLAGS) fdtr.c
-
-gamma.obj: gamma.c $(INCS)
-	$(CC) $(CFLAGS) gamma.c
-
-gdtr.obj: gdtr.c $(INCS)
-	$(CC) $(CFLAGS) gdtr.c
-
-igam.obj: igam.c $(INCS)
-	$(CC) $(CFLAGS) igam.c
-
-igami.obj: igami.c $(INCS)
-	$(CC) $(CFLAGS) igami.c
-
-incbet.obj: incbet.c $(INCS)
-	$(CC) $(CFLAGS) incbet.c
-
-incbi.obj: incbi.c $(INCS)
-	$(CC) $(CFLAGS) incbi.c
-
-mtherr.obj: mtherr.c $(INCS)
-	$(CC) $(CFLAGS) mtherr.c
-
-nbdtr.obj: nbdtr.c $(INCS)
-	$(CC) $(CFLAGS) nbdtr.c
-
-ndtr.obj: ndtr.c $(INCS)
-	$(CC) $(CFLAGS) ndtr.c
-
-ndtri.obj: ndtri.c $(INCS)
-	$(CC) $(CFLAGS) ndtri.c
-
-pdtr.obj: pdtr.c $(INCS)
-	$(CC) $(CFLAGS) pdtr.c
-
-polevl.obj: polevl.c $(INCS)
-	$(CC) $(CFLAGS) polevl.c
-
-stdtr.obj: stdtr.c $(INCS)
-	$(CC) $(CFLAGS) stdtr.c
-
-unity.obj: unity.c $(INCS)
-	$(CC) $(CFLAGS) unity.c
-
-# Delete the library file before attempting to rebuild it.
-prob.lib: $(OBJS)
-	lib @msc.rsp
Index: c/sas/models/c_extension/cephes/msc.rsp
===================================================================
--- src/sas/models/c_extension/cephes/msc.rsp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-prob
-y
-bdtr btdtr chdtr drand expx2 fdtr gamma gdtr igam igami incbet &
-incbi mtherr nbdtr ndtr ndtri pdtr stdtr unity polevl const
-prob.lst
-prob
Index: c/sas/models/c_extension/cephes/mtherr.c
===================================================================
--- src/sas/models/c_extension/cephes/mtherr.c	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,103 +1,0 @@
-/*							mtherr.c
- *
- *	Library common error handling routine
- *
- *
- *
- * SYNOPSIS:
- *
- * char *fctnam;
- * int code;
- * int mtherr();
- *
- * mtherr( fctnam, code );
- *
- *
- *
- * DESCRIPTION:
- *
- * This routine may be called to report one of the following
- * error conditions (in the include file mconf.h).
- *  
- *   Mnemonic        Value          Significance
- *
- *    DOMAIN            1       argument domain error
- *    SING              2       function singularity
- *    OVERFLOW          3       overflow range error
- *    UNDERFLOW         4       underflow range error
- *    TLOSS             5       total loss of precision
- *    PLOSS             6       partial loss of precision
- *    EDOM             33       Unix domain error code
- *    ERANGE           34       Unix range error code
- *
- * The default version of the file prints the function name,
- * passed to it by the pointer fctnam, followed by the
- * error condition.  The display is directed to the standard
- * output device.  The routine then returns to the calling
- * program.  Users may wish to modify the program to abort by
- * calling exit() under severe error conditions such as domain
- * errors.
- *
- * Since all error conditions pass control to this function,
- * the display may be easily changed, eliminated, or directed
- * to an error logging device.
- *
- * SEE ALSO:
- *
- * mconf.h
- *
- */
-
-
-/*
-Cephes Math Library Release 2.0:  April, 1987
-Copyright 1984, 1987 by Stephen L. Moshier
-Direct inquiries to 30 Frost Street, Cambridge, MA 02140
-*/
-
-#include <stdio.h>
-#include "mconf.h"
-
-int merror = 0;
-
-/* Notice: the order of appearance of the following
- * messages is bound to the error codes defined
- * in mconf.h.
- */
-static char *ermsg[7] = {
-"unknown",      /* error code 0 */
-"domain",       /* error code 1 */
-"singularity",  /* et seq.      */
-"overflow",
-"underflow",
-"total loss of precision",
-"partial loss of precision"
-};
-
-
-int mtherr( name, code )
-char *name;
-int code;
-{
-
-/* Display string passed by calling program,
- * which is supposed to be the name of the
- * function in which the error occurred:
- */
-printf( "\n%s ", name );
-
-/* Set global error message word */
-merror = code;
-
-/* Display error message defined
- * by the code argument.
- */
-if( (code <= 0) || (code >= 7) )
-	code = 0;
-printf( "%s error\n", ermsg[code] );
-
-/* Return to calling
- * program
- */
-return( 0 );
-}
Index: c/sas/models/c_extension/cephes/nbdtr.c
===================================================================
--- src/sas/models/c_extension/cephes/nbdtr.c	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,189 +1,0 @@
-/*							nbdtr.c
- *
- *	Negative binomial distribution
- *
- *
- *
- * SYNOPSIS:
- *
- * int k, n;
- * double p, y, nbdtr();
- *
- * y = nbdtr( k, n, p );
- *
- * DESCRIPTION:
- *
- * Returns the sum of the terms 0 through k of the negative
- * binomial distribution:
- *
- *   k
- *   --  ( n+j-1 )   n      j
- *   >   (       )  p  (1-p)
- *   --  (   j   )
- *  j=0
- *
- * In a sequence of Bernoulli trials, this is the probability
- * that k or fewer failures precede the nth success.
- *
- * The terms are not computed individually; instead the incomplete
- * beta integral is employed, according to the formula
- *
- * y = nbdtr( k, n, p ) = incbet( n, k+1, p ).
- *
- * The arguments must be positive, with p ranging from 0 to 1.
- *
- * ACCURACY:
- *
- * Tested at random points (a,b,p), with p between 0 and 1.
- *
- *               a,b                     Relative error:
- * arithmetic  domain     # trials      peak         rms
- *    IEEE     0,100       100000      1.7e-13     8.8e-15
- * See also incbet.c.
- *
- */
-
-/*							nbdtr.c
- *
- *	Complemented negative binomial distribution
- *
- *
- *
- * SYNOPSIS:
- *
- * int k, n;
- * double p, y, nbdtrc();
- *
- * y = nbdtrc( k, n, p );
- *
- * DESCRIPTION:
- *
- * Returns the sum of the terms k+1 to infinity of the negative
- * binomial distribution:
- *
- *   inf
- *   --  ( n+j-1 )   n      j
- *   >   (       )  p  (1-p)
- *   --  (   j   )
- *  j=k+1
- *
- * The terms are not computed individually; instead the incomplete
- * beta integral is employed, according to the formula
- *
- * y = nbdtrc( k, n, p ) = incbet( k+1, n, 1-p ).
- *
- * The arguments must be positive, with p ranging from 0 to 1.
- *
- * ACCURACY:
- *
- * Tested at random points (a,b,p), with p between 0 and 1.
- *
- *               a,b                     Relative error:
- * arithmetic  domain     # trials      peak         rms
- *    IEEE     0,100       100000      1.7e-13     8.8e-15
- * See also incbet.c.
- */
-
-/*							nbdtr.c
- *
- *	Functional inverse of negative binomial distribution
- *
- *
- *
- * SYNOPSIS:
- *
- * int k, n;
- * double p, y, nbdtri();
- *
- * p = nbdtri( k, n, y );
- *
- * DESCRIPTION:
- *
- * Finds the argument p such that nbdtr(k,n,p) is equal to y.
- *
- * ACCURACY:
- *
- * Tested at random points (a,b,y), with y between 0 and 1.
- *
- *               a,b                     Relative error:
- * arithmetic  domain     # trials      peak         rms
- *    IEEE     0,100       100000      1.5e-14     8.5e-16
- * See also incbi.c.
- */
-
-
-/*
-Cephes Math Library Release 2.8:  June, 2000
-Copyright 1984, 1987, 1995, 2000 by Stephen L. Moshier
-*/
-
-#include "mconf.h"
-#ifdef ANSIPROT
-extern double incbet ( double, double, double );
-extern double incbi ( double, double, double );
-#else
-double incbet(), incbi();
-#endif
-
-double nbdtrc( k, n, p )
-int k, n;
-double p;
-{
-double dk, dn;
-
-if( (p < 0.0) || (p > 1.0) )
-	goto domerr;
-if( k < 0 )
-	{
-domerr:
-	mtherr( "nbdtr", DOMAIN );
-	return( 0.0 );
-	}
-
-dk = k+1;
-dn = n;
-return( incbet( dk, dn, 1.0 - p ) );
-}
-
-
-
-double nbdtr( k, n, p )
-int k, n;
-double p;
-{
-double dk, dn;
-
-if( (p < 0.0) || (p > 1.0) )
-	goto domerr;
-if( k < 0 )
-	{
-domerr:
-	mtherr( "nbdtr", DOMAIN );
-	return( 0.0 );
-	}
-dk = k+1;
-dn = n;
-return( incbet( dn, dk, p ) );
-}
-
-
-
-double nbdtri( k, n, p )
-int k, n;
-double p;
-{
-double dk, dn, w;
-
-if( (p < 0.0) || (p > 1.0) )
-	goto domerr;
-if( k < 0 )
-	{
-domerr:
-	mtherr( "nbdtri", DOMAIN );
-	return( 0.0 );
-	}
-dk = k+1;
-dn = n;
-w = incbi( dn, dk, p );
-return( w );
-}
Index: c/sas/models/c_extension/cephes/ndtr.c
===================================================================
--- src/sas/models/c_extension/cephes/ndtr.c	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,527 +1,0 @@
-/*							ndtr.c
- *
- *	Normal distribution function
- *
- *
- *
- * SYNOPSIS:
- *
- * double x, y, ndtr();
- *
- * y = ndtr( x );
- *
- *
- *
- * DESCRIPTION:
- *
- * Returns the area under the Gaussian probability density
- * function, integrated from minus infinity to x:
- *
- *                            x
- *                             -
- *                   1        | |          2
- *    ndtr(x)  = ---------    |    exp( - t /2 ) dt
- *               sqrt(2pi)  | |
- *                           -
- *                          -inf.
- *
- *             =  ( 1 + erf(z) ) / 2
- *             =  erfc(z) / 2
- *
- * where z = x/sqrt(2). Computation is via the functions
- * erf and erfc with care to avoid error amplification in computing exp(-x^2).
- *
- *
- * ACCURACY:
- *
- *                      Relative error:
- * arithmetic   domain     # trials      peak         rms
- *    IEEE     -13,0        30000       1.3e-15     2.2e-16
- *
- *
- * ERROR MESSAGES:
- *
- *   message         condition         value returned
- * erfc underflow    x > 37.519379347       0.0
- *
- */
-
-/*							erf.c
- *
- *	Error function
- *
- *
- *
- * SYNOPSIS:
- *
- * double x, y, erf();
- *
- * y = erf( x );
- *
- *
- *
- * DESCRIPTION:
- *
- * The integral is
- *
- *                           x 
- *                            -
- *                 2         | |          2
- *   erf(x)  =  --------     |    exp( - t  ) dt.
- *              sqrt(pi)   | |
- *                          -
- *                           0
- *
- * The magnitude of x is limited to 9.231948545 for DEC
- * arithmetic; 1 or -1 is returned outside this range.
- *
- * For 0 <= |x| < 1, erf(x) = x * P4(x**2)/Q5(x**2); otherwise
- * erf(x) = 1 - erfc(x).
- *
- *
- *
- * ACCURACY:
- *
- *                      Relative error:
- * arithmetic   domain     # trials      peak         rms
- *    DEC       0,1         14000       4.7e-17     1.5e-17
- *    IEEE      0,1         30000       3.7e-16     1.0e-16
- *
- */
-
-/*							erfc.c
- *
- *	Complementary error function
- *
- *
- *
- * SYNOPSIS:
- *
- * double x, y, erfc();
- *
- * y = erfc( x );
- *
- *
- *
- * DESCRIPTION:
- *
- *
- *  1 - erf(x) =
- *
- *                           inf. 
- *                             -
- *                  2         | |          2
- *   erfc(x)  =  --------     |    exp( - t  ) dt
- *               sqrt(pi)   | |
- *                           -
- *                            x
- *
- *
- * For small x, erfc(x) = 1 - erf(x); otherwise rational
- * approximations are computed.
- *
- * A special function expx2.c is used to suppress error amplification
- * in computing exp(-x^2).
- *
- *
- * ACCURACY:
- *
- *                      Relative error:
- * arithmetic   domain     # trials      peak         rms
- *    IEEE      0,26.6417   30000       1.3e-15     2.2e-16
- *
- *
- * ERROR MESSAGES:
- *
- *   message         condition              value returned
- * erfc underflow    x > 9.231948545 (DEC)       0.0
- *
- *
- */
-
-
-
-/*
-Cephes Math Library Release 2.9:  November, 2000
-Copyright 1984, 1987, 1988, 1992, 2000 by Stephen L. Moshier
-*/
-
-
-#include "mconf.h"
-
-extern double SQRTH;
-extern double MAXLOG;
-
-/* Define this macro to suppress error propagation in exp(x^2)
-   by using the expx2 function.  The tradeoff is that doing so
-   generates two calls to the exponential function instead of one.  */
-#define USE_EXPXSQ 1
-
-#ifdef UNK
-static double P[] = {
- 2.46196981473530512524E-10,
- 5.64189564831068821977E-1,
- 7.46321056442269912687E0,
- 4.86371970985681366614E1,
- 1.96520832956077098242E2,
- 5.26445194995477358631E2,
- 9.34528527171957607540E2,
- 1.02755188689515710272E3,
- 5.57535335369399327526E2
-};
-static double Q[] = {
-/* 1.00000000000000000000E0,*/
- 1.32281951154744992508E1,
- 8.67072140885989742329E1,
- 3.54937778887819891062E2,
- 9.75708501743205489753E2,
- 1.82390916687909736289E3,
- 2.24633760818710981792E3,
- 1.65666309194161350182E3,
- 5.57535340817727675546E2
-};
-static double R[] = {
- 5.64189583547755073984E-1,
- 1.27536670759978104416E0,
- 5.01905042251180477414E0,
- 6.16021097993053585195E0,
- 7.40974269950448939160E0,
- 2.97886665372100240670E0
-};
-static double S[] = {
-/* 1.00000000000000000000E0,*/
- 2.26052863220117276590E0,
- 9.39603524938001434673E0,
- 1.20489539808096656605E1,
- 1.70814450747565897222E1,
- 9.60896809063285878198E0,
- 3.36907645100081516050E0
-};
-static double T[] = {
- 9.60497373987051638749E0,
- 9.00260197203842689217E1,
- 2.23200534594684319226E3,
- 7.00332514112805075473E3,
- 5.55923013010394962768E4
-};
-static double U[] = {
-/* 1.00000000000000000000E0,*/
- 3.35617141647503099647E1,
- 5.21357949780152679795E2,
- 4.59432382970980127987E3,
- 2.26290000613890934246E4,
- 4.92673942608635921086E4
-};
-
-#define UTHRESH 37.519379347
-#endif
-
-#ifdef DEC
-static unsigned short P[] = {
-0030207,0054445,0011173,0021706,
-0040020,0067272,0030661,0122075,
-0040756,0151236,0173053,0067042,
-0041502,0106175,0062555,0151457,
-0042104,0102525,0047401,0003667,
-0042403,0116176,0011446,0075303,
-0042551,0120723,0061641,0123275,
-0042600,0070651,0007264,0134516,
-0042413,0061102,0167507,0176625
-};
-static unsigned short Q[] = {
-/*0040200,0000000,0000000,0000000,*/
-0041123,0123257,0165741,0017142,
-0041655,0065027,0173413,0115450,
-0042261,0074011,0021573,0004150,
-0042563,0166530,0013662,0007200,
-0042743,0176427,0162443,0105214,
-0043014,0062546,0153727,0123772,
-0042717,0012470,0006227,0067424,
-0042413,0061103,0003042,0013254
-};
-static unsigned short R[] = {
-0040020,0067272,0101024,0155421,
-0040243,0037467,0056706,0026462,
-0040640,0116017,0120665,0034315,
-0040705,0020162,0143350,0060137,
-0040755,0016234,0134304,0130157,
-0040476,0122700,0051070,0015473
-};
-static unsigned short S[] = {
-/*0040200,0000000,0000000,0000000,*/
-0040420,0126200,0044276,0070413,
-0041026,0053051,0007302,0063746,
-0041100,0144203,0174051,0061151,
-0041210,0123314,0126343,0177646,
-0041031,0137125,0051431,0033011,
-0040527,0117362,0152661,0066201
-};
-static unsigned short T[] = {
-0041031,0126770,0170672,0166101,
-0041664,0006522,0072360,0031770,
-0043013,0100025,0162641,0126671,
-0043332,0155231,0161627,0076200,
-0044131,0024115,0021020,0117343
-};
-static unsigned short U[] = {
-/*0040200,0000000,0000000,0000000,*/
-0041406,0037461,0177575,0032714,
-0042402,0053350,0123061,0153557,
-0043217,0111227,0032007,0164217,
-0043660,0145000,0004013,0160114,
-0044100,0071544,0167107,0125471
-};
-#define UTHRESH 14.0
-#endif
-
-#ifdef IBMPC
-static unsigned short P[] = {
-0x6479,0xa24f,0xeb24,0x3df0,
-0x3488,0x4636,0x0dd7,0x3fe2,
-0x6dc4,0xdec5,0xda53,0x401d,
-0xba66,0xacad,0x518f,0x4048,
-0x20f7,0xa9e0,0x90aa,0x4068,
-0xcf58,0xc264,0x738f,0x4080,
-0x34d8,0x6c74,0x343a,0x408d,
-0x972a,0x21d6,0x0e35,0x4090,
-0xffb3,0x5de8,0x6c48,0x4081
-};
-static unsigned short Q[] = {
-/*0x0000,0x0000,0x0000,0x3ff0,*/
-0x23cc,0xfd7c,0x74d5,0x402a,
-0x7365,0xfee1,0xad42,0x4055,
-0x610d,0x246f,0x2f01,0x4076,
-0x41d0,0x02f6,0x7dab,0x408e,
-0x7151,0xfca4,0x7fa2,0x409c,
-0xf4ff,0xdafa,0x8cac,0x40a1,
-0xede2,0x0192,0xe2a7,0x4099,
-0x42d6,0x60c4,0x6c48,0x4081
-};
-static unsigned short R[] = {
-0x9b62,0x5042,0x0dd7,0x3fe2,
-0xc5a6,0xebb8,0x67e6,0x3ff4,
-0xa71a,0xf436,0x1381,0x4014,
-0x0c0c,0x58dd,0xa40e,0x4018,
-0x960e,0x9718,0xa393,0x401d,
-0x0367,0x0a47,0xd4b8,0x4007
-};
-static unsigned short S[] = {
-/*0x0000,0x0000,0x0000,0x3ff0,*/
-0xce21,0x0917,0x1590,0x4002,
-0x4cfd,0x21d8,0xcac5,0x4022,
-0x2c4d,0x7f05,0x1910,0x4028,
-0x7ff5,0x959c,0x14d9,0x4031,
-0x26c1,0xaa63,0x37ca,0x4023,
-0x2d90,0x5ab6,0xf3de,0x400a
-};
-static unsigned short T[] = {
-0x5d88,0x1e37,0x35bf,0x4023,
-0x067f,0x4e9e,0x81aa,0x4056,
-0x35b7,0xbcb4,0x7002,0x40a1,
-0xef90,0x3c72,0x5b53,0x40bb,
-0x13dc,0xa442,0x2509,0x40eb
-};
-static unsigned short U[] = {
-/*0x0000,0x0000,0x0000,0x3ff0,*/
-0xa6ba,0x3fef,0xc7e6,0x4040,
-0x3aee,0x14c6,0x4add,0x4080,
-0xfd12,0xe680,0xf252,0x40b1,
-0x7c0a,0x0101,0x1940,0x40d6,
-0xf567,0x9dc8,0x0e6c,0x40e8
-};
-#define UTHRESH 37.519379347
-#endif
-
-#ifdef MIEEE
-static unsigned short P[] = {
-0x3df0,0xeb24,0xa24f,0x6479,
-0x3fe2,0x0dd7,0x4636,0x3488,
-0x401d,0xda53,0xdec5,0x6dc4,
-0x4048,0x518f,0xacad,0xba66,
-0x4068,0x90aa,0xa9e0,0x20f7,
-0x4080,0x738f,0xc264,0xcf58,
-0x408d,0x343a,0x6c74,0x34d8,
-0x4090,0x0e35,0x21d6,0x972a,
-0x4081,0x6c48,0x5de8,0xffb3
-};
-static unsigned short Q[] = {
-0x402a,0x74d5,0xfd7c,0x23cc,
-0x4055,0xad42,0xfee1,0x7365,
-0x4076,0x2f01,0x246f,0x610d,
-0x408e,0x7dab,0x02f6,0x41d0,
-0x409c,0x7fa2,0xfca4,0x7151,
-0x40a1,0x8cac,0xdafa,0xf4ff,
-0x4099,0xe2a7,0x0192,0xede2,
-0x4081,0x6c48,0x60c4,0x42d6
-};
-static unsigned short R[] = {
-0x3fe2,0x0dd7,0x5042,0x9b62,
-0x3ff4,0x67e6,0xebb8,0xc5a6,
-0x4014,0x1381,0xf436,0xa71a,
-0x4018,0xa40e,0x58dd,0x0c0c,
-0x401d,0xa393,0x9718,0x960e,
-0x4007,0xd4b8,0x0a47,0x0367
-};
-static unsigned short S[] = {
-0x4002,0x1590,0x0917,0xce21,
-0x4022,0xcac5,0x21d8,0x4cfd,
-0x4028,0x1910,0x7f05,0x2c4d,
-0x4031,0x14d9,0x959c,0x7ff5,
-0x4023,0x37ca,0xaa63,0x26c1,
-0x400a,0xf3de,0x5ab6,0x2d90
-};
-static unsigned short T[] = {
-0x4023,0x35bf,0x1e37,0x5d88,
-0x4056,0x81aa,0x4e9e,0x067f,
-0x40a1,0x7002,0xbcb4,0x35b7,
-0x40bb,0x5b53,0x3c72,0xef90,
-0x40eb,0x2509,0xa442,0x13dc
-};
-static unsigned short U[] = {
-0x4040,0xc7e6,0x3fef,0xa6ba,
-0x4080,0x4add,0x14c6,0x3aee,
-0x40b1,0xf252,0xe680,0xfd12,
-0x40d6,0x1940,0x0101,0x7c0a,
-0x40e8,0x0e6c,0x9dc8,0xf567
-};
-#define UTHRESH 37.519379347
-#endif
-
-#ifdef ANSIPROT
-extern double polevl ( double, void *, int );
-extern double p1evl ( double, void *, int );
-extern double exp ( double );
-extern double log ( double );
-extern double fabs ( double );
-extern double sqrt ( double );
-extern double expx2 ( double, int );
-double erf ( double );
-double erfc ( double );
-static double erfce ( double );
-#else
-double polevl(), p1evl(), exp(), log(), fabs();
-double erf(), erfc(), expx2(), sqrt();
-static double erfce();
-#endif
-
-double ndtr(a)
-double a;
-{
-double x, y, z;
-
-x = a * SQRTH;
-z = fabs(x);
-
-/* if( z < SQRTH ) */
-if( z < 1.0 )
-	y = 0.5 + 0.5 * erf(x);
-
-else
-	{
-#ifdef USE_EXPXSQ
-	/* See below for erfce. */
-	y = 0.5 * erfce(z);
-	/* Multiply by exp(-x^2 / 2)  */
-	z = expx2(a, -1);
-	y = y * sqrt(z);
-#else
-	y = 0.5 * erfc(z);
-#endif
-	if( x > 0 )
-		y = 1.0 - y;
-	}
-
-return(y);
-}
-
-
-double erfc(a)
-double a;
-{
-double p,q,x,y,z;
-
-
-if( a < 0.0 )
-	x = -a;
-else
-	x = a;
-
-if( x < 1.0 )
-	return( 1.0 - erf(a) );
-
-z = -a * a;
-
-if( z < -MAXLOG )
-	{
-under:
-	mtherr( "erfc", UNDERFLOW );
-	if( a < 0 )
-		return( 2.0 );
-	else
-		return( 0.0 );
-	}
-
-#ifdef USE_EXPXSQ
-/* Compute z = exp(z).  */
-z = expx2(a, -1);
-#else
-z = exp(z);
-#endif
-if( x < 8.0 )
-	{
-	p = polevl( x, P, 8 );
-	q = p1evl( x, Q, 8 );
-	}
-else
-	{
-	p = polevl( x, R, 5 );
-	q = p1evl( x, S, 6 );
-	}
-y = (z * p)/q;
-
-if( a < 0 )
-	y = 2.0 - y;
-
-if( y == 0.0 )
-	goto under;
-
-return(y);
-}
-
-
-/* Exponentially scaled erfc function
-   exp(x^2) erfc(x)
-   valid for x > 1.
-   Use with ndtr and expx2.  */
-static double erfce(x)
-double x;
-{
-double p,q;
-
-if( x < 8.0 )
-	{
-	p = polevl( x, P, 8 );
-	q = p1evl( x, Q, 8 );
-	}
-else
-	{
-	p = polevl( x, R, 5 );
-	q = p1evl( x, S, 6 );
-	}
-return (p/q);
-}
-
-
-
-double erf(x)
-double x;
-{
-double y, z;
-
-if( fabs(x) > 1.0 )
-	return( 1.0 - erfc(x) );
-z = x * x;
-y = x * polevl( z, T, 4 ) / p1evl( z, U, 5 );
-return( y );
-
-}
Index: c/sas/models/c_extension/cephes/ndtri.c
===================================================================
--- src/sas/models/c_extension/cephes/ndtri.c	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,418 +1,0 @@
-/*							ndtri.c
- *
- *	Inverse of Normal distribution function
- *
- *
- *
- * SYNOPSIS:
- *
- * double x, y, ndtri();
- *
- * x = ndtri( y );
- *
- *
- *
- * DESCRIPTION:
- *
- * Returns the argument, x, for which the area under the
- * Gaussian probability density function (integrated from
- * minus infinity to x) is equal to y.
- *
- *
- * For small arguments 0 < y < exp(-2), the program computes
- * z = sqrt( -2.0 * log(y) );  then the approximation is
- * x = z - log(z)/z  - (1/z) P(1/z) / Q(1/z).
- * There are two rational functions P/Q, one for 0 < y < exp(-32)
- * and the other for y up to exp(-2).  For larger arguments,
- * w = y - 0.5, and  x/sqrt(2pi) = w + w**3 R(w**2)/S(w**2)).
- *
- *
- * ACCURACY:
- *
- *                      Relative error:
- * arithmetic   domain        # trials      peak         rms
- *    DEC      0.125, 1         5500       9.5e-17     2.1e-17
- *    DEC      6e-39, 0.135     3500       5.7e-17     1.3e-17
- *    IEEE     0.125, 1        20000       7.2e-16     1.3e-16
- *    IEEE     3e-308, 0.135   50000       4.6e-16     9.8e-17
- *
- *
- * ERROR MESSAGES:
- *
- *   message         condition    value returned
- * ndtri domain       x <= 0        -MAXNUM
- * ndtri domain       x >= 1         MAXNUM
- *
- */
-
-
-
-/*
-Cephes Math Library Release 2.8:  June, 2000
-Copyright 1984, 1987, 1989, 2000 by Stephen L. Moshier
-*/
-
-#include "mconf.h"
-extern double MAXNUM;
-
-#ifdef UNK
-/* sqrt(2pi) */
-static double s2pi = 2.50662827463100050242E0;
-#endif
-
-#ifdef DEC
-static unsigned short s2p[] = {0040440,0066230,0177661,0034055};
-#define s2pi *(double *)s2p
-#endif
-
-#ifdef IBMPC
-static unsigned short s2p[] = {0x2706,0x1ff6,0x0d93,0x4004};
-#define s2pi *(double *)s2p
-#endif
-
-#ifdef MIEEE
-static unsigned short s2p[] = {
-0x4004,0x0d93,0x1ff6,0x2706
-};
-#define s2pi *(double *)s2p
-#endif
-
-/* approximation for 0 <= |y - 0.5| <= 3/8 */
-#ifdef UNK
-static double P0[5] = {
--5.99633501014107895267E1,
- 9.80010754185999661536E1,
--5.66762857469070293439E1,
- 1.39312609387279679503E1,
--1.23916583867381258016E0,
-};
-static double Q0[8] = {
-/* 1.00000000000000000000E0,*/
- 1.95448858338141759834E0,
- 4.67627912898881538453E0,
- 8.63602421390890590575E1,
--2.25462687854119370527E2,
- 2.00260212380060660359E2,
--8.20372256168333339912E1,
- 1.59056225126211695515E1,
--1.18331621121330003142E0,
-};
-#endif
-#ifdef DEC
-static unsigned short P0[20] = {
-0141557,0155170,0071360,0120550,
-0041704,0000214,0172417,0067307,
-0141542,0132204,0040066,0156723,
-0041136,0163161,0157276,0007747,
-0140236,0116374,0073666,0051764,
-};
-static unsigned short Q0[32] = {
-/*0040200,0000000,0000000,0000000,*/
-0040372,0026256,0110403,0123707,
-0040625,0122024,0020277,0026661,
-0041654,0134161,0124134,0007244,
-0142141,0073162,0133021,0131371,
-0042110,0041235,0043516,0057767,
-0141644,0011417,0036155,0137305,
-0041176,0076556,0004043,0125430,
-0140227,0073347,0152776,0067251,
-};
-#endif
-#ifdef IBMPC
-static unsigned short P0[20] = {
-0x142d,0x0e5e,0xfb4f,0xc04d,
-0xedd9,0x9ea1,0x8011,0x4058,
-0xdbba,0x8806,0x5690,0xc04c,
-0xc1fd,0x3bd7,0xdcce,0x402b,
-0xca7e,0x8ef6,0xd39f,0xbff3,
-};
-static unsigned short Q0[36] = {
-/*0x0000,0x0000,0x0000,0x3ff0,*/
-0x74f9,0xd220,0x4595,0x3fff,
-0xe5b6,0x8417,0xb482,0x4012,
-0x81d4,0x350b,0x970e,0x4055,
-0x365f,0x56c2,0x2ece,0xc06c,
-0xcbff,0xa8e9,0x0853,0x4069,
-0xb7d9,0xe78d,0x8261,0xc054,
-0x7563,0xc104,0xcfad,0x402f,
-0xcdd5,0xfabf,0xeedc,0xbff2,
-};
-#endif
-#ifdef MIEEE
-static unsigned short P0[20] = {
-0xc04d,0xfb4f,0x0e5e,0x142d,
-0x4058,0x8011,0x9ea1,0xedd9,
-0xc04c,0x5690,0x8806,0xdbba,
-0x402b,0xdcce,0x3bd7,0xc1fd,
-0xbff3,0xd39f,0x8ef6,0xca7e,
-};
-static unsigned short Q0[32] = {
-/*0x3ff0,0x0000,0x0000,0x0000,*/
-0x3fff,0x4595,0xd220,0x74f9,
-0x4012,0xb482,0x8417,0xe5b6,
-0x4055,0x970e,0x350b,0x81d4,
-0xc06c,0x2ece,0x56c2,0x365f,
-0x4069,0x0853,0xa8e9,0xcbff,
-0xc054,0x8261,0xe78d,0xb7d9,
-0x402f,0xcfad,0xc104,0x7563,
-0xbff2,0xeedc,0xfabf,0xcdd5,
-};
-#endif
-
-
-/* Approximation for interval z = sqrt(-2 log y ) between 2 and 8
- * i.e., y between exp(-2) = .135 and exp(-32) = 1.27e-14.
- */
-#ifdef UNK
-static double P1[9] = {
- 4.05544892305962419923E0,
- 3.15251094599893866154E1,
- 5.71628192246421288162E1,
- 4.40805073893200834700E1,
- 1.46849561928858024014E1,
- 2.18663306850790267539E0,
--1.40256079171354495875E-1,
--3.50424626827848203418E-2,
--8.57456785154685413611E-4,
-};
-static double Q1[8] = {
-/*  1.00000000000000000000E0,*/
- 1.57799883256466749731E1,
- 4.53907635128879210584E1,
- 4.13172038254672030440E1,
- 1.50425385692907503408E1,
- 2.50464946208309415979E0,
--1.42182922854787788574E-1,
--3.80806407691578277194E-2,
--9.33259480895457427372E-4,
-};
-#endif
-#ifdef DEC
-static unsigned short P1[36] = {
-0040601,0143074,0150744,0073326,
-0041374,0031554,0113253,0146016,
-0041544,0123272,0012463,0176771,
-0041460,0051160,0103560,0156511,
-0041152,0172624,0117772,0030755,
-0040413,0170713,0151545,0176413,
-0137417,0117512,0022154,0131671,
-0137017,0104257,0071432,0007072,
-0135540,0143363,0063137,0036166,
-};
-static unsigned short Q1[32] = {
-/*0040200,0000000,0000000,0000000,*/
-0041174,0075325,0004736,0120326,
-0041465,0110044,0047561,0045567,
-0041445,0042321,0012142,0030340,
-0041160,0127074,0166076,0141051,
-0040440,0046055,0040745,0150400,
-0137421,0114146,0067330,0010621,
-0137033,0175162,0025555,0114351,
-0135564,0122773,0145750,0030357,
-};
-#endif
-#ifdef IBMPC
-static unsigned short P1[36] = {
-0x8edb,0x9a3c,0x38c7,0x4010,
-0x7982,0x92d5,0x866d,0x403f,
-0x7fbf,0x42a6,0x94d7,0x404c,
-0x1ba9,0x10ee,0x0a4e,0x4046,
-0x463e,0x93ff,0x5eb2,0x402d,
-0xbfa1,0x7a6c,0x7e39,0x4001,
-0x9677,0x448d,0xf3e9,0xbfc1,
-0x41c7,0xee63,0xf115,0xbfa1,
-0xe78f,0x6ccb,0x18de,0xbf4c,
-};
-static unsigned short Q1[32] = {
-/*0x0000,0x0000,0x0000,0x3ff0,*/
-0xd41b,0xa13b,0x8f5a,0x402f,
-0x296f,0x89ee,0xb204,0x4046,
-0x461c,0x228c,0xa89a,0x4044,
-0xd845,0x9d87,0x15c7,0x402e,
-0xba20,0xa83c,0x0985,0x4004,
-0x0232,0xcddb,0x330c,0xbfc2,
-0xb31d,0x456d,0x7f4e,0xbfa3,
-0x061e,0x797d,0x94bf,0xbf4e,
-};
-#endif
-#ifdef MIEEE
-static unsigned short P1[36] = {
-0x4010,0x38c7,0x9a3c,0x8edb,
-0x403f,0x866d,0x92d5,0x7982,
-0x404c,0x94d7,0x42a6,0x7fbf,
-0x4046,0x0a4e,0x10ee,0x1ba9,
-0x402d,0x5eb2,0x93ff,0x463e,
-0x4001,0x7e39,0x7a6c,0xbfa1,
-0xbfc1,0xf3e9,0x448d,0x9677,
-0xbfa1,0xf115,0xee63,0x41c7,
-0xbf4c,0x18de,0x6ccb,0xe78f,
-};
-static unsigned short Q1[32] = {
-/*0x3ff0,0x0000,0x0000,0x0000,*/
-0x402f,0x8f5a,0xa13b,0xd41b,
-0x4046,0xb204,0x89ee,0x296f,
-0x4044,0xa89a,0x228c,0x461c,
-0x402e,0x15c7,0x9d87,0xd845,
-0x4004,0x0985,0xa83c,0xba20,
-0xbfc2,0x330c,0xcddb,0x0232,
-0xbfa3,0x7f4e,0x456d,0xb31d,
-0xbf4e,0x94bf,0x797d,0x061e,
-};
-#endif
-
-/* Approximation for interval z = sqrt(-2 log y ) between 8 and 64
- * i.e., y between exp(-32) = 1.27e-14 and exp(-2048) = 3.67e-890.
- */
-
-#ifdef UNK
-static double P2[9] = {
-  3.23774891776946035970E0,
-  6.91522889068984211695E0,
-  3.93881025292474443415E0,
-  1.33303460815807542389E0,
-  2.01485389549179081538E-1,
-  1.23716634817820021358E-2,
-  3.01581553508235416007E-4,
-  2.65806974686737550832E-6,
-  6.23974539184983293730E-9,
-};
-static double Q2[8] = {
-/*  1.00000000000000000000E0,*/
-  6.02427039364742014255E0,
-  3.67983563856160859403E0,
-  1.37702099489081330271E0,
-  2.16236993594496635890E-1,
-  1.34204006088543189037E-2,
-  3.28014464682127739104E-4,
-  2.89247864745380683936E-6,
-  6.79019408009981274425E-9,
-};
-#endif
-#ifdef DEC
-static unsigned short P2[36] = {
-0040517,0033507,0036236,0125641,
-0040735,0044616,0014473,0140133,
-0040574,0012567,0114535,0102541,
-0040252,0120340,0143474,0150135,
-0037516,0051057,0115361,0031211,
-0036512,0131204,0101511,0125144,
-0035236,0016627,0043160,0140216,
-0033462,0060512,0060141,0010641,
-0031326,0062541,0101304,0077706,
-};
-static unsigned short Q2[32] = {
-/*0040200,0000000,0000000,0000000,*/
-0040700,0143322,0132137,0040501,
-0040553,0101155,0053221,0140257,
-0040260,0041071,0052573,0010004,
-0037535,0066472,0177261,0162330,
-0036533,0160475,0066666,0036132,
-0035253,0174533,0027771,0044027,
-0033502,0016147,0117666,0063671,
-0031351,0047455,0141663,0054751,
-};
-#endif
-#ifdef IBMPC
-static unsigned short P2[36] = {
-0xd574,0xe793,0xe6e8,0x4009,
-0x780b,0xc327,0xa931,0x401b,
-0xb0ac,0xf32b,0x82ae,0x400f,
-0x9a0c,0x18e7,0x541c,0x3ff5,
-0x2651,0xf35e,0xca45,0x3fc9,
-0x354d,0x9069,0x5650,0x3f89,
-0x1812,0xe8ce,0xc3b2,0x3f33,
-0x2234,0x4c0c,0x4c29,0x3ec6,
-0x8ff9,0x3058,0xccac,0x3e3a,
-};
-static unsigned short Q2[32] = {
-/*0x0000,0x0000,0x0000,0x3ff0,*/
-0xe828,0x568b,0x18da,0x4018,
-0x3816,0xaad2,0x704d,0x400d,
-0x6200,0x2aaf,0x0847,0x3ff6,
-0x3c9b,0x5fd6,0xada7,0x3fcb,
-0xc78b,0xadb6,0x7c27,0x3f8b,
-0x2903,0x65ff,0x7f2b,0x3f35,
-0xccf7,0xf3f6,0x438c,0x3ec8,
-0x6b3d,0xb876,0x29e5,0x3e3d,
-};
-#endif
-#ifdef MIEEE
-static unsigned short P2[36] = {
-0x4009,0xe6e8,0xe793,0xd574,
-0x401b,0xa931,0xc327,0x780b,
-0x400f,0x82ae,0xf32b,0xb0ac,
-0x3ff5,0x541c,0x18e7,0x9a0c,
-0x3fc9,0xca45,0xf35e,0x2651,
-0x3f89,0x5650,0x9069,0x354d,
-0x3f33,0xc3b2,0xe8ce,0x1812,
-0x3ec6,0x4c29,0x4c0c,0x2234,
-0x3e3a,0xccac,0x3058,0x8ff9,
-};
-static unsigned short Q2[32] = {
-/*0x3ff0,0x0000,0x0000,0x0000,*/
-0x4018,0x18da,0x568b,0xe828,
-0x400d,0x704d,0xaad2,0x3816,
-0x3ff6,0x0847,0x2aaf,0x6200,
-0x3fcb,0xada7,0x5fd6,0x3c9b,
-0x3f8b,0x7c27,0xadb6,0xc78b,
-0x3f35,0x7f2b,0x65ff,0x2903,
-0x3ec8,0x438c,0xf3f6,0xccf7,
-0x3e3d,0x29e5,0xb876,0x6b3d,
-};
-#endif
-
-#ifdef ANSIPROT
-extern double polevl ( double, void *, int );
-extern double p1evl ( double, void *, int );
-extern double log ( double );
-extern double sqrt ( double );
-#else
-double polevl(), p1evl(), log(), sqrt();
-#endif
-
-double ndtri(y0)
-double y0;
-{
-double x, y, z, y2, x0, x1;
-int code;
-
-if( y0 <= 0.0 )
-	{
-	mtherr( "ndtri", DOMAIN );
-	return( -MAXNUM );
-	}
-if( y0 >= 1.0 )
-	{
-	mtherr( "ndtri", DOMAIN );
-	return( MAXNUM );
-	}
-code = 1;
-y = y0;
-if( y > (1.0 - 0.13533528323661269189) ) /* 0.135... = exp(-2) */
-	{
-	y = 1.0 - y;
-	code = 0;
-	}
-
-if( y > 0.13533528323661269189 )
-	{
-	y = y - 0.5;
-	y2 = y * y;
-	x = y + y * (y2 * polevl( y2, P0, 4)/p1evl( y2, Q0, 8 ));
-	x = x * s2pi; 
-	return(x);
-	}
-
-x = sqrt( -2.0 * log(y) );
-x0 = x - log(x)/x;
-
-z = 1.0/x;
-if( x < 8.0 ) /* y > exp(-32) = 1.2664165549e-14 */
-	x1 = z * polevl( z, P1, 8 )/p1evl( z, Q1, 8 );
-else
-	x1 = z * polevl( z, P2, 8 )/p1evl( z, Q2, 8 );
-x = x0 - x1;
-if( code != 0 )
-	x = -x;
-return( x );
-}
Index: c/sas/models/c_extension/cephes/pdtr.c
===================================================================
--- src/sas/models/c_extension/cephes/pdtr.c	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,187 +1,0 @@
-/*							pdtr.c
- *
- *	Poisson distribution
- *
- *
- *
- * SYNOPSIS:
- *
- * int k;
- * double m, y, pdtr();
- *
- * y = pdtr( k, m );
- *
- *
- *
- * DESCRIPTION:
- *
- * Returns the sum of the first k terms of the Poisson
- * distribution:
- *
- *   k         j
- *   --   -m  m
- *   >   e    --
- *   --       j!
- *  j=0
- *
- * The terms are not summed directly; instead the incomplete
- * gamma integral is employed, according to the relation
- *
- * y = pdtr( k, m ) = igamc( k+1, m ).
- *
- * The arguments must both be positive.
- *
- *
- *
- * ACCURACY:
- *
- * See igamc().
- *
- */
-
-/*							pdtrc()
- *
- *	Complemented poisson distribution
- *
- *
- *
- * SYNOPSIS:
- *
- * int k;
- * double m, y, pdtrc();
- *
- * y = pdtrc( k, m );
- *
- *
- *
- * DESCRIPTION:
- *
- * Returns the sum of the terms k+1 to infinity of the Poisson
- * distribution:
- *
- *  inf.       j
- *   --   -m  m
- *   >   e    --
- *   --       j!
- *  j=k+1
- *
- * The terms are not summed directly; instead the incomplete
- * gamma integral is employed, according to the formula
- *
- * y = pdtrc( k, m ) = igam( k+1, m ).
- *
- * The arguments must both be positive.
- *
- *
- *
- * ACCURACY:
- *
- * See igam.c.
- *
- */
-
-/*							pdtri()
- *
- *	Inverse Poisson distribution
- *
- *
- *
- * SYNOPSIS:
- *
- * int k;
- * double m, y, pdtr();
- *
- * m = pdtri( k, y );
- *
- *
- *
- *
- * DESCRIPTION:
- *
- * Finds the Poisson variable x such that the integral
- * from 0 to x of the Poisson density is equal to the
- * given probability y.
- *
- * This is accomplished using the inverse gamma integral
- * function and the relation
- *
- *    m = igami( k+1, y ).
- *
- *
- *
- *
- * ACCURACY:
- *
- * See igami.c.
- *
- * ERROR MESSAGES:
- *
- *   message         condition      value returned
- * pdtri domain    y < 0 or y >= 1       0.0
- *                     k < 0
- *
- */
-
-
-/*
-Cephes Math Library Release 2.8:  June, 2000
-Copyright 1984, 1987, 1995, 2000 by Stephen L. Moshier
-*/
-
-#include "mconf.h"
-#ifdef ANSIPROT
-extern double igam ( double, double );
-extern double igamc ( double, double );
-extern double igami ( double, double );
-#else
-double igam(), igamc(), igami();
-#endif
-
-double pdtrc( k, m )
-int k;
-double m;
-{
-double v;
-
-if( (k < 0) || (m <= 0.0) )
-	{
-	mtherr( "pdtrc", DOMAIN );
-	return( 0.0 );
-	}
-v = k+1;
-return( igam( v, m ) );
-}
-
-
-
-double pdtr( k, m )
-int k;
-double m;
-{
-double v;
-
-if( (k < 0) || (m <= 0.0) )
-	{
-	mtherr( "pdtr", DOMAIN );
-	return( 0.0 );
-	}
-v = k+1;
-return( igamc( v, m ) );
-}
-
-
-double pdtri( k, y )
-int k;
-double y;
-{
-double v;
-
-if( (k < 0) || (y < 0.0) || (y >= 1.0) )
-	{
-	mtherr( "pdtri", DOMAIN );
-	return( 0.0 );
-	}
-v = k+1;
-v = igami( v, y );
-return( v );
-}
Index: c/sas/models/c_extension/cephes/polevl.c
===================================================================
--- src/sas/models/c_extension/cephes/polevl.c	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,98 +1,0 @@
-/*							polevl.c
- *							p1evl.c
- *
- *	Evaluate polynomial
- *
- *
- *
- * SYNOPSIS:
- *
- * int N;
- * double x, y, coef[N+1], polevl[];
- *
- * y = polevl( x, coef, N );
- *
- *
- *
- * DESCRIPTION:
- *
- * Evaluates polynomial of degree N:
- *
- *                     2          N
- * y  =  C  + C x + C x  +...+ C x
- *        0    1     2          N
- *
- * Coefficients are stored in reverse order:
- *
- * coef[0] = C  , ..., coef[N] = C  .
- *            N                   0
- *
- *  The function p1evl() assumes that coef[N] = 1.0 and is
- * omitted from the array.  Its calling arguments are
- * otherwise the same as polevl().
- *
- *
- * SPEED:
- *
- * In the interest of speed, there are no checks for out
- * of bounds arithmetic.  This routine is used by most of
- * the functions in the library.  Depending on available
- * equipment features, the user may wish to rewrite the
- * program in microcode or assembly language.
- *
- */
-
-
-
-/*
-Cephes Math Library Release 2.1:  December, 1988
-Copyright 1984, 1987, 1988 by Stephen L. Moshier
-Direct inquiries to 30 Frost Street, Cambridge, MA 02140
-*/
-
-
-double polevl( x, coef, N )
-double x;
-double coef[];
-int N;
-{
-double ans;
-int i;
-double *p;
-
-p = coef;
-ans = *p++;
-i = N;
-
-do
-	ans = ans * x  +  *p++;
-while( --i );
-
-return( ans );
-}
-
-/*							p1evl()	*/
-/*                                          N
- * Evaluate polynomial when coefficient of x  is 1.0.
- * Otherwise same as polevl.
- */
-
-double p1evl( x, coef, N )
-double x;
-double coef[];
-int N;
-{
-double ans;
-double *p;
-int i;
-
-p = coef;
-ans = x + *p++;
-i = N-1;
-
-do
-	ans = ans * x  + *p++;
-while( --i );
-
-return( ans );
-}
Index: c/sas/models/c_extension/cephes/protos.h
===================================================================
--- src/sas/models/c_extension/cephes/protos.h	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,184 +1,0 @@
-/*
- *   This file was automatically generated by version 1.7 of cextract.
- *   Manual editing not recommended.
- *
- *   Created: Fri Mar 31 19:17:33 1995
- */
-extern double acosh ( double x );
-extern int airy ( double, double *, double *, double *, double * );
-extern double asin ( double );
-extern double acos ( double );
-extern double asinh ( double x );
-extern double atan ( double );
-extern double atan2 ( double y, double x );
-extern double atanh ( double );
-extern double bdtrc ( int k, int n, double p );
-extern double bdtr ( int k, int n, double p );
-extern double bdtri ( int k, int n, double y );
-extern double beta ( double a, double b );
-extern double lbeta ( double a, double b );
-extern double btdtr ( double a, double b, double x );
-extern double cbrt ( double );
-extern double chbevl ( double, void *, int );
-extern double chdtrc ( double df, double x );
-extern double chdtr ( double df, double x );
-extern double chdtri ( double df, double y );
-extern void clog ( cmplx *z, cmplx *w );
-extern void cexp ( cmplx *z, cmplx *w );
-extern void csin ( cmplx *z, cmplx *w );
-extern void ccos ( cmplx *z, cmplx *w );
-extern void ctan ( cmplx *z, cmplx *w );
-extern void ccot ( cmplx *z, cmplx *w );
-extern void casin ( cmplx *z, cmplx *w );
-extern void cacos ( cmplx *z, cmplx *w );
-extern void catan ( cmplx *z, cmplx *w );
-extern void cadd ( cmplx *a, cmplx *b, cmplx *c );
-extern void csub ( cmplx *a, cmplx *b, cmplx *c );
-extern void cmul ( cmplx *a, cmplx *b, cmplx *c );
-extern void cdiv ( cmplx *a, cmplx *b, cmplx *c );
-extern void cmov ( void *a, void *b );
-extern void cneg ( cmplx *a );
-extern double cabs ( cmplx *z );
-extern void csqrt ( cmplx *z, cmplx *w );
-extern double hypot ( double, double );
-extern double cosh ( double );
-extern double dawsn ( double xx );
-extern void eigens ( double A[], double RR[], double E[], int N );
-extern double ellie ( double, double );
-extern double ellik ( double, double );
-extern double ellpe ( double );
-extern int ellpj ( double u, double m, double *sn, double *cn, double *dn, double *ph );
-extern double ellpk ( double );
-extern double exp10 ( double );
-extern double exp1m ( double );
-extern double exp2 ( double );
-extern double expn ( int n, double x );
-extern double fac ( int i );
-extern double fdtrc ( int ia, int ib, double x );
-extern double fdtr ( int ia, int ib, double x );
-extern double fdtri ( int ia, int ib, double y );
-extern int fftr ( double x[], int m0, double sine[] );
-extern double ceil ( double x );
-extern double fabs ( double );
-extern double floor ( double );
-extern double frexp ( double, int * );
-extern double ldexp ( double, int );
-//extern int signbit ( double );
-//extern int isnan ( double );
-//extern int isfinite ( double );
-extern double polevl ( double, void *, int );
-extern double p1evl ( double, void *, int );
-extern double exp ( double );
-extern double log ( double );
-extern double sin ( double );
-extern double cos ( double );
-extern double sqrt ( double );
-extern int fresnl ( double xxa, double *ssa, double *cca );
-extern double gamma ( double );
-extern double lgam ( double );
-extern double gdtr ( double a, double b, double x );
-extern double gdtrc ( double a, double b, double x );
-extern int gels ( double A[], double R[], int M, double EPS, double AUX[] );
-extern double hyp2f1 ( double a, double b, double c, double x );
-extern double hyperg ( double, double, double );
-extern double hyp2f0 ( double a, double b, double x, int type, double *err );
-extern double i0 ( double );
-extern double i0e ( double x );
-extern double i1 ( double );
-extern double i1e ( double x );
-extern double igamc ( double, double );
-extern double igam ( double, double );
-extern double igami ( double, double );
-extern double incbet ( double, double, double );
-extern double incbi ( double, double, double );
-extern double iv ( double v, double x );
-extern double j0 ( double );
-extern double y0 ( double );
-extern double j1 ( double );
-extern double y1 ( double );
-extern double jn ( int n, double x );
-extern double jv ( double, double );
-extern double k0 ( double x );
-extern double k0e ( double x );
-extern double k1 ( double x );
-extern double k1e ( double x );
-extern double kn ( int nn, double x );
-extern int levnsn ( int n, double r[], double a[], double e[], double refl[] );
-extern double log10 ( double );
-extern double log2 ( double );
-extern long lrand ( void );
-extern long lsqrt ( long x );
-extern int minv ( double A[], double X[], int n, double B[], int IPS[] );
-extern int mmmpy ( int r, int c, double *A, double *B, double *Y );
-extern int mtherr ( char *name, int code );
-extern int mtransp ( int n, double *A, double *T );
-extern int mvmpy ( int r, int c, double *A, double *V, double *Y );
-extern double nbdtrc ( int k, int n, double p );
-extern double nbdtr ( int k, int n, double p );
-extern double nbdtri ( int k, int n, double p );
-extern double ndtr ( double a );
-extern double erfc ( double );
-extern double erf ( double );
-extern double ndtri ( double );
-extern double pdtrc ( int k, double m );
-extern double pdtr ( int k, double m );
-extern double pdtri ( int k, double y );
-extern double pow ( double, double );
-extern double powi ( double, int );
-extern double psi ( double );
-extern void revers ( double y[], double x[], int n );
-extern double rgamma ( double x );
-extern double round ( double );
-extern int sprec ( void );
-extern int dprec ( void );
-extern int ldprec ( void );
-extern int shichi ( double x, double *si, double *ci );
-extern int sici ( double x, double *si, double *ci );
-extern double simpsn ( double f[], double delta );
-extern int simq ( double A[], double B[], double X[], int n, int flag, int IPS[] );
-extern double radian ( double d, double m, double s );
-/*
-extern int sincos ( double x, double *s, double *c, int flg );
-*/
-extern double sindg ( double x );
-extern double cosdg ( double x );
-extern double sinh ( double );
-extern double spence ( double );
-extern double stdtr ( int k, double t );
-extern double stdtri ( int k, double p );
-extern double onef2 ( double a, double b, double c, double x, double *err );
-extern double threef0 ( double a, double b, double c, double x, double *err );
-extern double struve ( double v, double x );
-extern double tan ( double );
-extern double cot ( double );
-extern double tandg ( double x );
-extern double cotdg ( double x );
-extern double tanh ( double );
-extern double log1p ( double );
-extern double exmp1 ( double );
-extern double cosm1 ( double x );
-extern double yn ( int, double );
-extern double zeta ( double x, double q );
-extern double zetac ( double );
-extern int drand ( double *a );
-double smirnov ( int, double );
-double smirnovi ( int, double );
-double kolmogorov ( double );
-double kolmogi ( double );
-
-/* polyn.c */
-extern void polini ( int maxdeg );
-extern void polprt ( double a[], int na, int d );
-extern void polclr ( double *a, int n );
-extern void polmov ( double *a, int na, double *b );
-extern void polmul ( double a[], int na, double b[], int nb, double c[] );
-extern void poladd ( double a[], int na, double b[], int nb, double c[] );
-extern void polsub ( double a[], int na, double b[], int nb, double c[] );
-extern int poldiv ( double a[], int na, double b[], int nb, double c[] );
-extern void polsbt ( double a[], int na, double b[], int nb, double c[] );
-extern double poleva ( double a[], int na, double x );
-/* polmisc.c */
-extern void polatn ( double num[], double den[], double ans[], int nn );
-extern void polsqt ( double pol[], double ans[], int nn );
-extern void polsin ( double x[], double y[], int nn );
-extern void polcos ( double x[], double y[], int nn );
Index: c/sas/models/c_extension/cephes/psi.c
===================================================================
--- src/sas/models/c_extension/cephes/psi.c	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,202 +1,0 @@
-/*							psi.c
- *
- *	Psi (digamma) function
- *
- *
- * SYNOPSIS:
- *
- * double x, y, psi();
- *
- * y = psi( x );
- *
- *
- * DESCRIPTION:
- *
- *              d      -
- *   psi(x)  =  -- ln | (x)
- *              dx
- *
- * is the logarithmic derivative of the gamma function.
- * For integer x,
- *                   n-1
- *                    -
- * psi(n) = -EUL  +   >  1/k.
- *                    -
- *                   k=1
- *
- * This formula is used for 0 < n <= 10.  If x is negative, it
- * is transformed to a positive argument by the reflection
- * formula  psi(1-x) = psi(x) + pi cot(pi x).
- * For general positive x, the argument is made greater than 10
- * using the recurrence  psi(x+1) = psi(x) + 1/x.
- * Then the following asymptotic expansion is applied:
- *
- *                           inf.   B
- *                            -      2k
- * psi(x) = log(x) - 1/2x -   >   -------
- *                            -        2k
- *                           k=1   2k x
- *
- * where the B2k are Bernoulli numbers.
- *
- * ACCURACY:
- *    Relative error (except absolute when |psi| < 1):
- * arithmetic   domain     # trials      peak         rms
- *    DEC       0,30         2500       1.7e-16     2.0e-17
- *    IEEE      0,30        30000       1.3e-15     1.4e-16
- *    IEEE      -30,0       40000       1.5e-15     2.2e-16
- *
- * ERROR MESSAGES:
- *     message         condition      value returned
- * psi singularity    x integer <=0      MAXNUM
- */
-
-
-/*
-Cephes Math Library Release 2.8:  June, 2000
-Copyright 1984, 1987, 1992, 2000 by Stephen L. Moshier
-*/
-
-#include "mconf.h"
-
-#ifdef UNK
-static double A[] = {
- 8.33333333333333333333E-2,
--2.10927960927960927961E-2,
- 7.57575757575757575758E-3,
--4.16666666666666666667E-3,
- 3.96825396825396825397E-3,
--8.33333333333333333333E-3,
- 8.33333333333333333333E-2
-};
-#endif
-
-#ifdef DEC
-static unsigned short A[] = {
-0037252,0125252,0125252,0125253,
-0136654,0145314,0126312,0146255,
-0036370,0037017,0101740,0174076,
-0136210,0104210,0104210,0104211,
-0036202,0004040,0101010,0020202,
-0136410,0104210,0104210,0104211,
-0037252,0125252,0125252,0125253
-};
-#endif
-
-#ifdef IBMPC
-static unsigned short A[] = {
-0x5555,0x5555,0x5555,0x3fb5,
-0x5996,0x9599,0x9959,0xbf95,
-0x1f08,0xf07c,0x07c1,0x3f7f,
-0x1111,0x1111,0x1111,0xbf71,
-0x0410,0x1041,0x4104,0x3f70,
-0x1111,0x1111,0x1111,0xbf81,
-0x5555,0x5555,0x5555,0x3fb5
-};
-#endif
-
-#ifdef MIEEE
-static unsigned short A[] = {
-0x3fb5,0x5555,0x5555,0x5555,
-0xbf95,0x9959,0x9599,0x5996,
-0x3f7f,0x07c1,0xf07c,0x1f08,
-0xbf71,0x1111,0x1111,0x1111,
-0x3f70,0x4104,0x1041,0x0410,
-0xbf81,0x1111,0x1111,0x1111,
-0x3fb5,0x5555,0x5555,0x5555
-};
-#endif
-
-#define EUL 0.57721566490153286061
-
-#ifdef ANSIPROT
-extern double floor ( double );
-extern double log ( double );
-extern double tan ( double );
-extern double polevl ( double, void *, int );
-#else
-double floor(), log(), tan(), polevl();
-#endif
-extern double PI, MAXNUM;
-
-
-double psi(x)
-double x;
-{
-double p, q, nz, s, w, y, z;
-int i, n, negative;
-
-negative = 0;
-nz = 0.0;
-
-if( x <= 0.0 )
-	{
-	negative = 1;
-	q = x;
-	p = floor(q);
-	if( p == q )
-		{
-		mtherr( "psi", SING );
-		return( MAXNUM );
-		}
-/* Remove the zeros of tan(PI x)
- * by subtracting the nearest integer from x
- */
-	nz = q - p;
-	if( nz != 0.5 )
-		{
-		if( nz > 0.5 )
-			{
-			p += 1.0;
-			nz = q - p;
-			}
-		nz = PI/tan(PI*nz);
-		}
-	else
-		{
-		nz = 0.0;
-		}
-	x = 1.0 - x;
-	}
-
-/* check for positive integer up to 10 */
-if( (x <= 10.0) && (x == floor(x)) )
-	{
-	y = 0.0;
-	n = x;
-	for( i=1; i<n; i++ )
-		{
-		w = i;
-		y += 1.0/w;
-		}
-	y -= EUL;
-	goto done;
-	}
-
-s = x;
-w = 0.0;
-while( s < 10.0 )
-	{
-	w += 1.0/s;
-	s += 1.0;
-	}
-
-if( s < 1.0e17 )
-	{
-	z = 1.0/(s * s);
-	y = z * polevl( z, A, 6 );
-	}
-else
-	y = 0.0;
-
-y = log(s)  -  (0.5/s)  -  y  -  w;
-
-done:
-
-if( negative )
-	{
-	y -= nz;
-	}
-
-return(y);
-}
Index: c/sas/models/c_extension/cephes/stdtr.c
===================================================================
--- src/sas/models/c_extension/cephes/stdtr.c	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,227 +1,0 @@
-/*							stdtr.c
- *
- *	Student's t distribution
- *
- *
- *
- * SYNOPSIS:
- *
- * double t, stdtr();
- * short k;
- *
- * y = stdtr( k, t );
- *
- *
- * DESCRIPTION:
- *
- * Computes the integral from minus infinity to t of the Student
- * t distribution with integer k > 0 degrees of freedom:
- *
- *                                      t
- *                                      -
- *                                     | |
- *              -                      |         2   -(k+1)/2
- *             | ( (k+1)/2 )           |  (     x   )
- *       ----------------------        |  ( 1 + --- )        dx
- *                     -               |  (      k  )
- *       sqrt( k pi ) | ( k/2 )        |
- *                                   | |
- *                                    -
- *                                   -inf.
- * 
- * Relation to incomplete beta integral:
- *
- *        1 - stdtr(k,t) = 0.5 * incbet( k/2, 1/2, z )
- * where
- *        z = k/(k + t**2).
- *
- * For t < -2, this is the method of computation.  For higher t,
- * a direct method is derived from integration by parts.
- * Since the function is symmetric about t=0, the area under the
- * right tail of the density is found by calling the function
- * with -t instead of t.
- * 
- * ACCURACY:
- *
- * Tested at random 1 <= k <= 25.  The "domain" refers to t.
- *                      Relative error:
- * arithmetic   domain     # trials      peak         rms
- *    IEEE     -100,-2      50000       5.9e-15     1.4e-15
- *    IEEE     -2,100      500000       2.7e-15     4.9e-17
- */
-
-
-/*							stdtri.c
- *
- *	Functional inverse of Student's t distribution
- *
- *
- *
- * SYNOPSIS:
- *
- * double p, t, stdtri();
- * int k;
- *
- * t = stdtri( k, p );
- *
- *
- * DESCRIPTION:
- *
- * Given probability p, finds the argument t such that stdtr(k,t)
- * is equal to p.
- * 
- * ACCURACY:
- *
- * Tested at random 1 <= k <= 100.  The "domain" refers to p:
- *                      Relative error:
- * arithmetic   domain     # trials      peak         rms
- *    IEEE    .001,.999     25000       5.7e-15     8.0e-16
- *    IEEE    10^-6,.001    25000       2.0e-12     2.9e-14
- */
-
-
-
-/*
-Cephes Math Library Release 2.8:  June, 2000
-Copyright 1984, 1987, 1995, 2000 by Stephen L. Moshier
-*/
-
-#include "mconf.h"
-
-extern double PI, MACHEP, MAXNUM;
-#ifdef ANSIPROT
-extern double sqrt ( double );
-extern double atan ( double );
-extern double incbet ( double, double, double );
-extern double incbi ( double, double, double );
-extern double fabs ( double );
-#else
-double sqrt(), atan(), incbet(), incbi(), fabs();
-#endif
-
-double stdtr( k, t )
-int k;
-double t;
-{
-double x, rk, z, f, tz, p, xsqk;
-int j;
-
-if( k <= 0 )
-	{
-	mtherr( "stdtr", DOMAIN );
-	return(0.0);
-	}
-
-if( t == 0 )
-	return( 0.5 );
-
-if( t < -2.0 )
-	{
-	rk = k;
-	z = rk / (rk + t * t);
-	p = 0.5 * incbet( 0.5*rk, 0.5, z );
-	return( p );
-	}
-
-/*	compute integral from -t to + t */
-
-if( t < 0 )
-	x = -t;
-else
-	x = t;
-
-rk = k;	/* degrees of freedom */
-z = 1.0 + ( x * x )/rk;
-
-/* test if k is odd or even */
-if( (k & 1) != 0)
-	{
-
-	/*	computation for odd k	*/
-
-	xsqk = x/sqrt(rk);
-	p = atan( xsqk );
-	if( k > 1 )
-		{
-		f = 1.0;
-		tz = 1.0;
-		j = 3;
-		while(  (j<=(k-2)) && ( (tz/f) > MACHEP )  )
-			{
-			tz *= (j-1)/( z * j );
-			f += tz;
-			j += 2;
-			}
-		p += f * xsqk/z;
-		}
-	p *= 2.0/PI;
-	}
-
-
-else
-	{
-
-	/*	computation for even k	*/
-
-	f = 1.0;
-	tz = 1.0;
-	j = 2;
-
-	while(  ( j <= (k-2) ) && ( (tz/f) > MACHEP )  )
-		{
-		tz *= (j - 1)/( z * j );
-		f += tz;
-		j += 2;
-		}
-	p = f * x/sqrt(z*rk);
-	}
-
-/*	common exit	*/
-
-
-if( t < 0 )
-	p = -p;	/* note destruction of relative accuracy */
-
-	p = 0.5 + 0.5 * p;
-return(p);
-}
-
-double stdtri( k, p )
-int k;
-double p;
-{
-double t, rk, z;
-int rflg;
-
-if( k <= 0 || p <= 0.0 || p >= 1.0 )
-	{
-	mtherr( "stdtri", DOMAIN );
-	return(0.0);
-	}
-
-rk = k;
-
-if( p > 0.25 && p < 0.75 )
-	{
-	if( p == 0.5 )
-		return( 0.0 );
-	z = 1.0 - 2.0 * p;
-	z = incbi( 0.5, 0.5*rk, fabs(z) );
-	t = sqrt( rk*z/(1.0-z) );
-	if( p < 0.5 )
-		t = -t;
-	return( t );
-	}
-rflg = -1;
-if( p >= 0.5)
-	{
-	p = 1.0 - p;
-	rflg = 1;
-	}
-z = incbi( 0.5*rk, 0.5, 2.0*p );
-
-if( MAXNUM * z < rk )
-	return(rflg* MAXNUM);
-t = sqrt( rk/z - rk );
-return( rflg * t );
-}
Index: c/sas/models/c_extension/cephes/struve.c
===================================================================
--- src/sas/models/c_extension/cephes/struve.c	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,313 +1,0 @@
-/*							struve.c
- *
- *      Struve function
- *
- *
- *
- * SYNOPSIS:
- *
- * double v, x, y, struve();
- *
- * y = struve( v, x );
- *
- *
- *
- * DESCRIPTION:
- *
- * Computes the Struve function Hv(x) of order v, argument x.
- * Negative x is rejected unless v is an integer.
- *
- * This module also contains the hypergeometric functions 1F2
- * and 3F0 and a routine for the Bessel function Yv(x) with
- * noninteger v.
- *
- *
- *
- * ACCURACY:
- *
- * Not accurately characterized, but spot checked against tables.
- *
- */
-
-
-
-/*
-Cephes Math Library Release 2.81:  June, 2000
-Copyright 1984, 1987, 1989, 2000 by Stephen L. Moshier
-*/
-#include "mconf.h"
-#define DEBUG 0
-#ifdef ANSIPROT
-extern double gamma ( double );
-extern double pow ( double, double );
-extern double sqrt ( double );
-extern double yn ( int, double );
-extern double jv ( double, double );
-extern double fabs ( double );
-extern double floor ( double );
-extern double sin ( double );
-extern double cos ( double );
-double yv ( double, double );
-double onef2 (double, double, double, double, double * );
-double threef0 (double, double, double, double, double * );
-#else
-double gamma(), pow(), sqrt(), yn(), yv(), jv(), fabs(), floor();
-double sin(), cos();
-double onef2(), threef0();
-#endif
-static double stop = 1.37e-17;
-extern double MACHEP;
-
-double onef2( a, b, c, x, err )
-double a, b, c, x;
-double *err;
-{
-double n, a0, sum, t;
-double an, bn, cn, max, z;
-
-an = a;
-bn = b;
-cn = c;
-a0 = 1.0;
-sum = 1.0;
-n = 1.0;
-t = 1.0;
-max = 0.0;
-
-do
-	{
-	if( an == 0 )
-		goto done;
-	if( bn == 0 )
-		goto error;
-	if( cn == 0 )
-		goto error;
-	if( (a0 > 1.0e34) || (n > 200) )
-		goto error;
-	a0 *= (an * x) / (bn * cn * n);
-	sum += a0;
-	an += 1.0;
-	bn += 1.0;
-	cn += 1.0;
-	n += 1.0;
-	z = fabs( a0 );
-	if( z > max )
-		max = z;
-	if( sum != 0 )
-		t = fabs( a0 / sum );
-	else
-		t = z;
-	}
-while( t > stop );
-
-done:
-
-*err = fabs( MACHEP*max /sum );
-
-#if DEBUG
-	printf(" onef2 cancellation error %.5E\n", *err );
-#endif
-
-goto xit;
-
-error:
-#if DEBUG
-printf("onef2 does not converge\n");
-#endif
-*err = 1.0e38;
-
-xit:
-
-#if DEBUG
-printf("onef2( %.2E %.2E %.2E %.5E ) =  %.3E  %.6E\n", a, b, c, x, n, sum);
-#endif
-return(sum);
-}
-
-
-
-
-double threef0( a, b, c, x, err )
-double a, b, c, x;
-double *err;
-{
-double n, a0, sum, t, conv, conv1;
-double an, bn, cn, max, z;
-
-an = a;
-bn = b;
-cn = c;
-a0 = 1.0;
-sum = 1.0;
-n = 1.0;
-t = 1.0;
-max = 0.0;
-conv = 1.0e38;
-conv1 = conv;
-
-do
-	{
-	if( an == 0.0 )
-		goto done;
-	if( bn == 0.0 )
-		goto done;
-	if( cn == 0.0 )
-		goto done;
-	if( (a0 > 1.0e34) || (n > 200) )
-		goto error;
-	a0 *= (an * bn * cn * x) / n;
-	an += 1.0;
-	bn += 1.0;
-	cn += 1.0;
-	n += 1.0;
-	z = fabs( a0 );
-	if( z > max )
-		max = z;
-	if( z >= conv )
-		{
-		if( (z < max) && (z > conv1) )
-			goto done;
-		}
-	conv1 = conv;
-	conv = z;
-	sum += a0;
-	if( sum != 0 )
-		t = fabs( a0 / sum );
-	else
-		t = z;
-	}
-while( t > stop );
-
-done:
-
-t = fabs( MACHEP*max/sum );
-#if DEBUG
-	printf(" threef0 cancellation error %.5E\n", t );
-#endif
-
-max = fabs( conv/sum );
-if( max > t )
-	t = max;
-#if DEBUG
-	printf(" threef0 convergence %.5E\n", max );
-#endif
-
-goto xit;
-
-error:
-#if DEBUG
-printf("threef0 does not converge\n");
-#endif
-t = 1.0e38;
-
-xit:
-
-#if DEBUG
-printf("threef0( %.2E %.2E %.2E %.5E ) =  %.3E  %.6E\n", a, b, c, x, n, sum);
-#endif
-
-*err = t;
-return(sum);
-}
-
-
-
-
-extern double PI;
-
-double struve( v, x )
-double v, x;
-{
-double y, ya, f, g, h, t;
-double onef2err, threef0err;
-
-f = floor(v);
-if( (v < 0) && ( v-f == 0.5 ) )
-	{
-	y = jv( -v, x );
-	f = 1.0 - f;
-	g =  2.0 * floor(f/2.0);
-	if( g != f )
-		y = -y;
-	return(y);
-	}
-t = 0.25*x*x;
-f = fabs(x);
-g = 1.5 * fabs(v);
-if( (f > 30.0) && (f > g) )
-	{
-	onef2err = 1.0e38;
-	y = 0.0;
-	}
-else
-	{
-	y = onef2( 1.0, 1.5, 1.5+v, -t, &onef2err );
-	}
-
-if( (f < 18.0) || (x < 0.0) )
-	{
-	threef0err = 1.0e38;
-	ya = 0.0;
-	}
-else
-	{
-	ya = threef0( 1.0, 0.5, 0.5-v, -1.0/t, &threef0err );
-	}
-
-f = sqrt( PI );
-h = pow( 0.5*x, v-1.0 );
-
-if( onef2err <= threef0err )
-	{
-	g = gamma( v + 1.5 );
-	y = y * h * t / ( 0.5 * f * g );
-	return(y);
-	}
-else
-	{
-	g = gamma( v + 0.5 );
-	ya = ya * h / ( f * g );
-	ya = ya + yv( v, x );
-	return(ya);
-	}
-}
-
-
-
-
-/* Bessel function of noninteger order
- */
-
-double yv( v, x )
-double v, x;
-{
-double y, t;
-int n;
-
-y = floor( v );
-if( y == v )
-	{
-	n = v;
-	y = yn( n, x );
-	return( y );
-	}
-t = PI * v;
-y = (cos(t) * jv( v, x ) - jv( -v, x ))/sin(t);
-return( y );
-}
-
-/* Crossover points between ascending series and asymptotic series
- * for Struve function
- *
- *	 v	 x
- * 
- *	 0	19.2
- *	 1	18.95
- *	 2	19.15
- *	 3	19.3
- *	 5	19.7
- *	10	21.35
- *	20	26.35
- *	30	32.31
- *	40	40.0
- */
Index: c/sas/models/c_extension/cephes/unity.c
===================================================================
--- src/sas/models/c_extension/cephes/unity.c	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,138 +1,0 @@
-/*							unity.c
- *
- * Relative error approximations for function arguments near
- * unity.
- *
- *    log1p(x) = log(1+x)
- *    expm1(x) = exp(x) - 1
- *    cosm1(x) = cos(x) - 1
- *
- */
-
-#include "mconf.h"
-
-#ifdef ANSIPROT
-extern int isnan (double);
-extern int isfinite (double);
-extern double log ( double );
-extern double polevl ( double, void *, int );
-extern double p1evl ( double, void *, int );
-extern double exp ( double );
-extern double cos ( double );
-#else
-double log(), polevl(), p1evl(), exp(), cos();
-int isnan(), isfinite();
-#endif
-extern double INFINITY;
-
-/* log1p(x) = log(1 + x)  */
-
-/* Coefficients for log(1+x) = x - x**2/2 + x**3 P(x)/Q(x)
- * 1/sqrt(2) <= x < sqrt(2)
- * Theoretical peak relative error = 2.32e-20
- */
-static double LP[] = {
- 4.5270000862445199635215E-5,
- 4.9854102823193375972212E-1,
- 6.5787325942061044846969E0,
- 2.9911919328553073277375E1,
- 6.0949667980987787057556E1,
- 5.7112963590585538103336E1,
- 2.0039553499201281259648E1,
-};
-static double LQ[] = {
-/* 1.0000000000000000000000E0,*/
- 1.5062909083469192043167E1,
- 8.3047565967967209469434E1,
- 2.2176239823732856465394E2,
- 3.0909872225312059774938E2,
- 2.1642788614495947685003E2,
- 6.0118660497603843919306E1,
-};
-
-#define SQRTH 0.70710678118654752440
-#define SQRT2 1.41421356237309504880
-
-double log1p(x)
-double x;
-{
-double z;
-
-z = 1.0 + x;
-if( (z < SQRTH) || (z > SQRT2) )
-	return( log(z) );
-z = x*x;
-z = -0.5 * z + x * ( z * polevl( x, LP, 6 ) / p1evl( x, LQ, 6 ) );
-return (x + z);
-}
-
-
-
-/* expm1(x) = exp(x) - 1  */
-
-/*  e^x =  1 + 2x P(x^2)/( Q(x^2) - P(x^2) )
- * -0.5 <= x <= 0.5
- */
-
-static double EP[3] = {
- 1.2617719307481059087798E-4,
- 3.0299440770744196129956E-2,
- 9.9999999999999999991025E-1,
-};
-static double EQ[4] = {
- 3.0019850513866445504159E-6,
- 2.5244834034968410419224E-3,
- 2.2726554820815502876593E-1,
- 2.0000000000000000000897E0,
-};
-
-double expm1(x)
-double x;
-{
-double r, xx;
-
-#ifdef NANS
-if( isnan(x) )
-	return(x);
-#endif
-#ifdef INFINITIES
-if( x == INFINITY )
-	return(INFINITY);
-if( x == -INFINITY )
-	return(-1.0);
-#endif
-if( (x < -0.5) || (x > 0.5) )
-	return( exp(x) - 1.0 );
-xx = x * x;
-r = x * polevl( xx, EP, 2 );
-r = r/( polevl( xx, EQ, 3 ) - r );
-return (r + r);
-}
-
-
-
-/* cosm1(x) = cos(x) - 1  */
-
-static double coscof[7] = {
- 4.7377507964246204691685E-14,
--1.1470284843425359765671E-11,
- 2.0876754287081521758361E-9,
--2.7557319214999787979814E-7,
- 2.4801587301570552304991E-5,
--1.3888888888888872993737E-3,
- 4.1666666666666666609054E-2,
-};
-
-extern double PIO4;
-
-double cosm1(x)
-double x;
-{
-double xx;
-
-if( (x < -PIO4) || (x > PIO4) )
-	return( cos(x) - 1.0 );
-xx = x * x;
-xx = -0.5*xx + xx * xx * polevl( xx, coscof, 6 );
-return xx;
-}
Index: c/sas/models/c_extension/cephes/yn.c
===================================================================
--- src/sas/models/c_extension/cephes/yn.c	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,115 +1,0 @@
-/*							yn.c
- *
- *	Bessel function of second kind of integer order
- *
- *
- *
- * SYNOPSIS:
- *
- * double x, y, yn();
- * int n;
- *
- * y = yn( n, x );
- *
- *
- *
- * DESCRIPTION:
- *
- * Returns Bessel function of order n, where n is a
- * (possibly negative) integer.
- *
- * The function is evaluated by forward recurrence on
- * n, starting with values computed by the routines
- * y0() and y1().
- *
- * If n = 0 or 1 the routine for y0 or y1 is called
- * directly.
- *
- *
- *
- * ACCURACY:
- *
- *
- *                      Absolute error, except relative
- *                      when y > 1:
- * arithmetic   domain     # trials      peak         rms
- *    DEC       0, 30        2200       2.9e-16     5.3e-17
- *    IEEE      0, 30       30000       3.4e-15     4.3e-16
- *
- *
- * ERROR MESSAGES:
- *
- *   message         condition      value returned
- * yn singularity   x = 0              MAXNUM
- * yn overflow                         MAXNUM
- *
- * Spot checked against tables for x, n between 0 and 100.
- *
- */
-
-
-/*
-Cephes Math Library Release 2.8:  June, 2000
-Copyright 1984, 1987, 2000 by Stephen L. Moshier
-*/
-
-#include "mconf.h"
-#ifdef ANSIPROT
-extern double y0 ( double );
-extern double y1 ( double );
-extern double log ( double );
-#else
-double y0(), y1(), log();
-#endif
-extern double MAXNUM, MAXLOG;
-
-double yn( n, x )
-int n;
-double x;
-{
-double an, anm1, anm2, r;
-int k, sign;
-
-if( n < 0 )
-	{
-	n = -n;
-	if( (n & 1) == 0 )	/* -1**n */
-		sign = 1;
-	else
-		sign = -1;
-	}
-else
-	sign = 1;
-
-
-if( n == 0 )
-	return( sign * y0(x) );
-if( n == 1 )
-	return( sign * y1(x) );
-
-/* test for overflow */
-if( x <= 0.0 )
-	{
-	mtherr( "yn", SING );
-	return( -MAXNUM );
-	}
-
-/* forward recurrence on n */
-
-anm2 = y0(x);
-anm1 = y1(x);
-k = 1;
-r = 2 * k;
-do
-	{
-	an = r * anm1 / x  -  anm2;
-	anm2 = anm1;
-	anm1 = an;
-	r += 2.0;
-	++k;
-	}
-while( k < n );
-
-
-return( sign * an );
-}
Index: c/sas/models/c_extension/libigor/StandardHeaders.h
===================================================================
--- src/sas/models/c_extension/libigor/StandardHeaders.h	(revision fd5ac0db8089df5bd882587f157d4bf317cfcf67)
+++ 	(revision )
@@ -1,19 +1,0 @@
-/*
- *  StandardHeaders.h
- *  SASAnalysis
- *
- *  Created by Andrew Jackson on 4/23/07.
- *  Copyright 2007 __MyCompanyName__. All rights reserved.
- *
- */
-
-#include <math.h>
-#include <ctype.h>
-
-#include <stdlib.h>
-#include <stdio.h>
-
-#ifdef _WIN32
-#include <float.h>
-#include "winFuncs.h"
-#endif
Index: c/sas/models/c_extension/libigor/local.def
===================================================================
--- src/sas/models/c_extension/libigor/local.def	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-# -*- Makefile -*-
-#
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-#
-#                               Michael A.G. Aivazis
-#                        California Institute of Technology
-#                        (C) 1998-2004  All Rights Reserved
-#
-# <LicenseText>
-#
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-#
-
-#
-# Local (project) definitions
-#
-
-# C++
-
-    PROJ_CXX_FLAGS += $(CXX_SOFLAGS)
-    PROJ_LCXX_FLAGS += $(LCXX_SARFLAGS)
-
-#PROJ_CXX_DEFINES += DEEPDEBUG
-#PROJ_CXX_DEFINES += DEBUG
-
-# version
-# $Id: local.def 1280 2007-06-25 07:01:00Z linjiao $
-
-# End of file
Index: c/sas/models/c_extension/libigor/release_notes.txt
===================================================================
--- src/sas/models/c_extension/libigor/release_notes.txt	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,8 +1,0 @@
-Release Notes for 'libigor'
-
-The C code in 'libigor' has been written as part of the SANS analysis package
-that uses IGOR. More information can be found here:
-
-	http://www.ncnr.nist.gov/programs/sans/data/red_anal.html
-	 
-    "Reduction and Analysis of SANS and USANS Data using Igor Pro", Kline, S. R. J Appl. Cryst. 39(6), 895 (2006).
Index: c/sas/models/c_extension/python_wrapper/WrapperGenerator.py
===================================================================
--- src/sas/models/c_extension/python_wrapper/WrapperGenerator.py	(revision 1f5f206cb54d8f1284dcdc7778dd1c77213dd744)
+++ 	(revision )
@@ -1,595 +1,0 @@
-#!/usr/bin/env python
-""" WrapperGenerator class to generate model code automatically.
-"""
-
-import os, sys, re
-import lineparser
-
-class WrapperGenerator(object):
-    """ Python wrapper generator for C models
-
-        The developer must provide a header file describing
-        the new model.
-
-        To provide the name of the Python class to be
-        generated, the .h file must contain the following
-        string in the comments:
-
-        // [PYTHONCLASS] = my_model
-
-        where my_model must be replaced by the name of the
-        class that you want to import from sas.models.
-        (example: [PYTHONCLASS] = MyModel
-          will create a class MyModel in sas.models.MyModel.
-          It will also create a class CMyModel in
-          sas_extension.c_models.)
-
-        Also in comments, each parameter of the params
-        dictionary must be declared with a default value
-        in the following way:
-
-        // [DEFAULT]=param_name=default_value
-
-        (example:
-            //  [DEFAULT]=radius=20.0
-        )
-
-        See cylinder.h for an example.
-
-        A .c file corresponding to the .h file should also
-        be provided (example: my_model.h, my_model.c).
-
-        The .h file should define two function definitions. For example,
-        cylinder.h defines the following:
-
-        /// 1D scattering function
-        double cylinder_analytical_1D(CylinderParameters *pars, double q);
-
-        /// 2D scattering function
-        double cylinder_analytical_2D(CylinderParameters *pars, double q, double phi);
-
-        The .c file implements those functions.
-
-        @author: Mathieu Doucet / UTK
-        @contact: mathieu.doucet@nist.gov
-    """
-
-    def __init__(self, filename, output_dir='.', c_wrapper_dir='.'):
-        """ Initialization """
-
-        ## Name of .h file to generate wrapper from
-        self.file = filename
-
-        # Info read from file
-
-        ## Name of python class to write
-        self.pythonClass = None
-        ## Parser in struct section
-        self.inStruct = False
-        self.foundCPP = False
-        self.inParDefs = False
-        ## Name of struct for the c object
-        self.structName = None
-        ## Dictionary of parameters
-        self.params = {}
-        ## ModelCalculation module flag
-        self.modelCalcFlag = False
-        ## List of default parameters (text)
-        self.default_list = ""
-        ## Dictionary of units
-        self.details = ""
-        ## List of dispersed parameters
-        self.disp_params = []
-        #model description
-        self.description = ''
-        # paramaters for fittable
-        self.fixed = []
-        # paramaters for non-fittable
-        self.non_fittable = []
-        ## parameters with orientation
-        self.orientation_params = []
-        ## parameter with magnetism
-        self.magentic_params = []
-        # Model category
-        self.category = None
-        # Whether model belongs to multifunc
-        self.is_multifunc = False
-        ## output directory for wrappers
-        self.output_dir = output_dir
-        self.c_wrapper_dir = c_wrapper_dir
-
-    def __repr__(self):
-        """ Simple output for printing """
-
-        rep = "\n Python class: %s\n\n" % self.pythonClass
-        rep += "  struc name: %s\n\n" % self.structName
-        rep += "  params:     %s\n\n" % self.params
-        rep += "  description:    %s\n\n" % self.description
-        rep += "  Fittable parameters:     %s\n\n" % self.fixed
-        rep += "  Non-Fittable parameters:     %s\n\n" % self.non_fittable
-        rep += "  Orientation parameters:  %s\n\n" % self.orientation_params
-        rep += "  Magnetic parameters:  %s\n\n" % self.magnetic_params
-        return rep
-
-    def read(self):
-        """ Reads in the .h file to catch parameters of the wrapper """
-
-        # Check if the file is there
-        if not os.path.isfile(self.file):
-            raise ValueError, "File %s is not a regular file" % self.file
-
-        # Read file
-        f = open(self.file, 'r')
-        buf = f.read()
-
-        self.default_list = "\n    List of default parameters:\n\n"
-        #lines = string.split(buf,'\n')
-        lines = buf.split('\n')
-        self.details = "## Parameter details [units, min, max]\n"
-        self.details += "        self.details = {}\n"
-
-        #open item in this case Fixed
-        text = 'text'
-        key2 = "<%s>" % text.lower()
-        # close an item in this case fixed
-        text = 'TexT'
-        key3 = "</%s>" % text.lower()
-
-        ## Catch fixed parameters
-        key = "[FIXED]"
-        try:
-            self.fixed = lineparser.readhelper(lines, key,
-                                               key2, key3, file=self.file)
-        except:
-            raise
-        ## Catch non-fittable parameters parameters
-        key = "[NON_FITTABLE_PARAMS]"
-        try:
-            self.non_fittable = lineparser.readhelper(lines, key, key2,
-                                                      key3, file=self.file)
-        except:
-            raise
-
-        ## Catch parameters with orientation
-        key = "[ORIENTATION_PARAMS]"
-        try:
-            self.orientation_params = lineparser.readhelper(lines, key,
-                                                            key2, key3, file=self.file)
-        except:
-            raise
-
-        ## Catch parameters with orientation
-        key = "[MAGNETIC_PARAMS]"
-        try:
-            self.magnetic_params = lineparser.readhelper(lines, key,
-                                                         key2, key3, file=self.file)
-        except:
-            raise
-
-        ## Catch Description
-        key = "[DESCRIPTION]"
-
-        find_description = False
-        temp = ""
-        for line in lines:
-            if line.count(key) > 0:
-                try:
-                    find_description = True
-                    index = line.index(key)
-                    toks = line[index:].split("=", 1)
-                    temp = toks[1].lstrip().rstrip()
-                    text = 'text'
-                    key2 = "<%s>" % text.lower()
-                    if re.match(key2, temp) != None:
-
-                        toks2 = temp.split(key2, 1)
-                        self.description = toks2[1]
-                        text = 'text'
-                        key2 = "</%s>" % text.lower()
-                        if re.search(key2, toks2[1]) != None:
-                            temp = toks2[1].split(key2, 1)
-                            self.description = temp[0]
-                            break
-
-                    else:
-                        self.description = temp
-                        break
-                except:
-                    raise ValueError, "Could not parse file %s" % self.file
-            elif find_description:
-                text = 'text'
-                key2 = "</%s>" % text.lower()
-                if re.search(key2, line) != None:
-                    tok = line.split(key2, 1)
-                    temp = tok[0].split("//", 1)
-                    self.description += tok[1].lstrip().rstrip()
-                    break
-                else:
-                    if re.search("//", line) != None:
-                        temp = line.split("//", 1)
-                        self.description += '\n\t\t' + temp[1].lstrip().rstrip()
-
-                    else:
-                        self.description += '\n\t\t' + line.lstrip().rstrip()
-
-
-
-        for line in lines:
-
-            # Catch class name
-            key = "[PYTHONCLASS]"
-            if line.count(key) > 0:
-                try:
-                    index = line.index(key)
-                    toks = line[index:].split("=")
-                    self.pythonClass = toks[1].lstrip().rstrip()
-
-                except:
-                    raise ValueError, "Could not parse file %s" % self.file
-
-            key = "[CATEGORY]"
-            if line.count(key) > 0:
-                try:
-                    index = line.index(key)
-                    toks = line[index:].split("=")
-                    self.category = toks[1].lstrip().rstrip()
-
-                except:
-                    raise ValueError, "Could not parse file %s" % self.file
-
-            # is_multifunc
-            key = "[MULTIPLICITY_INFO]"
-            if line.count(key) > 0:
-                self.is_multifunc = True
-                try:
-                    index = line.index(key)
-                    toks = line[index:].split("=")
-                    self.multiplicity_info = toks[1].lstrip().rstrip()
-                except:
-                    raise ValueError, "Could not parse file %s" % self.file
-
-            # Catch struct name
-            # C++ class definition
-            if line.count("class") > 0:
-                # We are entering a class definition
-                self.inParDefs = True
-                self.foundCPP = True
-
-            # Old-Style C struct definition
-            if line.count("typedef struct") > 0:
-                # We are entering a struct block
-                self.inParDefs = True
-                self.inStruct = True
-
-            if self.inParDefs and line.count("}") > 0:
-                # We are exiting a struct block
-                self.inParDefs = False
-
-                if self.inStruct:
-                    self.inStruct = False
-                    # Catch the name of the struct
-                    index = line.index("}")
-                    toks = line[index + 1:].split(";")
-                    # Catch pointer definition
-                    toks2 = toks[0].split(',')
-                    self.structName = toks2[0].lstrip().rstrip()
-
-            # Catch struct content
-            key = "[DEFAULT]"
-            if self.inParDefs and line.count(key) > 0:
-                # Found a new parameter
-                try:
-                    index = line.index(key)
-                    toks = line[index:].split("=")
-                    toks2 = toks[2].split()
-                    val = float(toks2[0])
-                    self.params[toks[1]] = val
-                    #self.pythonClass = toks[1].lstrip().rstrip()
-                    units = ""
-                    if len(toks2) >= 2:
-                        units = toks2[1]
-                    self.default_list += "    * %-15s = %s %s\n" % \
-                        (toks[1], val, units)
-
-                    # Check for min and max
-                    value_min = "None"
-                    value_max = "None"
-                    if len(toks2) == 4:
-                        value_min = toks2[2]
-                        value_max = toks2[3]
-
-                    self.details += "        self.details['%s'] = ['%s', %s, %s]\n" % \
-                        (toks[1].lstrip().rstrip(), units.lstrip().rstrip(), value_min, value_max)
-                except:
-                    raise ValueError, "Could not parse input file %s \n  %s" % \
-                        (self.file, sys.exc_value)
-
-
-            # Catch need for numerical calculations
-            key = "CalcParameters calcPars"
-            if line.count(key) > 0:
-                self.modelCalcFlag = True
-
-            # Catch list of dispersed parameters 
-            key = "[DISP_PARAMS]"
-            if line.count(key) > 0:
-                try:
-                    index = line.index(key)
-                    toks = line[index:].split("=")
-                    list_str = toks[1].lstrip().rstrip()
-                    self.disp_params = list_str.split(',')
-                except:
-                    raise ValueError, "Could not parse file %s" % self.file
-
-    def write_c_wrapper(self):
-        """ Writes the C file to create the python extension class 
-            The file is written in C[PYTHONCLASS].c
-        """
-        file_path = os.path.join(self.c_wrapper_dir,
-                                 "C" + self.pythonClass + '.cpp')
-        file = open(file_path, 'w')
-
-        template = open(os.path.join(os.path.dirname(__file__),
-                                     "classTemplate.txt"), 'r')
-
-        tmp_buf = template.read()
-        #tmp_lines = string.split(tmp_buf,'\n')
-        tmp_lines = tmp_buf.split('\n')
-
-        for tmp_line in tmp_lines:
-
-            # Catch class name
-            newline = self.replaceToken(tmp_line,
-                                        "[PYTHONCLASS]", 'C' + self.pythonClass)
-            #Catch model description
-            #newline = self.replaceToken(tmp_line, 
-            #                            "[DESCRIPTION]", self.description)
-            # Catch C model name
-            newline = self.replaceToken(newline,
-                                        "[CMODEL]", self.pythonClass)
-
-            # Catch class name
-            newline = self.replaceToken(newline,
-                                        "[MODELSTRUCT]", self.structName)
-
-            # Sort model initialization based on multifunc
-            if self.is_multifunc:
-                line = "int level = 1;\nPyArg_ParseTuple(args,\"i\",&level);\n"
-                line += "self->model = new " + self.pythonClass + "(level);"
-            else:
-                line = "self->model = new " + self.pythonClass + "();"
-
-            newline = self.replaceToken(newline, "[INITIALIZE_MODEL]", line)
-
-            # Dictionary initialization
-            param_str = "// Initialize parameter dictionary\n"
-            for par in self.params:
-                param_str += "        PyDict_SetItemString(self->params,\"%s\",Py_BuildValue(\"d\",%10.12f));\n" % \
-                    (par, self.params[par])
-
-            if len(self.disp_params) > 0:
-                param_str += "        // Initialize dispersion / averaging parameter dict\n"
-                param_str += "        DispersionVisitor* visitor = new DispersionVisitor();\n"
-                param_str += "        PyObject * disp_dict;\n"
-                for par in self.disp_params:
-                    par = par.strip()
-                    if par == '':
-                        continue
-                    param_str += "        disp_dict = PyDict_New();\n"
-                    param_str += "        self->model->%s.dispersion->accept_as_source(visitor, self->model->%s.dispersion, disp_dict);\n" % (par, par)
-                    param_str += "        PyDict_SetItemString(self->dispersion, \"%s\", disp_dict);\n" % par
-
-            # Initialize dispersion object dictionnary
-            param_str += "\n"
-
-
-            newline = self.replaceToken(newline,
-                                        "[INITDICTIONARY]", param_str)
-
-            # Read dictionary
-            param_str = "    // Reader parameter dictionary\n"
-            for par in self.params:
-                param_str += "    self->model->%s = PyFloat_AsDouble( PyDict_GetItemString(self->params, \"%s\") );\n" % \
-                    (par, par)
-
-            if len(self.disp_params) > 0:
-                param_str += "    // Read in dispersion parameters\n"
-                param_str += "    PyObject* disp_dict;\n"
-                param_str += "    DispersionVisitor* visitor = new DispersionVisitor();\n"
-                for par in self.disp_params:
-                    par = par.strip()
-                    if par == '':
-                        continue
-                    param_str += "    disp_dict = PyDict_GetItemString(self->dispersion, \"%s\");\n" % par
-                    param_str += "    self->model->%s.dispersion->accept_as_destination(visitor, self->model->%s.dispersion, disp_dict);\n" % (par, par)
-
-            newline = self.replaceToken(newline, "[READDICTIONARY]", param_str)
-
-            # Name of .c file
-            #toks = string.split(self.file,'.')
-            basename = os.path.basename(self.file)
-            toks = basename.split('.')
-            newline = self.replaceToken(newline, "[C_FILENAME]", toks[0])
-
-            # Include file
-            basename = os.path.basename(self.file)
-            newline = self.replaceToken(newline,
-                                        "[INCLUDE_FILE]", self.file)
-            if self.foundCPP:
-                newline = self.replaceToken(newline, "[C_INCLUDE_FILE]", "")
-                newline = self.replaceToken(newline,
-                                            "[CPP_INCLUDE_FILE]",
-                                            "#include \"%s\"" % basename)
-            else:
-                newline = self.replaceToken(newline,
-                                            "[C_INCLUDE_FILE]",
-                                            "#include \"%s\"" % basename)
-                newline = self.replaceToken(newline,
-                                            "[CPP_INCLUDE_FILE]",
-                                            "#include \"models.hh\"")
-
-            # Numerical calcs dealloc
-            dealloc_str = "\n"
-            if self.modelCalcFlag:
-                dealloc_str = "    modelcalculations_dealloc(&(self->model_pars.calcPars));\n"
-            newline = self.replaceToken(newline,
-                                        "[NUMERICAL_DEALLOC]", dealloc_str)
-
-            # Numerical calcs init
-            init_str = "\n"
-            if self.modelCalcFlag:
-                init_str = "        modelcalculations_init(&(self->model_pars.calcPars));\n"
-            newline = self.replaceToken(newline,
-                                        "[NUMERICAL_INIT]", init_str)
-
-            # Numerical calcs reset
-            reset_str = "\n"
-            if self.modelCalcFlag:
-                reset_str = "modelcalculations_reset(&(self->model_pars.calcPars));\n"
-            newline = self.replaceToken(newline,
-                                        "[NUMERICAL_RESET]", reset_str)
-
-            # Setting dispsertion weights
-            set_weights = "    // Ugliness necessary to go from python to C\n"
-            set_weights = "    // TODO: refactor this\n"
-            for par in self.disp_params:
-                par = par.strip()
-                if par == '':
-                        continue
-                set_weights += "    if (!strcmp(par_name, \"%s\")) {\n" % par
-                set_weights += "        self->model->%s.dispersion = dispersion;\n" % par
-                set_weights += "    } else"
-            newline = self.replaceToken(newline,
-                                        "[SET_DISPERSION]", set_weights)
-
-            # Write new line to the wrapper .c file
-            file.write(newline + '\n')
-
-
-        file.close()
-
-    def write_python_wrapper(self):
-        """ Writes the python file to create the python extension class 
-            The file is written in ../[PYTHONCLASS].py
-        """
-        file_path = os.path.join(self.output_dir, self.pythonClass + '.py')
-        file = open(file_path, 'w')
-        template = open(os.path.join(os.path.dirname(__file__),
-                                     "modelTemplate.txt"), 'r')
-
-        tmp_buf = template.read()
-        tmp_lines = tmp_buf.split('\n')
-
-        for tmp_line in tmp_lines:
-
-            # Catch class name
-            newline = self.replaceToken(tmp_line,
-                                        "[CPYTHONCLASS]",
-                                        'C' + self.pythonClass)
-
-            # Catch class name
-            newline = self.replaceToken(newline,
-                                        "[PYTHONCLASS]", self.pythonClass)
-
-            # Include file
-            newline = self.replaceToken(newline,
-                                        "[INCLUDE_FILE]", self.file)
-
-            # Include file
-            newline = self.replaceToken(newline,
-                                        "[DEFAULT_LIST]", self.default_list)
-            # model description
-            newline = self.replaceToken(newline,
-                                        "[DESCRIPTION]", self.description)
-            # Parameter details
-            newline = self.replaceToken(newline,
-                                        "[PAR_DETAILS]", self.details)
-
-            # Call base constructor
-            if self.is_multifunc:
-                newline = self.replaceToken(newline, "[CALL_CPYTHON_INIT]",
-                                            'C' + self.pythonClass + \
-                    ".__init__(self,multfactor)\n\tself.is_multifunc = True")
-                newline = self.replaceToken(newline, "[MULTIPLICITY_INFO]",
-                                            self.multiplicity_info)
-            else:
-                newline = self.replaceToken(newline, "[CALL_CPYTHON_INIT]",
-                                            'C' + self.pythonClass + \
-                    ".__init__(self)\n        self.is_multifunc = False")
-                newline = self.replaceToken(newline,
-                                            "[MULTIPLICITY_INFO]", "None")
-
-            # fixed list  details
-            fixed_str = str(self.fixed)
-            fixed_str = fixed_str.replace(', ', ',\n                      ')
-            newline = self.replaceToken(newline, "[FIXED]", fixed_str)
-
-            # non-fittable list details
-            pars_str = str(self.non_fittable)
-            pars_str = pars_str.replace(', ',
-                                        ',\n                             ')
-            newline = self.replaceToken(newline,
-                                        "[NON_FITTABLE_PARAMS]", pars_str)
-
-            ## parameters with orientation
-            oriented_str = str(self.orientation_params)
-            formatted_endl = ',\n                                   '
-            oriented_str = oriented_str.replace(', ', formatted_endl)
-            newline = self.replaceToken(newline,
-                                        "[ORIENTATION_PARAMS]", oriented_str)
-            ## parameters with magnetism
-            newline = self.replaceToken(newline,
-                                        "[MAGNETIC_PARAMS]",
-                                        str(self.magnetic_params))
-
-            if self.category:
-                newline = self.replaceToken(newline, "[CATEGORY]",
-                                            '"' + self.category + '"')
-            else:
-                newline = self.replaceToken(newline, "[CATEGORY]",
-                                            "None")
-
-
-
-            # Write new line to the wrapper .c file
-            file.write(newline + '\n')
-
-        file.close()
-
-
-    def replaceToken(self, line, key, value): #pylint: disable-msg=R0201
-        """ Replace a token in the template file 
-            :param line: line of text to inspect
-            :param key: token to look for
-            :param value: string value to replace the token with
-            :return: new string value
-        """
-        _str_value = str(value)
-        _new_value = _str_value.replace('\\','/')
-        lenkey = len(key)
-        newline = line
-
-        while newline.count(key) > 0:
-            index = newline.index(key)
-            newline = newline[:index] + _new_value + newline[index + lenkey:]
-
-        return newline
-
-    def getModelName(self):
-        return self.pythonClass
-
-
-
-# main
-if __name__ == '__main__':
-    if len(sys.argv) > 1:
-        print "Will look for file %s" % sys.argv[1]
-        app = WrapperGenerator(sys.argv[1])
-    else:
-        app = WrapperGenerator("test.h")
-    app.read()
-    app.write_c_wrapper()
-    app.write_python_wrapper()
-    print app
-
-# End of file        
Index: c/sas/models/c_extension/python_wrapper/classTemplate.txt
===================================================================
--- src/sas/models/c_extension/python_wrapper/classTemplate.txt	(revision fd5ac0db8089df5bd882587f157d4bf317cfcf67)
+++ 	(revision )
@@ -1,507 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/** [PYTHONCLASS]
- *
- * C extension 
- *
- * WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
- *          DO NOT MODIFY THIS FILE, MODIFY [INCLUDE_FILE]
- *          AND RE-RUN THE GENERATOR SCRIPT
- *
- */
-#define NO_IMPORT_ARRAY
-#define PY_ARRAY_UNIQUE_SYMBOL PyArray_API_sas
- 
-extern "C" {
-#include <Python.h>
-#include <arrayobject.h>
-#include "structmember.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <time.h>
-[C_INCLUDE_FILE]
-}
-
-[CPP_INCLUDE_FILE]
-#include "dispersion_visitor.hh"
-
-/// Error object for raised exceptions
-static PyObject * [PYTHONCLASS]Error = NULL;
-
-
-// Class definition
-typedef struct {
-    PyObject_HEAD
-    /// Parameters
-    PyObject * params;
-    /// Dispersion parameters
-    PyObject * dispersion;
-    /// Underlying model object
-    [CMODEL] * model;
-    /// Log for unit testing
-    PyObject * log;
-} [PYTHONCLASS];
-
-
-static void
-[PYTHONCLASS]_dealloc([PYTHONCLASS]* self)
-{
-    Py_DECREF(self->params);
-    Py_DECREF(self->dispersion);
-    Py_DECREF(self->log);
-    delete self->model;
-    self->ob_type->tp_free((PyObject*)self);
-    [NUMERICAL_DEALLOC]
-}
-
-static PyObject *
-[PYTHONCLASS]_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
-{
-    [PYTHONCLASS] *self;
-    
-    self = ([PYTHONCLASS] *)type->tp_alloc(type, 0);
-   
-    return (PyObject *)self;
-}
-
-static int
-[PYTHONCLASS]_init([PYTHONCLASS] *self, PyObject *args, PyObject *kwds)
-{
-    if (self != NULL) {
-    	
-    	// Create parameters
-        self->params = PyDict_New();
-        self->dispersion = PyDict_New();
-
-	[INITIALIZE_MODEL]
-
-        [INITDICTIONARY]
-         
-        // Create empty log
-        self->log = PyDict_New();
-        
-        [NUMERICAL_INIT]
-    }
-    return 0;
-}
-
-static char name_params[] = "params";
-static char def_params[] = "Parameters";
-static char name_dispersion[] = "dispersion";
-static char def_dispersion[] = "Dispersion parameters";
-static char name_log[] = "log";
-static char def_log[] = "Log";
-
-static PyMemberDef [PYTHONCLASS]_members[] = {
-    {name_params, T_OBJECT, offsetof([PYTHONCLASS], params), 0, def_params},
-	{name_dispersion, T_OBJECT, offsetof([PYTHONCLASS], dispersion), 0, def_dispersion},     
-    {name_log, T_OBJECT, offsetof([PYTHONCLASS], log), 0, def_log},
-    {NULL}  /* Sentinel */
-};
-
-/** Read double from PyObject
-    @param p PyObject
-    @return double
-*/
-double [PYTHONCLASS]_readDouble(PyObject *p) {
-    if (PyFloat_Check(p)==1) {
-        return (double)(((PyFloatObject *)(p))->ob_fval);
-    } else if (PyInt_Check(p)==1) {
-        return (double)(((PyIntObject *)(p))->ob_ival);
-    } else if (PyLong_Check(p)==1) {
-        return (double)PyLong_AsLong(p);
-    } else {
-        return 0.0;
-    }
-}
-/**
- * Function to call to evaluate model
- * @param args: input numpy array q[] 
- * @return: numpy array object 
- */
- 
-static PyObject *evaluateOneDim([CMODEL]* model, PyArrayObject *q){
-    PyArrayObject *result;
-   
-    // Check validity of array q , q must be of dimension 1, an array of double
-    if (q->nd != 1 || q->descr->type_num != PyArray_DOUBLE)
-    {
-        //const char * message= "Invalid array: q->nd=%d,type_num=%d\n",q->nd,q->descr->type_num;
-        //PyErr_SetString(PyExc_ValueError , message);
-        return NULL;
-    }
-    result = (PyArrayObject *)PyArray_FromDims(q->nd, (int *)(q->dimensions), PyArray_DOUBLE);
-	if (result == NULL) {
-        const char * message= "Could not create result ";
-        PyErr_SetString(PyExc_RuntimeError , message);
-		return NULL;
-	}
-#pragma omp parallel for
-	 for (int i = 0; i < q->dimensions[0]; i++){
-      double q_value  = *(double *)(q->data + i*q->strides[0]);
-      double *result_value = (double *)(result->data + i*result->strides[0]);
-      *result_value =(*model)(q_value);
-	}
-    return PyArray_Return(result); 
- }
-
- /**
- * Function to call to evaluate model
- * @param args: input numpy array  [x[],y[]]
- * @return: numpy array object 
- */
- static PyObject * evaluateTwoDimXY( [CMODEL]* model, 
-                              PyArrayObject *x, PyArrayObject *y)
- {
-    PyArrayObject *result;
-    int x_len, y_len, dims[1];
-    //check validity of input vectors
-    if (x->nd != 1 || x->descr->type_num != PyArray_DOUBLE
-        || y->nd != 1 || y->descr->type_num != PyArray_DOUBLE
-        || y->dimensions[0] != x->dimensions[0]){
-        const char * message= "evaluateTwoDimXY  expect 2 numpy arrays";
-        PyErr_SetString(PyExc_ValueError , message); 
-        return NULL;
-    }
-   
-	if (PyArray_Check(x) && PyArray_Check(y)) {
-		
-	    x_len = dims[0]= x->dimensions[0];
-        y_len = dims[0]= y->dimensions[0];
-	    
-	    // Make a new double matrix of same dims
-        result=(PyArrayObject *) PyArray_FromDims(1,dims,NPY_DOUBLE);
-        if (result == NULL){
-	    const char * message= "Could not create result ";
-        PyErr_SetString(PyExc_RuntimeError , message);
-	    return NULL;
-	    }
-       
-        /* Do the calculation. */
-#pragma omp parallel for
-        for (int i=0; i< x_len; i++) {
-            double x_value = *(double *)(x->data + i*x->strides[0]);
-  		    double y_value = *(double *)(y->data + i*y->strides[0]);
-  			double *result_value = (double *)(result->data +
-  			      i*result->strides[0]);
-  			*result_value = (*model)(x_value, y_value);
-        }           
-        return PyArray_Return(result); 
-        
-        }else{
-		    PyErr_SetString([PYTHONCLASS]Error, 
-                   "[PYTHONCLASS].evaluateTwoDimXY couldn't run.");
-	        return NULL;
-		}      	
-}
-/**
- *  evalDistribution function evaluate a model function with input vector
- *  @param args: input q as vector or [qx, qy] where qx, qy are vectors
- *
- */ 
-static PyObject * evalDistribution([PYTHONCLASS] *self, PyObject *args){
-	PyObject *qx, *qy;
-	PyArrayObject * pars;
-	int npars ,mpars;
-	
-	// Get parameters
-	
-	[READDICTIONARY]
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString([PYTHONCLASS]Error, 
-	    	"[PYTHONCLASS].evalDistribution expects a q value.");
-		return NULL;
-	}
-    // Check params
-	
-    if(PyArray_Check(pars)==1) {
-		
-	    // Length of list should 1 or 2
-	    npars = pars->nd; 
-	    if(npars==1) {
-	        // input is a numpy array
-	        if (PyArray_Check(pars)) {
-		        return evaluateOneDim(self->model, (PyArrayObject*)pars); 
-		    }
-		}else{
-		    PyErr_SetString([PYTHONCLASS]Error, 
-                   "[PYTHONCLASS].evalDistribution expect numpy array of one dimension.");
-	        return NULL;
-		}
-    }else if( PyList_Check(pars)==1) {
-    	// Length of list should be 2 for I(qx,qy)
-	    mpars = PyList_GET_SIZE(pars); 
-	    if(mpars!=2) {
-	    	PyErr_SetString([PYTHONCLASS]Error, 
-	    		"[PYTHONCLASS].evalDistribution expects a list of dimension 2.");
-	    	return NULL;
-	    }
-	     qx = PyList_GET_ITEM(pars,0);
-	     qy = PyList_GET_ITEM(pars,1);
-	     if (PyArray_Check(qx) && PyArray_Check(qy)) {
-	         return evaluateTwoDimXY(self->model, (PyArrayObject*)qx,
-		           (PyArrayObject*)qy);
-		 }else{
-		    PyErr_SetString([PYTHONCLASS]Error, 
-                   "[PYTHONCLASS].evalDistribution expect 2 numpy arrays in list.");
-	        return NULL;
-	     }
-	}
-	PyErr_SetString([PYTHONCLASS]Error, 
-                   "[PYTHONCLASS].evalDistribution couln't be run.");
-	return NULL;
-	
-}
-
-/**
- * Function to call to evaluate model
- * @param args: input q or [q,phi]
- * @return: function value
- */
-static PyObject * run([PYTHONCLASS] *self, PyObject *args) {
-	double q_value, phi_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	[READDICTIONARY]
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString([PYTHONCLASS]Error, 
-	    	"[PYTHONCLASS].run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(q,phi)
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString([PYTHONCLASS]Error, 
-	    		"[PYTHONCLASS].run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the q and phi values at which
-	    // to evaluate I(q,phi)
-	    q_value = [PYTHONCLASS]_readDouble(PyList_GET_ITEM(pars,0));
-	    phi_value = [PYTHONCLASS]_readDouble(PyList_GET_ITEM(pars,1));
-	    // Skip zero
-	    if (q_value==0) {
-	    	return Py_BuildValue("d",0.0);
-	    }
-		return Py_BuildValue("d",(*(self->model)).evaluate_rphi(q_value,phi_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		q_value = [PYTHONCLASS]_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(q_value));
-	}	
-}
-/**
- * Function to call to calculate_ER
- * @return: effective radius value 
- */
-static PyObject * calculate_ER([PYTHONCLASS] *self) {
-
-	// Get parameters
-	
-	[READDICTIONARY]
-		
-	return Py_BuildValue("d",(*(self->model)).calculate_ER());
-
-}
-/**
- * Function to call to cal the ratio shell volume/ total volume
- * @return: the ratio shell volume/ total volume 
- */
-static PyObject * calculate_VR([PYTHONCLASS] *self) {
-
-	// Get parameters
-	
-	[READDICTIONARY]
-		
-	return Py_BuildValue("d",(*(self->model)).calculate_VR());
-
-}
-/**
- * Function to call to evaluate model in cartesian coordinates
- * @param args: input q or [qx, qy]]
- * @return: function value
- */
-static PyObject * runXY([PYTHONCLASS] *self, PyObject *args) {
-	double qx_value, qy_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	[READDICTIONARY]
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString([PYTHONCLASS]Error, 
-	    	"[PYTHONCLASS].run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(qx, qy))
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString([PYTHONCLASS]Error, 
-	    		"[PYTHONCLASS].run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the qx and qy values at which
-	    // to evaluate I(qx,qy)
-	    qx_value = [PYTHONCLASS]_readDouble(PyList_GET_ITEM(pars,0));
-	    qy_value = [PYTHONCLASS]_readDouble(PyList_GET_ITEM(pars,1));
-	    return Py_BuildValue("d",(*(self->model))(qx_value,qy_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		qx_value = [PYTHONCLASS]_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(qx_value));
-	}	
-}
-
-static PyObject * reset([PYTHONCLASS] *self, PyObject *args) {
-    [NUMERICAL_RESET]
-    return Py_BuildValue("d",0.0);
-}
-
-static PyObject * set_dispersion([PYTHONCLASS] *self, PyObject *args) {
-	PyObject * disp;
-	const char * par_name;
-
-	if ( !PyArg_ParseTuple(args,"sO", &par_name, &disp) ) {
-	    PyErr_SetString([PYTHONCLASS]Error,
-	    	"[PYTHONCLASS].set_dispersion expects a DispersionModel object.");
-		return NULL;
-	}
-	void *temp = PyCObject_AsVoidPtr(disp);
-	DispersionModel * dispersion = static_cast<DispersionModel *>(temp);
-
-
-	// Ugliness necessary to go from python to C
-	[SET_DISPERSION] {
-	    PyErr_SetString([PYTHONCLASS]Error,
-	    	"[PYTHONCLASS].set_dispersion expects a valid parameter name.");
-		return NULL;
-	}
-
-	DispersionVisitor* visitor = new DispersionVisitor();
-	PyObject * disp_dict = PyDict_New();
-	dispersion->accept_as_source(visitor, dispersion, disp_dict);
-	PyDict_SetItemString(self->dispersion, par_name, disp_dict);
-    return Py_BuildValue("i",1);
-}
-
-
-static PyMethodDef [PYTHONCLASS]_methods[] = {
-    {"run",      (PyCFunction)run     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-    {"runXY",      (PyCFunction)runXY     , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy"},
-    {"calculate_ER",      (PyCFunction)calculate_ER     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-    {"calculate_VR",      (PyCFunction)calculate_VR     , METH_VARARGS,
-      "Evaluate VR"},    
-    {"evalDistribution",  (PyCFunction)evalDistribution , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy vector "},
-    {"reset",    (PyCFunction)reset   , METH_VARARGS,
-      "Reset pair correlation"},
-    {"set_dispersion",      (PyCFunction)set_dispersion     , METH_VARARGS,
-      "Set the dispersion model for a given parameter"},
-   {NULL}
-};
-
-static PyTypeObject [PYTHONCLASS]Type = {
-    PyObject_HEAD_INIT(NULL)
-    0,                         /*ob_size*/
-    "[PYTHONCLASS]",             /*tp_name*/
-    sizeof([PYTHONCLASS]),             /*tp_basicsize*/
-    0,                         /*tp_itemsize*/
-    (destructor)[PYTHONCLASS]_dealloc, /*tp_dealloc*/
-    0,                         /*tp_print*/
-    0,                         /*tp_getattr*/
-    0,                         /*tp_setattr*/
-    0,                         /*tp_compare*/
-    0,                         /*tp_repr*/
-    0,                         /*tp_as_number*/
-    0,                         /*tp_as_sequence*/
-    0,                         /*tp_as_mapping*/
-    0,                         /*tp_hash */
-    0,                         /*tp_call*/
-    0,                         /*tp_str*/
-    0,                         /*tp_getattro*/
-    0,                         /*tp_setattro*/
-    0,                         /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
-    "[PYTHONCLASS] objects",           /* tp_doc */
-    0,		               /* tp_traverse */
-    0,		               /* tp_clear */
-    0,		               /* tp_richcompare */
-    0,		               /* tp_weaklistoffset */
-    0,		               /* tp_iter */
-    0,		               /* tp_iternext */
-    [PYTHONCLASS]_methods,             /* tp_methods */
-    [PYTHONCLASS]_members,             /* tp_members */
-    0,                         /* tp_getset */
-    0,                         /* tp_base */
-    0,                         /* tp_dict */
-    0,                         /* tp_descr_get */
-    0,                         /* tp_descr_set */
-    0,                         /* tp_dictoffset */
-    (initproc)[PYTHONCLASS]_init,      /* tp_init */
-    0,                         /* tp_alloc */
-    [PYTHONCLASS]_new,                 /* tp_new */
-};
-
-
-//static PyMethodDef module_methods[] = {
-//    {NULL} 
-//};
-
-/**
- * Function used to add the model class to a module
- * @param module: module to add the class to
- */ 
-void add[PYTHONCLASS](PyObject *module) {
-	PyObject *d;
-	
-    if (PyType_Ready(&[PYTHONCLASS]Type) < 0)
-        return;
-
-    Py_INCREF(&[PYTHONCLASS]Type);
-    PyModule_AddObject(module, "[PYTHONCLASS]", (PyObject *)&[PYTHONCLASS]Type);
-    
-    d = PyModule_GetDict(module);
-    static char error_name[] = "[PYTHONCLASS].error";
-    [PYTHONCLASS]Error = PyErr_NewException(error_name, NULL, NULL);
-    PyDict_SetItemString(d, "[PYTHONCLASS]Error", [PYTHONCLASS]Error);
-}
Index: c/sas/models/c_extension/python_wrapper/lineparser.py
===================================================================
--- src/sas/models/c_extension/python_wrapper/lineparser.py	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,215 +1,0 @@
-#!/usr/bin/env python
-""" WrapperGenerator class to generate model code automatically.
-"""
-
-import os, sys,re
-def split_list(separator, mylist, n=0):
-    """
-        @return a list of string without white space of separator
-        @param separator: the string to remove
-    """
-    list=[]
-    for item in mylist:
-        if re.search( separator,item)!=None:
-            if n >0:
-                word =re.split(separator,item,int(n))
-            else:
-                word =re.split( separator,item)
-            for new_item in word: 
-                if new_item.lstrip().rstrip() !='':
-                    list.append(new_item.lstrip().rstrip())
-    return list
-def split_text(separator, string1, n=0):
-    """
-        @return a list of string without white space of separator
-        @param separator: the string to remove
-    """
-    list=[]
-    if re.search( separator,string1)!=None:
-        if n >0:
-            word =re.split(separator,string1,int(n))
-        else:
-            word =re.split(separator,string1)
-        for item in word: 
-            if item.lstrip().rstrip() !='':
-                list.append(item.lstrip().rstrip())
-    return list
-def look_for_tag( string1,begin, end=None ):
-    """
-        @note: this method  remove the begin and end tags given by the user
-        from the string .
-        @param begin: the initial tag
-        @param end: the final tag
-        @param string: the string to check
-        @return: begin_flag==True if begin was found,
-         end_flag==if end was found else return false, false
-         
-    """
-    begin_flag= False
-    end_flag= False
-    if  re.search( begin,string1)!=None:
-        begin_flag= True
-    if end !=None:
-        if  re.search(end,string1)!=None:
-            end_flag= True
-    return begin_flag, end_flag
-
-
-  
-def readhelper(lines, key, key2, key3 , file):
-  
-    temp=""
-    # flag to found key
-    find_fixed= False
-    find_key2=False
-    find_key3=False
-    listtofill=[]
-    for line in lines:
-        if line.count(key.lstrip().rstrip())>0 :#[FIXED]= .....
-            try:
-                find_fixed= True
-                index = line.index(key)
-                toks  = line[index:].split("=",1 )
-                temp  = toks[1].lstrip().rstrip()
-                find_key2, find_key3=look_for_tag( string1=temp,
-                                                   begin=key2, end=key3 )
-                if find_key2 and find_key3:
-                    temp1=[]
-                    temp2=[]
-                    temp3=[]
-                    temp4=[]
-                    temp1=split_text(separator=key2, string1=temp)
-                    temp2=split_list(separator=key3, mylist=temp1)
-                    temp3=split_list(separator=';', mylist=temp2)
-                    temp4=split_list(separator=',', mylist=temp3)
-                    listtofill= temp3 + temp4
-                    return listtofill
-                    
-                    
-                elif find_key2 and not find_key3:
-                    ## [key]= key2(<text>)
-                    ##        ....
-                    ##        key3(<text>)
-                    temp1=[]
-                    temp2=[]
-                    temp3=[]
-                    temp4=[]
-                    ## remove key2= <text>
-                    temp1=split_text(separator=key2, string1=temp)
-                    
-                    ## split ";" first
-                    temp3=split_list(separator=';', mylist=temp1)
-                    temp4=split_list(separator=',', mylist=temp3)
-            
-                    if len(temp3 + temp4)==0:
-                        # [FIXED]=  only one param
-                        listtofill+= temp1
-                    listtofill += temp3+temp4 
-               
-                elif not find_key2 and not find_key3 :
-                    ## [key]= param done looking
-                    temp3=[]
-                    temp4=[]
-                    if look_for_tag( string1=temp,begin=";")[0]:
-                        ## split ";" first
-                        temp3=split_text(separator=';',string1=temp)
-                        temp4=split_list(separator=',', mylist=temp3)
-                    else:
-                        ## slip "," first
-                        temp3=split_text(separator=',',string1=temp)
-                        temp4=split_list(separator=';', mylist=temp3)
-                    if len(temp3+ temp4)==0:
-                        ## [FIXED]=  only one param
-                        if temp.lstrip().rstrip()!="":
-                            listtofill= [temp.lstrip().rstrip()]
-                        
-                    listtofill += temp3+temp4
-                    return listtofill
-            except:
-                raise ValueError, "Could not parse file %s" % file
-        
-        elif find_fixed :
-            if not find_key2:
-                raise ValueError, "Could not parse file %s" % file
-            if find_key3:
-                temp1=[]
-                temp2=[]
-                temp3=[]
-                temp4=[]
-                temp5=[]
-               
-                temp1=split_text(separator=key3, string1=line)
-                temp2=split_list(separator='//',mylist=temp1)
-                temp5=split_list(separator="\*",mylist=temp1)
-                
-                if len(temp5)>0:
-                    temp3=split_list(separator=';',mylist=temp5)
-                    temp4=split_list(separator=',', mylist=temp5)
-                elif len(temp2)>0:
-                    temp3=split_list(separator=';',mylist=temp2)
-                    temp4=split_list(separator=',', mylist=temp2)
-                else:
-                    temp3=split_list(separator=';',mylist=temp1)
-                    temp4=split_list(separator=',', mylist=temp1)
-                
-                if len(temp3 + temp4)==0:# [FIXED]=  only one param
-                    listtofill += temp1
-                listtofill+=temp3+temp4 #   
-                break
-            
-            else:
-                temp2=split_text(separator='//', string1=line)
-                temp5=split_text(separator="\*", string1=line)
-                if len(temp5)>0:
-                    temp3=split_list(separator=';', mylist=temp5)
-                    temp4=split_list(separator=',', mylist=temp5)
-                elif len(temp2)>0:
-                    temp3=split_list(separator=';', mylist=temp2)
-                    temp4=split_list(separator=',', mylist=temp2)
-                else:
-                    if look_for_tag( string1=line,begin=";")[0]:# split ";" first
-                        temp3=split_text(separator=';', string1=line)
-                        temp4=split_list(separator=',', mylist=temp3)
-                    else:
-                        temp3=split_text(separator=',', string1=line)# slip "," first
-                        temp4=split_list(separator=';', mylist=temp3)
-                if len(temp3+ temp4)==0:# [FIXED]=  only one param
-                    if line.lstrip().rstrip()!="":
-                        listtofill=[line.lstrip().rstrip()]
-                listtofill+=temp3+temp4 #
-                break
-    return listtofill
-   
-# main
-if __name__ == '__main__':
-    
-    # Read file
-    name= "sphere.h"
-    f = open("..\include\core_shell.h",'r')
-    buf = f.read()
-  
-    lines = buf.split('\n')
-  
-    ## Catch Fixed parameters
-    key = "[FIXED]"
-    #open item in this case Fixed
-    text='text'
-    key2="<%s>"%text.lower()
-    # close an item in this case fixed
-    text='TexT'
-    key3="</%s>"%text.lower()
-    listto=[]
-   
-    listto= readhelper(lines, key, key2,key3, file=name)
-    print "fixed parameters\n ",listto
-    print 
-    
-   
-    key0="[ORIENTATION_PARAMS]"
-   
-    listto=[]
-    listto= readhelper(lines,key0, key2,key3, file=name)
-    print "orientation parameters\n ",listto
-    print 
-    f.close()
-# End of file        
Index: c/sas/models/c_extension/python_wrapper/modelTemplate.txt
===================================================================
--- src/sas/models/c_extension/python_wrapper/modelTemplate.txt	(revision 1f5f206cb54d8f1284dcdc7778dd1c77213dd744)
+++ 	(revision )
@@ -1,151 +1,0 @@
-##############################################################################
-# This software was developed by the University of Tennessee as part of the
-# Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-# project funded by the US National Science Foundation.
-#
-# If you use DANSE applications to do scientific research that leads to
-# publication, we ask that you acknowledge the use of the software with the
-# following sentence:
-#
-# This work benefited from DANSE software developed under NSF award DMR-0520547
-#
-# Copyright 2008-2011, University of Tennessee
-##############################################################################
-
-"""
-Provide functionality for a C extension model
-
-.. WARNING::
-   THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
-   DO NOT MODIFY THIS FILE, MODIFY
-   [INCLUDE_FILE]
-   AND RE-RUN THE GENERATOR SCRIPT
-"""
-
-from sas.models.BaseComponent import BaseComponent
-from sas.models.sas_extension.c_models import [CPYTHONCLASS]
-from numpy import inf
-
-def create_[PYTHONCLASS]():
-    """
-    Create a model instance
-    """
-    obj = [PYTHONCLASS]()
-    # [CPYTHONCLASS].__init__(obj) is called by
-    # the [PYTHONCLASS] constructor
-    return obj
-
-class [PYTHONCLASS]([CPYTHONCLASS], BaseComponent):
-    """
-    Class that evaluates a [PYTHONCLASS] model.
-    This file was auto-generated from [INCLUDE_FILE].
-    Refer to that file and the structure it contains
-    for details of the model.
-    [DEFAULT_LIST]
-    """
-
-    def __init__(self, multfactor=1):
-        """ Initialization """
-        self.__dict__ = {}
-
-        # Initialize BaseComponent first, then sphere
-        BaseComponent.__init__(self)
-        #apply([CPYTHONCLASS].__init__, (self,)) 
-
-        [CALL_CPYTHON_INIT]
-
-        ## Name of the model
-        self.name = "[PYTHONCLASS]"
-        ## Model description
-        self.description = """
-        [DESCRIPTION]
-        """
-
-        [PAR_DETAILS]
-        ## fittable parameters
-        self.fixed = [FIXED]
-
-        ## non-fittable parameters
-        self.non_fittable = [NON_FITTABLE_PARAMS]
-
-        ## parameters with orientation
-        self.orientation_params = [ORIENTATION_PARAMS]
-
-        ## parameters with magnetism
-        self.magnetic_params = [MAGNETIC_PARAMS]
-
-        self.category = [CATEGORY]
-        self.multiplicity_info = [MULTIPLICITY_INFO]
-
-    def __setstate__(self, state):
-        """
-        restore the state of a model from pickle
-        """
-        self.__dict__, self.params, self.dispersion = state
-
-    def __reduce_ex__(self, proto):
-        """
-        Overwrite the __reduce_ex__ of PyTypeObject *type call in the init of
-        c model.
-        """
-        state = (self.__dict__, self.params, self.dispersion)
-        return (create_[PYTHONCLASS], tuple(), state, None, None)
-
-    def clone(self):
-        """ Return a identical copy of self """
-        return self._clone([PYTHONCLASS]())
-
-    def run(self, x=0.0):
-        """
-        Evaluate the model
-
-        :param x: input q, or [q,phi]
-        :return: scattering function P(q)
-        """
-        return [CPYTHONCLASS].run(self, x)
-
-    def runXY(self, x=0.0):
-        """
-        Evaluate the model in cartesian coordinates
-
-        :param x: input q, or [qx, qy]
-        :return: scattering function P(q)
-        """
-        return [CPYTHONCLASS].runXY(self, x)
-
-    def evalDistribution(self, x):
-        """
-        Evaluate the model in cartesian coordinates
-
-        :param x: input q[], or [qx[], qy[]]
-        :return: scattering function P(q[])
-        """
-        return [CPYTHONCLASS].evalDistribution(self, x)
-
-    def calculate_ER(self):
-        """
-        Calculate the effective radius for P(q)*S(q)
-
-        :return: the value of the effective radius
-        """
-        return [CPYTHONCLASS].calculate_ER(self)
-
-    def calculate_VR(self):
-        """
-        Calculate the volf ratio for P(q)*S(q)
-
-        :return: the value of the volf ratio
-        """
-        return [CPYTHONCLASS].calculate_VR(self)
-
-    def set_dispersion(self, parameter, dispersion):
-        """
-        Set the dispersion object for a model parameter
-
-        :param parameter: name of the parameter [string]
-        :param dispersion: dispersion object of type DispersionModel
-        """
-        return [CPYTHONCLASS].set_dispersion(self,
-               parameter, dispersion.cdisp)
-
-# End of file
Index: c/sas/models/c_extension/python_wrapper/wrapping.py
===================================================================
--- src/sas/models/c_extension/python_wrapper/wrapping.py	(revision fd5ac0db8089df5bd882587f157d4bf317cfcf67)
+++ 	(revision )
@@ -1,69 +1,0 @@
-import sys
-import os
-import os.path
-from WrapperGenerator import WrapperGenerator
-
-def generate_wrappers(header_dir, output_dir='.', c_wrapper_dir='.'):
-    nModels=0
-    model_list = list()
-
-    for item in os.listdir(header_dir):
-        toks = os.path.splitext(os.path.basename(item))
-        if toks[1]=='.h':
-            nModels += 1
-            name = toks[0]
-            app = WrapperGenerator(os.path.join(header_dir, name+".h"), 
-                                   output_dir=output_dir,
-                                   c_wrapper_dir=c_wrapper_dir)
-            app.read()
-            app.write_c_wrapper()
-            app.write_python_wrapper()
-            model_list.append(app.getModelName())
-    write_c_models(model_list)
-    print "Total number of model  wrappers created is %s" % nModels
-
-def write_c_models(model_list):
-    # simultaneously generates 'sasmodels/installed_models.txt'
-    # and 'sasmodels/src/c_models/c_models.cpp'
-    
-
-    template_file = open(os.path.join("src", "sas", "models","c_extension","c_models","c_models.cpp.template"),"r")
-    write_file = open(os.path.join("src", "sas",  "models","c_extension","c_models","c_models.cpp"),"w")
-    buf = template_file.read()
-    lines = buf.split('\n')
-    
-    tag1 = "[TAG_1]"
-    tag2 = "[TAG_2]"
-    
-    for line in lines:
-        
-        if line.count(tag1) > 0:
-            write_file.write("\n // adding generated code \n")
-            for pyclass in model_list:
-                write_file.write("void addC" + pyclass
-                                 + "(PyObject *module); \n")
-            write_file.write(" // end generated code \n")
-                
-
-        elif line.count(tag2) > 0:
-            write_file.write("\n // adding generated code \n")
-
-            for pyclass in model_list:
-                write_file.write("addC" + pyclass + "(m); \n")
-
-            write_file.write("addDisperser(m); \n")
-            write_file.write("\n // end generated code \n")
-                
-                
-        else:
-            write_file.write(line + "\n")
-
-
-
-if __name__ == '__main__':
-    header_dir = os.path.join('..', 'include')
-    generate_wrappers(header_dir, output_dir="../sas/models/", c_wrapper_dir='.')
-
-
-
-
Index: c/sas/models/c_extension/release_notes.txt
===================================================================
--- src/sas/models/c_extension/release_notes.txt	(revision fd5ac0db8089df5bd882587f157d4bf317cfcf67)
+++ 	(revision )
@@ -1,105 +1,0 @@
-Release Notes
-=============
-
-SAS Models version 0.4.3
-
-Package name: sans.models 
-
-1- What's New in Version 0.4.3
-    - Release date: April 21, 2009
-    - C extension models now use new C++ classes that incorporate dispersity and averaging
-      functionality. See utest_dispersity.py for examples of how to use the new dispersion
-      classes.
-      
-      # Create a model
-      model= CylinderModel()
-      
-      # Create a dispersion model
-      disp = GaussianDispersion()
-      
-	  # Set the dispersion for a chosen parameter
-	  model.set_dispersion('radius', disp)
-	  
-	  # Set the parameters of the dispersion model
-      model.dispersion['radius']['width'] = 5.0
-      model.dispersion['radius']['npts'] = 100
-
-
-    Version 0.4.3
-    -P(Q)*S(Q) added for P(Q)=cylinder, sphere, ellipsoid
-    -Array dispersion (user defined) added
-
-    Version 0.4.2
-    -4 Structure factors added
-    
-    Version 0.4.1
-    - Release date: 6/9/2008
-    - Modified non-shape models so that the 2D output is the 1D output for the length of Q
-
-    Version 0.4.0
-	- Release date: 4/15/2008
-	- Added shape-independent models.
-	
-	Version 0.3.2:
-	- Release date: 2/14/2008
-	- Added models to be used in magnetic analysis.
-
-
-2- Downloading and Installing
-
-	2.1- System Requirements:
-		- Python version >= 2.5 and < 3.0 should be running on the system
-
-
-	2.2- Installing:
-		- Get the code from svn://danse.us/sans/releases/sansmodels-0.4.3
-		- Execute the following: 
-			python setup.py install
-
-3- Known Issues
-
-	3.1- All systems:
-		- Q range validity of I(q) calculations.
-			Our 1D models of I(q) use the function of the NCNR library 
-			for their IGOR package (Klein, 2006). That library uses a
-			fast integration technique in some of its models (cylinders
-			and ellipsoids). Integration is done using 76 points in the
-			angle between the axis of the object and the q-vector, which
-			translates in a larger inaccuracy at high q. Integratiing
-			the 2D model I(q,phi) over all orientations of the object
-			will not yield the exact same result as the NCNR calculation
-			for q > 0.3 A-1.
-		- Refactoring needs to be done to update the model base class.
-		  We should get rid of the useless arithmetics and store the parameters
-		  as class objects rather than values. This would eliminate the multitude
-		  of dictionaries needed to store all the various aspects of a parameter
-		  (limits, units, dispersity information). The C++ design it relies
-		  on is much cleaner in that respect, but it still depends on the old
-		  C computation. Those should be incorporated in the C++ classes.
-
-	3.2- Windows:
-		- None
-
-	3.3- Linux:
-		- None
-
-4- Troubleshooting
-
-	- None
-
-5- Frequently Asked Questions
-
-	- None
-
-6- Other Resources
-
-	- See: http://danse.us/trac/sans/wiki/8_2_2_1DModelFitting
-	- See: http://danse.us/trac/sans/wiki/8_2_3_2DModeling
-	- See: http://danse.us/trac/sans/wiki/8_2_6_model_extensions
-	- See: http://danse.us/trac/sans/wiki/8_2_1Nonshape_models
-
-	
-
-	
-
-
Index: c/sas/models/media/olddocs/list-of-links.txt
===================================================================
--- src/sas/models/media/olddocs/list-of-links.txt	(revision c9c718afc415c160fe0caed7ef47e971a7998a0a)
+++ 	(revision )
@@ -1,92 +1,0 @@
-
----------- MODEL_FUNCTIONS.RST
-.. _Background:
-.. _here: polar_mag_help.html
-.. _Model:
-.. _Shape-based:
-.. _Shape-independent:
-.. _Structure-factor:
-.. _Customised:
-.. _References:
-.. _SphereModel:
-.. _here: polar_mag_help.html
-.. _BinaryHSModel:
-.. _FuzzySphereModel:
-.. _RaspBerryModel:
-.. _CoreShellModel:
-.. _CoreMultiShellModel:
-.. _Core2ndMomentModel:
-.. _MultiShellModel:
-.. _OnionExpShellModel:
-.. _VesicleModel:
-.. _SphericalSLDModel:
-.. _LinearPearlsModel:
-.. _PearlNecklaceModel:
-.. _CylinderModel:
-.. _HollowCylinderModel:
-.. _CappedCylinderModel:
-.. _CoreShellCylinderModel:
-.. _EllipticalCylinderModel:
-.. _FlexibleCylinderModel:
-.. _FlexCylEllipXModel:
-.. _CoreShellBicelleModel:
-.. _BarBellModel:
-.. _StackedDisksModel:
-.. _PringleModel:
-.. _EllipsoidModel:
-.. _CoreShellEllipsoidModel:
-.. _CoreShellEllipsoidXTModel:
-.. _TriaxialEllipsoidModel:
-.. _LamellarModel:
-.. _LamellarFFHGModel:
-.. _LamellarPSModel:
-.. _LamellarPSHGModel:
-.. _LamellarPCrystalModel:
-.. _SCCrystalModel:
-.. _FCCrystalModel:
-.. _BCCrystalModel:
-.. _ParallelepipedModel:
-.. _CSParallelepipedModel:
-.. _RectangularPrismModel:
-.. _RectangularHollowPrismModel:
-.. _RectangularHollowPrismInfThinWallsModel:
-.. _Debye:
-.. _BroadPeakModel:
-.. _CorrLength:
-.. _Lorentz:
-.. _DABModel:
-.. _AbsolutePower_Law:
-.. _TeubnerStrey:
-.. _FractalModel:
-.. _MassFractalModel:
-.. _SurfaceFractalModel:
-.. _MassSurfaceFractal:
-.. _FractalCoreShell:
-.. _GaussLorentzGel:
-.. _BEPolyelectrolyte:
-.. _Guinier:
-.. _GuinierPorod:
-.. _PorodModel:
-.. _PeakGaussModel:
-.. _PeakLorentzModel:
-.. _Poly_GaussCoil:
-.. _PolyExclVolume:
-.. _RPA10Model:
-.. _TwoLorentzian:
-.. _TwoPowerLaw:
-.. _UnifiedPowerRg:
-.. _LineModel:
-.. _GelFitModel:
-.. _StarPolymer:
-.. _ReflectivityModel:
-.. _ReflectivityIIModel:
-.. _HardSphereStructure:
-.. _SquareWellStructure:
-.. _HayterMSAStructure:
-.. _StickyHSStructure:
-.. _testmodel:
-.. _testmodel_2:
-.. _sum_p1_p2:
-.. _sum_Ap1_1_Ap2:
-.. _polynomial5:
-.. _sph_bessel_jn:
Index: c/sas/models/media/olddocs/mag_pic.html
===================================================================
--- src/sas/models/media/olddocs/mag_pic.html	(revision c9c718afc415c160fe0caed7ef47e971a7998a0a)
+++ 	(revision )
@@ -1,3 +1,0 @@
-<body>
-<img src="img/M_angles_pic.bmp">
-</body>
Index: c/sas/models/media/olddocs/model_functions.rst
===================================================================
--- src/sas/models/media/olddocs/model_functions.rst	(revision 02d7952c33cbc71069f568d8f4bad0951927542a)
+++ 	(revision )
@@ -1,4918 +1,0 @@
-.. model_functions.rst
-
-.. This is a port of the original SasView model_functions.html to ReSTructured text
-.. by S King, ISIS, during and after SasView CodeCamp-II in April 2014.
-
-.. Thanks are due to A Jackson & P Kienzle for advice on RST!
-
-.. The CoreShellEllipsoidXTModel was ported and documented by R K Heenan, ISIS, Apr 2014
-.. The RectangularPrism models were coded and documented by M A Gonzalez, ILL, Apr 2014
-
-.. To do:
-.. Add example parameters/plots for the CoreShellEllipsoidXTModel
-.. Add example parameters/plots for the RectangularPrism models
-.. Check the content against the NIST Igor Help File
-.. Wordsmith the content for consistency of style, etc
-
-
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-
-.. note::  The contents of this document are presented in good faith and are 
-           believed to be mostly correct and accurate, however they have not 
-           yet been rigorously checked for errors. June2015
-
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-
-
-.. Actual document starts here...
-
-.. _SasView_model_functions:
-
-SasView Model Functions
-=======================
-
-.. _Background:
-
-1. Background
----------------
-
-Many of our models use the form factor calculations implemented in a c-library provided by the NIST Center for Neutron
-Research and thus some content and figures in this document are originated from or shared with the NIST SANS Igor-based
-analysis package.
-
-This software provides form factors for various particle shapes. After giving a mathematical definition of each model,
-we show the list of parameters available to the user. Validation plots for each model are also presented.
-
-Instructions on how to use SasView itself are available separately.
-
-To easily compare to the scattering intensity measured in experiments, we normalize the form factors by the volume of
-the particle
-
-.. image:: ..\img\olddocs\image001.PNG
-
-with
-
-.. image:: ..\img\olddocs\image002.PNG
-
-where |P0|\ *(q)* is the un-normalized form factor, |rho|\ *(r)* is the scattering length density at a given
-point in space and the integration is done over the volume *V* of the scatterer.
-
-For systems without inter-particle interference, the form factors we provide can be related to the scattering intensity
-by the particle volume fraction
-
-.. image:: ..\img\olddocs\image003.PNG
-
-Our so-called 1D scattering intensity functions provide *P(q)* for the case where the scatterer is randomly oriented. In
-that case, the scattering intensity only depends on the length of *q* . The intensity measured on the plane of the SAS
-detector will have an azimuthal symmetry around *q*\ =0 .
-
-Our so-called 2D scattering intensity functions provide *P(q,* |phi| *)* for an oriented system as a function of a
-q-vector in the plane of the detector. We define the angle |phi| as the angle between the q vector and the horizontal
-(x) axis of the plane of the detector.
-
-For information about polarised and magnetic scattering, click here_.
-
-.. _here: polar_mag_help.html
-
-
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-
-
-.. _Model:
-
-2. Model functions
-------------------
-
-.. _Shape-based:
-
-2.1 Shape-based Functions
--------------------------
-
-Sphere-based
-------------
-
-- SphereModel_ (including magnetic 2D version)
-- BinaryHSModel_
-- FuzzySphereModel_
-- RaspBerryModel_
-- CoreShellModel_ (including magnetic 2D version)
-- MicelleSphCoreModel_
-- CoreMultiShellModel_ (including magnetic 2D version)
-- Core2ndMomentModel_
-- MultiShellModel_
-- OnionExpShellModel_
-- VesicleModel_
-- SphericalSLDModel_
-- LinearPearlsModel_
-- PearlNecklaceModel_
-
-Cylinder-based
---------------
-
-- CylinderModel_ (including magnetic 2D version)
-- HollowCylinderModel_
-- CappedCylinderModel_
-- CoreShellCylinderModel_
-- EllipticalCylinderModel_
-- FlexibleCylinderModel_
-- FlexCylEllipXModel_
-- CoreShellBicelleModel_
-- BarBellModel_
-- StackedDisksModel_
-- PringleModel_
-
-Ellipsoid-based
----------------
-
-- EllipsoidModel_
-- CoreShellEllipsoidModel_
-- CoreShellEllipsoidXTModel_
-- TriaxialEllipsoidModel_
-
-Lamellae
---------
-
-- LamellarModel_
-- LamellarFFHGModel_
-- LamellarPSModel_
-- LamellarPSHGModel_
-
-Paracrystals
-------------
-
-- LamellarPCrystalModel_
-- SCCrystalModel_
-- FCCrystalModel_
-- BCCrystalModel_
-
-Parallelpipeds
---------------
-
-- ParallelepipedModel_ (including magnetic 2D version)
-- CSParallelepipedModel_
-- RectangularPrismModel_
-- RectangularHollowPrismModel_
-- RectangularHollowPrismInfThinWallsModel_
-
-.. _Shape-independent:
-
-2.2 Shape-Independent Functions
--------------------------------
-
-(In alphabetical order)
-
-- AbsolutePower_Law_
-- BEPolyelectrolyte_
-- BroadPeakModel_
-- CorrLength_
-- DABModel_
-- Debye_
-- FractalModel_
-- FractalCoreShell_
-- GaussLorentzGel_
-- GelFitModel_
-- GuinierLaw_
-- GuinierPorod_
-- LineModel_
-- LorentzOZ_
-- MassFractalModel_
-- MassSurfaceFractal_
-- PeakGaussModel_
-- PeakLorentzModel_
-- Poly_GaussCoil_
-- PolyExclVolume_
-- PorodModel_
-- RPA10Model_
-- StarPolymer_
-- SurfaceFractalModel_
-- TeubnerStrey_
-- TwoLorentzian_
-- TwoPowerLaw_
-- UnifiedPowerRg_
-- ReflectivityModel_
-- ReflectivityIIModel_
-
-.. _Structure-factor:
-
-2.3 Structure Factor Functions
-------------------------------
-
-- HardSphereStructure_
-- SquareWellStructure_
-- HayterMSAStructure_
-- StickyHSStructure_
-
-.. _Customised:
-
-2.4 Customized Functions
-------------------------
-
-- testmodel_
-- testmodel_2_
-- sum_p1_p2_
-- sum_Ap1_1_Ap2_
-- polynomial5_
-- sph_bessel_jn_
-
-Also see the documentation on :ref:`Adding_your_own_models` under Fitting Data. 
-
-
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-
-
-.. _References:
-
-3. References
--------------
-
-*Small-Angle Scattering of X-Rays*
-A Guinier and G Fournet
-John Wiley & Sons, New York (1955)
-
-P Stckel, R May, I Strell, Z Cejka, W Hoppe, H Heumann, W Zillig and H Crespi
-*Eur. J. Biochem.*, 112, (1980), 411-417
-
-G Porod
-in *Small Angle X-ray Scattering*
-(editors) O Glatter and O Kratky
-Academic Press (1982)
-
-*Structure Analysis by Small-Angle X-Ray and Neutron Scattering*
-L.A Feigin and D I Svergun
-Plenum Press, New York (1987)
-
-S Hansen
-*J. Appl. Cryst.* 23, (1990), 344-346
-
-S J Henderson
-*Biophys. J.* 70, (1996), 1618-1627
-
-B C McAlister and B P Grady
-*J. Appl. Cryst.* 31, (1998), 594-599
-
-S R Kline
-*J Appl. Cryst.* 39(6), (2006), 895
-
-**Also see the references at the end of the each model function descriptions.**
-
-
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-
-
-Model Definitions
------------------
-
-.. _SphereModel:
-
-**2.1.1. SphereModel**
-
-This model provides the form factor, *P(q)*, for a monodisperse spherical particle with uniform scattering length
-density. The form factor is normalized by the particle volume as described below.
-
-For information about polarised and magnetic scattering, click here_.
-
-.. _here: polar_mag_help.html
-
-*2.1.1.1. Definition*
-
-The 1D scattering intensity is calculated in the following way (Guinier, 1955)
-
-.. image:: ..\img\olddocs\image004.PNG
-
-where *scale* is a volume fraction, *V* is the volume of the scatterer, *r* is the radius of the sphere, *bkg* is
-the background level and *sldXXX* is the scattering length density (SLD) of the scatterer or the solvent.
-
-Note that if your data is in absolute scale, the *scale* should represent the volume fraction (which is unitless) if
-you have a good fit. If not, it should represent the volume fraction \* a factor (by which your data might need to be
-rescaled).
-
-The 2D scattering intensity is the same as above, regardless of the orientation of the q vector.
-
-The returned value is scaled to units of |cm^-1| and the parameters of the SphereModel are the following:
-
-==============  ========  =============
-Parameter name  Units     Default value
-==============  ========  =============
-scale           None      1
-radius          |Ang|     60
-sldSph          |Ang^-2|  2.0e-6
-sldSolv         |Ang^-2|  1.0e-6
-background      |cm^-1|   0
-==============  ========  =============
-
-Our model uses the form factor calculations implemented in a c-library provided by the NIST Center for Neutron
-Research (Kline, 2006).
-
-REFERENCE
-
-A Guinier and G. Fournet, *Small-Angle Scattering of X-Rays*, John Wiley and Sons, New York, (1955)
-
-*2.1.1.2. Validation of the SphereModel*
-
-Validation of our code was done by comparing the output of the 1D model to the output of the software provided by the
-NIST (Kline, 2006). Figure 1 shows a comparison of the output of our model and the output of the NIST software.
-
-.. image:: ..\img\olddocs\image005.jpg
-
-Figure 1: Comparison of the DANSE scattering intensity for a sphere with the output of the NIST SANS analysis software.
-The parameters were set to: Scale=1.0, Radius=60 |Ang|, Contrast=1e-6 |Ang^-2|, and Background=0.01 |cm^-1|.
-
-*2013/09/09 and 2014/01/06 - Description reviewed by S King and P Parker.*
-
-
-
-.. _BinaryHSModel:
-
-**2.1.2. BinaryHSModel**
-
-*2.1.2.1. Definition*
-
-This model (binary hard sphere model) provides the scattering intensity, for binary mixture of spheres including hard
-sphere interaction between those particles. Using Percus-Yevick closure, the calculation is an exact multi-component
-solution
-
-.. image:: ..\img\olddocs\image006.PNG
-
-where *Sij* are the partial structure factors and *fi* are the scattering amplitudes of the particles. The subscript 1
-is for the smaller particle and 2 is for the larger. The number fraction of the larger particle, (*x* = n2/(n1+n2),
-where *n* = the number density) is internally calculated based on
-
-.. image:: ..\img\olddocs\image007.PNG
-
-The 2D scattering intensity is the same as 1D, regardless of the orientation of the *q* vector which is defined as
-
-.. image:: ..\img\olddocs\image008.PNG
-
-The parameters of the BinaryHSModel are the following (in the names, *l* (or *ls*\ ) stands for larger spheres
-while *s* (or *ss*\ ) for the smaller spheres).
-
-==============  ========  =============
-Parameter name  Units     Default value
-==============  ========  =============
-background      |cm^-1|   0.001
-l_radius        |Ang|     100.0
-ss_sld          |Ang^-2|  0.0
-ls_sld          |Ang^-2|  3e-6
-solvent_sld     |Ang^-2|  6e-6
-s_radius        |Ang|     25.0
-vol_frac_ls     None      0.1
-vol_frac_ss     None      0.2
-==============  ========  =============
-
-.. image:: ..\img\olddocs\image009.jpg
-
-*Figure. 1D plot using the default values above (w/200 data point).*
-
-Our model uses the form factor calculations implemented in a c-library provided by the NIST Center for Neutron
-Research (Kline, 2006).
-
-See the reference for details.
-
-REFERENCE
-
-N W Ashcroft and D C Langreth, *Physical Review*, 156 (1967) 685-692
-[Errata found in *Phys. Rev.* 166 (1968) 934]
-
-
-
-.. _FuzzySphereModel:
-
-**2.1.3. FuzzySphereModel**
-
-This model is to calculate the scattering from spherical particles with a "fuzzy" interface.
-
-*2.1.3.1. Definition*
-
-The scattering intensity *I(q)* is calculated as:
-
-.. image:: ..\img\olddocs\image010.PNG
-
-where the amplitude *A(q)* is given as the typical sphere scattering convoluted with a Gaussian to get a gradual
-drop-off in the scattering length density
-
-.. image:: ..\img\olddocs\image011.PNG
-
-Here |A2|\ *(q)* is the form factor, *P(q)*. The scale is equivalent to the volume fraction of spheres, each of
-volume, *V*\. Contrast (|drho|) is the difference of scattering length densities of the sphere and the surrounding
-solvent.
-
-Poly-dispersion in radius and in fuzziness is provided for.
-
-The returned value is scaled to units of |cm^-1|\ |sr^-1|; ie, absolute scale.
-
-From the reference
-
-  The "fuzziness" of the interface is defined by the parameter |sigma| :sub:`fuzzy`\ . The particle radius *R*
-  represents the radius of the particle where the scattering length density profile decreased to 1/2 of the core
-  density. The |sigma| :sub:`fuzzy`\ is the width of the smeared particle surface; i.e., the standard deviation
-  from the average height of the fuzzy interface. The inner regions of the microgel that display a higher density
-  are described by the radial box profile extending to a radius of approximately *Rbox* ~ *R* - 2\ |sigma|\ . The
-  profile approaches zero as *Rsans* ~ *R* + 2\ |sigma|\ .
-
-For 2D data: The 2D scattering intensity is calculated in the same way as 1D, where the *q* vector is defined as
-
-.. image:: ..\img\olddocs\image008.PNG
-
-This example dataset is produced by running the FuzzySphereModel, using 200 data points, *qmin* = 0.001 -1,
-*qmax* = 0.7 |Ang^-1| and the default values
-
-==============  ========  =============
-Parameter name  Units     Default value
-==============  ========  =============
-scale           None      1.0
-radius          |Ang|     60
-fuzziness       |Ang|     10
-sldSolv         |Ang^-2|  3e-6
-sldSph          |Ang^-2|  1e-6
-background      |cm^-1|   0.001
-==============  ========  =============
-
-.. image:: ..\img\olddocs\image012.jpg
-
-*Figure. 1D plot using the default values (w/200 data point).*
-
-REFERENCE
-
-M Stieger, J. S Pedersen, P Lindner, W Richtering, *Langmuir*, 20 (2004) 7283-7292
-
-
-
-.. _RaspBerryModel:
-
-**2.1.4. RaspBerryModel**
-
-Calculates the form factor, *P(q)*, for a "Raspberry-like" structure where there are smaller spheres at the surface
-of a larger sphere, such as the structure of a Pickering emulsion.
-
-*2.1.4.1. Definition*
-
-The structure is:
-
-.. image:: ..\img\olddocs\raspberry_pic.jpg
-
-where *Ro* = the radius of the large sphere, *Rp* = the radius of the smaller sphere on the surface, |delta| = the
-fractional penetration depth, and surface coverage = fractional coverage of the large sphere surface (0.9 max).
-
-The large and small spheres have their own SLD, as well as the solvent. The surface coverage term is a fractional
-coverage (maximum of approximately 0.9 for hexagonally-packed spheres on a surface). Since not all of the small
-spheres are necessarily attached to the surface, the excess free (small) spheres scattering is also included in the
-calculation. The function calculated follows equations (8)-(12) of the reference below, and the equations are not
-reproduced here.
-
-The returned value is scaled to units of |cm^-1|. No inter-particle scattering is included in this model.
-
-For 2D data: The 2D scattering intensity is calculated in the same way as 1D, where the *q* vector is defined as
-
-.. image:: ..\img\olddocs\image008.PNG
-
-This example dataset is produced by running the RaspBerryModel, using 2000 data points, *qmin* = 0.0001 |Ang^-1|,
-*qmax* = 0.2 |Ang^-1| and the default values below, where *Ssph/Lsph* stands for smaller or larger sphere, respectively,
-and *surfrac_Ssph* is the surface fraction of the smaller spheres.
-
-==============  ========  =============
-Parameter name  Units     Default value
-==============  ========  =============
-delta_Ssph      None      0
-radius_Lsph     |Ang|     5000
-radius_Ssph     |Ang|     100
-sld_Lsph        |Ang^-2|  -4e-07
-sld_Ssph        |Ang^-2|  3.5e-6
-sld_solv        |Ang^-2|  6.3e-6
-surfrac_Ssph    None      0.4
-volf_Lsph       None      0.05
-volf_Lsph       None      0.005
-background      |cm^-1|   0
-==============  ========  =============
-
-.. image:: ..\img\olddocs\raspberry_plot.jpg
-
-*Figure. 1D plot using the values of /2000 data points.*
-
-REFERENCE
-
-K Larson-Smith, A Jackson, and D C Pozzo, *Small angle scattering model for Pickering emulsions and raspberry*
-*particles*, *Journal of Colloid and Interface Science*, 343(1) (2010) 36-41
-
-
-
-.. _CoreShellModel:
-
-**2.1.5. CoreShellModel**
-
-This model provides the form factor, *P(q)*, for a spherical particle with a core-shell structure. The form factor is
-normalized by the particle volume.
-
-For information about polarised and magnetic scattering, click here_.
-
-*2.1.5.1. Definition*
-
-The 1D scattering intensity is calculated in the following way (Guinier, 1955)
-
-.. image:: ..\img\olddocs\image013.PNG
-
-where *scale* is a scale factor, *Vs* is the volume of the outer shell, *Vc* is the volume of the core, *rs* is the
-radius of the shell, *rc* is the radius of the core, *c* is the scattering length density of the core, *s* is the
-scattering length density of the shell, *solv* is the scattering length density of the solvent, and *bkg* is the
-background level.
-
-The 2D scattering intensity is the same as *P(q)* above, regardless of the orientation of the *q* vector.
-
-NB: The outer most radius (ie, = *radius* + *thickness*) is used as the effective radius for *S(Q)* when
-*P(Q)* \* *S(Q)* is applied.
-
-The returned value is scaled to units of |cm^-1| and the parameters of the CoreShellModel are the following
-
-==============  ========  =============
-Parameter name  Units     Default value
-==============  ========  =============
-scale           None      1.0
-(core) radius   |Ang|     60
-thickness       |Ang|     10
-core_sld        |Ang^-2|  1e-6
-shell_sld       |Ang^-2|  2e-6
-solvent_sld     |Ang^-2|  3e-6
-background      |cm^-1|   0.001
-==============  ========  =============
-
-Here, *radius* = the radius of the core and *thickness* = the thickness of the shell.
-
-Our model uses the form factor calculations implemented in a c-library provided by the NIST Center for Neutron
-Research (Kline, 2006).
-
-REFERENCE
-
-A Guinier and G Fournet, *Small-Angle Scattering of X-Rays*, John Wiley and Sons, New York, (1955)
-
-*2.1.5.2. Validation of the core-shell sphere model*
-
-Validation of our code was done by comparing the output of the 1D model to the output of the software provided by
-NIST (Kline, 2006). Figure 1 shows a comparison of the output of our model and the output of the NIST software.
-
-.. image:: ..\img\olddocs\image014.jpg
-
-Figure 1: Comparison of the SasView scattering intensity for a core-shell sphere with the output of the NIST SANS
-analysis software. The parameters were set to: *Scale* = 1.0, *Radius* = 60 , *Contrast* = 1e-6 |Ang^-2|, and
-*Background* = 0.001 |cm^-1|.
-
-
-
-.. _CoreMultiShellModel:
-
-**2.1.6. CoreMultiShellModel**
-
-This model provides the scattering from a spherical core with 1 to 4 concentric shell structures. The SLDs of the core
-and each shell are individually specified.
-
-For information about polarised and magnetic scattering, click here_.
-
-*2.1.6.1. Definition*
-
-This model is a trivial extension of the CoreShell function to a larger number of shells. See the CoreShell function
-for a diagram and documentation.
-
-The returned value is scaled to units of |cm^-1|\ |sr^-1|, absolute scale.
-
-Be careful! The SLDs and scale can be highly correlated. Hold as many of these parameters fixed as possible.
-
-The 2D scattering intensity is the same as P(q) of 1D, regardless of the orientation of the q vector.
-
-NB: The outer most radius (ie, = *radius* + 4 *thicknesses*) is used as the effective radius for *S(Q)* when
-*P(Q)* \* *S(Q)* is applied.
-
-The returned value is scaled to units of |cm^-1| and the parameters of the CoreMultiShell model are the following
-
-==============  ========  =============
-Parameter name  Units     Default value
-==============  ========  =============
-scale           None      1.0
-rad_core        |Ang|     60
-sld_core        |Ang^-2|  6.4e-6
-sld_shell1      |Ang^-2|  1e-6
-sld_shell2      |Ang^-2|  2e-6
-sld_shell3      |Ang^-2|  3e-6
-sld_shell4      |Ang^-2|  4e-6
-sld_solv        |Ang^-2|  6.4e-6
-thick_shell1    |Ang|     10
-thick_shell2    |Ang|     10
-thick_shell3    |Ang|     10
-thick_shell4    |Ang|     10
-background      |cm^-1|   0.001
-==============  ========  =============
-
-NB: Here, *rad_core* = the radius of the core, *thick_shelli* = the thickness of the shell *i* and
-*sld_shelli* = the SLD of the shell *i*. *sld_core* and the *sld_solv* are the SLD of the core and the solvent,
-respectively.
-
-Our model uses the form factor calculations implemented in a c-library provided by the NIST Center for Neutron
-Research (Kline, 2006).
-
-This example dataset is produced by running the CoreMultiShellModel using 200 data points, *qmin* = 0.001 -1,
-*qmax* = 0.7 -1 and the above default values.
-
-.. image:: ..\img\olddocs\image015.jpg
-
-*Figure: 1D plot using the default values (w/200 data point).*
-
-The scattering length density profile for the default sld values (w/ 4 shells).
-
-.. image:: ..\img\olddocs\image016.jpg
-
-*Figure: SLD profile against the radius of the sphere for default SLDs.*
-
-REFERENCE
-
-See the CoreShellModel_ documentation.
-
-
-
-.. _Core2ndMomentModel:
-
-**2.1.7. Core2ndMomentModel**
-
-This model describes the scattering from a layer of surfactant or polymer adsorbed on spherical particles under the
-conditions that (i) the particles (cores) are contrast-matched to the dispersion medium, (ii) *S(Q)* ~ 1 (ie, the
-particle volume fraction is dilute), (iii) the particle radius is >> layer thickness (ie, the interface is locally
-flat), and (iv) scattering from excess unadsorbed adsorbate in the bulk medium is absent or has been corrected for.
-
-Unlike a core-shell model, this model does not assume any form for the density distribution of the adsorbed species
-normal to the interface (cf, a core-shell model which assumes the density distribution to be a homogeneous
-step-function). For comparison, if the thickness of a (core-shell like) step function distribution is *t*, the second
-moment, |sigma| = sqrt((*t* :sup:`2` )/12). The |sigma| is the second moment about the mean of the density distribution
-(ie, the distance of the centre-of-mass of the distribution from the interface).
-
-*2.1.7.1. Definition*
-
-The *I* :sub:`0` is calculated in the following way (King, 2002)
-
-.. image:: ..\img\olddocs\secondmeq1.jpg
-
-where *scale* is a scale factor, *poly* is the sld of the polymer (or surfactant) layer, *solv* is the sld of the
-solvent/medium and cores, |phi|\ :sub:`cores` is the volume fraction of the core paraticles, and |biggamma| and
-|delta| are the adsorbed amount and the bulk density of the polymers respectively. The |sigma| is the second moment
-of the thickness distribution.
-
-Note that all parameters except the |sigma| are correlated for fitting so that fitting those with more than one
-parameter will generally fail. Also note that unlike other shape models, no volume normalization is applied to this
-model (the calculation is exact).
-
-The returned value is scaled to units of |cm^-1| and the parameters are the following
-
-==============  ========  =============
-Parameter name  Units     Default value
-==============  ========  =============
-scale           None      1.0
-density_poly    g/cm2     0.7
-radius_core     |Ang|     500
-ads_amount      mg/m 2    1.9
-second_moment   |Ang|     23.0
-volf_cores      None      0.14
-sld_poly        |Ang^-2|  1.5e-6
-sld_solv        |Ang^-2|  6.3e-6
-background      |cm^-1|   0.0
-==============  ========  =============
-
-.. image:: ..\img\olddocs\secongm_fig1.jpg
-
-REFERENCE
-
-S King, P Griffiths, J. Hone, and T Cosgrove, *SANS from Adsorbed Polymer Layers*,
-*Macromol. Symp.*, 190 (2002) 33-42
-
-
-
-.. _MultiShellModel:
-
-**2.1.8. MultiShellModel**
-
-This model provides the form factor, *P(q)*, for a multi-lamellar vesicle with *N* shells where the core is filled with
-solvent and the shells are interleaved with layers of solvent. For *N* = 1, this returns the VesicleModel (above).
-
-.. image:: ..\img\olddocs\image020.jpg
-
-The 2D scattering intensity is the same as 1D, regardless of the orientation of the *q* vector which is defined as
-
-.. image:: ..\img\olddocs\image008.PNG
-
-NB: The outer most radius (= *core_radius* + *n_pairs* \* *s_thickness* + (*n_pairs* - 1) \* *w_thickness*) is used
-as the effective radius for *S(Q)* when *P(Q)* \* *S(Q)* is applied.
-
-The returned value is scaled to units of |cm^-1| and the parameters of the MultiShellModel are the following
-
-==============  ========  =============
-Parameter name  Units     Default value
-==============  ========  =============
-scale           None      1.0
-core_radius     |Ang|     60.0
-n_pairs         None      2.0
-core_sld        |Ang^-2|  6.3e-6
-shell_sld       |Ang^-2|  0.0
-background      |cm^-1|   0.0
-s_thickness     |Ang|     10
-w_thickness     |Ang|     10
-==============  ========  =============
-
-NB: *s_thickness* is the shell thickness while the *w_thickness* is the solvent thickness, and *n_pair*
-is the number of shells.
-
-.. image:: ..\img\olddocs\image021.jpg
-
-*Figure. 1D plot using the default values (w/200 data point).*
-
-Our model uses the form factor calculations implemented in a c-library provided by the NIST Center for Neutron
-Research (Kline, 2006).
-
-REFERENCE
-
-B Cabane, *Small Angle Scattering Methods*, in *Surfactant Solutions: New Methods of Investigation*, Ch.2,
-Surfactant Science Series Vol. 22, Ed. R Zana and M Dekker, New York, (1987).
-
-
-
-.. _OnionExpShellModel:
-
-**2.1.9. OnionExpShellModel**
-
-This model provides the form factor, *P(q)*, for a multi-shell sphere where the scattering length density (SLD) of the
-each shell is described by an exponential (linear, or flat-top) function. The form factor is normalized by the volume
-of the sphere where the SLD is not identical to the SLD of the solvent. We currently provide up to 9 shells with this
-model.
-
-*2.1.9.1. Definition*
-
-The 1D scattering intensity is calculated in the following way
-
-.. image:: ..\img\olddocs\image022.gif
-
-.. image:: ..\img\olddocs\image023.gif
-
-where, for a spherically symmetric particle with a particle density |rho|\ *(r)*
-
-.. image:: ..\img\olddocs\image024.gif
-
-so that
-
-.. image:: ..\img\olddocs\image025.gif
-
-.. image:: ..\img\olddocs\image026.gif
-
-.. image:: ..\img\olddocs\image027.gif
-
-Here we assumed that the SLDs of the core and solvent are constant against *r*.
-
-Now lets consider the SLD of a shell, *r*\ :sub:`shelli`, defined by
-
-.. image:: ..\img\olddocs\image028.gif
-
-An example of a possible SLD profile is shown below where *sld_in_shelli* (|rho|\ :sub:`in`\ ) and
-*thick_shelli* (|bigdelta|\ *t* :sub:`shelli`\ ) stand for the SLD of the inner side of the *i*\ th shell and the
-thickness of the *i*\ th shell in the equation above, respectively.
-
-For \| *A* \| > 0,
-
-.. image:: ..\img\olddocs\image029.gif
-
-For *A* ~ 0 (eg., *A* = -0.0001), this function converges to that of the linear SLD profile (ie,
-|rho|\ :sub:`shelli`\ *(r)* = *A*\ :sup:`'` ( *r* - *r*\ :sub:`shelli` - 1) / |bigdelta|\ *t* :sub:`shelli`) + *B*\ :sup:`'`),
-so this case is equivalent to
-
-.. image:: ..\img\olddocs\image030.gif
-
-.. image:: ..\img\olddocs\image031.gif
-
-.. image:: ..\img\olddocs\image032.gif
-
-.. image:: ..\img\olddocs\image033.gif
-
-For *A* = 0, the exponential function has no dependence on the radius (so that *sld_out_shell* (|rho|\ :sub:`out`) is
-ignored this case) and becomes flat. We set the constant to |rho|\ :sub:`in` for convenience, and thus the form
-factor contributed by the shells is
-
-.. image:: ..\img\olddocs\image034.gif
-
-.. image:: ..\img\olddocs\image035.gif
-
-In the equation
-
-.. image:: ..\img\olddocs\image036.gif
-
-Finally, the form factor can be calculated by
-
-.. image:: ..\img\olddocs\image037.gif
-
-where
-
-.. image:: ..\img\olddocs\image038.gif
-
-and
-
-.. image:: ..\img\olddocs\image039.gif
-
-The 2D scattering intensity is the same as *P(q)* above, regardless of the orientation of the *q* vector which is
-defined as
-
-.. image:: ..\img\olddocs\image040.gif
-
-NB: The outer most radius is used as the effective radius for *S(Q)* when *P(Q)* \* *S(Q)* is applied.
-
-The returned value is scaled to units of |cm^-1| and the parameters of this model (for only one shell) are the following
-
-==============  ========  =============
-Parameter name  Units     Default value
-==============  ========  =============
-A_shell1        None      1
-scale           None      1.0
-rad_core        |Ang|     200
-thick_shell1    |Ang|     50
-sld_core        |Ang^-2|  1.0e-06
-sld_in_shell1   |Ang^-2|  1.7e-06
-sld_out_shell1  |Ang^-2|  2.0e-06
-sld_solv        |Ang^-2|  6.4e-06
-background      |cm^-1|   0.0
-==============  ========  =============
-
-NB: *rad_core* represents the core radius (*R1*) and *thick_shell1* (*R2* - *R1*) is the thickness of the shell1, etc.
-
-.. image:: ..\img\olddocs\image041.jpg
-
-*Figure. 1D plot using the default values (w/400 point).*
-
-.. image:: ..\img\olddocs\image042.jpg
-
-*Figure. SLD profile from the default values.*
-
-REFERENCE
-
-L A Feigin and D I Svergun, *Structure Analysis by Small-Angle X-Ray and Neutron Scattering*,
-Plenum Press, New York, (1987).
-
-
-
-.. _VesicleModel:
-
-**2.1.10. VesicleModel**
-
-This model provides the form factor, *P(q)*, for an unilamellar vesicle. The form factor is normalized by the volume
-of the shell.
-
-*2.1.10.1. Definition*
-
-The 1D scattering intensity is calculated in the following way (Guinier, 1955)
-
-.. image:: ..\img\olddocs\image017.PNG
-
-where *scale* is a scale factor, *Vshell* is the volume of the shell, *V1* is the volume of the core, *V2* is the total
-volume, *R1* is the radius of the core, *R2* is the outer radius of the shell, |rho|\ :sub:`1` is the scattering
-length density of the core and the solvent, |rho|\ :sub:`2` is the scattering length density of the shell, *bkg* is
-the background level, and *J1* = (sin\ *x*- *x* cos\ *x*)/ *x* :sup:`2`\ . The functional form is identical to a
-"typical" core-shell structure, except that the scattering is normalized by the volume that is contributing to the
-scattering, namely the volume of the shell alone. Also, the vesicle is best defined in terms of a core radius (= *R1*)
-and a shell thickness, *t*.
-
-.. image:: ..\img\olddocs\image018.jpg
-
-The 2D scattering intensity is the same as *P(q)* above, regardless of the orientation of the *q* vector which is
-defined as
-
-.. image:: ..\img\olddocs\image008.PNG
-
-NB: The outer most radius (= *radius* + *thickness*) is used as the effective radius for *S(Q)* when *P(Q)* \* *S(Q)*
-is applied.
-
-The returned value is scaled to units of |cm^-1| and the parameters of the VesicleModel are the following
-
-==============  ========  =============
-Parameter name  Units     Default value
-==============  ========  =============
-scale           None      1.0
-radius          |Ang|     100
-thickness       |Ang|     30
-core_sld        |Ang^-2|  6.3e-6
-shell_sld       |Ang^-2|  0
-background      |cm^-1|   0.0
-==============  ========  =============
-
-NB: *radius* represents the core radius (*R1*) and the *thickness* (*R2* - *R1*) is the shell thickness.
-
-.. image:: ..\img\olddocs\image019.jpg
-
-*Figure. 1D plot using the default values (w/200 data point).*
-
-Our model uses the form factor calculations implemented in a c-library
-provided by the NIST Center for Neutron Research (Kline, 2006).
-
-REFERENCE
-
-A Guinier and G. Fournet, *Small-Angle Scattering of X-Rays*, John Wiley and Sons, New York, (1955)
-
-
-
-.. _SphericalSLDModel:
-
-**2.1.11. SphericalSLDModel**
-
-Similarly to the OnionExpShellModel, this model provides the form factor, *P(q)*, for a multi-shell sphere, where the
-interface between the each neighboring shells can be described by one of a number of functions including error,
-power-law, and exponential functions. This model is to calculate the scattering intensity by building a continuous
-custom SLD profile against the radius of the particle. The SLD profile is composed of a flat core, a flat solvent,
-a number (up to 9 ) flat shells, and the interfacial layers between the adjacent flat shells (or core, and solvent)
-(see below). Unlike the OnionExpShellModel (using an analytical integration), the interfacial layers here are
-sub-divided and numerically integrated assuming each of the sub-layers are described by a line function. The number
-of the sub-layer can be given by users by setting the integer values of *npts_inter* in the GUI. The form factor is
-normalized by the total volume of the sphere.
-
-*2.1.11.1. Definition*
-
-The 1D scattering intensity is calculated in the following way:
-
-.. image:: ..\img\olddocs\image022.gif
-
-.. image:: ..\img\olddocs\image043.gif
-
-where, for a spherically symmetric particle with a particle density |rho|\ *(r)*
-
-.. image:: ..\img\olddocs\image024.gif
-
-so that
-
-.. image:: ..\img\olddocs\image044.gif
-
-.. image:: ..\img\olddocs\image045.gif
-
-.. image:: ..\img\olddocs\image046.gif
-
-.. image:: ..\img\olddocs\image047.gif
-
-.. image:: ..\img\olddocs\image048.gif
-
-.. image:: ..\img\olddocs\image027.gif
-
-Here we assumed that the SLDs of the core and solvent are constant against *r*. The SLD at the interface between
-shells, |rho|\ :sub:`inter_i`, is calculated with a function chosen by an user, where the functions are
-
-1) Exp
-
-.. image:: ..\img\olddocs\image049.gif
-
-2) Power-Law
-
-.. image:: ..\img\olddocs\image050.gif
-
-3) Erf
-
-.. image:: ..\img\olddocs\image051.gif
-
-The functions are normalized so that they vary between 0 and 1, and they are constrained such that the SLD is
-continuous at the boundaries of the interface as well as each sub-layers. Thus *B* and *C* are determined.
-
-Once |rho|\ :sub:`rinter_i` is found at the boundary of the sub-layer of the interface, we can find its contribution
-to the form factor *P(q)*
-
-.. image:: ..\img\olddocs\image052.gif
-
-.. image:: ..\img\olddocs\image053.gif
-
-.. image:: ..\img\olddocs\image054.gif
-
-where we assume that |rho|\ :sub:`inter_i`\ *(r)* can be approximately linear within a sub-layer *j*.
-
-In the equation
-
-.. image:: ..\img\olddocs\image055.gif
-
-Finally, the form factor can be calculated by
-
-.. image:: ..\img\olddocs\image037.gif
-
-where
-
-.. image:: ..\img\olddocs\image038.gif
-
-and
-
-.. image:: ..\img\olddocs\image056.gif
-
-The 2D scattering intensity is the same as *P(q)* above, regardless of the orientation of the *q* vector which is
-defined as
-
-.. image:: ..\img\olddocs\image040.gif
-
-NB: The outer most radius is used as the effective radius for *S(Q)* when *P(Q)* \* *S(Q)* is applied.
-
-The returned value is scaled to units of |cm^-1| and the parameters of this model (for just one shell) are the following
-
-==============  ========  =============
-Parameter name  Units     Default value
-==============  ========  =============
-background      |cm^-1|   0.0
-npts_inter      None      35
-scale           None      1
-sld_solv        |Ang^-2|  1e-006
-func_inter1     None      Erf
-nu_inter        None      2.5
-thick_inter1    |Ang|     50
-sld_flat1       |Ang^-2|  4e-006
-thick_flat1     |Ang|     100
-func_inter0     None      Erf
-nu_inter0       None      2.5
-rad_core0       |Ang|     50
-sld_core0       |Ang^-2|  2.07e-06
-thick_core0     |Ang|     50
-==============  ========  =============
-
-NB: *rad_core0* represents the core radius (*R1*).
-
-.. image:: ..\img\olddocs\image057.jpg
-
-*Figure. 1D plot using the default values (w/400 point).*
-
-.. image:: ..\img\olddocs\image058.jpg
-
-*Figure. SLD profile from the default values.*
-
-REFERENCE
-
-L A Feigin and D I Svergun, *Structure Analysis by Small-Angle X-Ray and Neutron Scattering*,
-Plenum Press, New York, (1987)
-
-
-
-.. _LinearPearlsModel:
-
-**2.1.12. LinearPearlsModel**
-
-This model provides the form factor for *N* spherical pearls of radius *R* linearly joined by short strings (or segment
-length or edge separation) *l* (= *A* - 2\ *R*)). *A* is the center-to-center pearl separation distance. The thickness
-of each string is assumed to be negligible.
-
-.. image:: ..\img\olddocs\linearpearls.jpg
-
-*2.1.12.1. Definition*
-
-The output of the scattering intensity function for the LinearPearlsModel is given by (Dobrynin, 1996)
-
-.. image:: ..\img\olddocs\linearpearl_eq1.gif
-
-where the mass *m*\ :sub:`p` is (SLD\ :sub:`pearl` - SLD\ :sub:`solvent`) \* (volume of *N* pearls). V is the total
-volume.
-
-The 2D scattering intensity is the same as *P(q)* above, regardless of the orientation of the *q* vector.
-
-The returned value is scaled to units of |cm^-1| and the parameters of the LinearPearlsModel are the following
-
-===============  ========  =============
-Parameter name   Units     Default value
-===============  ========  =============
-scale            None      1.0
-radius           |Ang|     80.0
-edge_separation  |Ang|     350.0
-num_pearls       None      3
-sld_pearl        |Ang^-2|  1e-6
-sld_solv         |Ang^-2|  6.3e-6
-background       |cm^-1|   0.0
-===============  ========  =============
-
-NB: *num_pearls* must be an integer.
-
-.. image:: ..\img\olddocs\linearpearl_plot.jpg
-
-REFERENCE
-
-A V Dobrynin, M Rubinstein and S P Obukhov, *Macromol.*, 29 (1996) 2974-2979
-
-
-
-.. _PearlNecklaceModel:
-
-**2.1.13. PearlNecklaceModel**
-
-This model provides the form factor for a pearl necklace composed of two elements: *N* pearls (homogeneous spheres
-of radius *R*) freely jointed by *M* rods (like strings - with a total mass *Mw* = *M* \* *m*\ :sub:`r` + *N* \* *m*\ :sub:`s`,
-and the string segment length (or edge separation) *l* (= *A* - 2\ *R*)). *A* is the center-to-center pearl separation
-distance.
-
-.. image:: ..\img\olddocs\pearl_fig.jpg
-
-*2.1.13.1. Definition*
-
-The output of the scattering intensity function for the PearlNecklaceModel is given by (Schweins, 2004)
-
-.. image:: ..\img\olddocs\pearl_eq1.gif
-
-where
-
-.. image:: ..\img\olddocs\pearl_eq2.gif
-
-.. image:: ..\img\olddocs\pearl_eq3.gif
-
-.. image:: ..\img\olddocs\pearl_eq4.gif
-
-.. image:: ..\img\olddocs\pearl_eq5.gif
-
-.. image:: ..\img\olddocs\pearl_eq6.gif
-
-and
-
-.. image:: ..\img\olddocs\pearl_eq7.gif
-
-where the mass *m*\ :sub:`i` is (SLD\ :sub:`i` - SLD\ :sub:`solvent`) \* (volume of the *N* pearls/rods). *V* is the
-total volume of the necklace.
-
-The 2D scattering intensity is the same as *P(q)* above, regardless of the orientation of the *q* vector.
-
-The returned value is scaled to units of |cm^-1| and the parameters of the PearlNecklaceModel are the following
-
-===============  ========  =============
-Parameter name   Units     Default value
-===============  ========  =============
-scale            None      1.0
-radius           |Ang|     80.0
-edge_separation  |Ang|     350.0
-num_pearls       None      3
-sld_pearl        |Ang^-2|  1e-6
-sld_solv         |Ang^-2|  6.3e-6
-sld_string       |Ang^-2|  1e-6
-thick_string
-(=rod diameter)  |Ang|     2.5
-background       |cm^-1|   0.0
-===============  ========  =============
-
-NB: *num_pearls* must be an integer.
-
-.. image:: ..\img\olddocs\pearl_plot.jpg
-
-REFERENCE
-
-R Schweins and K Huber, *Particle Scattering Factor of Pearl Necklace Chains*, *Macromol. Symp.* 211 (2004) 25-42 2004
-
-
-
-.. _CylinderModel:
-
-**2.1.14. CylinderModel**
-
-This model provides the form factor for a right circular cylinder with uniform scattering length density. The form
-factor is normalized by the particle volume.
-
-For information about polarised and magnetic scattering, click here_.
-
-*2.1.14.1. Definition*
-
-The output of the 2D scattering intensity function for oriented cylinders is given by (Guinier, 1955)
-
-.. image:: ..\img\olddocs\image059.PNG
-
-where
-
-.. image:: ..\img\olddocs\image060.PNG
-
-and |alpha| is the angle between the axis of the cylinder and the *q*-vector, *V* is the volume of the cylinder,
-*L* is the length of the cylinder, *r* is the radius of the cylinder, and |drho| (contrast) is the
-scattering length density difference between the scatterer and the solvent. *J1* is the first order Bessel function.
-
-To provide easy access to the orientation of the cylinder, we define the axis of the cylinder using two angles |theta|
-and |phi|. Those angles are defined in Figure 1.
-
-.. image:: ..\img\olddocs\image061.jpg
-
-*Figure 1. Definition of the angles for oriented cylinders.*
-
-.. image:: ..\img\olddocs\image062.jpg
-
-*Figure 2. Examples of the angles for oriented pp against the detector plane.*
-
-NB: The 2nd virial coefficient of the cylinder is calculated based on the radius and length values, and used as the
-effective radius for *S(Q)* when *P(Q)* \* *S(Q)* is applied.
-
-The returned value is scaled to units of |cm^-1| and the parameters of the CylinderModel are the following:
-
-==============  ========  =============
-Parameter name  Units     Default value
-==============  ========  =============
-scale           None      1.0
-radius          |Ang|     20.0
-length          |Ang|     400.0
-contrast        |Ang^-2|  3.0e-6
-background      |cm^-1|   0.0
-cyl_theta       degree    60
-cyl_phi         degree    60
-==============  ========  =============
-
-The output of the 1D scattering intensity function for randomly oriented cylinders is then given by
-
-.. image:: ..\img\olddocs\image063.PNG
-
-The *cyl_theta* and *cyl_phi* parameter are not used for the 1D output. Our implementation of the scattering kernel
-and the 1D scattering intensity use the c-library from NIST.
-
-*2.1.14.2. Validation of the CylinderModel*
-
-Validation of our code was done by comparing the output of the 1D model to the output of the software provided by the
-NIST (Kline, 2006). Figure 3 shows a comparison of the 1D output of our model and the output of the NIST software.
-
-.. image:: ..\img\olddocs\image065.jpg
-
-*Figure 3: Comparison of the SasView scattering intensity for a cylinder with the output of the NIST SANS analysis*
-*software.* The parameters were set to: *Scale* = 1.0, *Radius* = 20 |Ang|, *Length* = 400 |Ang|,
-*Contrast* = 3e-6 |Ang^-2|, and *Background* = 0.01 |cm^-1|.
-
-In general, averaging over a distribution of orientations is done by evaluating the following
-
-.. image:: ..\img\olddocs\image064.PNG
-
-where *p(*\ |theta|,\ |phi|\ *)* is the probability distribution for the orientation and |P0|\ *(q,*\ |alpha|\ *)* is
-the scattering intensity for the fully oriented system. Since we have no other software to compare the implementation
-of the intensity for fully oriented cylinders, we can compare the result of averaging our 2D output using a uniform
-distribution *p(*\ |theta|,\ |phi|\ *)* = 1.0. Figure 4 shows the result of such a cross-check.
-
-.. image:: ..\img\olddocs\image066.jpg
-
-*Figure 4: Comparison of the intensity for uniformly distributed cylinders calculated from our 2D model and the*
-*intensity from the NIST SANS analysis software.* The parameters used were: *Scale* = 1.0, *Radius* = 20 |Ang|,
-*Length* = 400 |Ang|, *Contrast* = 3e-6 |Ang^-2|, and *Background* = 0.0 |cm^-1|.
-
-
-
-.. _HollowCylinderModel:
-
-**2.1.15. HollowCylinderModel**
-
-This model provides the form factor, *P(q)*, for a monodisperse hollow right angle circular cylinder (tube) where the
-form factor is normalized by the volume of the tube
-
-*P(q)* = *scale* \* *<F*\ :sup:`2`\ *>* / *V*\ :sub:`shell` + *background*
-
-where the averaging < > is applied only for the 1D calculation.
-
-The inside and outside of the hollow cylinder are assumed have the same SLD.
-
-*2.1.15.1 Definition*
-
-The 1D scattering intensity is calculated in the following way (Guinier, 1955)
-
-.. image:: ..\img\olddocs\image072.PNG
-
-where *scale* is a scale factor, *J1* is the 1st order Bessel function, *J1(x)* = (sin *x* - *x* cos *x*)/ *x*\ :sup:`2`.
-
-To provide easy access to the orientation of the core-shell cylinder, we define the axis of the cylinder using two
-angles |theta| and |phi|\ . As for the case of the cylinder, those angles are defined in Figure 2 of the CylinderModel.
-
-NB: The 2nd virial coefficient of the cylinder is calculated based on the radius and 2 length values, and used as the
-effective radius for *S(Q)* when *P(Q)* \* *S(Q)* is applied.
-
-In the parameters, the contrast represents SLD :sub:`shell` - SLD :sub:`solvent` and the *radius* = *R*\ :sub:`shell`
-while *core_radius* = *R*\ :sub:`core`.
-
-==============  ========  =============
-Parameter name  Units     Default value
-==============  ========  =============
-scale           None      1.0
-radius          |Ang|     30
-length          |Ang|     400
-core_radius     |Ang|     20
-sldCyl          |Ang^-2|  6.3e-6
-sldSolv         |Ang^-2|  5e-06
-background      |cm^-1|   0.01
-==============  ========  =============
-
-.. image:: ..\img\olddocs\image074.jpg
-
-*Figure. 1D plot using the default values (w/1000 data point).*
-
-Our model uses the form factor calculations implemented in a c-library provided by the NIST Center for Neutron Research
-(Kline, 2006).
-
-.. image:: ..\img\olddocs\image061.jpg
-
-*Figure. Definition of the angles for the oriented HollowCylinderModel.*
-
-.. image:: ..\img\olddocs\image062.jpg
-
-*Figure. Examples of the angles for oriented pp against the detector plane.*
-
-REFERENCE
-
-L A Feigin and D I Svergun, *Structure Analysis by Small-Angle X-Ray and Neutron Scattering*, Plenum Press,
-New York, (1987)
-
-
-
-.. _CappedCylinderModel:
-
-**2.1.16 CappedCylinderModel**
-
-Calculates the scattering from a cylinder with spherical section end-caps. This model simply becomes the ConvexLensModel
-when the length of the cylinder *L* = 0, that is, a sphereocylinder with end caps that have a radius larger than that
-of the cylinder and the center of the end cap radius lies within the cylinder. See the diagram for the details
-of the geometry and restrictions on parameter values.
-
-*2.1.16.1. Definition*
-
-The returned value is scaled to units of |cm^-1|\ |sr^-1|, absolute scale.
-
-The Capped Cylinder geometry is defined as
-
-.. image:: ..\img\olddocs\image112.jpg
-
-where *r* is the radius of the cylinder. All other parameters are as defined in the diagram. Since the end cap radius
-*R* >= *r* and by definition for this geometry *h* < 0, *h* is then defined by *r* and *R* as
-
-*h* = -1 \* sqrt(*R*\ :sup:`2` - *r*\ :sup:`2`)
-
-The scattered intensity *I(q)* is calculated as
-
-.. image:: ..\img\olddocs\image113.jpg
-
-where the amplitude *A(q)* is given as
-
-.. image:: ..\img\olddocs\image114.jpg
-
-The < > brackets denote an average of the structure over all orientations. <\ *A*\ :sup:`2`\ *(q)*> is then the form
-factor, *P(q)*. The scale factor is equivalent to the volume fraction of cylinders, each of volume, *V*. Contrast is the
-difference of scattering length densities of the cylinder and the surrounding solvent.
-
-The volume of the Capped Cylinder is (with *h* as a positive value here)
-
-.. image:: ..\img\olddocs\image115.jpg
-
-and its radius-of-gyration
-
-.. image:: ..\img\olddocs\image116.jpg
-
-**The requirement that** *R* >= *r* **is not enforced in the model! It is up to you to restrict this during analysis.**
-
-This following example dataset is produced by running the MacroCappedCylinder(), using 200 data points,
-*qmin* = 0.001 |Ang^-1|, *qmax* = 0.7 |Ang^-1| and the default values
-
-==============  ========  =============
-Parameter name  Units     Default value
-==============  ========  =============
-scale           None      1.0
-len_cyl         |Ang|     400.0
-rad_cap         |Ang|     40.0
-rad_cyl         |Ang|     20.0
-sld_capcyl      |Ang^-2|  1.0e-006
-sld_solv        |Ang^-2|  6.3e-006
-background      |cm^-1|   0
-==============  ========  =============
-
-.. image:: ..\img\olddocs\image117.jpg
-
-*Figure. 1D plot using the default values (w/256 data point).*
-
-For 2D data: The 2D scattering intensity is calculated similar to the 2D cylinder model. For example, for
-|theta| = 45 deg and |phi| =0 deg with default values for other parameters
-
-.. image:: ..\img\olddocs\image118.jpg
-
-*Figure. 2D plot (w/(256X265) data points).*
-
-.. image:: ..\img\olddocs\image061.jpg
-
-*Figure. Definition of the angles for oriented 2D cylinders.*
-
-.. image:: ..\img\olddocs\image062.jpg
-
-*Figure. Examples of the angles for oriented pp against the detector plane.*
-
-REFERENCE
-
-H Kaya, *J. Appl. Cryst.*, 37 (2004) 223-230
-
-H Kaya and N-R deSouza, *J. Appl. Cryst.*, 37 (2004) 508-509 (addenda and errata)
-
-
-
-.. _CoreShellCylinderModel:
-
-**2.1.17. CoreShellCylinderModel**
-
-This model provides the form factor for a circular cylinder with a core-shell scattering length density profile. The
-form factor is normalized by the particle volume.
-
-*2.1.17.1. Definition*
-
-The output of the 2D scattering intensity function for oriented core-shell cylinders is given by (Kline, 2006)
-
-.. image:: ..\img\olddocs\image067.PNG
-
-where
-
-.. image:: ..\img\olddocs\image068.PNG
-
-.. image:: ..\img\olddocs\image239.PNG
-
-and |alpha| is the angle between the axis of the cylinder and the *q*\ -vector, *Vs* is the volume of the outer shell
-(i.e. the total volume, including the shell), *Vc* is the volume of the core, *L* is the length of the core, *r* is the
-radius of the core, *t* is the thickness of the shell, |rho|\ :sub:`c` is the scattering length density of the core,
-|rho|\ :sub:`s` is the scattering length density of the shell, |rho|\ :sub:`solv` is the scattering length density of
-the solvent, and *bkg* is the background level. The outer radius of the shell is given by *r+t* and the total length of
-the outer shell is given by *L+2t*. *J1* is the first order Bessel function.
-
-.. image:: ..\img\olddocs\image069.jpg
-
-To provide easy access to the orientation of the core-shell cylinder, we define the axis of the cylinder using two
-angles |theta| and |phi|\ . As for the case of the cylinder, those angles are defined in Figure 2 of the CylinderModel.
-
-NB: The 2nd virial coefficient of the cylinder is calculated based on the radius and 2 length values, and used as the
-effective radius for *S(Q)* when *P(Q)* \* *S(Q)* is applied.
-
-The returned value is scaled to units of |cm^-1| and the parameters of the core-shell cylinder model are the following
-
-==============  ========  =============
-Parameter name  Units     Default value
-==============  ========  =============
-scale           None      1.0
-radius          |Ang|     20.0
-thickness       |Ang|     10.0
-length          |Ang|     400.0
-core_sld        |Ang^-2|  1e-6
-shell_sld       |Ang^-2|  4e-6
-solvent_sld     |Ang^-2|  1e-6
-background      |cm^-1|   0.0
-axis_theta      degree    90
-axis_phi        degree    0.0
-==============  ========  =============
-
-The output of the 1D scattering intensity function for randomly oriented cylinders is then given by the equation above.
-
-The *axis_theta* and *axis_phi* parameters are not used for the 1D output. Our implementation of the scattering kernel
-and the 1D scattering intensity use the c-library from NIST.
-
-*2.1.17.2. Validation of the CoreShellCylinderModel*
-
-Validation of our code was done by comparing the output of the 1D model to the output of the software provided by the
-NIST (Kline, 2006). Figure 1 shows a comparison of the 1D output of our model and the output of the NIST software.
-
-.. image:: ..\img\olddocs\image070.jpg
-
-*Figure 1: Comparison of the SasView scattering intensity for a core-shell cylinder with the output of the NIST SANS*
-*analysis software.* The parameters were set to: *Scale* = 1.0, *Radius* = 20 |Ang|, *Thickness* = 10 |Ang|,
-*Length* = 400 |Ang|, *Core_sld* = 1e-6 |Ang^-2|, *Shell_sld* = 4e-6 |Ang^-2|, *Solvent_sld* = 1e-6 |Ang^-2|,
-and *Background* = 0.01 |cm^-1|.
-
-Averaging over a distribution of orientation is done by evaluating the equation above. Since we have no other software
-to compare the implementation of the intensity for fully oriented cylinders, we can compare the result of averaging our
-2D output using a uniform distribution *p(*\ |theta|,\ |phi|\ *)* = 1.0. Figure 2 shows the result of such a cross-check.
-
-.. image:: ..\img\olddocs\image071.jpg
-
-*Figure 2: Comparison of the intensity for uniformly distributed core-shell cylinders calculated from our 2D model and*
-*the intensity from the NIST SANS analysis software.* The parameters used were: *Scale* = 1.0, *Radius* = 20 |Ang|,
-*Thickness* = 10 |Ang|, *Length* =400 |Ang|, *Core_sld* = 1e-6 |Ang^-2|, *Shell_sld* = 4e-6 |Ang^-2|,
-*Solvent_sld* = 1e-6 |Ang^-2|, and *Background* = 0.0 |cm^-1|.
-
-.. image:: ..\img\olddocs\image061.jpg
-
-*Figure. Definition of the angles for oriented core-shell cylinders.*
-
-.. image:: ..\img\olddocs\image062.jpg
-
-*Figure. Examples of the angles for oriented pp against the detector plane.*
-
-2013/11/26 - Description reviewed by Heenan, R.
-
-
-
-.. _EllipticalCylinderModel:
-
-**2.1.18 EllipticalCylinderModel**
-
-This function calculates the scattering from an elliptical cylinder.
-
-*2.1.18.1 Definition for 2D (orientated system)*
-
-The angles |theta| and |phi| define the orientation of the axis of the cylinder. The angle |bigpsi| is defined as the
-orientation of the major axis of the ellipse with respect to the vector *Q*\ . A gaussian polydispersity can be added
-to any of the orientation angles, and also for the minor radius and the ratio of the ellipse radii.
-
-.. image:: ..\img\olddocs\image098.gif
-
-*Figure.* *a* = *r_minor* and |nu|\ :sub:`n` = *r_ratio* (i.e., *r_major* / *r_minor*).
-
-The function calculated is
-
-.. image:: ..\img\olddocs\image099.PNG
-
-with the functions
-
-.. image:: ..\img\olddocs\image100.PNG
-
-and the angle |bigpsi| is defined as the orientation of the major axis of the ellipse with respect to the vector *q*\ .
-
-*2.1.18.2 Definition for 1D (no preferred orientation)*
-
-The form factor is averaged over all possible orientation before normalized by the particle volume
-
-*P(q)* = *scale* \* <*F*\ :sup:`2`> / *V*
-
-The returned value is scaled to units of |cm^-1|.
-
-To provide easy access to the orientation of the elliptical cylinder, we define the axis of the cylinder using two
-angles |theta|, |phi| and |bigpsi|. As for the case of the cylinder, the angles |theta| and |phi| are defined on
-Figure 2 of CylinderModel. The angle |bigpsi| is the rotational angle around its own long_c axis against the *q* plane.
-For example, |bigpsi| = 0 when the *r_minor* axis is parallel to the *x*\ -axis of the detector.
-
-All angle parameters are valid and given only for 2D calculation; ie, an oriented system.
-
-.. image:: ..\img\olddocs\image101.jpg
-
-*Figure. Definition of angles for 2D*
-
-.. image:: ..\img\olddocs\image062.jpg
-
-*Figure. Examples of the angles for oriented elliptical cylinders against the detector plane.*
-
-NB: The 2nd virial coefficient of the cylinder is calculated based on the averaged radius (= sqrt(*r_minor*\ :sup:`2` \* *r_ratio*))
-and length values, and used as the effective radius for *S(Q)* when *P(Q)* \* *S(Q)* is applied.
-
-==============  ========  =============
-Parameter name  Units     Default value
-==============  ========  =============
-scale           None      1.0
-r_minor         |Ang|     20.0
-r_ratio         |Ang|     1.5
-length          |Ang|     400.0
-sldCyl          |Ang^-2|  4e-06
-sldSolv         |Ang^-2|  1e-06
-background      |cm^-1|   0
-==============  ========  =============
-
-.. image:: ..\img\olddocs\image102.jpg
-
-*Figure. 1D plot using the default values (w/1000 data point).*
-
-*2.1.18.3 Validation of the EllipticalCylinderModel*
-
-Validation of our code was done by comparing the output of the 1D calculation to the angular average of the output of
-the 2D calculation over all possible angles. The figure below shows the comparison where the solid dot refers to
-averaged 2D values while the line represents the result of the 1D calculation (for the 2D averaging, values of 76, 180,
-and 76 degrees are taken for the angles of |theta|, |phi|, and |bigpsi| respectively).
-
-.. image:: ..\img\olddocs\image103.gif
-
-*Figure. Comparison between 1D and averaged 2D.*
-
-In the 2D average, more binning in the angle |phi| is necessary to get the proper result. The following figure shows
-the results of the averaging by varying the number of angular bins.
-
-.. image:: ..\img\olddocs\image104.gif
-
-*Figure. The intensities averaged from 2D over different numbers of bins and angles.*
-
-REFERENCE
-
-L A Feigin and D I Svergun, *Structure Analysis by Small-Angle X-Ray and Neutron Scattering*, Plenum,
-New York, (1987)
-
-
-
-.. _FlexibleCylinderModel:
-
-**2.1.19. FlexibleCylinderModel**
-
-This model provides the form factor, *P(q)*, for a flexible cylinder where the form factor is normalized by the volume
-of the cylinder. **Inter-cylinder interactions are NOT provided for.**
-
-*P(q)* = *scale* \* <*F*\ :sup:`2`> / *V* + *background*
-
-where the averaging < > is applied over all orientations for 1D.
-
-The 2D scattering intensity is the same as 1D, regardless of the orientation of the *q* vector which is defined as
-
-.. image:: ..\img\olddocs\image040.gif
-
-*2.1.19.1. Definition*
-
-.. image:: ..\img\olddocs\image075.jpg
-
-The chain of contour length, *L*, (the total length) can be described as a chain of some number of locally stiff
-segments of length *l*\ :sub:`p`\ , the persistence length (the length along the cylinder over which the flexible
-cylinder can be considered a rigid rod). The Kuhn length (*b* = 2 \* *l* :sub:`p`) is also used to describe the
-stiffness of a chain.
-
-The returned value is in units of |cm^-1|, on absolute scale.
-
-In the parameters, the sldCyl and sldSolv represent the SLD of the chain/cylinder and solvent respectively.
-
-==============  ========  =============
-Parameter name  Units     Default value
-==============  ========  =============
-scale           None      1.0
-radius          |Ang|     20
-length          |Ang|     1000
-sldCyl          |Ang^-2|  1e-06
-sldSolv         |Ang^-2|  6.3e-06
-background      |cm^-1|   0.01
-kuhn_length     |Ang|     100
-==============  ========  =============
-
-.. image:: ..\img\olddocs\image076.jpg
-
-*Figure. 1D plot using the default values (w/1000 data point).*
-
-Our model uses the form factor calculations implemented in a c-library provided by the NIST Center for Neutron Research
-(Kline, 2006).
-
-From the reference
-
-  "Method 3 With Excluded Volume" is used. The model is a parametrization of simulations of a discrete representation
-  of the worm-like chain model of Kratky and Porod applied in the pseudocontinuous limit. See equations (13,26-27) in
-  the original reference for the details.
-
-REFERENCE
-
-J S Pedersen and P Schurtenberger. *Scattering functions of semiflexible polymers with and without excluded volume*
-*effects*. *Macromolecules*, 29 (1996) 7602-7612
-
-Correction of the formula can be found in
-
-W R Chen, P D Butler and L J Magid, *Incorporating Intermicellar Interactions in the Fitting of SANS Data from*
-*Cationic Wormlike Micelles*. *Langmuir*, 22(15) 2006 6539Ã¢â¬â6548
-
-
-
-.. _FlexCylEllipXModel:
-
-**2.1.20 FlexCylEllipXModel**
-
-This model calculates the form factor for a flexible cylinder with an elliptical cross section and a uniform scattering
-length density. The non-negligible diameter of the cylinder is included by accounting for excluded volume interactions
-within the walk of a single cylinder. The form factor is normalized by the particle volume such that
-
-*P(q)* = *scale* \* <*F*\ :sup:`2`> / *V* + *background*
-
-where < > is an average over all possible orientations of the flexible cylinder.
-
-*2.1.20.1. Definition*
-
-The function calculated is from the reference given below. From that paper, "Method 3 With Excluded Volume" is used.
-The model is a parameterization of simulations of a discrete representation of the worm-like chain model of Kratky and
-Porod applied in the pseudo-continuous limit. See equations (13, 26-27) in the original reference for the details.
-
-NB: there are several typos in the original reference that have been corrected by WRC. Details of the corrections are
-in the reference below. Most notably
-
-- Equation (13): the term (1 - w(QR)) should swap position with w(QR)
-
-- Equations (23) and (24) are incorrect; WRC has entered these into Mathematica and solved analytically. The results
-  were then converted to code.
-
-- Equation (27) should be q0 = max(a3/sqrt(RgSquare),3) instead of max(a3*b/sqrt(RgSquare),3)
-
-- The scattering function is negative for a range of parameter values and q-values that are experimentally accessible. A correction function has been added to give the proper behavior.
-
-.. image:: ..\img\olddocs\image077.jpg
-
-The chain of contour length, *L*, (the total length) can be described as a chain of some number of locally stiff
-segments of length *l*\ :sub:`p`\ , the persistence length (the length along the cylinder over which the flexible
-cylinder can be considered a rigid rod). The Kuhn length (*b* = 2 \* *l* :sub:`p`) is also used to describe the
-stiffness of a chain.
-
-The cross section of the cylinder is elliptical, with minor radius *a*\ . The major radius is larger, so of course,
-**the axis ratio (parameter 4) must be greater than one.** Simple constraints should be applied during curve fitting to
-maintain this inequality.
-
-The returned value is in units of |cm^-1|, on absolute scale.
-
-In the parameters, *sldCyl* and *sldSolv* represent the SLD of the chain/cylinder and solvent respectively. The
-*scale*, and the contrast are both multiplicative factors in the model and are perfectly correlated. One or both of
-these parameters must be held fixed during model fitting.
-
-If the scale is set equal to the particle volume fraction, |phi|, the returned value is the scattered intensity per
-unit volume, *I(q)* = |phi| \* *P(q)*.
-
-**No inter-cylinder interference effects are included in this calculation.**
-
-For 2D data: The 2D scattering intensity is calculated in the same way as 1D, where the *q* vector is defined as
-
-.. image:: ..\img\olddocs\image008.PNG
-
-This example dataset is produced by running the Macro FlexCylEllipXModel, using 200 data points, *qmin* = 0.001 |Ang^-1|,
-*qmax* = 0.7 |Ang^-1| and the default values below
-
-==============  ========  =============
-Parameter name  Units     Default value
-==============  ========  =============
-axis_ratio      None      1.5
-background      |cm^-1|   0.0001
-Kuhn_length     |Ang|     100
-Contour length  |Ang|     1e+3
-radius          |Ang|     20.0
-scale           None      1.0
-sldCyl          |Ang^-2|  1e-6
-sldSolv         |Ang^-2|  6.3e-6
-==============  ========  =============
-
-.. image:: ..\img\olddocs\image078.jpg
-
-*Figure. 1D plot using the default values (w/200 data points).*
-
-REFERENCE
-
-J S Pedersen and P Schurtenberger. *Scattering functions of semiflexible polymers with and without excluded volume*
-*effects*. *Macromolecules*, 29 (1996) 7602-7612
-
-Correction of the formula can be found in
-
-W R Chen, P D Butler and L J Magid, *Incorporating Intermicellar Interactions in the Fitting of SANS Data from*
-*Cationic Wormlike Micelles*. *Langmuir*, 22(15) 2006 6539Ã¢â¬â6548
-
-
-
-.. _CoreShellBicelleModel:
-
-**2.1.21 CoreShellBicelleModel**
-
-This model provides the form factor for a circular cylinder with a core-shell scattering length density profile. The
-form factor is normalized by the particle volume.
-
-This model is a more general case of core-shell cylinder model (see above and reference below) in that the parameters
-of the shell are separated into a face-shell and a rim-shell so that users can set different values of the thicknesses
-and SLDs.
-
-.. image:: ..\img\olddocs\image240.png
-
-*(Graphic from DOI: 10.1039/C0NP00002G)*
-
-The returned value is scaled to units of |cm^-1| and the parameters of the CoreShellBicelleModel are the following
-
-==============  ========  =============
-Parameter name  Units     Default value
-==============  ========  =============
-scale           None      1.0
-radius          |Ang|     20.0
-rim_thick       |Ang|     10.0
-face_thick      |Ang|     10.0
-length          |Ang|     400.0
-core_sld        |Ang^-2|  1e-6
-rim_sld         |Ang^-2|  4e-6
-face_sld        |Ang^-2|  4e-6
-solvent_sld     |Ang^-2|  1e-6
-background      |cm^-1|   0.0
-axis_theta      degree    90
-axis_phi        degree    0.0
-==============  ========  =============
-
-The output of the 1D scattering intensity function for randomly oriented cylinders is then given by the equation above.
-
-The *axis_theta* and *axis_phi* parameters are not used for the 1D output. Our implementation of the scattering kernel
-and the 1D scattering intensity use the c-library from NIST.
-
-.. image:: ..\img\olddocs\cscylbicelle_pic.jpg
-
-*Figure. 1D plot using the default values (w/200 data point).*
-
-.. image:: ..\img\olddocs\image061.jpg
-
-*Figure. Definition of the angles for the oriented CoreShellBicelleModel.*
-
-.. image:: ..\img\olddocs\image062.jpg
-
-*Figure. Examples of the angles for oriented pp against the detector plane.*
-
-REFERENCE
-
-L A Feigin and D I Svergun, *Structure Analysis by Small-Angle X-Ray and Neutron Scattering*, Plenum Press,
-New York, (1987)
-
-
-
-.. _BarBellModel:
-
-**2.1.22. BarBellModel**
-
-Calculates the scattering from a barbell-shaped cylinder (This model simply becomes the DumBellModel when the length of
-the cylinder, *L*, is set to zero). That is, a sphereocylinder with spherical end caps that have a radius larger than
-that of the cylinder and the center of the end cap radius lies outside of the cylinder. All dimensions of the BarBell
-are considered to be monodisperse. See the diagram for the details of the geometry and restrictions on parameter values.
-
-*2.1.22.1. Definition*
-
-The returned value is scaled to units of |cm^-1|\ |sr^-1|, absolute scale.
-
-The barbell geometry is defined as
-
-.. image:: ..\img\olddocs\image105.jpg
-
-where *r* is the radius of the cylinder. All other parameters are as defined in the diagram.
-
-Since the end cap radius
-*R* >= *r* and by definition for this geometry *h* < 0, *h* is then defined by *r* and *R* as
-
-*h* = -1 \* sqrt(*R*\ :sup:`2` - *r*\ :sup:`2`)
-
-The scattered intensity *I(q)* is calculated as
-
-.. image:: ..\img\olddocs\image106.PNG
-
-where the amplitude *A(q)* is given as
-
-.. image:: ..\img\olddocs\image107.PNG
-
-The < > brackets denote an average of the structure over all orientations. <*A* :sup:`2`\ *(q)*> is then the form
-factor, *P(q)*. The scale factor is equivalent to the volume fraction of cylinders, each of volume, *V*. Contrast is
-the difference of scattering length densities of the cylinder and the surrounding solvent.
-
-The volume of the barbell is
-
-.. image:: ..\img\olddocs\image108.jpg
-
-
-and its radius-of-gyration is
-
-.. image:: ..\img\olddocs\image109.jpg
-
-**The requirement that** *R* >= *r* **is not enforced in the model!** It is up to you to restrict this during analysis.
-
-This example dataset is produced by running the Macro PlotBarbell(), using 200 data points, *qmin* = 0.001 |Ang^-1|,
-*qmax* = 0.7 |Ang^-1| and the following default values
-
-==============  ========  =============
-Parameter name  Units     Default value
-==============  ========  =============
-scale           None      1.0
-len_bar         |Ang|     400.0
-rad_bar         |Ang|     20.0
-rad_bell        |Ang|     40.0
-sld_barbell     |Ang^-2|  1.0e-006
-sld_solv        |Ang^-2|  6.3e-006
-background      |cm^-1|   0
-==============  ========  =============
-
-.. image:: ..\img\olddocs\image110.jpg
-
-*Figure. 1D plot using the default values (w/256 data point).*
-
-For 2D data: The 2D scattering intensity is calculated similar to the 2D cylinder model. For example, for
-|theta| = 45 deg and |phi| = 0 deg with default values for other parameters
-
-.. image:: ..\img\olddocs\image111.jpg
-
-*Figure. 2D plot (w/(256X265) data points).*
-
-.. image:: ..\img\olddocs\image061.jpg
-
-*Figure. Examples of the angles for oriented pp against the detector plane.*
-
-.. image:: ..\img\olddocs\image062.jpg
-
-Figure. Definition of the angles for oriented 2D barbells.
-
-REFERENCE
-
-H Kaya, *J. Appl. Cryst.*, 37 (2004) 37 223-230
-
-H Kaya and N R deSouza, *J. Appl. Cryst.*, 37 (2004) 508-509 (addenda and errata)
-
-
-
-.. _StackedDisksModel:
-
-**2.1.23. StackedDisksModel**
-
-This model provides the form factor, *P(q)*, for stacked discs (tactoids) with a core/layer structure where the form
-factor is normalized by the volume of the cylinder. Assuming the next neighbor distance (d-spacing) in a stack of
-parallel discs obeys a Gaussian distribution, a structure factor *S(q)* proposed by Kratky and Porod in 1949 is used
-in this function.
-
-Note that the resolution smearing calculation uses 76 Gauss quadrature points to properly smear the model since the
-function is HIGHLY oscillatory, especially around the *q*-values that correspond to the repeat distance of the layers.
-
-The 2D scattering intensity is the same as 1D, regardless of the orientation of the *q* vector which is defined as
-
-.. image:: ..\img\olddocs\image008.PNG
-
-The returned value is in units of |cm^-1| |sr^-1|, on absolute scale.
-
-*2.1.23.1 Definition*
-
-.. image:: ..\img\olddocs\image079.gif
-
-The scattering intensity *I(q)* is
-
-.. image:: ..\img\olddocs\image081.PNG
-
-where the contrast
-
-.. image:: ..\img\olddocs\image082.PNG
-
-and *N* is the number of discs per unit volume, |alpha| is the angle between the axis of the disc and *q*, and *Vt*
-and *Vc* are the total volume and the core volume of a single disc, respectively.
-
-.. image:: ..\img\olddocs\image083.PNG
-
-where *d* = thickness of the layer (*layer_thick*), 2\ *h* = core thickness (*core_thick*), and *R* = radius of the
-disc (*radius*).
-
-.. image:: ..\img\olddocs\image084.PNG
-
-where *n* = the total number of the disc stacked (*n_stacking*), *D* = the next neighbor center-to-center distance
-(*d-spacing*), and |sigma|\ D= the Gaussian standard deviation of the d-spacing (*sigma_d*).
-
-To provide easy access to the orientation of the stacked disks, we define the axis of the cylinder using two angles
-|theta| and |phi|. These angles are defined on Figure 2 of CylinderModel.
-
-NB: The 2nd virial coefficient of the cylinder is calculated based on the *radius* and *length* = *n_stacking* \*
-(*core_thick* + 2 \* *layer_thick*) values, and used as the effective radius for *S(Q)* when *P(Q)* \* *S(Q)* is applied.
-
-==============  ========  =============
-Parameter name  Units     Default value
-==============  ========  =============
-background      |cm^-1|   0.001
-core_sld        |Ang^-2|  4e-006
-core_thick      |Ang|     10
-layer_sld       |Ang^-2|  0
-layer_thick     |Ang|     15
-n_stacking      None      1
-radius          |Ang|     3e+03
-scale           None      0.01
-sigma_d         |Ang|     0
-solvent_sld     |Ang^-2|  5e-06
-==============  ========  =============
-
-.. image:: ..\img\olddocs\image085.jpg
-
-*Figure. 1D plot using the default values (w/1000 data point).*
-
-.. image:: ..\img\olddocs\image086.jpg
-
-*Figure. Examples of the angles for oriented stackeddisks against the detector plane.*
-
-.. image:: ..\img\olddocs\image062.jpg
-
-*Figure. Examples of the angles for oriented pp against the detector plane.*
-
-Our model uses the form factor calculations implemented in a c-library provided by the NIST Center for Neutron Research
-(Kline, 2006)
-
-REFERENCE
-
-A Guinier and G Fournet, *Small-Angle Scattering of X-Rays*, John Wiley and Sons, New York, 1955
-
-O Kratky and G Porod, *J. Colloid Science*, 4, (1949) 35
-
-J S Higgins and H C Benoit, *Polymers and Neutron Scattering*, Clarendon, Oxford, 1994
-
-
-
-.. _PringleModel:
-
-**2.1.24. PringleModel**
-
-This model provides the form factor, *P(q)*, for a 'pringle' or 'saddle-shaped' object (a hyperbolic paraboloid).
-
-.. image:: ..\img\olddocs\image241.png
-
-*(Graphic from Matt Henderson, matt@matthen.com)*
-
-The returned value is in units of |cm^-1|, on absolute scale.
-
-The form factor calculated is
-
-.. image:: ..\img\olddocs\pringle_eqn_1.jpg
-
-where
-
-.. image:: ..\img\olddocs\pringle_eqn_2.jpg
-
-The parameters of the model and a plot comparing the pringle model with the equivalent cylinder are shown below.
-
-==============  ========  =============
-Parameter name  Units     Default value
-==============  ========  =============
-background      |cm^-1|   0.0
-alpha           None      0.001
-beta            None      0.02
-radius          |Ang|     60
-scale           None      1
-sld_pringle     |Ang^-2|  1e-06
-sld_solvent     |Ang^-2|  6.3e-06
-thickness       |Ang|     10
-==============  ========  =============
-
-.. image:: ..\img\olddocs\pringle-vs-cylinder.png
-
-*Figure. 1D plot using the default values (w/150 data point).*
-
-REFERENCE
-
-S Alexandru Rautu, Private Communication.
-
-
-
-.. _EllipsoidModel:
-
-**2.1.25. EllipsoidModel**
-
-This model provides the form factor for an ellipsoid (ellipsoid of revolution) with uniform scattering length density.
-The form factor is normalized by the particle volume.
-
-*2.1.25.1. Definition*
-
-The output of the 2D scattering intensity function for oriented ellipsoids is given by (Feigin, 1987)
-
-.. image:: ..\img\olddocs\image059.PNG
-
-where
-
-.. image:: ..\img\olddocs\image119.PNG
-
-and
-
-.. image:: ..\img\olddocs\image120.PNG
-
-|alpha| is the angle between the axis of the ellipsoid and the *q*\ -vector, *V* is the volume of the ellipsoid, *Ra*
-is the radius along the rotational axis of the ellipsoid, *Rb* is the radius perpendicular to the rotational axis of
-the ellipsoid and |drho| (contrast) is the scattering length density difference between the scatterer and
-the solvent.
-
-To provide easy access to the orientation of the ellipsoid, we define the rotation axis of the ellipsoid using two
-angles |theta| and |phi|\ . These angles are defined on Figure 2 of the CylinderModel_. For the ellipsoid, |theta|
-is the angle between the rotational axis and the *z*\ -axis.
-
-NB: The 2nd virial coefficient of the solid ellipsoid is calculated based on the *radius_a* and *radius_b* values, and
-used as the effective radius for *S(Q)* when *P(Q)* \* *S(Q)* is applied.
-
-The returned value is scaled to units of |cm^-1| and the parameters of the EllipsoidModel are the following
-
-================  ========  =============
-Parameter name    Units     Default value
-================  ========  =============
-scale             None      1.0
-radius_a (polar)  |Ang|     20.0
-radius_b (equat)  |Ang|     400.0
-sldEll            |Ang^-2|  4.0e-6
-sldSolv           |Ang^-2|  1.0e-6
-background        |cm^-1|   0.0
-axis_theta        degree    90
-axis_phi          degree    0.0
-================  ========  =============
-
-The output of the 1D scattering intensity function for randomly oriented ellipsoids is then given by the equation
-above.
-
-.. image:: ..\img\olddocs\image121.jpg
-
-The *axis_theta* and *axis_phi* parameters are not used for the 1D output. Our implementation of the scattering
-kernel and the 1D scattering intensity use the c-library from NIST.
-
-.. image:: ..\img\olddocs\image122.jpg
-
-*Figure. The angles for oriented ellipsoid.*
-
-*2.1.25.1. Validation of the EllipsoidModel*
-
-Validation of our code was done by comparing the output of the 1D model to the output of the software provided by the
-NIST (Kline, 2006). Figure 1 below shows a comparison of the 1D output of our model and the output of the NIST
-software.
-
-.. image:: ..\img\olddocs\image123.jpg
-
-*Figure 1: Comparison of the SasView scattering intensity for an ellipsoid with the output of the NIST SANS analysis*
-*software.* The parameters were set to: *Scale* = 1.0, *Radius_a* = 20, *Radius_b* = 400, *Contrast* = 3e-6 |Ang^-2|,
-and *Background* = 0.01 |cm^-1|.
-
-Averaging over a distribution of orientation is done by evaluating the equation above. Since we have no other software
-to compare the implementation of the intensity for fully oriented ellipsoids, we can compare the result of averaging
-our 2D output using a uniform distribution *p(*\ |theta|,\ |phi|\ *)* = 1.0. Figure 2 shows the result of such a
-cross-check.
-
-.. image:: ..\img\olddocs\image124.jpg
-
-*Figure 2: Comparison of the intensity for uniformly distributed ellipsoids calculated from our 2D model and the*
-*intensity from the NIST SANS analysis software.* The parameters used were: *Scale* = 1.0, *Radius_a* = 20,
-*Radius_b* = 400, *Contrast* = 3e-6 |Ang^-2|, and *Background* = 0.0 |cm^-1|.
-
-The discrepancy above *q* = 0.3 |cm^-1| is due to the way the form factors are calculated in the c-library provided by
-NIST. A numerical integration has to be performed to obtain *P(q)* for randomly oriented particles. The NIST software
-performs that integration with a 76-point Gaussian quadrature rule, which will become imprecise at high q where the
-amplitude varies quickly as a function of *q*. The SasView result shown has been obtained by summing over 501
-equidistant points in . Our result was found to be stable over the range of *q* shown for a number of points higher
-than 500.
-
-REFERENCE
-
-L A Feigin and D I Svergun. *Structure Analysis by Small-Angle X-Ray and Neutron Scattering*, Plenum,
-New York, 1987.
-
-
-
-.. _CoreShellEllipsoidModel:
-
-**2.1.26. CoreShellEllipsoidModel**
-
-This model provides the form factor, *P(q)*, for a core shell ellipsoid (below) where the form factor is normalized by
-the volume of the cylinder.
-
-*P(q)* = *scale* \* <*f*\ :sup:`2`> / *V* + *background*
-
-where the volume *V* = (4/3)\ |pi| (*r*\ :sub:`maj` *r*\ :sub:`min`\ :sup:`2`) and the averaging < > is applied over
-all orientations for 1D.
-
-.. image:: ..\img\olddocs\image125.gif
-
-The returned value is in units of |cm^-1|, on absolute scale.
-
-*2.1.26.1. Definition*
-
-The form factor calculated is
-
-.. image:: ..\img\olddocs\image126.PNG
-
-To provide easy access to the orientation of the core-shell ellipsoid, we define the axis of the solid ellipsoid using
-two angles |theta| and |phi|\ . These angles are defined on Figure 2 of the CylinderModel_. The contrast is defined as
-SLD(core) - SLD(shell) and SLD(shell) - SLD(solvent).
-
-In the parameters, *equat_core* = equatorial core radius, *polar_core* = polar core radius, *equat_shell* =
-*r*\ :sub:`min` (or equatorial outer radius), and *polar_shell* = = *r*\ :sub:`maj` (or polar outer radius).
-
-NB: The 2nd virial coefficient of the solid ellipsoid is calculated based on the *radius_a* (= *polar_shell*) and
-*radius_b* (= *equat_shell*) values, and used as the effective radius for *S(Q)* when *P(Q)* \* *S(Q)* is applied.
-
-==============  ========  =============
-Parameter name  Units     Default value
-==============  ========  =============
-background      |cm^-1|   0.001
-equat_core      |Ang|     200
-equat_shell     |Ang|     250
-sld_solvent     |Ang^-2|  6e-06
-ploar_shell     |Ang|     30
-ploar_core      |Ang|     20
-scale           None      1
-sld_core        |Ang^-2|  2e-06
-sld_shell       |Ang^-2|  1e-06
-==============  ========  =============
-
-.. image:: ..\img\olddocs\image127.jpg
-
-*Figure. 1D plot using the default values (w/1000 data point).*
-
-.. image:: ..\img\olddocs\image122.jpg
-
-*Figure. The angles for oriented CoreShellEllipsoid.*
-
-Our model uses the form factor calculations implemented in a c-library provided by the NIST Center for Neutron Research
-(Kline, 2006).
-
-REFERENCE
-
-M Kotlarchyk, S H Chen, *J. Chem. Phys.*, 79 (1983) 2461
-
-S J Berr, *Phys. Chem.*, 91 (1987) 4760
-
-
-
-.. _CoreShellEllipsoidXTModel:
-
-**2.1.27. CoreShellEllipsoidXTModel**
-
-An alternative version of *P(q)* for the core-shell ellipsoid (see CoreShellEllipsoidModel), having as parameters the
-core axial ratio *X* and a shell thickness, which are more often what we would like to determine.
-
-This model is also better behaved when polydispersity is applied than the four independent radii in
-CoreShellEllipsoidModel.
-
-*2.1.27.1. Definition*
-
-.. image:: ..\img\olddocs\image125.gif
-
-The geometric parameters of this model are
-
-  *equat_core* = equatorial core radius = *Rminor_core*
-  
-  *X_core* = *polar_core* / *equat_core* = *Rmajor_core* / *Rminor_core*
-  
-  *T_shell* = *equat_outer* - *equat_core* = *Rminor_outer* - *Rminor_core*
-  
-  *XpolarShell* = *Tpolar_shell* / *T_shell* = (*Rmajor_outer* - *Rmajor_core*)/(*Rminor_outer* - *Rminor_core*)
-
-In terms of the original radii
-
-  *polar_core* = *equat_core* \* *X_core*
-  
-  *equat_shell* = *equat_core* + *T_shell*
-  
-  *polar_shell* = *equat_core* \* *X_core* + *T_shell* \* *XpolarShell*
-
-  (where we note that "shell" perhaps confusingly, relates to the outer radius)
-
-When *X_core* < 1 the core is oblate; when *X_core* > 1  it is prolate. *X_core* = 1 is a spherical core.
-
-For a fixed shell thickness *XpolarShell* = 1, to scale the shell thickness pro-rata with the radius
-*XpolarShell* = *X_core*.
-
-When including an *S(q)*, the radius in *S(q)* is calculated to be that of a sphere with the same 2nd virial
-coefficient of the **outer** surface of the ellipsoid. This may have some undesirable effects if the aspect ratio of
-the ellipsoid is large (ie, if *X* << 1 or *X* >> 1), when the *S(q)* - which assumes spheres - will not in any case
-be valid.
-
-If SAS data are in absolute units, and the SLDs are correct, then *scale* should be the total volume fraction of the
-"outer particle". When *S(q)* is introduced this moves to the *S(q)* volume fraction, and *scale* should then be 1.0,
-or contain some other units conversion factor (for example, if you have SAXS data).
-
-==============  ========  =============
-Parameter name  Units     Default value
-==============  ========  =============
-background      |cm^-1|   0.001
-equat_core      |Ang|     20
-scale           None      0.05
-sld_core        |Ang^-2|  2.0e-6
-sld_shell       |Ang^-2|  1.0e-6
-sld_solv        |Ang^-2|  6.3e-6
-T_shell         |Ang|     30
-X_core          None      3.0
-XpolarShell     None      1.0
-==============  ========  =============
-
-REFERENCE
-
-R K Heenan, Private communication
-
-
-
-.. _TriaxialEllipsoidModel:
-
-**2.1.28. TriaxialEllipsoidModel**
-
-This model provides the form factor, *P(q)*, for an ellipsoid (below) where all three axes are of different lengths,
-i.e., *Ra* =< *Rb* =< *Rc*\ . **Users should maintain this inequality for all calculations**.
-
-*P(q)* = *scale* \* <*f*\ :sup:`2`> / *V* + *background*
-
-where the volume *V* = (4/3)\ |pi| (*Ra* *Rb* *Rc*), and the averaging < > is applied over all orientations for 1D.
-
-.. image:: ..\img\olddocs\image128.jpg
-
-The returned value is in units of |cm^-1|, on absolute scale.
-
-*2.1.28.1. Definition*
-
-The form factor calculated is
-
-.. image:: ..\img\olddocs\image129.PNG
-
-To provide easy access to the orientation of the triaxial ellipsoid, we define the axis of the cylinder using the
-angles |theta|, |phi| and |bigpsi|. These angles are defined on Figure 2 of the CylinderModel_. The angle |bigpsi| is
-the rotational angle around its own *semi_axisC* axis against the *q* plane. For example, |bigpsi| = 0 when the
-*semi_axisA* axis is parallel to the *x*-axis of the detector.
-
-The radius-of-gyration for this system is *Rg*\ :sup:`2` = (*Ra*\ :sup:`2` *Rb*\ :sup:`2` *Rc*\ :sup:`2`)/5.
-
-The contrast is defined as SLD(ellipsoid) - SLD(solvent). In the parameters, *semi_axisA* = *Ra* (or minor equatorial
-radius), *semi_axisB* = *Rb* (or major equatorial radius), and *semi_axisC* = *Rc* (or polar radius of the ellipsoid).
-
-NB: The 2nd virial coefficient of the triaxial solid ellipsoid is calculated based on the
-*radius_a* (= *semi_axisC*\ ) and *radius_b* (= sqrt(*semi_axisA* \* *semi_axisB*)) values, and used as the effective
-radius for *S(Q)* when *P(Q)* \* *S(Q)* is applied.
-
-==============  ========  =============
-Parameter name  Units     Default value
-==============  ========  =============
-background      |cm^-1|   0.0
-semi_axisA      |Ang|     35
-semi_axisB      |Ang|     100
-semi_axisC      |Ang|     400
-scale           None      1
-sldEll          |Ang^-2|  1.0e-06
-sldSolv         |Ang^-2|  6.3e-06
-==============  ========  =============
-
-.. image:: ..\img\olddocs\image130.jpg
-
-*Figure. 1D plot using the default values (w/1000 data point).*
-
-*2.1.28.2.Validation of the TriaxialEllipsoidModel*
-
-Validation of our code was done by comparing the output of the 1D calculation to the angular average of the output of
-2D calculation over all possible angles. The Figure below shows the comparison where the solid dot refers to averaged
-2D while the line represents the result of 1D calculation (for 2D averaging, 76, 180, and 76 points are taken for the
-angles of |theta|, |phi|, and |psi| respectively).
-
-.. image:: ..\img\olddocs\image131.gif
-
-*Figure. Comparison between 1D and averaged 2D.*
-
-.. image:: ..\img\olddocs\image132.jpg
-
-*Figure. The angles for oriented ellipsoid.*
-
-Our model uses the form factor calculations implemented in a c-library provided by the NIST Center for Neutron Research
-(Kline, 2006)
-
-REFERENCE
-
-L A Feigin and D I Svergun, *Structure Analysis by Small-Angle X-Ray and Neutron Scattering*, Plenum,
-New York, 1987.
-
-
-
-.. _LamellarModel:
-
-**2.1.29. LamellarModel**
-
-This model provides the scattering intensity, *I(q)*, for a lyotropic lamellar phase where a uniform SLD and random
-distribution in solution are assumed. Polydispersity in the bilayer thickness can be applied from the GUI.
-
-*2.1.29.1. Definition*
-
-The scattering intensity *I(q)* is
-
-.. image:: ..\img\olddocs\image133.PNG
-
-The form factor is
-
-.. image:: ..\img\olddocs\image134.PNG
-
-where |delta| = bilayer thickness.
-
-The 2D scattering intensity is calculated in the same way as 1D, where the *q* vector is defined as
-
-.. image:: ..\img\olddocs\image040.gif
-
-The returned value is in units of |cm^-1|, on absolute scale. In the parameters, *sld_bi* = SLD of the bilayer,
-*sld_sol* = SLD of the solvent, and *bi_thick* = thickness of the bilayer.
-
-==============  ========  =============
-Parameter name  Units     Default value
-==============  ========  =============
-background      |cm^-1|   0.0
-sld_bi          |Ang^-2|  1e-06
-bi_thick        |Ang|     50
-sld_sol         |Ang^-2|  6e-06
-scale           None      1
-==============  ========  =============
-
-.. image:: ..\img\olddocs\image135.jpg
-
-*Figure. 1D plot using the default values (w/1000 data point).*
-
-Our model uses the form factor calculations implemented in a c-library provided by the NIST Center for Neutron Research
-(Kline, 2006).
-
-REFERENCE
-
-F Nallet, R Laversanne, and D Roux, J. Phys. II France, 3, (1993) 487-502
-
-also in J. Phys. Chem. B, 105, (2001) 11081-11088
-
-
-
-.. _LamellarFFHGModel:
-
-**2.1.30. LamellarFFHGModel**
-
-This model provides the scattering intensity, *I(q)*, for a lyotropic lamellar phase where a random distribution in
-solution are assumed. The SLD of the head region is taken to be different from the SLD of the tail region.
-
-*2.1.31.1. Definition*
-
-The scattering intensity *I(q)* is
-
-.. image:: ..\img\olddocs\image136.PNG
-
-The form factor is
-
-.. image:: ..\img\olddocs\image137.jpg
-
-where |delta|\ T = tail length (or *t_length*), |delta|\ H = head thickness (or *h_thickness*),
-|drho|\ H = SLD(headgroup) - SLD(solvent), and |drho|\ T = SLD(tail) - SLD(solvent). The total thickness is 2(H+T).
-
-The 2D scattering intensity is calculated in the same way as 1D, where the *q* vector is defined as
-
-.. image:: ..\img\olddocs\image040.gif
-
-The returned value is in units of |cm^-1|, on absolute scale. In the parameters, *sld_tail* = SLD of the tail group,
-and *sld_head* = SLD of the head group.
-
-==============  ========  =============
-Parameter name  Units     Default value
-==============  ========  =============
-background      |cm^-1|   0.0
-sld_head        |Ang^-2|  3e-06
-scale           None      1
-sld_solvent     |Ang^-2|  6e-06
-h_thickness     |Ang|     10
-t_length        |Ang|     15
-sld_tail        |Ang^-2|  0
-==============  ========  =============
-
-.. image:: ..\img\olddocs\image138.jpg
-
-*Figure. 1D plot using the default values (w/1000 data point).*
-
-Our model uses the form factor calculations implemented in a c-library provided by the NIST Center for Neutron Research
-(Kline, 2006).
-
-REFERENCE
-
-F Nallet, R Laversanne, and D Roux, J. Phys. II France, 3, (1993) 487-502
-
-also in J. Phys. Chem. B, 105, (2001) 11081-11088
-
-*2014/04/17 - Description reviewed by S King and P Butler.*
-
-
-
-.. _LamellarPSModel:
-
-**2.1.31. LamellarPSModel**
-
-This model provides the scattering intensity, *I(q)* = *P(q)* \* *S(q)*, for a lyotropic lamellar phase where a random
-distribution in solution are assumed.
-
-*2.1.31.1. Definition*
-
-The scattering intensity *I(q)* is
-
-.. image:: ..\img\olddocs\image139.PNG
-
-The form factor is
-
-.. image:: ..\img\olddocs\image134.PNG
-
-and the structure factor is
-
-.. image:: ..\img\olddocs\image140.PNG
-
-where
-
-.. image:: ..\img\olddocs\image141.PNG
-
-Here *d* = (repeat) spacing, |delta| = bilayer thickness, the contrast |drho| = SLD(headgroup) - SLD(solvent),
-K = smectic bending elasticity, B = compression modulus, and N = number of lamellar plates (*n_plates*).
-
-NB: **When the Caille parameter is greater than approximately 0.8 to 1.0, the assumptions of the model are incorrect.**
-And due to a complication of the model function, users are responsible for making sure that all the assumptions are
-handled accurately (see the original reference below for more details).
-
-The 2D scattering intensity is calculated in the same way as 1D, where the *q* vector is defined as
-
-.. image:: ..\img\olddocs\image040.gif
-
-The returned value is in units of |cm^-1|, on absolute scale.
-
-==============  ========  =============
-Parameter name  Units     Default value
-==============  ========  =============
-background      |cm^-1|   0.0
-contrast        |Ang^-2|  5e-06
-scale           None      1
-delta           |Ang|     30
-n_plates        None      20
-spacing         |Ang|     400
-caille          |Ang^-2|  0.1
-==============  ========  =============
-
-.. image:: ..\img\olddocs\image142.jpg
-
-*Figure. 1D plot using the default values (w/6000 data point).*
-
-Our model uses the form factor calculations implemented in a c-library provided by the NIST Center for Neutron Research
-(Kline, 2006).
-
-REFERENCE
-
-F Nallet, R Laversanne, and D Roux, J. Phys. II France, 3, (1993) 487-502
-
-also in J. Phys. Chem. B, 105, (2001) 11081-11088
-
-
-
-.. _LamellarPSHGModel:
-
-**2.1.32. LamellarPSHGModel**
-
-This model provides the scattering intensity, *I(q)* = *P(q)* \* *S(q)*, for a lyotropic lamellar phase where a random
-distribution in solution are assumed. The SLD of the head region is taken to be different from the SLD of the tail
-region.
-
-*2.1.32.1. Definition*
-
-The scattering intensity *I(q)* is
-
-.. image:: ..\img\olddocs\image139.PNG
-
-The form factor is
-
-.. image:: ..\img\olddocs\image143.PNG
-
-The structure factor is
-
-.. image:: ..\img\olddocs\image140.PNG
-
-where
-
-.. image:: ..\img\olddocs\image141.PNG
-
-where |delta|\ T = tail length (or *t_length*), |delta|\ H = head thickness (or *h_thickness*),
-|drho|\ H = SLD(headgroup) - SLD(solvent), and |drho|\ T = SLD(tail) - SLD(headgroup).
-Here *d* = (repeat) spacing, *K* = smectic bending elasticity, *B* = compression modulus, and N = number of lamellar
-plates (*n_plates*).
-
-NB: **When the Caille parameter is greater than approximately 0.8 to 1.0, the assumptions of the model are incorrect.**
-And due to a complication of the model function, users are responsible for making sure that all the assumptions are
-handled accurately (see the original reference below for more details).
-
-The 2D scattering intensity is calculated in the same way as 1D, where the *q* vector is defined as
-
-.. image:: ..\img\olddocs\image040.gif
-
-The returned value is in units of |cm^-1|, on absolute scale. In the parameters, *sld_tail* = SLD of the tail group,
-*sld_head* = SLD of the head group, and *sld_solvent* = SLD of the solvent.
-
-==============  ========  =============
-Parameter name  Units     Default value
-==============  ========  =============
-background      |cm^-1|   0.001
-sld_head        |Ang^-2|  2e-06
-scale           None      1
-sld_solvent     |Ang^-2|  6e-06
-deltaH          |Ang|     2
-deltaT          |Ang|     10
-sld_tail        |Ang^-2|  0
-n_plates        None      30
-spacing         |Ang|     40
-caille          |Ang^-2|  0.001
-==============  ========  =============
-
-.. image:: ..\img\olddocs\image144.jpg
-
-*Figure. 1D plot using the default values (w/6000 data point).*
-
-Our model uses the form factor calculations implemented in a c-library provided by the NIST Center for Neutron Research
-(Kline, 2006).
-
-REFERENCE
-
-F Nallet, R Laversanne, and D Roux, J. Phys. II France, 3, (1993) 487-502
-
-also in J. Phys. Chem. B, 105, (2001) 11081-11088
-
-
-
-.. _LamellarPCrystalModel:
-
-**2.1.33. LamellarPCrystalModel**
-
-This model calculates the scattering from a stack of repeating lamellar structures. The stacks of lamellae (infinite
-in lateral dimension) are treated as a paracrystal to account for the repeating spacing. The repeat distance is further
-characterized by a Gaussian polydispersity. **This model can be used for large multilamellar vesicles.**
-
-*2.1.33.1. Definition*
-
-The scattering intensity *I(q)* is calculated as
-
-.. image:: ..\img\olddocs\image145.jpg
-
-The form factor of the bilayer is approximated as the cross section of an infinite, planar bilayer of thickness *t*
-
-.. image:: ..\img\olddocs\image146.jpg
-
-Here, the scale factor is used instead of the mass per area of the bilayer (*G*). The scale factor is the volume
-fraction of the material in the bilayer, *not* the total excluded volume of the paracrystal. *Z*\ :sub:`N`\ *(q)*
-describes the interference effects for aggregates consisting of more than one bilayer. The equations used are (3-5)
-from the Bergstrom reference below.
-
-Non-integer numbers of stacks are calculated as a linear combination of the lower and higher values
-
-.. image:: ..\img\olddocs\image147.jpg
-
-The 2D scattering intensity is the same as 1D, regardless of the orientation of the *q* vector which is defined as
-
-.. image:: ..\img\olddocs\image040.gif
-
-The parameters of the model are *Nlayers* = no. of layers, and *pd_spacing* = polydispersity of spacing.
-
-==============  ========  =============
-Parameter name  Units     Default value
-==============  ========  =============
-background      |cm^-1|   0
-scale           None      1
-Nlayers         None      20
-pd_spacing      None      0.2
-sld_layer       |Ang^-2|  1e-6
-sld_solvent     |Ang^-2|  6.34e-6
-spacing         |Ang|     250
-thickness       |Ang|     33
-==============  ========  =============
-
-.. image:: ..\img\olddocs\image148.jpg
-
-*Figure. 1D plot using the default values above (w/20000 data point).*
-
-Our model uses the form factor calculations implemented in a c-library provided by the NIST Center for Neutron Research
-(Kline, 2006).
-
-REFERENCE
-
-M Bergstrom, J S Pedersen, P Schurtenberger, S U Egelhaaf, *J. Phys. Chem. B*, 103 (1999) 9888-9897
-
-
-
-.. _SCCrystalModel:
-
-**2.1.34. SCCrystalModel**
-
-Calculates the scattering from a **simple cubic lattice** with paracrystalline distortion. Thermal vibrations are
-considered to be negligible, and the size of the paracrystal is infinitely large. Paracrystalline distortion is assumed
-to be isotropic and characterized by a Gaussian distribution.
-
-The returned value is scaled to units of |cm^-1|\ |sr^-1|, absolute scale.
-
-*2.1.34.1. Definition*
-
-The scattering intensity *I(q)* is calculated as
-
-.. image:: ..\img\olddocs\image149.jpg
-
-where *scale* is the volume fraction of spheres, *Vp* is the volume of the primary particle, *V(lattice)* is a volume
-correction for the crystal structure, *P(q)* is the form factor of the sphere (normalized), and *Z(q)* is the
-paracrystalline structure factor for a simple cubic structure.
-
-Equation (16) of the 1987 reference is used to calculate *Z(q)*, using equations (13)-(15) from the 1987 paper for
-*Z1*\ , *Z2*\ , and *Z3*\ .
-
-The lattice correction (the occupied volume of the lattice) for a simple cubic structure of particles of radius *R*
-and nearest neighbor separation *D* is
-
-.. image:: ..\img\olddocs\image150.jpg
-
-The distortion factor (one standard deviation) of the paracrystal is included in the calculation of *Z(q)*
-
-.. image:: ..\img\olddocs\image151.jpg
-
-where *g* is a fractional distortion based on the nearest neighbor distance.
-
-The simple cubic lattice is
-
-.. image:: ..\img\olddocs\image152.jpg
-
-For a crystal, diffraction peaks appear at reduced *q*\ -values given by
-
-.. image:: ..\img\olddocs\image153.jpg
-
-where for a simple cubic lattice any *h*\ , *k*\ , *l* are allowed and none are forbidden. Thus the peak positions
-correspond to (just the first 5)
-
-.. image:: ..\img\olddocs\image154.jpg
-
-**NB: The calculation of** *Z(q)* **is a double numerical integral that must be carried out with a high density of**
-**points to properly capture the sharp peaks of the paracrystalline scattering.** So be warned that the calculation is
-SLOW. Go get some coffee. Fitting of any experimental data must be resolution smeared for any meaningful fit. This
-makes a triple integral. Very, very slow. Go get lunch!
-
-==============  ========  =============
-Parameter name  Units     Default value
-==============  ========  =============
-background      |cm^-1|   0
-dnn             |Ang|     220
-scale           None      1
-sldSolv         |Ang^-2|  6.3e-06
-radius          |Ang|     40
-sld_Sph         |Ang^-2|  3e-06
-d_factor        None      0.06
-==============  ========  =============
-
-This example dataset is produced using 200 data points, *qmin* = 0.01 |Ang^-1|, *qmax* = 0.1 |Ang^-1| and the above
-default values.
-
-.. image:: ..\img\olddocs\image155.jpg
-
-*Figure. 1D plot in the linear scale using the default values (w/200 data point).*
-
-The 2D (Anisotropic model) is based on the reference below where *I(q)* is approximated for 1d scattering. Thus the
-scattering pattern for 2D may not be accurate. Note that we are not responsible for any incorrectness of the 2D model
-computation.
-
-.. image:: ..\img\olddocs\image156.jpg
-
-.. image:: ..\img\olddocs\image157.jpg
-
-*Figure. 2D plot using the default values (w/200X200 pixels).*
-
-REFERENCE
-
-Hideki Matsuoka et. al. *Physical Review B*, 36 (1987) 1754-1765
-(Original Paper)
-
-Hideki Matsuoka et. al. *Physical Review B*, 41 (1990) 3854 -3856
-(Corrections to FCC and BCC lattice structure calculation)
-
-
-
-.. _FCCrystalModel:
-
-**2.1.35. FCCrystalModel**
-
-Calculates the scattering from a **face-centered cubic lattice** with paracrystalline distortion. Thermal vibrations
-are considered to be negligible, and the size of the paracrystal is infinitely large. Paracrystalline distortion is
-assumed to be isotropic and characterized by a Gaussian distribution.
-
-The returned value is scaled to units of |cm^-1|\ |sr^-1|, absolute scale.
-
-*2.1.35.1. Definition*
-
-The scattering intensity *I(q)* is calculated as
-
-.. image:: ..\img\olddocs\image158.jpg
-
-where *scale* is the volume fraction of spheres, *Vp* is the volume of the primary particle, *V(lattice)* is a volume
-correction for the crystal structure, *P(q)* is the form factor of the sphere (normalized), and *Z(q)* is the
-paracrystalline structure factor for a face-centered cubic structure.
-
-Equation (1) of the 1990 reference is used to calculate *Z(q)*, using equations (23)-(25) from the 1987 paper for
-*Z1*\ , *Z2*\ , and *Z3*\ .
-
-The lattice correction (the occupied volume of the lattice) for a face-centered cubic structure of particles of radius
-*R* and nearest neighbor separation *D* is
-
-.. image:: ..\img\olddocs\image159.jpg
-
-The distortion factor (one standard deviation) of the paracrystal is included in the calculation of *Z(q)*
-
-.. image:: ..\img\olddocs\image160.jpg
-
-where *g* is a fractional distortion based on the nearest neighbor distance.
-
-The face-centered cubic lattice is
-
-.. image:: ..\img\olddocs\image161.jpg
-
-For a crystal, diffraction peaks appear at reduced q-values given by
-
-.. image:: ..\img\olddocs\image162.jpg
-
-where for a face-centered cubic lattice *h*\ , *k*\ , *l* all odd or all even are allowed and reflections where
-*h*\ , *k*\ , *l* are mixed odd/even are forbidden. Thus the peak positions correspond to (just the first 5)
-
-.. image:: ..\img\olddocs\image163.jpg
-
-**NB: The calculation of** *Z(q)* **is a double numerical integral that must be carried out with a high density of**
-**points to properly capture the sharp peaks of the paracrystalline scattering.** So be warned that the calculation is
-SLOW. Go get some coffee. Fitting of any experimental data must be resolution smeared for any meaningful fit. This
-makes a triple integral. Very, very slow. Go get lunch!
-
-==============  ========  =============
-Parameter name  Units     Default value
-==============  ========  =============
-background      |cm^-1|   0
-dnn             |Ang|     220
-scale           None      1
-sldSolv         |Ang^-2|  6.3e-06
-radius          |Ang|     40
-sld_Sph         |Ang^-2|  3e-06
-d_factor        None      0.06
-==============  ========  =============
-
-This example dataset is produced using 200 data points, *qmin* = 0.01 |Ang^-1|, *qmax* = 0.1 |Ang^-1| and the above
-default values.
-
-.. image:: ..\img\olddocs\image164.jpg
-
-*Figure. 1D plot in the linear scale using the default values (w/200 data point).*
-
-The 2D (Anisotropic model) is based on the reference below where *I(q)* is approximated for 1d scattering. Thus the
-scattering pattern for 2D may not be accurate. Note that we are not responsible for any incorrectness of the 2D model
-computation.
-
-.. image:: ..\img\olddocs\image165.gif
-
-.. image:: ..\img\olddocs\image166.jpg
-
-*Figure. 2D plot using the default values (w/200X200 pixels).*
-
-REFERENCE
-
-Hideki Matsuoka et. al. *Physical Review B*, 36 (1987) 1754-1765
-(Original Paper)
-
-Hideki Matsuoka et. al. *Physical Review B*, 41 (1990) 3854 -3856
-(Corrections to FCC and BCC lattice structure calculation)
-
-
-
-.. _BCCrystalModel:
-
-**2.1.36. BCCrystalModel**
-
-Calculates the scattering from a **body-centered cubic lattice** with paracrystalline distortion. Thermal vibrations
-are considered to be negligible, and the size of the paracrystal is infinitely large. Paracrystalline distortion is
-assumed to be isotropic and characterized by a Gaussian distribution.
-
-The returned value is scaled to units of |cm^-1|\ |sr^-1|, absolute scale.
-
-*2.1.36.1. Definition**
-
-The scattering intensity *I(q)* is calculated as
-
-.. image:: ..\img\olddocs\image167.jpg
-
-where *scale* is the volume fraction of spheres, *Vp* is the volume of the primary particle, *V(lattice)* is a volume
-correction for the crystal structure, *P(q)* is the form factor of the sphere (normalized), and *Z(q)* is the
-paracrystalline structure factor for a body-centered cubic structure.
-
-Equation (1) of the 1990 reference is used to calculate *Z(q)*, using equations (29)-(31) from the 1987 paper for
-*Z1*\ , *Z2*\ , and *Z3*\ .
-
-The lattice correction (the occupied volume of the lattice) for a body-centered cubic structure of particles of radius
-*R* and nearest neighbor separation *D* is
-
-.. image:: ..\img\olddocs\image159.jpg
-
-The distortion factor (one standard deviation) of the paracrystal is included in the calculation of *Z(q)*
-
-.. image:: ..\img\olddocs\image160.jpg
-
-where *g* is a fractional distortion based on the nearest neighbor distance.
-
-The body-centered cubic lattice is
-
-.. image:: ..\img\olddocs\image168.jpg
-
-For a crystal, diffraction peaks appear at reduced q-values given by
-
-.. image:: ..\img\olddocs\image162.jpg
-
-where for a body-centered cubic lattice, only reflections where (\ *h* + *k* + *l*\ ) = even are allowed and
-reflections where (\ *h* + *k* + *l*\ ) = odd are forbidden. Thus the peak positions correspond to (just the first 5)
-
-.. image:: ..\img\olddocs\image169.jpg
-
-**NB: The calculation of** *Z(q)* **is a double numerical integral that must be carried out with a high density of**
-**points to properly capture the sharp peaks of the paracrystalline scattering.** So be warned that the calculation is
-SLOW. Go get some coffee. Fitting of any experimental data must be resolution smeared for any meaningful fit. This
-makes a triple integral. Very, very slow. Go get lunch!
-
-==============  ========  =============
-Parameter name  Units     Default value
-==============  ========  =============
-background      |cm^-1|   0
-dnn             |Ang|     220
-scale           None      1
-sldSolv         |Ang^-2|  6.3e-006
-radius          |Ang|     40
-sld_Sph         |Ang^-2|  3e-006
-d_factor        None      0.06
-==============  ========  =============
-
-This example dataset is produced using 200 data points, *qmin* = 0.001 |Ang^-1|, *qmax* = 0.1 |Ang^-1| and the above
-default values.
-
-.. image:: ..\img\olddocs\image170.jpg
-
-*Figure. 1D plot in the linear scale using the default values (w/200 data point).*
-
-The 2D (Anisotropic model) is based on the reference below where *I(q)* is approximated for 1d scattering. Thus the
-scattering pattern for 2D may not be accurate. Note that we are not responsible for any incorrectness of the 2D model
-computation.
-
-.. image:: ..\img\olddocs\image165.gif
-
-.. image:: ..\img\olddocs\image171.jpg
-
-*Figure. 2D plot using the default values (w/200X200 pixels).*
-
-REFERENCE
-
-Hideki Matsuoka et. al. *Physical Review B*, 36 (1987) 1754-1765
-(Original Paper)
-
-Hideki Matsuoka et. al. *Physical Review B*, 41 (1990) 3854 -3856
-(Corrections to FCC and BCC lattice structure calculation)
-
-
-
-.. _ParallelepipedModel:
-
-**2.1.37. ParallelepipedModel**
-
-This model provides the form factor, *P(q)*, for a rectangular cylinder (below) where the form factor is normalized by
-the volume of the cylinder. If you need to apply polydispersity, see the RectangularPrismModel_.
-
-*P(q)* = *scale* \* <*f*\ :sup:`2`> / *V* + *background*
-
-where the volume *V* = *A B C* and the averaging < > is applied over all orientations for 1D.
-
-For information about polarised and magnetic scattering, click here_.
-
-.. image:: ..\img\olddocs\image087.jpg
-
-*2.1.37.1. Definition*
-
-**The edge of the solid must satisfy the condition that** *A* < *B*. Then, assuming *a* = *A* / *B* < 1,
-*b* = *B* / *B* = 1, and *c* = *C* / *B* > 1, the form factor is
-
-.. image:: ..\img\olddocs\image088.PNG
-
-and the contrast is defined as
-
-.. image:: ..\img\olddocs\image089.PNG
-
-The scattering intensity per unit volume is returned in units of |cm^-1|; ie, *I(q)* = |phi| *P(q)*\ .
-
-NB: The 2nd virial coefficient of the parallelpiped is calculated based on the the averaged effective radius
-(= sqrt(*short_a* \* *short_b* / |pi|)) and length(= *long_c*) values, and used as the effective radius for
-*S(Q)* when *P(Q)* \* *S(Q)* is applied.
-
-To provide easy access to the orientation of the parallelepiped, we define the axis of the cylinder using three angles
-|theta|, |phi| and |bigpsi|. These angles are defined on Figure 2 of the CylinderModel_. The angle |bigpsi| is the
-rotational angle around the *long_c* axis against the *q* plane. For example, |bigpsi| = 0 when the *short_b* axis is
-parallel to the *x*-axis of the detector.
-
-.. image:: ..\img\olddocs\image090.jpg
-
-*Figure. Definition of angles for 2D*.
-
-.. image:: ..\img\olddocs\image091.jpg
-
-*Figure. Examples of the angles for oriented pp against the detector plane.*
-
-==============  ========  =============
-Parameter name  Units     Default value
-==============  ========  =============
-background      |cm^-1|   0.0
-contrast        |Ang^-2|  5e-06
-long_c          |Ang|     400
-short_a         |Ang^-2|  35
-short_b         |Ang|     75
-scale           None      1
-==============  ========  =============
-
-.. image:: ..\img\olddocs\image092.jpg
-
-*Figure. 1D plot using the default values (w/1000 data point).*
-
-*2.1.37.2. Validation of the parallelepiped 2D model*
-
-Validation of our code was done by comparing the output of the 1D calculation to the angular average of the output of
-a 2D calculation over all possible angles. The Figure below shows the comparison where the solid dot refers to averaged
-2D while the line represents the result of the 1D calculation (for the averaging, 76, 180, 76 points are taken for the
-angles of |theta|, |phi|, and |psi| respectively).
-
-.. image:: ..\img\olddocs\image093.gif
-
-*Figure. Comparison between 1D and averaged 2D.*
-
-Our model uses the form factor calculations implemented in a c-library provided by the NIST Center for Neutron Research
-(Kline, 2006).
-
-REFERENCE
-
-P Mittelbach and G Porod, *Acta Physica Austriaca*, 14 (1961) 185-211
-Equations (1), (13-14). (in German)
-
-
-
-.. _CSParallelepipedModel:
-
-**2.1.38. CSParallelepipedModel**
-
-Calculates the form factor for a rectangular solid with a core-shell structure. **The thickness and the scattering**
-**length density of the shell or "rim" can be different on all three (pairs) of faces.**
-
-The form factor is normalized by the particle volume *V* such that
-
-*P(q)* = *scale* \* <*f*\ :sup:`2`> / *V* + *background*
-
-where < > is an average over all possible orientations of the rectangular solid.
-
-An instrument resolution smeared version of the model is also provided.
-
-*2.1.38.1. Definition*
-
-The function calculated is the form factor of the rectangular solid below. The core of the solid is defined by the
-dimensions *A*, *B*, *C* such that *A* < *B* < *C*.
-
-.. image:: ..\img\olddocs\image087.jpg
-
-There are rectangular "slabs" of thickness *tA* that add to the *A* dimension (on the *BC* faces). There are similar
-slabs on the *AC* (= *tB*) and *AB* (= *tC*) faces. The projection in the *AB* plane is then
-
-.. image:: ..\img\olddocs\image094.jpg
-
-The volume of the solid is
-
-.. image:: ..\img\olddocs\image095.PNG
-
-**meaning that there are "gaps" at the corners of the solid.**
-
-The intensity calculated follows the ParallelepipedModel_, with the core-shell intensity being calculated as the
-square of the sum of the amplitudes of the core and shell, in the same manner as a CoreShellModel_.
-
-**For the calculation of the form factor to be valid, the sides of the solid MUST be chosen such that** *A* < *B* < *C*.
-**If this inequality is not satisfied, the model will not report an error, and the calculation will not be correct.**
-
-FITTING NOTES
-If the scale is set equal to the particle volume fraction, |phi|, the returned value is the scattered intensity per
-unit volume; ie, *I(q)* = |phi| *P(q)*\ . However, **no interparticle interference effects are included in this**
-**calculation.**
-
-There are many parameters in this model. Hold as many fixed as possible with known values, or you will certainly end
-up at a solution that is unphysical.
-
-Constraints must be applied during fitting to ensure that the inequality *A* < *B* < *C* is not violated. The
-calculation will not report an error, but the results will not be correct.
-
-The returned value is in units of |cm^-1|, on absolute scale.
-
-NB: The 2nd virial coefficient of the CSParallelpiped is calculated based on the the averaged effective radius
-(= sqrt((*short_a* + 2 *rim_a*) \* (*short_b* + 2 *rim_b*) / |pi|)) and length(= *long_c* + 2 *rim_c*) values, and
-used as the effective radius for *S(Q)* when *P(Q)* \* *S(Q)* is applied.
-
-To provide easy access to the orientation of the parallelepiped, we define the axis of the cylinder using three angles
-|theta|, |phi| and |bigpsi|. These angles are defined on Figure 2 of the CylinderModel_. The angle |bigpsi| is the
-rotational angle around the *long_c* axis against the *q* plane. For example, |bigpsi| = 0 when the *short_b* axis is
-parallel to the *x*-axis of the detector.
-
-.. image:: ..\img\olddocs\image090.jpg
-
-*Figure. Definition of angles for 2D*.
-
-.. image:: ..\img\olddocs\image091.jpg
-
-*Figure. Examples of the angles for oriented cspp against the detector plane.*
-
-This example dataset was produced by running the Macro Plot_CSParallelepiped(), using 100 data points,
-*qmin* = 0.001 |Ang^-1|, *qmax* = 0.7 |Ang^-1| and the default values
-
-==============  ========  =============
-Parameter name  Units     Default value
-==============  ========  =============
-background      |cm^-1|   0.06
-sld_pcore       |Ang^-2|  1e-06
-sld_rimA        |Ang^-2|  2e-06
-sld_rimB        |Ang^-2|  4e-06
-sld_rimC        |Ang^-2|  2e-06
-sld_solv        |Ang^-2|  6e-06
-rimA            |Ang|     10
-rimB            |Ang|     10
-rimC            |Ang|     10
-longC           |Ang|     400
-shortA          |Ang|     35
-midB            |Ang|     75
-scale           None      1
-==============  ========  =============
-
-.. image:: ..\img\olddocs\image096.jpg
-
-*Figure. 1D plot using the default values (w/256 data points).*
-
-.. image:: ..\img\olddocs\image097.jpg
-
-*Figure. 2D plot using the default values (w/(256X265) data points).*
-
-Our model uses the form factor calculations implemented in a c-library provided by the NIST Center for Neutron Research
-(Kline, 2006).
-
-REFERENCE
-
-P Mittelbach and G Porod, *Acta Physica Austriaca*, 14 (1961) 185-211
-Equations (1), (13-14). (in German)
-
-
-
-.. _RectangularPrismModel:
-
-**2.1.39. RectangularPrismModel**
-
-This model provides the form factor, *P(q)*, for a rectangular prism.
-
-Note that this model is almost totally equivalent to the existing ParallelepipedModel_. The only difference is that the
-way the relevant parameters are defined here (*a*, *b/a*, *c/a* instead of *a*, *b*, *c*) allows to use polydispersity
-with this model while keeping the shape of the prism (e.g. setting *b/a* = 1 and *c/a* = 1 and applying polydispersity
-to *a* will generate a distribution of cubes of different sizes).
-
-*2.1.39.1. Definition*
-
-The 1D scattering intensity for this model was calculated by Mittelbach and Porod (Mittelbach, 1961), but the
-implementation here is closer to the equations given by Nayuk and Huber (Nayuk, 2012).
-
-The scattering from a massive parallelepiped with an orientation with respect to the scattering vector given by |theta|
-and |phi| is given by
-
-.. math::
-  A_P\,(q) =  \frac{\sin \bigl( q \frac{C}{2} \cos\theta \bigr)}{q \frac{C}{2} \cos\theta} \, \times \,
-  \frac{\sin \bigl( q \frac{A}{2} \sin\theta \sin\phi \bigr)}{q \frac{A}{2} \sin\theta \sin\phi} \, \times \,
-  \frac{\sin \bigl( q \frac{B}{2} \sin\theta \cos\phi \bigr)}{q \frac{B}{2} \sin\theta \cos\phi}
-
-where *A*, *B* and *C* are the sides of the parallelepiped and must fulfill :math:`A \le B \le C`, |theta| is the angle
-between the *z* axis and the longest axis of the parallelepiped *C*, and |phi| is the angle between the scattering
-vector (lying in the *xy* plane) and the *y* axis.
-
-The normalized form factor in 1D is obtained averaging over all possible orientations
-
-.. math::
-  P(q) =  \frac{2}{\pi} \times \, \int_0^{\frac{\pi}{2}} \, \int_0^{\frac{\pi}{2}} A_P^2(q) \, \sin\theta \, d\theta \, d\phi
-
-The 1D scattering intensity is then calculated as
-
-.. math::
-  I(q) = \mbox{scale} \times V \times (\rho_{\mbox{pipe}} - \rho_{\mbox{solvent}})^2 \times P(q)
-
-where *V* is the volume of the rectangular prism, :math:`\rho_{\mbox{pipe}}` is the scattering length of the
-parallelepiped, :math:`\rho_{\mbox{solvent}}` is the scattering length of the solvent, and (if the data are in absolute
-units) *scale* represents the volume fraction (which is unitless).
-
-**The 2D scattering intensity is not computed by this model.**
-
-The returned value is scaled to units of |cm^-1| and the parameters of the RectangularPrismModel are the following
-
-==============  ========  =============
-Parameter name  Units     Default value
-==============  ========  =============
-scale           None      1
-short_side      |Ang|     35
-b2a_ratio       None      1
-c2a_ratio       None      1
-sldPipe         |Ang^-2|  6.3e-6
-sldSolv         |Ang^-2|  1.0e-6
-background      |cm^-1|   0
-==============  ========  =============
-
-*2.1.39.2. Validation of the RectangularPrismModel*
-
-Validation of the code was conducted by comparing the output of the 1D model to the output of the existing
-parallelepiped model.
-
-REFERENCES
-
-P Mittelbach and G Porod, *Acta Physica Austriaca*, 14 (1961) 185-211
-
-R Nayuk and K Huber, *Z. Phys. Chem.*, 226 (2012) 837-854
-
-
-
-.. _RectangularHollowPrismModel:
-
-**2.1.40. RectangularHollowPrismModel**
-
-This model provides the form factor, *P(q)*, for a hollow rectangular parallelepiped with a wall thickness |bigdelta|.
-
-*2.1.40.1. Definition*
-
-The 1D scattering intensity for this model is calculated by forming the difference of the amplitudes of two massive
-parallelepipeds differing in their outermost dimensions in each direction by the same length increment 2 |bigdelta|
-(Nayuk, 2012).
-
-As in the case of the massive parallelepiped, the scattering amplitude is computed for a particular orientation of the
-parallelepiped with respect to the scattering vector and then averaged over all possible orientations, giving
-
-.. math::
-  P(q) =  \frac{1}{V^2} \frac{2}{\pi} \times \, \int_0^{\frac{\pi}{2}} \, \int_0^{\frac{\pi}{2}} A_{P\Delta}^2(q) \,
-  \sin\theta \, d\theta \, d\phi
-
-where |theta| is the angle between the *z* axis and the longest axis of the parallelepiped, |phi| is the angle between
-the scattering vector (lying in the *xy* plane) and the *y* axis, and
-
-.. math::
-  A_{P\Delta}\,(q) =  A \, B \, C \, \times
-                      \frac{\sin \bigl( q \frac{C}{2} \cos\theta \bigr)}{q \frac{C}{2} \cos\theta} \,
-                      \frac{\sin \bigl( q \frac{A}{2} \sin\theta \sin\phi \bigr)}{q \frac{A}{2} \sin\theta \sin\phi} \,
-                      \frac{\sin \bigl( q \frac{B}{2} \sin\theta \cos\phi \bigr)}{q \frac{B}{2} \sin\theta \cos\phi} -
-                      8 \, \bigl( \frac{A}{2} - \Delta \bigr) \, \bigl( \frac{B}{2} - \Delta \bigr) \,
-                      \bigl( \frac{C}{2} - \Delta \bigr) \, \times
-                      \frac{\sin \bigl[ q \bigl(\frac{C}{2}-\Delta\bigr) \cos\theta \bigr]}
-                      {q \bigl(\frac{C}{2}-\Delta\bigr) \cos\theta} \,
-                      \frac{\sin \bigl[ q \bigl(\frac{A}{2}-\Delta\bigr) \sin\theta \sin\phi \bigr]}
-                      {q \bigl(\frac{A}{2}-\Delta\bigr) \sin\theta \sin\phi} \,
-                      \frac{\sin \bigl[ q \bigl(\frac{B}{2}-\Delta\bigr) \sin\theta \cos\phi \bigr]}
-                      {q \bigl(\frac{B}{2}-\Delta\bigr) \sin\theta \cos\phi} \,
-
-where *A*, *B* and *C* are the external sides of the parallelepiped fulfilling :math:`A \le B \le C`, and the volume *V*
-of the parallelepiped is
-
-.. math::
-  V = A B C \, - \, (A - 2\Delta) (B - 2\Delta) (C - 2\Delta)
-
-The 1D scattering intensity is then calculated as
-
-.. math::
-  I(q) = \mbox{scale} \times V \times (\rho_{\mbox{pipe}} - \rho_{\mbox{solvent}})^2 \times P(q)
-
-where :math:`\rho_{\mbox{pipe}}` is the scattering length of the parallelepiped, :math:`\rho_{\mbox{solvent}}` is the
-scattering length of the solvent, and (if the data are in absolute units) *scale* represents the volume fraction (which
-is unitless).
-
-**The 2D scattering intensity is not computed by this model.**
-
-The returned value is scaled to units of |cm^-1| and the parameters of the RectangularHollowPrismModel are the
-following
-
-==============  ========  =============
-Parameter name  Units     Default value
-==============  ========  =============
-scale           None      1
-short_side      |Ang|     35
-b2a_ratio       None      1
-c2a_ratio       None      1
-thickness       |Ang|     1
-sldPipe         |Ang^-2|  6.3e-6
-sldSolv         |Ang^-2|  1.0e-6
-background      |cm^-1|   0
-==============  ========  =============
-
-*2.1.40.2. Validation of the RectangularHollowPrismModel*
-
-Validation of the code was conducted by qualitatively comparing the output of the 1D model to the curves shown in
-(Nayuk, 2012).
-
-REFERENCES
-
-R Nayuk and K Huber, *Z. Phys. Chem.*, 226 (2012) 837-854
-
-
-
-.. _RectangularHollowPrismInfThinWallsModel:
-
-**2.1.41. RectangularHollowPrismInfThinWallsModel**
-
-This model provides the form factor, *P(q)*, for a hollow rectangular prism with infinitely thin walls.
-
-*2.1.41.1. Definition*
-
-The 1D scattering intensity for this model is calculated according to the equations given by Nayuk and Huber
-(Nayuk, 2012).
-
-Assuming a hollow parallelepiped with infinitely thin walls, edge lengths :math:`A \le B \le C` and presenting an
-orientation with respect to the scattering vector given by |theta| and |phi|, where |theta| is the angle between the
-*z* axis and the longest axis of the parallelepiped *C*, and |phi| is the angle between the scattering vector
-(lying in the *xy* plane) and the *y* axis, the form factor is given by
-
-.. math::
-  P(q) =  \frac{1}{V^2} \frac{2}{\pi} \times \, \int_0^{\frac{\pi}{2}} \, \int_0^{\frac{\pi}{2}} [A_L(q)+A_T(q)]^2
-  \, \sin\theta \, d\theta \, d\phi
-
-where
-
-.. math::
-  V = 2AB + 2AC + 2BC
-
-.. math::
-  A_L\,(q) =  8 \times \frac{ \sin \bigl( q \frac{A}{2} \sin\phi \sin\theta \bigr)
-                              \sin \bigl( q \frac{B}{2} \cos\phi \sin\theta \bigr)
-                              \cos \bigl( q \frac{C}{2} \cos\theta \bigr) }
-                            {q^2 \, \sin^2\theta \, \sin\phi \cos\phi}
-
-.. math::
-  A_T\,(q) =  A_F\,(q) \times \frac{2 \, \sin \bigl( q \frac{C}{2} \cos\theta \bigr)}{q \, \cos\theta}
-
-and
-
-.. math::
-  A_F\,(q) =  4 \frac{ \cos \bigl( q \frac{A}{2} \sin\phi \sin\theta \bigr)
-                       \sin \bigl( q \frac{B}{2} \cos\phi \sin\theta \bigr) }
-                     {q \, \cos\phi \, \sin\theta} +
-              4 \frac{ \sin \bigl( q \frac{A}{2} \sin\phi \sin\theta \bigr)
-                       \cos \bigl( q \frac{B}{2} \cos\phi \sin\theta \bigr) }
-                     {q \, \sin\phi \, \sin\theta}
-
-The 1D scattering intensity is then calculated as
-
-.. math::
-  I(q) = \mbox{scale} \times V \times (\rho_{\mbox{pipe}} - \rho_{\mbox{solvent}})^2 \times P(q)
-
-where *V* is the volume of the rectangular prism, :math:`\rho_{\mbox{pipe}}` is the scattering length of the
-parallelepiped, :math:`\rho_{\mbox{solvent}}` is the scattering length of the solvent, and (if the data are in absolute
-units) *scale* represents the volume fraction (which is unitless).
-
-**The 2D scattering intensity is not computed by this model.**
-
-The returned value is scaled to units of |cm^-1| and the parameters of the RectangularHollowPrismInfThinWallModel
-are the following
-
-==============  ========  =============
-Parameter name  Units     Default value
-==============  ========  =============
-scale           None      1
-short_side      |Ang|     35
-b2a_ratio       None      1
-c2a_ratio       None      1
-sldPipe         |Ang^-2|  6.3e-6
-sldSolv         |Ang^-2|  1.0e-6
-background      |cm^-1|   0
-==============  ========  =============
-
-*2.1.41.2. Validation of the RectangularHollowPrismInfThinWallsModel*
-
-Validation of the code was conducted  by qualitatively comparing the output of the 1D model to the curves shown in
-(Nayuk, 2012).
-
-REFERENCES
-
-R Nayuk and K Huber, *Z. Phys. Chem.*, 226 (2012) 837-854
-
-
-
-.. _MicelleSphCoreModel:
-
-**2.1.42. MicelleSphCoreModel**
-
-This model provides the form factor, *P(q)*, for a micelle with a spherical core 
-and Gaussian polymer chains attached to the surface.
-
-*2.1.42.1. Definition*
-
-The 1D scattering intensity for this model is calculated according to the equations given by Pedersen
-(Pedersen, 2000).
-
-*2.1.42.2. Validation of the MicelleSphCoreModel*
-
-This model has not yet been validated. Feb2015
-
-REFERENCES
-
-J Pedersen, *J. Appl. Cryst.*, 33 (2000) 637-640
-
-
-
-2.2 Shape-independent Functions
--------------------------------
-
-The following are models used for shape-independent SAS analysis.
-
-.. _Debye:
-
-**2.2.1. Debye (Gaussian Coil Model)**
-
-The Debye model is a form factor for a linear polymer chain obeying Gaussian statistics (ie, it is in the theta state).
-In addition to the radius-of-gyration, *Rg*, a scale factor *scale*, and a constant background term are included in the
-calculation. **NB: No size polydispersity is included in this model, use the** Poly_GaussCoil_ **Model instead**
-
-.. image:: ..\img\olddocs\image172.PNG
-
-For 2D data: The 2D scattering intensity is calculated in the same way as 1D, where the *q* vector is defined as
-
-.. image:: ..\img\olddocs\image040.gif
-
-==============  ========  =============
-Parameter name  Units     Default value
-==============  ========  =============
-scale           None      1.0
-rg              |Ang|     50.0
-background      |cm^-1|   0.0
-==============  ========  =============
-
-.. image:: ..\img\olddocs\image173.jpg
-
-*Figure. 1D plot using the default values (w/200 data point).*
-
-REFERENCE
-
-R J Roe, *Methods of X-Ray and Neutron Scattering in Polymer Science*, Oxford University Press, New York (2000)
-
-
-
-.. _BroadPeakModel:
-
-**2.2.2. BroadPeakModel**
-
-This model calculates an empirical functional form for SAS data characterized by a broad scattering peak. Many SAS
-spectra are characterized by a broad peak even though they are from amorphous soft materials. For example, soft systems
-that show a SAS peak include copolymers, polyelectrolytes, multiphase systems, layered structures, etc.
-
-The d-spacing corresponding to the broad peak is a characteristic distance between the scattering inhomogeneities (such
-as in lamellar, cylindrical, or spherical morphologies, or for bicontinuous structures).
-
-The returned value is scaled to units of |cm^-1|, absolute scale.
-
-*2.2.2.1. Definition*
-
-The scattering intensity *I(q)* is calculated as
-
-.. image:: ..\img\olddocs\image174.jpg
-
-Here the peak position is related to the d-spacing as *Q0* = 2|pi| / *d0*.
-
-For 2D data: The 2D scattering intensity is calculated in the same way as 1D, where the *q* vector is defined as
-
-.. image:: ..\img\olddocs\image040.gif
-
-==================  ========  =============
-Parameter name      Units     Default value
-==================  ========  =============
-scale_l    (=C)     None      10
-scale_p    (=A)     None      1e-05
-length_l (= |xi| )  |Ang|     50
-q_peak    (=Q0)     |Ang^-1|  0.1
-exponent_p (=n)     None      2
-exponent_l (=m)     None      3
-Background (=B)     |cm^-1|   0.1
-==================  ========  =============
-
-.. image:: ..\img\olddocs\image175.jpg
-
-*Figure. 1D plot using the default values (w/200 data point).*
-
-REFERENCE
-
-None.
-
-*2013/09/09 - Description reviewed by King, S and Parker, P.*
-
-
-
-.. _CorrLength:
-
-**2.2.3. CorrLength (Correlation Length Model)**
-
-Calculates an empirical functional form for SAS data characterized by a low-Q signal and a high-Q signal.
-
-The returned value is scaled to units of |cm^-1|, absolute scale.
-
-*2.2.3. Definition*
-
-The scattering intensity *I(q)* is calculated as
-
-.. image:: ..\img\olddocs\image176.jpg
-
-The first term describes Porod scattering from clusters (exponent = n) and the second term is a Lorentzian function
-describing scattering from polymer chains (exponent = *m*). This second term characterizes the polymer/solvent
-interactions and therefore the thermodynamics. The two multiplicative factors *A* and *C*, the incoherent
-background *B* and the two exponents *n* and *m* are used as fitting parameters. The final parameter |xi| is a
-correlation length for the polymer chains. Note that when *m*\ =2 this functional form becomes the familiar Lorentzian
-function.Â 
-
-For 2D data: The 2D scattering intensity is calculated in the same way as 1D, where the *q* vector is defined as
-
-.. image:: ..\img\olddocs\image040.gif
-
-====================  ========  =============
-Parameter name        Units     Default value
-====================  ========  =============
-scale_l    (=C)       None Â     10
-scale_p    (=A)       None Â     1e-06
-length_l   (= |xi| )  |Ang|     50
-exponent_p (=n)       None Â     2
-exponent_l (=m)       NoneÂ      3
-Background (=B)       |cm^-1|   0.1
-====================  ========  =============
-
-.. image:: ..\img\olddocs\image177.jpg
-
-*Figure. 1D plot using the default values (w/500 data points).*
-
-REFERENCE
-
-B Hammouda, D L Ho and S R Kline, *Insight into Clustering in Poly(ethylene oxide) Solutions*, *Macromolecules*, 37
-(2004) 6932-6937
-
-*2013/09/09 - Description reviewed by King, S and Parker, P.*
-
-
-
-.. _LorentzOZ:
-
-**2.2.4. Lorentz (Ornstein-Zernicke Model)**
-
-*2.2.4.1. Definition*
-
-The Ornstein-Zernicke model is defined by
-
-.. image:: ..\img\olddocs\image178.PNG
-
-The parameter *L* is the screening length.
-
-For 2D data: The 2D scattering intensity is calculated in the same way as 1D, where the *q* vector is defined as
-
-.. image:: ..\img\olddocs\image040.gif
-
-==============  ========  =============
-Parameter name  Units     Default value
-==============  ========  =============
-scale           None      1.0
-length          |Ang|     50.0
-background      |cm^-1|   0.0
-==============  ========  =============
-
-.. image:: ..\img\olddocs\image179.jpg
-
-*Â Figure. 1D plot using the default values (w/200 data point).*
-
-REFERENCE
-
-None.
-
-
-
-.. _DABModel:
-
-**2.2.5. DABModel (Debye-Anderson-Brumberger Model)**
-
-Calculates the scattering from a randomly distributed, two-phase system based on the Debye-Anderson-Brumberger (DAB)
-model for such systems. The two-phase system is characterized by a single length scale, the correlation length, which
-is a measure of the average spacing between regions of phase 1 and phase 2. **The model also assumes smooth interfaces**
-**between the phases** and hence exhibits Porod behavior (I ~ *q*\ :sup:`-4`) at large *q* (*QL* >> 1).
-
-The DAB model is ostensibly a development of the earlier Debye-Bueche model.
-
-*2.2.5.1. Definition*
-
-.. image:: ..\img\olddocs\image180_corrected.PNG
-
-The parameter *L* is the correlation length.
-
-For 2D data: The 2D scattering intensity is calculated in the same way as 1D, where the *q* vector is defined as
-
-.. image:: ..\img\olddocs\image040.gif
-
-==============  ========  =============
-Parameter name  Units     Default value
-==============  ========  =============
-scale           None      1.0
-length          |Ang|     50.0
-background      |cm^-1|   0.0
-==============  ========  =============
-
-.. image:: ..\img\olddocs\image181.jpg
-
-*Â Figure. 1D plot using the default values (w/200 data point).*
-
-REFERENCE
-
-P Debye, H R Anderson, H Brumberger, *Scattering by an Inhomogeneous Solid. II. The Correlation Function*
-*and its Application*, *J. Appl. Phys.*, 28(6) (1957) 679
-
-P Debye, A M Bueche, *Scattering by an Inhomogeneous Solid*, *J. Appl. Phys.*, 20 (1949) 518
-
-*2013/09/09 - Description reviewed by King, S and Parker, P.*
-
-
-
-.. _AbsolutePower_Law:
-
-**2.2.6. AbsolutePower_Law**
-
-This model describes a simple power law with background.
-
-.. image:: ..\img\olddocs\image182.PNG
-
-Note the minus sign in front of the exponent. The parameter *m* should therefore be entered as a **positive** number.
-
-==============  ========  =============
-Parameter name  Units     Default value
-==============  ========  =============
-Scale           None      1.0
-m               None      4
-Background      |cm^-1|   0.0
-==============  ========  =============
-
-.. image:: ..\img\olddocs\image183.jpg
-
-*Figure. 1D plot using the default values (w/200 data point).*
-
-REFERENCE
-
-None.
-
-
-
-.. _TeubnerStrey:
-
-**2.2.7. TeubnerStrey (Model)**
-
-This function calculates the scattered intensity of a two-component system using the Teubner-Strey model. Unlike the
-DABModel_ this function generates a peak.
-
-*2.2.7.1. Definition*
-
-.. image:: ..\img\olddocs\image184.PNG
-
-For 2D data: The 2D scattering intensity is calculated in the same way as 1D, where the *q* vector is defined as
-
-.. image:: ..\img\olddocs\image040.gif
-
-==============  ========  =============
-Parameter name  Units     Default value
-==============  ========  =============
-scale           None      0.1
-c1              None      -30.0
-c2              None      5000.0
-background      |cm^-1|   0.0
-==============  ========  =============
-
-.. image:: ..\img\olddocs\image185.jpg
-
-*Figure. 1D plot using the default values (w/200 data point).*
-
-REFERENCE
-
-M Teubner, R Strey, *J. Chem. Phys.*, 87 (1987) 3195
-
-K V Schubert, R Strey, S R Kline and E W Kaler, *J. Chem. Phys.*, 101 (1994) 5343
-
-
-
-.. _FractalModel:
-
-**2.2.8. FractalModel**
-
-Calculates the scattering from fractal-like aggregates built from spherical building blocks following the Texiera
-reference.
-
-The value returned is in |cm^-1|\ .
-
-*2.2.8.1. Definition*
-
-.. image:: ..\img\olddocs\image186.PNG
-
-The *scale* parameter is the volume fraction of the building blocks, *R0* is the radius of the building block, *Df* is
-the fractal dimension, |xi| is the correlation length, |rho|\ *solvent* is the scattering length density of the
-solvent, and |rho|\ *block* is the scattering length density of the building blocks.
-
-**Polydispersity on the radius is provided for.**
-
-For 2D data: The 2D scattering intensity is calculated in the same way as 1D, where the *q* vector is defined as
-
-.. image:: ..\img\olddocs\image040.gif
-
-==============  ========  =============
-Parameter name  Units     Default value
-==============  ========  =============
-scale           None      0.05
-radius          |Ang|     5.0
-fractal_dim     None      2
-corr_length     |Ang|     100.0
-block_sld       |Ang^-2|  2e-6
-solvent_sld     |Ang^-2|  6e-6
-background      |cm^-1|   0.0
-==============  ========  =============
-
-.. image:: ..\img\olddocs\image187.jpg
-
-*Figure. 1D plot using the default values (w/200 data point).*
-
-REFERENCE
-
-J Teixeira, *J. Appl. Cryst.*, 21 (1988) 781-785
-
-
-
-.. _MassFractalModel:
-
-**2.2.9. MassFractalModel**
-
-Calculates the scattering from fractal-like aggregates based on the Mildner reference.
-
-*2.2.9.1. Definition*
-
-.. image:: ..\img\olddocs\mass_fractal_eq1.jpg
-
-where *R* is the radius of the building block, *Dm* is the **mass** fractal dimension, |zeta| is the cut-off length,
-|rho|\ *solvent* is the scattering length density of the solvent, and |rho|\ *particle* is the scattering length
-density of particles.
-
-Note: Â The mass fractal dimension *Dm* is only valid if 1 < mass_dim < 6. It is also only valid over a limited
-*q* range (see the reference for details).
-
-==============  ========  =============
-Parameter name  Units     Default value
-==============  ========  =============
-scale           None      1
-radius          |Ang|     10.0
-mass_dim        None      1.9
-co_length       |Ang|     100.0
-background      |cm^-1|   0.0
-==============  ========  =============
-
-.. image:: ..\img\olddocs\mass_fractal_fig1.jpg
-
-*Figure. 1D plot using default values.*
-
-REFERENCE
-
-D Mildner and P Hall,Â *J. Phys. D: Appl. Phys.*,Â  19 (1986) 1535-1545
-Equation(9)
-
-*2013/09/09 - Description reviewed by King, S and Parker, P.*
-
-
-
-.. _SurfaceFractalModel:
-
-**2.2.10. SurfaceFractalModel**
-
-Calculates the scattering from fractal-like aggregates based on the Mildner reference.
-
-*2.2.10.1. Definition*
-
-.. image:: ..\img\olddocs\surface_fractal_eq1.gif
-
-where *R* is the radius of the building block, *Ds* is the **surface** fractal dimension, |zeta| is the cut-off length,
-|rho|\ *solvent* is the scattering length density of the solvent, and |rho|\ *particle* is the scattering length
-density of particles.
-
-Note: Â The surface fractal dimension *Ds* is only valid if 1 < surface_dim < 3. It is also only valid over a limited
-*q* range (see the reference for details).
-
-==============  ========  =============
-Parameter name  Units     Default value
-==============  ========  =============
-scale           None      1
-radius          |Ang|     10.0
-surface_dim     None      2.0
-co_length       |Ang|     500.0
-background      |cm^-1|   0.0
-==============  ========  =============
-
-.. image:: ..\img\olddocs\surface_fractal_fig1.jpg
-
-*Figure. 1D plot using default values.*
-
-REFERENCE
-
-D Mildner and P Hall,Â *J. Phys. D: Appl. Phys.*,Â  19 (1986) 1535-1545
-Equation(13)
-
-
-
-.. _MassSurfaceFractal:
-
-**2.2.11. MassSurfaceFractal (Model)**
-
-A number of natural and commercial processes form high-surface area materials as a result of the vapour-phase
-aggregation of primary particles. Examples of such materials include soots, aerosols, and fume or pyrogenic silicas.
-These are all characterised by cluster mass distributions (sometimes also cluster size distributions) and internal
-surfaces that are fractal in nature. The scattering from such materials displays two distinct breaks in log-log
-representation, corresponding to the radius-of-gyration of the primary particles, *rg*, and the radius-of-gyration of
-the clusters (aggregates), *Rg*. Between these boundaries the scattering follows a power law related to the mass
-fractal dimension, *Dm*, whilst above the high-Q boundary the scattering follows a power law related to the surface
-fractal dimension of the primary particles, *Ds*.
-
-*2.2.11.1. Definition*
-
-The scattered intensity *I(q)* is  calculated using a modified Ornstein-Zernicke equation
-
-.. image:: ..\img\olddocs\masssurface_fractal_eq1.jpg
-
-where *Rg* is the size of the cluster, *rg* is the size of the primary particle, *Ds* is the surface fractal dimension,
-*Dm* is the mass fractal dimension, |rho|\ *solvent* is the scattering length density of the solvent, and |rho|\ *p* is
-the scattering length density of particles.
-
-Note: Â The surface (*Ds*) and mass (*Dm*) fractal dimensions are only valid if 0 < *surface_dim* < 6,
-0 < *mass_dim* < 6, and (*surface_dim*+*mass_dim*) < 6.Â 
-
-==============  ========  =============
-Parameter name  Units     Default value
-==============  ========  =============
-scale           None      1
-primary_rg      |Ang|     4000.0
-cluster_rg      |Ang|  Â   86.7
-surface_dim     None      2.3
-mass_dim        None Â     1.8
-background      |cm^-1| Â  0.0
-==============  ========  =============
-
-.. image:: ..\img\olddocs\masssurface_fractal_fig1.jpg
-
-*Figure. 1D plot using default values.*
-
-REFERENCE
-
-P Schmidt, *J Appl. Cryst.*, 24 (1991) 414-435
-Equation(19)
-
-A J Hurd, D W Schaefer, J E Martin, *Phys. Rev. A*, 35 (1987) 2361-2364
-Equation(2)
-
-
-
-.. _FractalCoreShell:
-
-**2.2.12. FractalCoreShell (Model)**
-
-Calculates the scattering from a fractal structure with a primary building block of core-shell spheres, as opposed to
-just homogeneous spheres in the FractalModel_. This model could find use for aggregates of coated particles, or
-aggregates of vesicles.
-
-The returned value is scaled to units of |cm^-1|, absolute scale.
-
-*2.2.12.1. Definition*
-
-.. image:: ..\img\olddocs\fractcore_eq1.gif
-
-The form factor *P(q)* is that from CoreShellModel_ with *bkg* = 0
-
-.. image:: ..\img\olddocs\image013.PNG
-
-while the fractal structure factor S(q) is
-
-.. image:: ..\img\olddocs\fractcore_eq3.gif
-
-where *Df* = frac_dim, |xi| = cor_length, *rc* = (core) radius, and *scale* = volume fraction.
-
-The fractal structure is as documented in the FractalModel_. Polydispersity of radius and thickness is provided for.
-
-For 2D data: The 2D scattering intensity is calculated in the same way as 1D, where the *q* vector is defined as
-
-.. image:: ..\img\olddocs\image040.gif
-
-==============  ========  =============
-Parameter name  Units     Default value
-==============  ========  =============
-volfraction     None Â     0.05
-frac_dim        None Â     2
-thickness       |Ang|     5.0
-radius Â         |Ang|     20.0
-cor_length      |Ang|     100.0
-core_sld        |Ang^-2|  3.5e-6
-shell_sld       |Ang^-2|  1e-6
-solvent_sld     |Ang^-2|  6.35e-6
-background      |cm^-1|   0.0
-==============  ========  =============
-
-.. image:: ..\img\olddocs\image188.jpg
-
-*Figure. 1D plot using the default values (w/500 data points).*
-
-REFERENCE
-
-See the CoreShellModel_ and FractalModel_ descriptions.
-
-
-
-.. _GaussLorentzGel:
-
-**2.2.13. GaussLorentzGel(Model)**
-
-Calculates the scattering from a gel structure, but typically a physical rather than chemical network. It is modeled as
-a sum of a low-*q* exponential decay plus a lorentzian at higher *q*-values.
-
-Also see the GelFitModel_.
-
-The returned value is scaled to units of |cm^-1|, absolute scale.
-
-*2.2.13.1. Definition*
-
-The scattering intensity *I(q)* is calculated as (eqn 5 from the reference)
-
-.. image:: ..\img\olddocs\image189.jpg
-
-|bigzeta| is the length scale of the static correlations in the gel, which can be attributed to the "frozen-in"
-crosslinks. |xi| is the dynamic correlation length, which can be attributed to the fluctuating polymer chains between
-crosslinks. *I*\ :sub:`G`\ *(0)* and *I*\ :sub:`L`\ *(0)* are the scaling factors for each of these structures. **Think carefully about how**
-**these map to your particular system!**
-
-NB: The peaked structure at higher *q* values (Figure 2 from the reference) is not reproduced by the model. Peaks can
-be introduced into the model by summing this model with the PeakGaussModel_ function.
-
-For 2D data: The 2D scattering intensity is calculated in the same way as 1D, where the *q* vector is defined as
-
-.. image:: ..\img\olddocs\image040.gif
-
-===================================  ========  =============
-Parameter name                       Units     Default value
-===================================  ========  =============
-dyn_colength (=dynamic corr length)  |Ang|     20.0
-scale_g       (=Gauss scale factor)  None Â     100
-scale_l  (=Lorentzian scale factor)  NoneÂ      50
-stat_colength (=static corr length)  |Ang|     100.0
-background                           |cm^-1|   0.0
-===================================  ========  =============
-
-.. image:: ..\img\olddocs\image190.jpg
-
-*Figure. 1D plot using the default values (w/500 data points).*
-
-REFERENCE
-
-G Evmenenko, E Theunissen, K Mortensen, H Reynaers, *Polymer*, 42 (2001) 2907-2913
-
-
-
-.. _BEPolyelectrolyte:
-
-**2.2.14. BEPolyelectrolyte (Model)**
-
-Calculates the structure factor of a polyelectrolyte solution with the RPA expression derived by Borue and Erukhimovich.
-
-The value returned is in |cm^-1|.
-
-*2.2.14.1. Definition*
-
-.. image:: ..\img\olddocs\image191.PNG
-
-where *K* is the contrast factor for the polymer, *Lb* is the Bjerrum length, *h* is the virial parameter, *b* is the
-monomer length, *Cs* is the concentration of monovalent salt, |alpha| is the ionization degree, *Ca* is the polymer
-molar concentration, and *background* is the incoherent background.
-
-For 2D data: The 2D scattering intensity is calculated in the same way as 1D, where the *q* vector is defined as
-
-.. image:: ..\img\olddocs\image040.gif
-
-==============  ========  =============
-Parameter name  Units     Default value
-==============  ========  =============
-K               barns     10
-Lb              |Ang|     7.1
-h               |Ang^-3|  12
-b               |Ang|     10
-Cs              mol/L     0
-alpha           None      0.05
-Ca              mol/L     0.7
-background      |cm^-1|   0.0
-==============  ========  =============
-
-NB: 1 barn = 10\ :sup:`-24` |cm^2|
-
-REFERENCE
-
-V Y Borue, I Y Erukhimovich, *Macromolecules*, 21 (1988) 3240
-
-J F Joanny, L Leibler, *Journal de Physique*, 51 (1990) 545
-
-A Moussaid, F Schosseler, J P Munch, S Candau, *J. Journal de Physique II France*, 3 (1993) 573
-
-E Raphael, J F Joanny, *Europhysics Letters*, 11 (1990) 179
-
-
-
-.. _GuinierLaw:
-
-**2.2.15. Guinier (Model)**
-
-This model fits the Guinier function
-
-.. image:: ..\img\olddocs\image192.PNG
-
-to the data directly without any need for linearisation (*cf*. Ln *I(q)* vs *q*\ :sup:`2`).
-
-For 2D data: The 2D scattering intensity is calculated in the same way as 1D, where the *q* vector is defined as
-
-.. image:: ..\img\olddocs\image040.gif
-
-==============  ========  =============
-Parameter name  Units     Default value
-==============  ========  =============
-scale           |cm^-1|   1.0
-Rg              |Ang|     0.1
-==============  ========  =============
-
-REFERENCE
-
-A Guinier and G Fournet, *Small-Angle Scattering of X-Rays*, John Wiley & Sons, New York (1955)
-
-
-
-.. _GuinierPorod:
-
-**2.2.16. GuinierPorod (Model)**
-
-Calculates the scattering for a generalized Guinier/power law object. This is an empirical model that can be used to
-determine the size and dimensionality of scattering objects, including asymmetric objects such as rods or platelets, and
-shapes intermediate between spheres and rods or between rods and platelets.
-
-The result is in the units of |cm^-1|, absolute scale.
-
-*2.2.16.1 Definition*
-
-The following functional form is used
-
-.. image:: ..\img\olddocs\image193.jpg
-
-This is based on the generalized Guinier law for such elongated objects (see the Glatter reference below). For 3D
-globular objects (such as spheres), *s* = 0 and one recovers the standard GuinierLaw_ formula. For 2D symmetry (such as
-for rods) *s* = 1, and for 1D symmetry (such as for lamellae or platelets) *s* = 2. A dimensionality parameter (3-*s*)
-is thus defined, and is 3 for spherical objects, 2 for rods, and 1 for plates.
-
-Enforcing the continuity of the Guinier and Porod functions and their derivatives yields
-
-.. image:: ..\img\olddocs\image194.jpg
-
-and
-
-.. image:: ..\img\olddocs\image195.jpg
-
-Note that
-
- the radius-of-gyration for a sphere of radius *R* is given by *Rg* = *R* sqrt(3/5)
-
-Â the cross-sectional radius-of-gyration for a randomly oriented cylinder of radius *R* is given byÂ *Rg* = *R* / sqrt(2)
-
- the cross-sectional radius-of-gyration of a randomly oriented lamella of thickness *T* is given by *Rg* = *T* / sqrt(12)
-
-For 2D data: The 2D scattering intensity is calculated in the same way as 1D, where the *q* vector is defined as
-
-.. image:: ..\img\olddocs\image008.PNG
-
-==============================  ========  =============
-Parameter name                  Units     Default value
-==============================  ========  =============
-scale      (=Guinier scale, G)  |cm^-1|   1.0
-rg                              |Ang|     100
-dim (=dimensional variable, s)  None Â     1
-m            (=Porod exponent)  None Â     3
-background                      |cm^-1|Â   0.1
-==============================  ========  =============
-
-.. image:: ..\img\olddocs\image196.jpg
-
-*Figure. 1D plot using the default values (w/500 data points).*
-
-REFERENCE
-
-A Guinier, G Fournet, *Small-Angle Scattering of X-Rays*, John Wiley and Sons, New York, (1955)
-
-O Glatter, O Kratky, *Small-Angle X-Ray Scattering*, Academic Press (1982)
-Check out Chapter 4 on Data Treatment, pages 155-156.
-
-
-
-.. _PorodModel:
-
-**2.2.17. PorodModel**
-
-This model fits the Porod function
-
-.. image:: ..\img\olddocs\image197_corrected.PNG
-
-to the data directly without any need for linearisation (*cf*. Log *I(q)* vs Log *q*).
-
-Here *C* is the scale factor and *Sv* is the specific surface area (ie, surface area / volume) of the sample, and
-|drho| is the contrast factor.
-
-For 2D data: The 2D scattering intensity is calculated in the same way as 1D, where the *q* vector is defined as
-
-.. image:: ..\img\olddocs\image040.gif
-
-==============  ========  =============
-Parameter name  Units     Default value
-==============  ========  =============
-scale           |Ang^-4|  0.1
-background      |cm^-1|   0
-==============  ========  =============
-
-REFERENCE
-
-None.
-
-
-
-.. _PeakGaussModel:
-
-**2.2.18. PeakGaussModel**
-
-This model describes a Gaussian shaped peak on a flat background
-
-.. image:: ..\img\olddocs\image198.PNG
-
-with the peak having height of *I0* centered at *q0* and having a standard deviation of *B*.Â  The FWHM (full-width
-half-maximum) is 2.354 B.Â Â 
-
-For 2D data: The 2D scattering intensity is calculated in the same way as 1D, where the *q* vector is defined as
-
-.. image:: ..\img\olddocs\image040.gif
-
-==============  ========  =============
-Parameter name  Units     Default value
-==============  ========  =============
-scale           |cm^-1|   100
-q0              |Ang^-1|  0.05
-B    Â           |Ang^-1|  0.005
-background      |cm^-1|Â   1
-==============  ========  =============
-
-.. image:: ..\img\olddocs\image199.jpg
-
-*Figure. 1D plot using the default values (w/500 data points).*
-
-REFERENCE
-
-None.
-
-
-
-.. _PeakLorentzModel:
-
-**2.2.19. PeakLorentzModel**
-
-This model describes a Lorentzian shaped peak on a flat background
-
-.. image:: ..\img\olddocs\image200.PNG
-
-with the peak having height of *I0* centered at *q0* and having a HWHM (half-width half-maximum) of B.Â 
-
-For 2D data: The 2D scattering intensity is calculated in the same way as 1D, where the *q* vector is defined as
-
-.. image:: ..\img\olddocs\image040.gif
-
-==============  ========  =============
-Parameter name  Units     Default value
-==============  ========  =============
-scale           |cm^-1|   100
-q0              |Ang^-1|  0.05
-B    Â           |Ang^-1|  0.005
-background      |cm^-1|Â     1
-==============  ========  =============
-
-.. image:: ..\img\olddocs\image201.jpg
-
-*Figure. 1D plot using the default values (w/500 data points).*
-
-REFERENCE
-
-None.
-
-
-
-.. _Poly_GaussCoil:
-
-**2.2.20. Poly_GaussCoil (Model)**
-
-This model calculates an empirical functional form for the scattering from a **polydisperse** polymer chain in the
-theta state assuming a Schulz-Zimm type molecular weight distribution.Â Polydispersity on the radius-of-gyration is also
-provided for.
-
-The returned value is scaled to units of |cm^-1|, absolute scale.
-
-*2.2.20.1. Definition*
-
-The scattering intensity *I(q)* is calculated as
-
-.. image:: ..\img\olddocs\image202.PNG
-
-where the dimensionless chain dimension is
-
-.. image:: ..\img\olddocs\image203.PNG
-
-and the polydispersity is
-
-.. image:: ..\img\olddocs\image204.PNG
-
-For 2D data: The 2D scattering intensity is calculated in the same way as 1D, where the *q* vector is defined as
-
-.. image:: ..\img\olddocs\image040.gif
-
-This example dataset is produced using 200 data points, using 200 data points,
-*qmin* = 0.001 |Ang^-1|, *qmax* = 0.7 |Ang^-1| and the default values
-
-==============  ========  =============
-Parameter name  Units     Default value
-==============  ========  =============
-scale           None      1.0
-rg              |Ang|     60.0
-poly_m (Mw/Mn)  None      2
-background      |cm^-1|   0.001
-==============  ========  =============
-
-.. image:: ..\img\olddocs\image205.jpg
-
-*Figure. 1D plot using the default values (w/200 data point).*
-
-REFERENCE
-
-O Glatter and O Kratky (editors), *Small Angle X-ray Scattering*, Academic Press, (1982)
-Page 404
-
-J S Higgins, and H C Benoit, Polymers and Neutron Scattering, Oxford Science Publications (1996)
-
-
-
-.. _PolyExclVolume:
-
-**2.2.21. PolymerExclVolume (Model)**
-
-This model describes the scattering from polymer chains subject to excluded volume effects, and has been used as a
-template for describing mass fractals.
-
-The returned value is scaled to units of |cm^-1|, absolute scale.
-
-*2.2.21.1 Definition*
-
-The form factor  was originally presented in the following integral form (Benoit, 1957)
-
-.. image:: ..\img\olddocs\image206.jpg
-
-where |nu| is the excluded volume parameter (which is related to the Porod exponent *m* as |nu| = 1 / *m*), *a* is the
-statistical segment length of the polymer chain, and *n* is the degree of polymerization. This integral was later put
-into an almost analytical form as follows (Hammouda, 1993)
-
-.. image:: ..\img\olddocs\image207.jpg
-
-where |gamma|\ *(x,U)* is the incomplete gamma function
-
-.. image:: ..\img\olddocs\image208.jpg
-
-and the variable *U* is given in terms of the scattering vector *Q* as
-
-.. image:: ..\img\olddocs\image209.jpg
-
-The square of the radius-of-gyration is defined as
-
-.. image:: ..\img\olddocs\image210.jpg
-
-Note that this model applies only in the mass fractal range (ie, 5/3 <= *m* <= 3) and **does not** apply to surface
-fractals (3 < *m* <= 4). It also does not reproduce the rigid rod limit (*m* = 1) because it assumes chain flexibility
-from the outset.Â It may cover a portion of the semi-flexible chain range (1 < *m* < 5/3).
-
-A low-*Q* expansion yields the Guinier form and a high-*Q* expansion yields the Porod form which is given by
-
-.. image:: ..\img\olddocs\image211.jpg
-
-Here |biggamma|\ *(x)* = |gamma|\ *(x,inf)* is the gamma function.
-
-The asymptotic limit is dominated by the first term
-
-.. image:: ..\img\olddocs\image212.jpg
-
-The special case when |nu| = 0.5 (or *m* = 1/|nu| = 2) corresponds to Gaussian chains for which the form factor is given
-by the familiar Debye_ function.
-
-.. image:: ..\img\olddocs\image213.jpg
-
-For 2D data: The 2D scattering intensity is calculated in the same way as 1D, where the *q* vector is defined as
-
-.. image:: ..\img\olddocs\image040.gif
-
-This example dataset is produced using 200 data points, *qmin* = 0.001 |Ang^-1|, *qmax* = 0.2 |Ang^-1| and the default
-values
-
-===================  ========  =============
-Parameter name       Units     Default value
-===================  ========  =============
-scale                None      1.0
-rg                   |Ang|     60.0
-m (=Porod exponent)  None Â     3
-background           |cm^-1|   0.0
-===================  ========  =============
-
-.. image:: ..\img\olddocs\image214.jpg
-
-*Figure. 1D plot using the default values (w/500 data points).*
-
-REFERENCE
-
-H Benoit, *Comptes Rendus*, 245 (1957) 2244-2247
-
-B Hammouda, *SANS from Homogeneous Polymer Mixtures Â­ A Unified Overview*, *Advances in Polym. Sci.*, 106 (1993) 87-133
-
-
-
-.. _RPA10Model:
-
-**2.2.22. RPA10Model**
-
-Calculates the macroscopic scattering intensity (units of |cm^-1|) for a multicomponent homogeneous mixture of polymers
-using the Random Phase Approximation. This general formalism contains 10 specific cases
-
-Case 0: C/D binary mixture of homopolymers
-
-Case 1: C-D diblock copolymer
-
-Case 2: B/C/D ternary mixture of homopolymers
-
-Case 3: C/C-D mixture of a homopolymer B and a diblock copolymer C-D
-
-Case 4: B-C-D triblock copolymer
-
-Case 5: A/B/C/D quaternary mixture of homopolymers
-
-Case 6: A/B/C-D mixture of two homopolymers A/B and a diblock C-D
-
-Case 7: A/B-C-D mixture of a homopolymer A and a triblock B-C-D
-
-Case 8: A-B/C-D mixture of two diblock copolymers A-B and C-D
-
-Case 9: A-B-C-D tetra-block copolymer
-
-**NB: these case numbers are different from those in the NIST SANS package!**
-
-Only one case can be used at any one time.
-
-The returned value is scaled to units of |cm^-1|, absolute scale.
-
-The RPA (mean field) formalism only applies only when the multicomponent polymer mixture is in the homogeneous
-mixed-phase region.
-
-**Component D is assumed to be the "background" component (ie, all contrasts are calculated with respect to**
-**component D).** So the scattering contrast for a C/D blend = [SLD(component C) - SLD(component D)]\ :sup:`2`.
-
-Depending on which case is being used, the number of fitting parameters - the segment lengths (ba, bb, etc) and |chi|
-parameters (Kab, Kac, etc) - vary. The *scale* parameter should be held equal to unity.
-
-The input parameters are the degrees of polymerization, the volume fractions, the specific volumes, and the neutron
-scattering length densities for each component.
-
-Fitting parameters for a Case 0 Model
-
-=======================  ========  =============
-Parameter name           Units     Default value
-=======================  ========  =============
-background               |cm^-1|   0.0
-scale Â                   None      1
-bc (=segment Length_bc)  **unit**  5
-bd (=segment length_bd)  **unit**  5
-Kcd (=chi_cd)            **unit**  -0.0004
-=======================  ========  =============
-
-Fixed parameters for a Case 0 Model
-
-=======================  ========  =============
-Parameter name           Units     Default value
-=======================  ========  =============
-Lc (=scatter. length_c)  **unit**  1e-12
-Ld (=scatter. length_d)  **unit**  0
-Nc    (=degree polym_c)  None      1000
-Nd    (=degree polym_d)  None Â     1000
-Phic (=vol. fraction_c)  None Â     0.25
-Phid (=vol. fraction_d)  None Â     0.25
-vc (=specific volume_c)  **unit**  100
-vd (=specific volume_d)  **unit**  100
-=======================  ========  =============
-
-.. image:: ..\img\olddocs\image215.jpg
-
-*Figure. 1D plot using the default values (w/500 data points).*
-
-REFERENCE
-
-A Z Akcasu, R Klein and B Hammouda, *Macromolecules*, 26 (1993) 4136
-
-
-
-.. _TwoLorentzian:
-
-**2.2.23. TwoLorentzian (Model)**
-
-This model calculates an empirical functional form for SAS data characterized by two Lorentzian-type functions.
-
-The returned value is scaled to units of |cm^-1|, absolute scale.
-
-*2.2.23.1. Definition*
-
-The scattering intensity *I(q)* is calculated as
-
-.. image:: ..\img\olddocs\image216.jpgÂ 
-
-where *A* = Lorentzian scale factor #1, *C* = Lorentzian scale #2, |xi|\ :sub:`1` and |xi|\ :sub:`2` are the
-corresponding correlation lengths, and *n* and *m* are the respective power law exponents (set *n* = *m* = 2 for
-Ornstein-Zernicke behaviour).
-
-For 2D data: The 2D scattering intensity is calculated in the same way as 1D, where the *q* vector is defined as
-
-.. image:: ..\img\olddocs\image040.gif
-
-===============================  ========  =============
-Parameter name                   Units     Default value
-===============================  ========  =============
-scale_1 (=A)                     None Â     10
-scale_2 (=C)                     None Â     1
-1ength_1 (=correlation length1)  |Ang|     100
-1ength_2 (=correlation length2)  |Ang|     10
-exponent_1 (=n)                  None Â     3
-exponent_2 (=m)                  None Â     2
-background (=B)                  |cm^-1|   0.1
-===============================  ========  =============
-
-.. image:: ..\img\olddocs\image217.jpg
-
-*Figure. 1D plot using the default values (w/500 data points).*
-
-REFERENCE
-
-None.
-
-
-
-.. _TwoPowerLaw:
-
-**2.2.24. TwoPowerLaw (Model)**
-
-This model calculates an empirical functional form for SAS data characterized by two power laws.
-
-The returned value is scaled to units of |cm^-1|, absolute scale.
-
-*2.2.24.1. Definition*
-
-The scattering intensity *I(q)* is calculated as
-
-.. image:: ..\img\olddocs\image218.jpg
-
-where *qc* is the location of the crossover from one slope to the other. The scaling *coef_A* sets the overall
-intensity of the lower *q* power law region. The scaling of the second power law region is then automatically scaled to
-match the first.
-
-**NB: Be sure to enter the power law exponents as positive values!**
-
-For 2D data: The 2D scattering intensity is calculated in the same way as 1D, where the *q* vector is defined as
-
-.. image:: ..\img\olddocs\image040.gif
-
-==============  ========  =============
-Parameter name  Units     Default value
-==============  ========  =============
-coef_A Â         None      1.0
-qc              |Ang^-1|  0.04
-power_1 (=m1)   None Â     4
-power_2 (=m2)   None Â     4
-background      |cm^-1|   0.0
-==============  ========  =============
-
-.. image:: ..\img\olddocs\image219.jpg
-
-*Figure. 1D plot using the default values (w/500 data points).*
-
-REFERENCE
-
-None.
-
-
-
-.. _UnifiedPowerRg:
-
-**2.2.25. UnifiedPowerRg (Beaucage Model)**
-
-This model deploys the empirical multiple level unified Exponential/Power-law fit method developed by G Beaucage. Four
-functions are included so that 1, 2, 3, or 4 levels can be used. In addition a 0 level has been added which simply
-calculates
-
-*I(q)* = *scale* / *q* + *background*
-
-The returned value is scaled to units of |cm^-1|, absolute scale.Â 
-
-The Beaucage method is able to reasonably approximate the scattering from many different types of particles, including
-fractal clusters, random coils (Debye equation), ellipsoidal particles, etc.Â 
-
-*2.2.25.1 Definition*
-
-The empirical fit function isÂ 
-
-.. image:: ..\img\olddocs\image220.jpg
-
-For each level, the four parameters *Gi*, *Rg,i*, *Bi* and *Pi* must be chosen.Â 
-
-For example, to approximate the scattering from random coils (Debye_ equation), set *Rg,i* as the Guinier radius,
-*Pi* = 2, and *Bi* = 2 *Gi* / *Rg,i*Â 
-
-See the references for further information on choosing the parameters.
-
-For 2D data: The 2D scattering intensity is calculated in the same way as 1D, where the *q* vector is defined as
-
-.. image:: ..\img\olddocs\image040.gif
-
-==============  ========  =============
-Parameter name  Units     Default value
-==============  ========  =============
-scale Â          None      1.0
-Rg2             |Ang|     21
-power2 Â         None      2
-G2              |cm^-1|   3
-B2              |cm^-1|   0.0006
-Rg1             |Ang|     15.8
-power1 Â         None      4
-G1              |cm^-1|   400
-B1              |cm^-1|   4.5e-6                |
-background      |cm^-1|   0.0
-==============  ========  =============
-
-.. image:: ..\img\olddocs\image221.jpg
-
-*Figure. 1D plot using the default values (w/500 data points).*
-
-REFERENCE
-
-G Beaucage, *J. Appl. Cryst.*, 28 (1995) 717-728
-
-G Beaucage, *J. Appl. Cryst.*, 29 (1996) 134-146
-
-
-
-.. _LineModel:
-
-**2.2.26. LineModel**
-
-This calculates the simple linear function
-
-.. image:: ..\img\olddocs\image222.PNG
-
-**NB: For 2D plots,** *I(q)* = *I(qx)*\ *\ *I(qy)*,Â **which is a different definition to other shape independent models.**
-
-==============  ==============  =============
-Parameter name  Units           Default value
-==============  ==============  =============
-A               |cm^-1|         1.0
-B               |Ang|\ |cm^-1|  1.0
-==============  ==============  =============
-
-REFERENCE
-
-None.
-
-
-
-.. _GelFitModel:
-
-**2.2.27. GelFitModel**
-
-*This model was implemented by an interested user!*
-
-Unlike a concentrated polymer solution, the fine-scale polymer distribution in a gel involves at least two
-characteristic length scales, a shorter correlation length (*a1*) to describe the rapid fluctuations in the position
-of the polymer chains that ensure thermodynamic equilibrium, and a longer distance (denoted here as *a2*) needed to
-account for the static accumulations of polymer pinned down by junction points or clusters of such points. The latter
-is derived from a simple Guinier function.
-
-Also see the GaussLorentzGel_ Model.
-
-*2.2.27.1. Definition*
-
-The scattered intensity *I(q)* is calculated as
-
-.. image:: ..\img\olddocs\image233.gif
-
-where
-
-.. image:: ..\img\olddocs\image234.gif
-
-Note that the first term reduces to the Ornstein-Zernicke equation when *D* = 2; ie, when the Flory exponent is 0.5
-(theta conditions). In gels with significant hydrogen bonding *D* has been reported to be ~2.6 to 2.8.
-
-============================  ========  =============
-Parameter name                Units     Default value
-============================  ========  =============
-Background                    |cm^-1|   0.01
-Guinier scale    (= *I(0)G*)  |cm^-1|   1.7
-Lorentzian scale (= *I(0)L*)  |cm^-1|   3.5
-Radius of gyration  (= *Rg*)  |Ang|     104
-Fractal exponent     (= *D*)  None Â     2
-Correlation length  (= *a1*)  |Ang|     16
-============================  ========  =============
-
-.. image:: ..\img\olddocs\image235.gif
-
-*Figure. 1D plot using the default values (w/300 data points).*
-
-REFERENCE
-
-Mitsuhiro Shibayama, Toyoichi Tanaka, Charles C Han, J. Chem. Phys. 1992, 97 (9), 6829-6841
-
-Simon Mallam, Ferenc Horkay, Anne-Marie Hecht, Adrian R Rennie, Erik Geissler, Macromolecules 1991, 24, 543-548
-
-
-
-.. _StarPolymer:
-
-**2.2.28. Star Polymer with Gaussian Statistics**
-
-This model is also known as the Benoit Star model.
-
-*2.2.28.1. Definition*
-
-For a star with *f* arms:
-
-.. image:: ..\img\olddocs\star1.png
-
-where
-
-.. image:: ..\img\olddocs\star2.png
-
-and
-
-.. image:: ..\img\olddocs\star3.png
-
-is the square of the ensemble average radius-of-gyration of an arm.
-
-REFERENCE
-
-H Benoit, Â  J. Polymer Science.,Â  11, 596-599Â  (1953)
-
-
-
-.. _ReflectivityModel:
-
-**2.2.29. ReflectivityModel**
-
-*This model was contributed by an interested user!*
-
-This model calculates **reflectivity** using the Parrett algorithm.
-
-Up to nine film layers are supported between Bottom(substrate) and Medium(Superstrate) where the neutron enters the
-first top film. Each of the layers are composed of
-
-[Âœ of the interface (from the previous layer or substrate) + flat portion + Âœ of the interface (to the next layer or medium)]
-
-Two simple functions are provided to describe the interfacial density distribution; a linear function and an error
-function. The interfacial thickness is equivalent to (-2.5 |sigma| to +2.5 |sigma| for the error function, where
-|sigma| = roughness).
-
-Also see ReflectivityIIModel_.
-
-.. image:: ..\img\olddocs\image231.bmp
-
-*Figure. Comparison (using the SLD profile below) with the NIST web calculation (circles)*
-http://www.ncnr.nist.gov/resources/reflcalc.html
-
-.. image:: ..\img\olddocs\image232.gif
-
-*Figure. SLD profile used for the calculation (above).*
-
-REFERENCE
-
-None.
-
-
-
-.. _ReflectivityIIModel:
-
-**2.2.30. ReflectivityIIModel**
-
-*This model was contributed by an interested user!*
-
-This **reflectivity** model is a more flexible version of ReflectivityModel_. More interfacial density
-functions are supported, and the number of points (*npts_inter*) for each interface can be chosen.
-
-The SLD at the interface between layers, |rho|\ *inter_i*, is calculated with a function chosen by a user, where the
-available functions are
-
-1) Erf
-
-.. image:: ..\img\olddocs\image051.gif
-
-2) Power-Law
-
-.. image:: ..\img\olddocs\image050.gif
-
-3) Exp
-
-.. image:: ..\img\olddocs\image049.gif
-
-The constant *A* in the expressions above (but the parameter *nu* in the model!) is an input.
-
-REFERENCE
-
-None.
-
-
-
-2.3 Structure-factor Functions
-------------------------------
-
-The information in this section originated from NIST SANS package.
-
-.. _HardSphereStructure:
-
-**2.3.1. HardSphereStructure Factor**
-
-This calculates the interparticle structure factor for monodisperse spherical particles interacting through hard
-sphere (excluded volume) interactions.
-
-The calculation uses the Percus-Yevick closure where the interparticle potential is
-
-.. image:: ..\img\olddocs\image223.PNG
-
-where *r* is the distance from the center of the sphere of a radius *R*.
-
-For a 2D plot, the wave transfer is defined as
-
-.. image:: ..\img\olddocs\image040.gif
-
-==============  ========  =============
-Parameter name  Units     Default value
-==============  ========  =============
-effect_radius   |Ang|     50.0
-volfraction     None      0.2
-==============  ========  =============
-
-.. image:: ..\img\olddocs\image224.jpg
-
-*Figure. 1D plot using the default values (in linear scale).*
-
-REFERENCE
-
-J K Percus, J Yevick, *J. Phys. Rev.*, 110, (1958) 1
-
-
-
-.. _SquareWellStructure:
-
-**2.3.2. SquareWellStructure Factor**
-
-This calculates the interparticle structure factor for a square well fluid spherical particles. The mean spherical
-approximation (MSA) closure was used for this calculation, and is not the most appropriate closure for an attractive
-interparticle potential. This solution has been compared to Monte Carlo simulations for a square well fluid, showing
-this calculation to be limited in applicability to well depths |epsilon| < 1.5 kT and volume fractions |phi| < 0.08.
-
-Positive well depths correspond to an attractive potential well. Negative well depths correspond to a potential
-"shoulder", which may or may not be physically reasonable.
-
-The well width (*l*\ ) is defined as multiples of the particle diameter (2\*\ *R*\ )
-
-The interaction potential is:
-
-.. image:: ..\img\olddocs\image225.PNG
-
-where *r* is the distance from the center of the sphere of a radius *R*.
-
-For 2D data: The 2D scattering intensity is calculated in the same way as 1D, where the *q* vector is defined as
-
-.. image:: ..\img\olddocs\image040.gif
-
-==============  =========  =============
-Parameter name  Units      Default value
-==============  =========  =============
-effect_radius   |Ang|      50.0
-volfraction     None       0.04
-welldepth       kT         1.5
-wellwidth       diameters  1.2
-==============  =========  =============
-
-.. image:: ..\img\olddocs\image226.jpg
-
-*Figure. 1D plot using the default values (in linear scale).*
-
-REFERENCE
-
-R V Sharma, K C Sharma, *Physica*, 89A (1977) 213
-
-
-
-.. _HayterMSAStructure:
-
-**2.3.3. HayterMSAStructure Factor**
-
-This is an implementation of the Rescaled Mean Spherical Approximation which calculates the structure factor (the 
-Fourier transform of the pair correlation function *g(r)*) for a system of charged, spheroidal objects in a
-dielectric medium. When combined with an appropriate form factor (such as sphere,core+shell, ellipsoid, etc), this
-allows for inclusion of the interparticle interference effects due to screened coulomb repulsion between charged particles.
-
-**This routine only works for charged particles**. If the charge is set to zero the routine will self-destruct!
-For non-charged particles use a hard sphere potential.
-
-The salt concentration is used to compute the ionic strength of the solution which in turn is used to compute the Debye
-screening length. At present there is no provision for entering the ionic strength directly nor for use of any
-multivalent salts. The counterions are also assumed to be monovalent.
-
-For 2D data: The 2D scattering intensity is calculated in the same way as 1D, where the *q* vector is defined as
-
-.. image:: ..\img\olddocs\image040.gif
-
-==============  ========  =============
-Parameter name  Units     Default value
-==============  ========  =============
-effect_radius   |Ang|     20.8
-charge          *e*       19
-volfraction     None      0.2
-temperature     K         318
-salt conc       M         0
-dielectconst    None      71.1
-==============  ========  =============
-
-.. image:: ..\img\olddocs\image227.jpg
-
-*Figure. 1D plot using the default values (in linear scale).*
-
-REFERENCE
-
-J B Hayter and J Penfold, *Molecular Physics*, 42 (1981) 109-118
-
-J P Hansen and J B Hayter, *Molecular Physics*, 46 (1982) 651-656
-
-
-.. _StickyHSStructure:
-
-**2.3.4. StickyHSStructure Factor**
-
-This calculates the interparticle structure factor for a hard sphere fluid with a narrow attractive well. A perturbative
-solution of the Percus-Yevick closure is used. The strength of the attractive well is described in terms of "stickiness"
-as defined below. The returned value is a dimensionless structure factor, *S(q)*.
-
-The perturb (perturbation parameter), |epsilon|, should be held between 0.01 and 0.1. It is best to hold the
-perturbation parameter fixed and let the "stickiness" vary to adjust the interaction strength. The stickiness, |tau|,
-is defined in the equation below and is a function of both the perturbation parameter and the interaction strength.
-|tau| and |epsilon| are defined in terms of the hard sphere diameter (|sigma| = 2\*\ *R*\ ), the width of the square
-well, |bigdelta| (same units as *R*), and the depth of the well, *Uo*, in units of kT. From the definition, it is clear
-that smaller |tau| means stronger attraction.
-
-.. image:: ..\img\olddocs\image228.PNG
-
-where the interaction potential is
-
-.. image:: ..\img\olddocs\image229.PNG
-
-The Percus-Yevick (PY) closure was used for this calculation, and is an adequate closure for an attractive interparticle
-potential. This solution has been compared to Monte Carlo simulations for a square well fluid, with good agreement.
-
-The true particle volume fraction, |phi|, is not equal to *h*, which appears in most of the reference. The two are
-related in equation (24) of the reference. The reference also describes the relationship between this perturbation
-solution and the original sticky hard sphere (or adhesive sphere) model by Baxter.
-
-NB: The calculation can go haywire for certain combinations of the input parameters, producing unphysical solutions - in
-this case errors are reported to the command window and the *S(q)* is set to -1 (so it will disappear on a log-log
-plot). Use tight bounds to keep the parameters to values that you know are physical (test them) and keep nudging them
-until the optimization does not hit the constraints.
-
-For 2D data: The 2D scattering intensity is calculated in the same way as 1D, where the *q* vector is defined as
-
-.. image:: ..\img\olddocs\image040.gif
-
-==============  ========  =============
-Parameter name  Units     Default value
-==============  ========  =============
-effect_radius   |Ang|     50
-perturb         None      0.05
-volfraction     None      0.1
-stickiness      K         0.2
-==============  ========  =============
-
-.. image:: ..\img\olddocs\image230.jpg
-
-*Figure. 1D plot using the default values (in linear scale).*
-
-REFERENCE
-
-S V G Menon, C Manohar, and K S Rao, *J. Chem. Phys.*, 95(12) (1991) 9186-9190
-
-
-
-2.4 Customised Functions
-------------------------------
-
-
-Customized model functions can be redefined or added to by users (See SansView tutorial for details).
-
-.. _testmodel:
-
-**2.4.1. testmodel**
-
-This function, as an example of a user defined function, calculates
-
-*I(q)* = *A* + *B* cos(2\ *q*\ ) + *C* sin(2\ *q*\ )
-
-
-
-.. _testmodel_2:
-
-**2.4.2. testmodel_2**
-
-This function, as an example of a user defined function, calculates
-
-*I(q)* = *scale* * sin(*f*\ )/*f*
-
-where
-
-*f* = *A* + *Bq* + *Cq*\ :sup:`2` + *Dq*\ :sup:`3` + *Eq*\ :sup:`4` + *Fq*\ :sup:`5`
-
-
-
-.. _sum_p1_p2:
-
-**2.4.3. sum_p1_p2**
-
-This function, as an example of a user defined function, calculates
-
-*I(q)* = *scale_factor* \* (CylinderModel + PolymerExclVolumeModel)
-
-To make your own (*p1 + p2*) model, select 'Easy Custom Sum' from the Fitting menu, or modify and compile the file
-named 'sum_p1_p2.py' from 'Edit Custom Model' in the 'Fitting' menu.
-
-NB: Summing models only works only for single functional models (ie, single shell models, two-component RPA models, etc).
-
-
-
-.. _sum_Ap1_1_Ap2:
-
-**2.4.4. sum_Ap1_1_Ap2**
-
-This function, as an example of a user defined function, calculates
-
-*I(q)* = (*scale_factor* \* CylinderModel + (1 - *scale_factor*\ ) \* PolymerExclVolume model)
-
-To make your own (*A*\ * *p1* + (1-*A*) \* *p2*) model, modify and compile the file named 'sum_Ap1_1_Ap2.py' from
-'Edit Custom Model' in the 'Fitting' menu.
-
-NB: Summing models only works only for single functional models (ie, single shell models, two-component RPA models, etc).
-
-
-
-.. _polynomial5:
-
-**2.4.5. polynomial5**
-
-This function, as an example of a user defined function, calculates
-
-*I(q)* = *A* + *Bq* + *Cq*\ :sup:`2` + *Dq*\ :sup:`3` + *Eq*\ :sup:`4` + *Fq*\ :sup:`5`
-
-This model can be modified and compiled from 'Edit Custom Model' in the 'Fitting' menu.
-
-
-
-.. _sph_bessel_jn:
-
-**2.4.6. sph_bessel_jn**
-
-This function, as an example of a user defined function, calculates
-
-*I(q)* = *C* \* *sph_jn(Ax+B)+D*
-
-where *sph_jn* is a spherical Bessel function of order *n*.
-
-This model can be modified and compiled from 'Edit Custom Model' in the 'Fitting' menu.
Index: c/sas/models/sas_extension/__init__.py
===================================================================
--- src/sas/models/sas_extension/__init__.py	(revision fb3f9af6b7f4c21e4835a63ed3f7428632d42bc2)
+++ 	(revision )
@@ -1,3 +1,0 @@
-"""
-This is an empty package - should probably delete
-"""
Index: c/sas/sascalc/data_util/qsmearing.py
===================================================================
--- src/sas/sascalc/data_util/qsmearing.py	(revision 8cb069213ce4e17f7a4e5febf1429aa2b0e0ea0a)
+++ 	(revision )
@@ -1,148 +1,0 @@
-"""
-    Handle Q smearing
-"""
-#####################################################################
-#This software was developed by the University of Tennessee as part of the
-#Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-#project funded by the US National Science Foundation. 
-#See the license text in license.txt
-#copyright 2008, University of Tennessee
-######################################################################
-import numpy
-import math
-import logging
-import sys
-
-from sasmodels.resolution import Slit1D, Pinhole1D
-from sasmodels.resolution2d import Pinhole2D
-
-def smear_selection(data, model = None):
-    """
-    Creates the right type of smearer according 
-    to the data.
-
-    The canSAS format has a rule that either
-    slit smearing data OR resolution smearing data
-    is available. 
-    
-    For the present purpose, we choose the one that
-    has none-zero data. If both slit and resolution
-    smearing arrays are filled with good data 
-    (which should not happen), then we choose the
-    resolution smearing data. 
-    
-    :param data: Data1D object
-    :param model: sas.model instance
-    """
-    # Sanity check. If we are not dealing with a SAS Data1D
-    # object, just return None
-    if  data.__class__.__name__ not in ['Data1D', 'Theory1D']:
-        if data == None:
-            return None
-        elif data.dqx_data == None or data.dqy_data == None:
-            return None
-        return Pinhole2D(data)
-    
-    if  not hasattr(data, "dx") and not hasattr(data, "dxl")\
-         and not hasattr(data, "dxw"):
-        return None
-    
-    # Look for resolution smearing data
-    _found_resolution = False
-    if data.dx is not None and len(data.dx) == len(data.x):
-        
-        # Check that we have non-zero data
-        if data.dx[0] > 0.0:
-            _found_resolution = True
-            #print "_found_resolution",_found_resolution
-            #print "data1D.dx[0]",data1D.dx[0],data1D.dxl[0]
-    # If we found resolution smearing data, return a QSmearer
-    if _found_resolution == True:
-         return pinhole_smear(data, model)
-
-    # Look for slit smearing data
-    _found_slit = False
-    if data.dxl is not None and len(data.dxl) == len(data.x) \
-        and data.dxw is not None and len(data.dxw) == len(data.x):
-        
-        # Check that we have non-zero data
-        if data.dxl[0] > 0.0 or data.dxw[0] > 0.0:
-            _found_slit = True
-        
-        # Sanity check: all data should be the same as a function of Q
-        for item in data.dxl:
-            if data.dxl[0] != item:
-                _found_resolution = False
-                break
-            
-        for item in data.dxw:
-            if data.dxw[0] != item:
-                _found_resolution = False
-                break
-    # If we found slit smearing data, return a slit smearer
-    if _found_slit == True:
-        return slit_smear(data, model)
-    return None
-
-
-class PySmear(object):
-    """
-    Wrapper for pure python sasmodels resolution functions.
-    """
-    def __init__(self, resolution, model):
-        self.model = model
-        self.resolution = resolution
-        self.offset = numpy.searchsorted(self.resolution.q_calc, self.resolution.q[0])
-
-    def apply(self, iq_in, first_bin=0, last_bin=None):
-        """
-        Apply the resolution function to the data.
-
-        Note that this is called with iq_in matching data.x, but with
-        iq_in[first_bin:last_bin] set to theory values for these bins,
-        and the remainder left undefined.  The first_bin, last_bin values
-        should be those returned from get_bin_range.
-
-        The returned value is of the same length as iq_in, with the range
-        first_bin:last_bin set to the resolution smeared values.
-        """
-        if last_bin is None: last_bin = len(iq_in)
-        start, end = first_bin + self.offset, last_bin + self.offset
-        q_calc = self.resolution.q_calc
-        iq_calc = numpy.empty_like(q_calc)
-        if start > 0:
-            iq_calc[:start] = self.model.evalDistribution(q_calc[:start])
-        if end+1 < len(q_calc):
-            iq_calc[end+1:] = self.model.evalDistribution(q_calc[end+1:])
-        iq_calc[start:end+1] = iq_in[first_bin:last_bin+1]
-        smeared = self.resolution.apply(iq_calc)
-        return smeared
-    __call__ = apply
-
-    def get_bin_range(self, q_min=None, q_max=None):
-        """
-        For a given q_min, q_max, find the corresponding indices in the data.
-
-        Returns first, last.
-
-        Note that these are indexes into q from the data, not the q_calc
-        needed by the resolution function.  Note also that these are the
-        indices, not the range limits.  That is, the complete range will be
-        q[first:last+1].
-        """
-        q = self.resolution.q
-        first = numpy.searchsorted(q, q_min)
-        last = numpy.searchsorted(q, q_max)
-        return first, min(last,len(q)-1)
-
-def slit_smear(data, model=None):
-    q = data.x
-    width = data.dxw if data.dxw is not None else 0
-    height = data.dxl if data.dxl is not None else 0
-    # TODO: width and height seem to be reversed
-    return PySmear(Slit1D(q, height, width), model)
-
-def pinhole_smear(data, model=None):
-    q = data.x
-    width = data.dx if data.dx is not None else 0
-    return PySmear(Pinhole1D(q, width), model)
