#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
self.assertEqual(diff.getnnz(),0)
# IntegralGlobConstraint (division by sum of cols)
colSum=m.sum(axis=0)
self.assertEqual(diff.getnnz(),0)
# IntegralGlobConstraint (division by sum of cols)
colSum=m.sum(axis=0)
- m_0=m*diags(array(1/colSum),[0])
+ # version 0.12.0 # m_0=m*diags(array(1/colSum),[0])
+ m_0=m*spdiags(array(1/colSum),[0],colSum.shape[1],colSum.shape[1])
del colSum
self.assertAlmostEqual(m_0[0,0],0.625,12)
self.assertAlmostEqual(m_0[1,0],0.25,12)
del colSum
self.assertAlmostEqual(m_0[0,0],0.625,12)
self.assertAlmostEqual(m_0[1,0],0.25,12)
self.assertEqual(m_0.getnnz(),7)
# ConservativeVolumic (division by sum of rows)
rowSum=m.sum(axis=1)
self.assertEqual(m_0.getnnz(),7)
# ConservativeVolumic (division by sum of rows)
rowSum=m.sum(axis=1)
- m_1=diags(array(1/rowSum.transpose()),[0])*m
+ # version 0.12.0 # m_1=diags(array(1/rowSum.transpose()),[0])*m
+ m_1=spdiags(array(1/rowSum.transpose()),[0],rowSum.shape[0],rowSum.shape[0])*m
del rowSum
self.assertAlmostEqual(m_1[0,0],1.,12)
self.assertAlmostEqual(m_1[1,0],0.4,12)
del rowSum
self.assertAlmostEqual(m_1[0,0],1.,12)
self.assertAlmostEqual(m_1[1,0],0.4,12)