# ConsistentAlgebrae: testing algebrae consistency¶

This class test for any object conformance with linear algebrae rules

class vector_dict.ConsistentAlgebrae.ConsistentAlgebrae(**kw)

test wether an addition for two object is consistant

__init__(**kw)

only method really callable. Arguments :

• neutral : neutral element of addition for the object ;
• scalar : real, float, or complex (normaly anything that is 1D, and follow algebraic rules);
• one : an element to test
• other : other element to test
optionnal :
• other_scalar : real, float, or complex (normaly anything that is 1D, and follow algebraic rules);
• context : default “print” make it verbose ;
• collect_values : default lambda x : x, if testing for conservation a lambda fonction for getting the values

## How to use it¶

```    if cmd_folder not in sys.path:
sys.path.insert(0, cmd_folder)

try:
from numpy import array as array

ConsistentAlgebrae(
neutral=array([0, 0, 0]),
one=array([1, 2, 3]),
another=array([5, 2, 3]),
other=array([3, 4, -1]),
equal=lambda left, right: (right == left).all(),
)
except Exception as e:
print "only lamers dont use numpy"

ConsistentAlgebrae(
neutral=0,
one=1,
other=2,
another=3

)

ConsistentAlgebrae(
neutral=[],
one=[1],
other=[2],
another=[42]
)

ConsistentAlgebrae(
neutral="",
one="1",
other="2",
another="4"
)

ConsistentAlgebrae(
neutral=VectorDict(int, {}),
one=VectorDict(int, {"one": 1, "one_and_two": 3}),
other=VectorDict(int, {"one_and_two": - 1, "two": 2}),
another=VectorDict(int, {"one": 3, 'two':  2, "three": 1}),
collect_values=lambda x: x.values()
)

one = VectorDict(int, {"one": 1, "one_and_two": 12})
other = VectorDict(int, {"one_and_two": - 9, "two": 2})

print "just for fun \n\t%r\n\t+\n\t%r\n\t=\n\t%r" % (one, other, one + other)
```

Path

Convention :