# This file was automatically generated by SWIG (http://www.swig.org).
# Version 4.0.2
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.

# This wrapper is part of IMP,
# Copyright 2007-2021 IMP Inventors. All rights reserved.

from __future__ import print_function, division, absolute_import
from sys import version_info as _swig_python_version_info
if _swig_python_version_info < (2, 7, 0):
    raise RuntimeError("Python 2.7 or later required")

import _IMP_gsl

try:
    import builtins as __builtin__
except ImportError:
    import __builtin__

def _swig_repr(self):
    try:
        strthis = "proxy of " + self.this.__repr__()
    except __builtin__.Exception:
        strthis = ""
    return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)


def _swig_setattr_nondynamic_instance_variable(set):
    def set_instance_attr(self, name, value):
        if name == "thisown":
            self.this.own(value)
        elif name == "this":
            set(self, name, value)
        elif hasattr(self, name) and isinstance(getattr(type(self), name), property):
            set(self, name, value)
        else:
            raise AttributeError("You cannot add instance attributes to %s" % self)
    return set_instance_attr


def _swig_setattr_nondynamic_class_variable(set):
    def set_class_attr(cls, name, value):
        if hasattr(cls, name) and not isinstance(getattr(cls, name), property):
            set(cls, name, value)
        else:
            raise AttributeError("You cannot add class attributes to %s" % cls)
    return set_class_attr


def _swig_add_metaclass(metaclass):
    """Class decorator for adding a metaclass to a SWIG wrapped class - a slimmed down version of six.add_metaclass"""
    def wrapper(cls):
        return metaclass(cls.__name__, cls.__bases__, cls.__dict__.copy())
    return wrapper


class _SwigNonDynamicMeta(type):
    """Meta class to enforce nondynamic attributes (no new attributes) for a class"""
    __setattr__ = _swig_setattr_nondynamic_class_variable(type.__setattr__)


import weakref

class IMP_GSL_SwigPyIterator(object):
    r"""Proxy of C++ swig::IMP_GSL_SwigPyIterator class."""

    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")

    def __init__(self, *args, **kwargs):
        raise AttributeError("No constructor defined - class is abstract")
    __repr__ = _swig_repr
    __swig_destroy__ = _IMP_gsl.delete_IMP_GSL_SwigPyIterator

    def value(self):
        r"""value(IMP_GSL_SwigPyIterator self) -> PyObject *"""
        return _IMP_gsl.IMP_GSL_SwigPyIterator_value(self)

    def incr(self, n=1):
        r"""incr(IMP_GSL_SwigPyIterator self, size_t n=1) -> IMP_GSL_SwigPyIterator"""
        return _IMP_gsl.IMP_GSL_SwigPyIterator_incr(self, n)

    def decr(self, n=1):
        r"""decr(IMP_GSL_SwigPyIterator self, size_t n=1) -> IMP_GSL_SwigPyIterator"""
        return _IMP_gsl.IMP_GSL_SwigPyIterator_decr(self, n)

    def distance(self, x):
        r"""distance(IMP_GSL_SwigPyIterator self, IMP_GSL_SwigPyIterator x) -> ptrdiff_t"""
        return _IMP_gsl.IMP_GSL_SwigPyIterator_distance(self, x)

    def equal(self, x):
        r"""equal(IMP_GSL_SwigPyIterator self, IMP_GSL_SwigPyIterator x) -> bool"""
        return _IMP_gsl.IMP_GSL_SwigPyIterator_equal(self, x)

    def copy(self):
        r"""copy(IMP_GSL_SwigPyIterator self) -> IMP_GSL_SwigPyIterator"""
        return _IMP_gsl.IMP_GSL_SwigPyIterator_copy(self)

    def next(self):
        r"""next(IMP_GSL_SwigPyIterator self) -> PyObject *"""
        return _IMP_gsl.IMP_GSL_SwigPyIterator_next(self)

    def __next__(self):
        r"""__next__(IMP_GSL_SwigPyIterator self) -> PyObject *"""
        return _IMP_gsl.IMP_GSL_SwigPyIterator___next__(self)

    def previous(self):
        r"""previous(IMP_GSL_SwigPyIterator self) -> PyObject *"""
        return _IMP_gsl.IMP_GSL_SwigPyIterator_previous(self)

    def advance(self, n):
        r"""advance(IMP_GSL_SwigPyIterator self, ptrdiff_t n) -> IMP_GSL_SwigPyIterator"""
        return _IMP_gsl.IMP_GSL_SwigPyIterator_advance(self, n)

    def __eq__(self, x):
        r"""__eq__(IMP_GSL_SwigPyIterator self, IMP_GSL_SwigPyIterator x) -> bool"""
        return _IMP_gsl.IMP_GSL_SwigPyIterator___eq__(self, x)

    def __ne__(self, x):
        r"""__ne__(IMP_GSL_SwigPyIterator self, IMP_GSL_SwigPyIterator x) -> bool"""
        return _IMP_gsl.IMP_GSL_SwigPyIterator___ne__(self, x)

    def __iadd__(self, n):
        r"""__iadd__(IMP_GSL_SwigPyIterator self, ptrdiff_t n) -> IMP_GSL_SwigPyIterator"""
        return _IMP_gsl.IMP_GSL_SwigPyIterator___iadd__(self, n)

    def __isub__(self, n):
        r"""__isub__(IMP_GSL_SwigPyIterator self, ptrdiff_t n) -> IMP_GSL_SwigPyIterator"""
        return _IMP_gsl.IMP_GSL_SwigPyIterator___isub__(self, n)

    def __add__(self, n):
        r"""__add__(IMP_GSL_SwigPyIterator self, ptrdiff_t n) -> IMP_GSL_SwigPyIterator"""
        return _IMP_gsl.IMP_GSL_SwigPyIterator___add__(self, n)

    def __sub__(self, *args):
        r"""
        __sub__(IMP_GSL_SwigPyIterator self, ptrdiff_t n) -> IMP_GSL_SwigPyIterator
        __sub__(IMP_GSL_SwigPyIterator self, IMP_GSL_SwigPyIterator x) -> ptrdiff_t
        """
        return _IMP_gsl.IMP_GSL_SwigPyIterator___sub__(self, *args)
    def __iter__(self):
        return self

# Register IMP_GSL_SwigPyIterator in _IMP_gsl:
_IMP_gsl.IMP_GSL_SwigPyIterator_swigregister(IMP_GSL_SwigPyIterator)


_value_types=[]
_object_types=[]
_raii_types=[]
_plural_types=[]

IMP_DEBUG = _IMP_gsl.IMP_DEBUG

IMP_RELEASE = _IMP_gsl.IMP_RELEASE

IMP_SILENT = _IMP_gsl.IMP_SILENT

IMP_PROGRESS = _IMP_gsl.IMP_PROGRESS

IMP_TERSE = _IMP_gsl.IMP_TERSE

IMP_VERBOSE = _IMP_gsl.IMP_VERBOSE

IMP_MEMORY = _IMP_gsl.IMP_MEMORY

IMP_NONE = _IMP_gsl.IMP_NONE

IMP_USAGE = _IMP_gsl.IMP_USAGE

IMP_INTERNAL = _IMP_gsl.IMP_INTERNAL

IMP_KERNEL_HAS_LOG4CXX = _IMP_gsl.IMP_KERNEL_HAS_LOG4CXX

IMP_COMPILER_HAS_AUTO = _IMP_gsl.IMP_COMPILER_HAS_AUTO

IMP_COMPILER_HAS_DEBUG_VECTOR = _IMP_gsl.IMP_COMPILER_HAS_DEBUG_VECTOR

IMP_COMPILER_HAS_UNIQUE_PTR = _IMP_gsl.IMP_COMPILER_HAS_UNIQUE_PTR

IMP_KERNEL_HAS_BOOST_RANDOM = _IMP_gsl.IMP_KERNEL_HAS_BOOST_RANDOM

IMP_KERNEL_HAS_NUMPY = _IMP_gsl.IMP_KERNEL_HAS_NUMPY

IMP_KERNEL_HAS_GPERFTOOLS = _IMP_gsl.IMP_KERNEL_HAS_GPERFTOOLS

IMP_KERNEL_HAS_TCMALLOC_HEAPCHECKER = _IMP_gsl.IMP_KERNEL_HAS_TCMALLOC_HEAPCHECKER

IMP_KERNEL_HAS_TCMALLOC_HEAPPROFILER = _IMP_gsl.IMP_KERNEL_HAS_TCMALLOC_HEAPPROFILER

IMPKERNEL_SHOW_WARNINGS = _IMP_gsl.IMPKERNEL_SHOW_WARNINGS


import sys
class _DirectorObjects(object):
    """@internal Simple class to keep references to director objects
       to prevent premature deletion."""
    def __init__(self):
        self._objects = []
    def register(self, obj):
        """Take a reference to a director object; will only work for
           refcounted C++ classes"""
        if hasattr(obj, 'get_ref_count'):
            self._objects.append(obj)
    def cleanup(self):
        """Only drop our reference and allow cleanup by Python if no other
           Python references exist (we hold 3 references: one in self._objects,
           one in x, and one in the argument list for getrefcount) *and* no
           other C++ references exist (the Python object always holds one)"""
        objs = [x for x in self._objects if sys.getrefcount(x) > 3 \
                                         or x.get_ref_count() > 1]
# Do in two steps so the references are kept until the end of the
# function (deleting references may trigger a fresh call to this method)
        self._objects = objs
    def get_object_count(self):
        """Get number of director objects (useful for testing only)"""
        return len(self._objects)
_director_objects = _DirectorObjects()

class _ostream(object):
    r"""Proxy of C++ std::ostream class."""

    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")

    def __init__(self, *args, **kwargs):
        raise AttributeError("No constructor defined")
    __repr__ = _swig_repr

    def write(self, osa_buf):
        r"""write(_ostream self, char const * osa_buf)"""
        return _IMP_gsl._ostream_write(self, osa_buf)

# Register _ostream in _IMP_gsl:
_IMP_gsl._ostream_swigregister(_ostream)

IMP_COMPILER_HAS_OVERRIDE = _IMP_gsl.IMP_COMPILER_HAS_OVERRIDE

IMP_COMPILER_HAS_FINAL = _IMP_gsl.IMP_COMPILER_HAS_FINAL

IMP_HAS_NOEXCEPT = _IMP_gsl.IMP_HAS_NOEXCEPT

IMP_C_OPEN_BINARY = _IMP_gsl.IMP_C_OPEN_BINARY

import IMP
IMP_CGAL_HAS_BOOST_FILESYSTEM = _IMP_gsl.IMP_CGAL_HAS_BOOST_FILESYSTEM

IMP_CGAL_HAS_BOOST_PROGRAMOPTIONS = _IMP_gsl.IMP_CGAL_HAS_BOOST_PROGRAMOPTIONS

IMP_CGAL_HAS_BOOST_RANDOM = _IMP_gsl.IMP_CGAL_HAS_BOOST_RANDOM

IMP_CGAL_HAS_BOOST_SYSTEM = _IMP_gsl.IMP_CGAL_HAS_BOOST_SYSTEM

IMP_CGAL_HAS_NUMPY = _IMP_gsl.IMP_CGAL_HAS_NUMPY

IMPCGAL_SHOW_WARNINGS = _IMP_gsl.IMPCGAL_SHOW_WARNINGS

import IMP.cgal
IMP_ALGEBRA_HAS_IMP_CGAL = _IMP_gsl.IMP_ALGEBRA_HAS_IMP_CGAL

IMP_ALGEBRA_HAS_BOOST_FILESYSTEM = _IMP_gsl.IMP_ALGEBRA_HAS_BOOST_FILESYSTEM

IMP_ALGEBRA_HAS_BOOST_PROGRAMOPTIONS = _IMP_gsl.IMP_ALGEBRA_HAS_BOOST_PROGRAMOPTIONS

IMP_ALGEBRA_HAS_BOOST_RANDOM = _IMP_gsl.IMP_ALGEBRA_HAS_BOOST_RANDOM

IMP_ALGEBRA_HAS_BOOST_SYSTEM = _IMP_gsl.IMP_ALGEBRA_HAS_BOOST_SYSTEM

IMP_ALGEBRA_HAS_CGAL = _IMP_gsl.IMP_ALGEBRA_HAS_CGAL

IMP_ALGEBRA_HAS_NUMPY = _IMP_gsl.IMP_ALGEBRA_HAS_NUMPY

IMP_ALGEBRA_HAS_ANN = _IMP_gsl.IMP_ALGEBRA_HAS_ANN

IMPALGEBRA_SHOW_WARNINGS = _IMP_gsl.IMPALGEBRA_SHOW_WARNINGS

import IMP.algebra
IMP_GSL_HAS_IMP_CGAL = _IMP_gsl.IMP_GSL_HAS_IMP_CGAL

IMP_GSL_HAS_BOOST_FILESYSTEM = _IMP_gsl.IMP_GSL_HAS_BOOST_FILESYSTEM

IMP_GSL_HAS_BOOST_PROGRAMOPTIONS = _IMP_gsl.IMP_GSL_HAS_BOOST_PROGRAMOPTIONS

IMP_GSL_HAS_BOOST_RANDOM = _IMP_gsl.IMP_GSL_HAS_BOOST_RANDOM

IMP_GSL_HAS_BOOST_SYSTEM = _IMP_gsl.IMP_GSL_HAS_BOOST_SYSTEM

IMP_GSL_HAS_CGAL = _IMP_gsl.IMP_GSL_HAS_CGAL

IMP_GSL_HAS_NUMPY = _IMP_gsl.IMP_GSL_HAS_NUMPY

IMPGSL_SHOW_WARNINGS = _IMP_gsl.IMPGSL_SHOW_WARNINGS


_object_types.append("GSLOptimizer")


def _object_cast_to_GSLOptimizer(o):
    r"""_object_cast_to_GSLOptimizer(Object o) -> GSLOptimizer"""
    return _IMP_gsl._object_cast_to_GSLOptimizer(o)

_object_types.append("ConjugateGradients")


def _object_cast_to_ConjugateGradients(o):
    r"""_object_cast_to_ConjugateGradients(Object o) -> ConjugateGradients"""
    return _IMP_gsl._object_cast_to_ConjugateGradients(o)

_object_types.append("QuasiNewton")


def _object_cast_to_QuasiNewton(o):
    r"""_object_cast_to_QuasiNewton(Object o) -> QuasiNewton"""
    return _IMP_gsl._object_cast_to_QuasiNewton(o)

_object_types.append("Simplex")


def _object_cast_to_Simplex(o):
    r"""_object_cast_to_Simplex(Object o) -> Simplex"""
    return _IMP_gsl._object_cast_to_Simplex(o)
class GSLOptimizer(IMP.AttributeOptimizer):
    r"""Proxy of C++ IMP::gsl::GSLOptimizer class."""

    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")

    def __init__(self, m):
        r"""__init__(GSLOptimizer self, Model m) -> GSLOptimizer"""
        if self.__class__ == GSLOptimizer:
            _self = None
        else:
            _self = self
        _IMP_gsl.GSLOptimizer_swiginit(self, _IMP_gsl.new_GSLOptimizer(_self, m))

        if self.__class__ != GSLOptimizer:
            _director_objects.register(self)



    __swig_destroy__ = _IMP_gsl.delete_GSLOptimizer

    def set_stop_score(self, d):
        r"""set_stop_score(GSLOptimizer self, double d)"""
        return _IMP_gsl.GSLOptimizer_set_stop_score(self, d)

    def __str__(self):
        r"""__str__(GSLOptimizer self) -> std::string"""
        return _IMP_gsl.GSLOptimizer___str__(self)

    def __repr__(self):
        r"""__repr__(GSLOptimizer self) -> std::string"""
        return _IMP_gsl.GSLOptimizer___repr__(self)

    @staticmethod
    def get_from(o):
       return _object_cast_to_GSLOptimizer(o)


    def get_type_name(self):
        return self.__class__.__name__
    def do_show(self, out):
        pass
    def get_version_info(self):
        if"IMP::gsl" == "IMP":
          return VersionInfo(self.__module__,
                             __import__(self.__module__).get_module_version())
        else:
          return IMP.VersionInfo(self.__module__,
                             __import__(self.__module__).get_module_version())
    @staticmethod
    def get_from(o):
       return _object_cast_to_GSLOptimizer(o)

    def __disown__(self):
        self.this.disown()
        _IMP_gsl.disown_GSLOptimizer(self)
        return weakref.proxy(self)

    def do_destroy(self):
        r"""do_destroy(GSLOptimizer self)"""
        return _IMP_gsl.GSLOptimizer_do_destroy(self)

    def handle_set_has_required_score_states(self, arg0):
        r"""handle_set_has_required_score_states(GSLOptimizer self, bool arg0)"""
        return _IMP_gsl.GSLOptimizer_handle_set_has_required_score_states(self, arg0)

    def do_get_inputs(self):
        r"""do_get_inputs(GSLOptimizer self) -> IMP::ModelObjectsTemp"""
        return _IMP_gsl.GSLOptimizer_do_get_inputs(self)

    def do_get_outputs(self):
        r"""do_get_outputs(GSLOptimizer self) -> IMP::ModelObjectsTemp"""
        return _IMP_gsl.GSLOptimizer_do_get_outputs(self)

    def do_get_interactions(self):
        r"""do_get_interactions(GSLOptimizer self) -> IMP::ModelObjectsTemps"""
        return _IMP_gsl.GSLOptimizer_do_get_interactions(self)

    def do_optimize(self, ns):
        r"""do_optimize(GSLOptimizer self, unsigned int ns) -> double"""
        return _IMP_gsl.GSLOptimizer_do_optimize(self, ns)

# Register GSLOptimizer in _IMP_gsl:
_IMP_gsl.GSLOptimizer_swigregister(GSLOptimizer)

class ConjugateGradients(GSLOptimizer):
    r"""Proxy of C++ IMP::gsl::ConjugateGradients class."""

    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")

    def __init__(self, m):
        r"""__init__(ConjugateGradients self, Model m) -> ConjugateGradients"""
        _IMP_gsl.ConjugateGradients_swiginit(self, _IMP_gsl.new_ConjugateGradients(m))

    def set_threshold(self, mg):
        r"""set_threshold(ConjugateGradients self, double mg)"""
        return _IMP_gsl.ConjugateGradients_set_threshold(self, mg)

    def do_optimize(self, max_steps):
        r"""do_optimize(ConjugateGradients self, unsigned int max_steps) -> IMP::Float"""
        return _IMP_gsl.ConjugateGradients_do_optimize(self, max_steps)

    def get_version_info(self):
        r"""get_version_info(ConjugateGradients self) -> VersionInfo"""
        return _IMP_gsl.ConjugateGradients_get_version_info(self)

    def __str__(self):
        r"""__str__(ConjugateGradients self) -> std::string"""
        return _IMP_gsl.ConjugateGradients___str__(self)

    def __repr__(self):
        r"""__repr__(ConjugateGradients self) -> std::string"""
        return _IMP_gsl.ConjugateGradients___repr__(self)

    @staticmethod
    def get_from(o):
       return _object_cast_to_ConjugateGradients(o)


# Register ConjugateGradients in _IMP_gsl:
_IMP_gsl.ConjugateGradients_swigregister(ConjugateGradients)

class QuasiNewton(GSLOptimizer):
    r"""Proxy of C++ IMP::gsl::QuasiNewton class."""

    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")

    def __init__(self, m):
        r"""__init__(QuasiNewton self, Model m) -> QuasiNewton"""
        _IMP_gsl.QuasiNewton_swiginit(self, _IMP_gsl.new_QuasiNewton(m))

    def set_initial_step(self, length):
        r"""set_initial_step(QuasiNewton self, double length)"""
        return _IMP_gsl.QuasiNewton_set_initial_step(self, length)

    def set_line_step(self, d):
        r"""set_line_step(QuasiNewton self, double d)"""
        return _IMP_gsl.QuasiNewton_set_line_step(self, d)

    def set_minimum_gradient(self, d):
        r"""set_minimum_gradient(QuasiNewton self, double d)"""
        return _IMP_gsl.QuasiNewton_set_minimum_gradient(self, d)

    def do_optimize(self, max_steps):
        r"""do_optimize(QuasiNewton self, unsigned int max_steps) -> IMP::Float"""
        return _IMP_gsl.QuasiNewton_do_optimize(self, max_steps)

    def get_version_info(self):
        r"""get_version_info(QuasiNewton self) -> VersionInfo"""
        return _IMP_gsl.QuasiNewton_get_version_info(self)

    def __str__(self):
        r"""__str__(QuasiNewton self) -> std::string"""
        return _IMP_gsl.QuasiNewton___str__(self)

    def __repr__(self):
        r"""__repr__(QuasiNewton self) -> std::string"""
        return _IMP_gsl.QuasiNewton___repr__(self)

    @staticmethod
    def get_from(o):
       return _object_cast_to_QuasiNewton(o)


# Register QuasiNewton in _IMP_gsl:
_IMP_gsl.QuasiNewton_swigregister(QuasiNewton)

class Simplex(GSLOptimizer):
    r"""Proxy of C++ IMP::gsl::Simplex class."""

    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")

    def __init__(self, m):
        r"""__init__(Simplex self, Model m) -> Simplex"""
        _IMP_gsl.Simplex_swiginit(self, _IMP_gsl.new_Simplex(m))

    def set_initial_length(self, length):
        r"""set_initial_length(Simplex self, double length)"""
        return _IMP_gsl.Simplex_set_initial_length(self, length)

    def set_minimum_size(self, d):
        r"""set_minimum_size(Simplex self, double d)"""
        return _IMP_gsl.Simplex_set_minimum_size(self, d)

    def do_optimize(self, max_steps):
        r"""do_optimize(Simplex self, unsigned int max_steps) -> IMP::Float"""
        return _IMP_gsl.Simplex_do_optimize(self, max_steps)

    def get_version_info(self):
        r"""get_version_info(Simplex self) -> VersionInfo"""
        return _IMP_gsl.Simplex_get_version_info(self)

    def __str__(self):
        r"""__str__(Simplex self) -> std::string"""
        return _IMP_gsl.Simplex___str__(self)

    def __repr__(self):
        r"""__repr__(Simplex self) -> std::string"""
        return _IMP_gsl.Simplex___repr__(self)

    @staticmethod
    def get_from(o):
       return _object_cast_to_Simplex(o)


# Register Simplex in _IMP_gsl:
_IMP_gsl.Simplex_swigregister(Simplex)


def get_module_version():
    r"""get_module_version() -> std::string const"""
    return _IMP_gsl.get_module_version()

def get_example_path(fname):
    r"""get_example_path(std::string fname) -> std::string"""
    return _IMP_gsl.get_example_path(fname)

def get_data_path(fname):
    r"""get_data_path(std::string fname) -> std::string"""
    return _IMP_gsl.get_data_path(fname)

from . import _version_check
_version_check.check_version(get_module_version())
__version__ = get_module_version()



