#!/usr/bin/env python
# (C) 2000 Huaiyu Zhu <hzhu@users.sourceforge.net>. Licence: GPL
# $Id: test_augassign.py,v 1.1 2000/07/26 20:58:27 hzhu Exp $
"""
Test augmented assignment for Matrix module
"""
from MatPy.Matrix import norm
from MatPy.Stats.distribs import randn
print "-"*40, "matrix functions"
A = randn((3,3))
B = A.copy()
B += 2
B *= 3
B -= 6
B /= 3
print A
print B, norm(A-B)
assert norm(A - B) < 1e-15
C = randn((3,3))
B += (C + 1)
B *= C
B -= (C + 1)*C
B /= C
print A
print B, norm(A-B)
assert norm(A - B) < 3e-15
|