Example #1
0
 def test01(self):
     """
     One-dimensional LHS indexing of multi-dimensional array,
     without expansion.  Using scalar index.
     """
     self.a[4] = 9
     self.assertTrue(isequal_(self.a, sparsearray([[1, 3], [2, 9]])))
Example #2
0
 def test01(self):
     """
     One-dimensional LHS indexing of multi-dimensional array,
     without expansion.  Using scalar index.
     """
     self.a[4]=9
     self.assertTrue(isequal_(self.a, sparsearray([[1, 3],[2, 9]])))
Example #3
0
 def test04(self):
     a = sparsearray([1, 2, 3])
     a[5] = 100
     a[3, 3] = 33
     self.assertEqual(a.shape, (3, 5))
     self.assertTrue(
         isequal_(a.todense(),
                  [[1, 2, 3, 0, 100], [0, 0, 0, 0, 0], [0, 0, 33, 0, 0]]))
Example #4
0
 def test02(self):
     """
     Multi-dimensional LHS indexing, without expansion.
     """
     self.a[1, 1] = 11
     self.a[2, 2] = 22
     self.a[1, 2] = 12
     self.a[2, 1] = 21
     self.assertTrue(isequal_(self.a, sparsearray([[11, 12], [21, 22]])))
Example #5
0
 def test02(self):
     """
     Multi-dimensional LHS indexing, without expansion.
     """
     self.a[1,1]=11
     self.a[2,2]=22
     self.a[1,2]=12
     self.a[2,1]=21
     self.assertTrue(isequal_(self.a, sparsearray([[11,12],[21,22]])))
Example #6
0
 def setUp(self):
     self.a = sparsearray(arange_(1, 4).reshape(2, 2, order="F"))
Example #7
0
 def setUp(self):
     self.a = sparsearray(np.arange(1, 5).reshape(2, 2, order="F"))
     self.c = sparsearray(arange_(1, 20).reshape(4, 5, order="F"))
Example #8
0
 def setUp(self):
     self.a = np.arange(1, 5).reshape(2, 2, order="F")
     self.b = sparsearray(self.a)
Example #9
0
 def setUp(self):
     self.a = np.arange(1,5).reshape(2,2,order="F")
     self.b = sparsearray(self.a)
Example #10
0
 def setUp(self):
     self.a = sparsearray(arange_(1,4).reshape(2,2,order="F"))
Example #11
0
 def test04(self):
     a = sparsearray([1,2,3])
     a[5]=100
     a[3,3]=33
     self.assertEqual(a.shape, (3,5))
     self.assertTrue(isequal_(a.todense(), [[1,2,3,0,100],[0,0,0,0,0],[0,0,33,0,0]]))
Example #12
0
 def setUp(self):
     self.a = sparsearray(np.arange(1,5).reshape(2,2,order="F"))
     self.c = sparsearray(arange_(1,20).reshape(4,5,order="F"))