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

from sys import version_info as _swig_python_version_info
# Import the low-level C/C++ module
if __package__ or "." in __name__:
    from . import _doublevec
else:
    import _doublevec

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 == "this":
            set(self, name, value)
        elif name == "thisown":
            self.this.own(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__)


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

    def __init__(self, size, val=0):
        _doublevec.DoubleVec_swiginit(self, _doublevec.new_DoubleVec(size, val))
    __swig_destroy__ = _doublevec.delete_DoubleVec

    def size(self):
        return _doublevec.DoubleVec_size(self)

    def resize(self, size, val=0):
        return _doublevec.DoubleVec_resize(self, size, val)

    def zero(self):
        return _doublevec.DoubleVec_zero(self)

    def unit(self):
        return _doublevec.DoubleVec_unit(self)

    def norm(self):
        return _doublevec.DoubleVec_norm(self)

    def axpy(self, alpha, x):
        return _doublevec.DoubleVec_axpy(self, alpha, x)

    def scale(self, alpha):
        return _doublevec.DoubleVec_scale(self, alpha)

    def dot(self, arg2):
        return _doublevec.DoubleVec_dot(self, arg2)

    def str(self):
        return _doublevec.DoubleVec_str(self)

    def __repr__(self):
        return _doublevec.DoubleVec___repr__(self)

    def copy_inplace(self, x):
        return _doublevec.DoubleVec_copy_inplace(self, x)

    def clone(self):
        return _doublevec.DoubleVec_clone(self)

    def increment(self, i, v):
        return _doublevec.DoubleVec_increment(self, i, v)

    def save(self, filename):
        return _doublevec.DoubleVec_save(self, filename)

    def load(self, filename):
        return _doublevec.DoubleVec_load(self, filename)

# Register DoubleVec in _doublevec:
_doublevec.DoubleVec_swigregister(DoubleVec)
# -*- python -*-

# This software was produced by NIST, an agency of the U.S. government,
# and by statute is not subject to copyright in the United States.
# Recipients of this software assume all responsibilities associated
# with its operation, modification and maintenance. However, to
# facilitate maintenance we ask that before distributing modified
# versions of this software, you first contact the authors at
# oof_manager@nist.gov. 

def _doublevec___len__(self):
    return self.size()
DoubleVec.__len__ = _doublevec___len__

def _doublevec___add__(self, other):
    result = self.clone()
    result += other
    return result
DoubleVec.__add__ = _doublevec___add__

def _doublevec___sub__(self, other):
    result = self.clone()
    result -= other
    return result
DoubleVec.__sub__ = _doublevec___sub__

def _doublevec___iadd__(self, other):
    if isinstance(other, DoubleVec):
        self.axpy(1.0, other)
        return self
    return NotImplemented
DoubleVec.__iadd__ = _doublevec___iadd__

def _doublevec___isub__(self, other):
    if isinstance(other, DoubleVec):
        self.axpy(-1.0, other)
        return self
    return NotImplemented
DoubleVec.__isub__ = _doublevec___isub__

def _doublevec___mul__(self, factor):
    if isinstance(factor, DoubleVec):
        return self.dot(factor)
# The test for float and int has to be done here, or else
# vector*matrix leads to an infinite loop, trying to find a
# suitable __mul__ variant.  Without the test, the __imul__ (*=)
# invocation below will fail when the rhs is a matrix.  When that
# happens, python falls back to __mul__, which is this function,
# which will call __imul__ and so on ad infinitum.
    if isinstance(factor, float) or isinstance(factor, int):
        result = self.clone()
        result *= factor
        return result
    return NotImplemented
DoubleVec.__mul__ = _doublevec___mul__

def _doublevec___rmul__(self, factor):
    if isinstance(factor, float) or isinstance(factor, int):
        result = self.clone()
        result *= factor
        return result
    return NotImplemented
DoubleVec.__rmul__ = _doublevec___rmul__

def _doublevec___truediv__(self, factor):
    result = self.clone()
    result /= factor
    return result
DoubleVec.__truediv__ = _doublevec___truediv__

def _doublevec___imul__(self, factor):
    if isinstance(factor, float) or isinstance(factor, int):
        self.scale(factor)
        return self
    return NotImplemented
DoubleVec.__imul__ = _doublevec___imul__

def _doublevec___itruediv__(self, factor):
    if isinstance(factor, float) or isinstance(factor, int):
        self.scale(1./factor)
        return self
    return NotImplemented
DoubleVec.__itruediv__ = _doublevec___itruediv__

def _doublevec___neg__(self):
    result = self.clone()
    result *= -1.0
    return result
DoubleVec.__neg__ = _doublevec___neg__



