# 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 _smallmatrix
else:
    import _smallmatrix

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 SmallMatrix(object):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr

    def __init__(self, arg2, arg3):
        _smallmatrix.SmallMatrix_swiginit(self, _smallmatrix.new_SmallMatrix(arg2, arg3))
    __swig_destroy__ = _smallmatrix.delete_SmallMatrix

    def clear(self):
        return _smallmatrix.SmallMatrix_clear(self)

    def solve(self, arg2):
        return _smallmatrix.SmallMatrix_solve(self, arg2)

    def scale(self, arg2):
        return _smallmatrix.SmallMatrix_scale(self, arg2)

    def madd(self, arg2):
        return _smallmatrix.SmallMatrix_madd(self, arg2)

    def msub(self, arg2):
        return _smallmatrix.SmallMatrix_msub(self, arg2)

    def getitem(self, i, j):
        return _smallmatrix.SmallMatrix_getitem(self, i, j)

    def setitem(self, i, j, v):
        return _smallmatrix.SmallMatrix_setitem(self, i, j, v)

    def copy(self):
        return _smallmatrix.SmallMatrix_copy(self)

    def mmult(self, other):
        return _smallmatrix.SmallMatrix_mmult(self, other)

# Register SmallMatrix in _smallmatrix:
_smallmatrix.SmallMatrix_swigregister(SmallMatrix)
# -*- 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. 

# Another opportunity for bounds checking.
def _SmallMatrix___getitem__(self, idx):
    if len(idx)==2:
        return self.getitem(idx[0],idx[1])
    else:
        raise KeyError
SmallMatrix.__getitem__ = _SmallMatrix___getitem__


def _SmallMatrix___setitem__(self, idx, val):
    if len(idx)==2:
        self.setitem(idx[0],idx[1],val)
    else:
        raise KeyError
SmallMatrix.__setitem__ = _SmallMatrix___setitem__


def _SmallMatrix___mul__(self, other):
    if isinstance(other, float):
        cpy = self.copy()
        cpy.scale(other)
        return cpy
    elif isinstance(other, SmallMatrix):
        cpy = self.copy()
        cpy.mmult(other)        # matrix multiplication
        return cpy
    else:
        raise TypeError
SmallMatrix.__mul__ = _SmallMatrix___mul__

def _SmallMatrix___imul__(self, x):
    self.scale(x)
    return self
SmallMatrix.__imul__ = _SmallMatrix___imul__



def _SmallMatrix___add__(self, other):
    cpy = self.copy()
    cpy.madd(other)
    return cpy
SmallMatrix.__add__ = _SmallMatrix___add__

def _SmallMatrix___iadd__(self, a):
    self.madd(a);
    return self
SmallMatrix.__iadd__ = _SmallMatrix___iadd__



def _SmallMatrix___sub__(self, other):
    cpy = self.copy()
    cpy.msub(other)
    return cpy
SmallMatrix.__sub__ = _SmallMatrix___sub__


def _SmallMatrix___isub(self, a):
    self.msub(a)
    return self
SmallMatrix.__isub__ = _SmallMatrix___isub


