Esempio n. 1
0
	def test_base_exchange_dim2(self):
		'''
		test matrix base echange by 2 dimention
		'''
		va = lr.Vector([-1,2])
		vb = lr.Vector([3,1])
		mSrc = lr.Matrix([va, vb])
		vc = lr.Vector([1,5])
		vd = lr.Vector([11,-1])
		mDist = lr.Matrix([vc, vd])
		resm = lr.base_exchange(mSrc, mDist)
		
		chkv1 = lr.Vector([2,1])
		chkv2 = lr.Vector([-2,3])
		chkm = lr.Matrix([chkv1,chkv2])
		
		self.assertEqual(resm, chkm)
Esempio n. 2
0
	def test_base_exchange_dim3(self):
		'''
		test matrix base echange by 3 dimention
		'''
		va = lr.Vector([1,-1,2])
		vb = lr.Vector([-2,3,-5])
		vc = lr.Vector([1,-1,1])
		mSrc = lr.Matrix([va, vb, vc])
		vd = lr.Vector([3,-2,3])
		ve = lr.Vector([-1,1,3])
		vf = lr.Vector([-1,1,2])
		mDist = lr.Matrix([vd, ve, vf])
		resm = lr.base_exchange(mSrc, mDist)
		
		chkv1 = lr.Vector([3,1,2])
		chkv2 = lr.Vector([4,0,-5])
		chkv3 = lr.Vector([3,0,-4])
		chkm = lr.Matrix([chkv1,chkv2,chkv3])
		
		self.assertEqual(resm, chkm)