# 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_kmeans

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_KMEANS_SwigPyIterator(object):
    r"""Proxy of C++ swig::IMP_KMEANS_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_kmeans.delete_IMP_KMEANS_SwigPyIterator

    def value(self):
        r"""value(IMP_KMEANS_SwigPyIterator self) -> PyObject *"""
        return _IMP_kmeans.IMP_KMEANS_SwigPyIterator_value(self)

    def incr(self, n=1):
        r"""incr(IMP_KMEANS_SwigPyIterator self, size_t n=1) -> IMP_KMEANS_SwigPyIterator"""
        return _IMP_kmeans.IMP_KMEANS_SwigPyIterator_incr(self, n)

    def decr(self, n=1):
        r"""decr(IMP_KMEANS_SwigPyIterator self, size_t n=1) -> IMP_KMEANS_SwigPyIterator"""
        return _IMP_kmeans.IMP_KMEANS_SwigPyIterator_decr(self, n)

    def distance(self, x):
        r"""distance(IMP_KMEANS_SwigPyIterator self, IMP_KMEANS_SwigPyIterator x) -> ptrdiff_t"""
        return _IMP_kmeans.IMP_KMEANS_SwigPyIterator_distance(self, x)

    def equal(self, x):
        r"""equal(IMP_KMEANS_SwigPyIterator self, IMP_KMEANS_SwigPyIterator x) -> bool"""
        return _IMP_kmeans.IMP_KMEANS_SwigPyIterator_equal(self, x)

    def copy(self):
        r"""copy(IMP_KMEANS_SwigPyIterator self) -> IMP_KMEANS_SwigPyIterator"""
        return _IMP_kmeans.IMP_KMEANS_SwigPyIterator_copy(self)

    def next(self):
        r"""next(IMP_KMEANS_SwigPyIterator self) -> PyObject *"""
        return _IMP_kmeans.IMP_KMEANS_SwigPyIterator_next(self)

    def __next__(self):
        r"""__next__(IMP_KMEANS_SwigPyIterator self) -> PyObject *"""
        return _IMP_kmeans.IMP_KMEANS_SwigPyIterator___next__(self)

    def previous(self):
        r"""previous(IMP_KMEANS_SwigPyIterator self) -> PyObject *"""
        return _IMP_kmeans.IMP_KMEANS_SwigPyIterator_previous(self)

    def advance(self, n):
        r"""advance(IMP_KMEANS_SwigPyIterator self, ptrdiff_t n) -> IMP_KMEANS_SwigPyIterator"""
        return _IMP_kmeans.IMP_KMEANS_SwigPyIterator_advance(self, n)

    def __eq__(self, x):
        r"""__eq__(IMP_KMEANS_SwigPyIterator self, IMP_KMEANS_SwigPyIterator x) -> bool"""
        return _IMP_kmeans.IMP_KMEANS_SwigPyIterator___eq__(self, x)

    def __ne__(self, x):
        r"""__ne__(IMP_KMEANS_SwigPyIterator self, IMP_KMEANS_SwigPyIterator x) -> bool"""
        return _IMP_kmeans.IMP_KMEANS_SwigPyIterator___ne__(self, x)

    def __iadd__(self, n):
        r"""__iadd__(IMP_KMEANS_SwigPyIterator self, ptrdiff_t n) -> IMP_KMEANS_SwigPyIterator"""
        return _IMP_kmeans.IMP_KMEANS_SwigPyIterator___iadd__(self, n)

    def __isub__(self, n):
        r"""__isub__(IMP_KMEANS_SwigPyIterator self, ptrdiff_t n) -> IMP_KMEANS_SwigPyIterator"""
        return _IMP_kmeans.IMP_KMEANS_SwigPyIterator___isub__(self, n)

    def __add__(self, n):
        r"""__add__(IMP_KMEANS_SwigPyIterator self, ptrdiff_t n) -> IMP_KMEANS_SwigPyIterator"""
        return _IMP_kmeans.IMP_KMEANS_SwigPyIterator___add__(self, n)

    def __sub__(self, *args):
        r"""
        __sub__(IMP_KMEANS_SwigPyIterator self, ptrdiff_t n) -> IMP_KMEANS_SwigPyIterator
        __sub__(IMP_KMEANS_SwigPyIterator self, IMP_KMEANS_SwigPyIterator x) -> ptrdiff_t
        """
        return _IMP_kmeans.IMP_KMEANS_SwigPyIterator___sub__(self, *args)
    def __iter__(self):
        return self

# Register IMP_KMEANS_SwigPyIterator in _IMP_kmeans:
_IMP_kmeans.IMP_KMEANS_SwigPyIterator_swigregister(IMP_KMEANS_SwigPyIterator)


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

IMP_DEBUG = _IMP_kmeans.IMP_DEBUG

IMP_RELEASE = _IMP_kmeans.IMP_RELEASE

IMP_SILENT = _IMP_kmeans.IMP_SILENT

IMP_PROGRESS = _IMP_kmeans.IMP_PROGRESS

IMP_TERSE = _IMP_kmeans.IMP_TERSE

IMP_VERBOSE = _IMP_kmeans.IMP_VERBOSE

IMP_MEMORY = _IMP_kmeans.IMP_MEMORY

IMP_NONE = _IMP_kmeans.IMP_NONE

IMP_USAGE = _IMP_kmeans.IMP_USAGE

IMP_INTERNAL = _IMP_kmeans.IMP_INTERNAL

IMP_KERNEL_HAS_LOG4CXX = _IMP_kmeans.IMP_KERNEL_HAS_LOG4CXX

IMP_COMPILER_HAS_AUTO = _IMP_kmeans.IMP_COMPILER_HAS_AUTO

IMP_COMPILER_HAS_DEBUG_VECTOR = _IMP_kmeans.IMP_COMPILER_HAS_DEBUG_VECTOR

IMP_COMPILER_HAS_UNIQUE_PTR = _IMP_kmeans.IMP_COMPILER_HAS_UNIQUE_PTR

IMP_KERNEL_HAS_BOOST_RANDOM = _IMP_kmeans.IMP_KERNEL_HAS_BOOST_RANDOM

IMP_KERNEL_HAS_NUMPY = _IMP_kmeans.IMP_KERNEL_HAS_NUMPY

IMP_KERNEL_HAS_GPERFTOOLS = _IMP_kmeans.IMP_KERNEL_HAS_GPERFTOOLS

IMP_KERNEL_HAS_TCMALLOC_HEAPCHECKER = _IMP_kmeans.IMP_KERNEL_HAS_TCMALLOC_HEAPCHECKER

IMP_KERNEL_HAS_TCMALLOC_HEAPPROFILER = _IMP_kmeans.IMP_KERNEL_HAS_TCMALLOC_HEAPPROFILER

IMPKERNEL_SHOW_WARNINGS = _IMP_kmeans.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_kmeans._ostream_write(self, osa_buf)

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

IMP_COMPILER_HAS_OVERRIDE = _IMP_kmeans.IMP_COMPILER_HAS_OVERRIDE

IMP_COMPILER_HAS_FINAL = _IMP_kmeans.IMP_COMPILER_HAS_FINAL

IMP_HAS_NOEXCEPT = _IMP_kmeans.IMP_HAS_NOEXCEPT

IMP_C_OPEN_BINARY = _IMP_kmeans.IMP_C_OPEN_BINARY

import IMP
IMP_KMEANS_HAS_BOOST_FILESYSTEM = _IMP_kmeans.IMP_KMEANS_HAS_BOOST_FILESYSTEM

IMP_KMEANS_HAS_BOOST_PROGRAMOPTIONS = _IMP_kmeans.IMP_KMEANS_HAS_BOOST_PROGRAMOPTIONS

IMP_KMEANS_HAS_BOOST_RANDOM = _IMP_kmeans.IMP_KMEANS_HAS_BOOST_RANDOM

IMP_KMEANS_HAS_BOOST_SYSTEM = _IMP_kmeans.IMP_KMEANS_HAS_BOOST_SYSTEM

IMP_KMEANS_HAS_NUMPY = _IMP_kmeans.IMP_KMEANS_HAS_NUMPY

IMPKMEANS_SHOW_WARNINGS = _IMP_kmeans.IMPKMEANS_SHOW_WARNINGS


_object_types.append("KMeans")


def _object_cast_to_KMeans(o):
    r"""_object_cast_to_KMeans(Object o) -> KMeans"""
    return _IMP_kmeans._object_cast_to_KMeans(o)
KM_LLOYDS = _IMP_kmeans.KM_LLOYDS

KM_LOCAL_SWAP = _IMP_kmeans.KM_LOCAL_SWAP

KM_LOCAL_EZ_HYBRID = _IMP_kmeans.KM_LOCAL_EZ_HYBRID

KM_HYBRID = _IMP_kmeans.KM_HYBRID

class KMeans(IMP.Object):
    r"""Proxy of C++ IMP::kmeans::KMeans class."""

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

    def __init__(self, *args):
        r"""
        __init__(KMeans self, std::string const & fname_data, int dim, unsigned int max_nPts) -> KMeans
        __init__(KMeans self) -> KMeans
        """
        _IMP_kmeans.KMeans_swiginit(self, _IMP_kmeans.new_KMeans(*args))

    def get_version_info(self):
        r"""get_version_info(KMeans self) -> VersionInfo"""
        return _IMP_kmeans.KMeans_get_version_info(self)

    def execute(self, *args):
        r"""execute(KMeans self, unsigned int k, IMP::kmeans::KM_ALG_TYPE alg_type=KM_LLOYDS, int stages=100)"""
        return _IMP_kmeans.KMeans_execute(self, *args)

    def add_data_pt(self, p):
        r"""add_data_pt(KMeans self, IMP::Floats const & p)"""
        return _IMP_kmeans.KMeans_add_data_pt(self, p)

    def clear_data(self):
        r"""clear_data(KMeans self)"""
        return _IMP_kmeans.KMeans_clear_data(self)

    def get_data_point(self, i):
        r"""get_data_point(KMeans self, unsigned int i) -> IMP::Floats const &"""
        return _IMP_kmeans.KMeans_get_data_point(self, i)

    def get_number_of_data_points(self):
        r"""get_number_of_data_points(KMeans self) -> unsigned int"""
        return _IMP_kmeans.KMeans_get_number_of_data_points(self)

    def print_centers(self, *args):
        r"""print_centers(KMeans self, IMP::LogLevel ll=PROGRESS)"""
        return _IMP_kmeans.KMeans_print_centers(self, *args)

    def get_center(self, i):
        r"""get_center(KMeans self, unsigned int i) -> IMP::Floats"""
        return _IMP_kmeans.KMeans_get_center(self, i)

    def get_assignments(self):
        r"""get_assignments(KMeans self) -> IMP::Ints"""
        return _IMP_kmeans.KMeans_get_assignments(self)

    def get_squared_distance_to_centers(self):
        r"""get_squared_distance_to_centers(KMeans self) -> IMP::Floats"""
        return _IMP_kmeans.KMeans_get_squared_distance_to_centers(self)

    def get_number_of_centers(self):
        r"""get_number_of_centers(KMeans self) -> unsigned int"""
        return _IMP_kmeans.KMeans_get_number_of_centers(self)

    def __str__(self):
        r"""__str__(KMeans self) -> std::string"""
        return _IMP_kmeans.KMeans___str__(self)

    def __repr__(self):
        r"""__repr__(KMeans self) -> std::string"""
        return _IMP_kmeans.KMeans___repr__(self)

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


# Register KMeans in _IMP_kmeans:
_IMP_kmeans.KMeans_swigregister(KMeans)


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

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

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

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



