def test_is_rate_matrix(rate_matrix):
    assert_(is_rate_matrix(rate_matrix))
    if issparse(rate_matrix):
        rate_matrix = rate_matrix.toarray()
        rate_matrix[0][0] = 3
        rate_matrix = csr_matrix(rate_matrix)
    else:
        rate_matrix[0][0] = 3
    assert_(not is_rate_matrix(rate_matrix))
def test_is_rate_matrix_mm1_queue(mm1_queue_rate_matrix):
    K_copy = mm1_queue_rate_matrix.copy()
    assert_(is_rate_matrix(mm1_queue_rate_matrix, tol=1e-15))
    if issparse(mm1_queue_rate_matrix):
        assert_allclose(mm1_queue_rate_matrix.data, K_copy.data)
        assert_allclose(mm1_queue_rate_matrix.offsets, K_copy.offsets)
    else:
        assert_allclose(mm1_queue_rate_matrix, K_copy)
Exemple #3
0
    def test_is_rate_matrix(self):
        K_copy = self.K.copy()
        self.assertTrue(is_rate_matrix(self.K, self.tol),
                        "K should be evaluated as rate matrix.")

        self.assertTrue(
            np.allclose(self.K.data, K_copy.data)
            and np.allclose(self.K.offsets, K_copy.offsets),
            "object modified!")
Exemple #4
0
    def test_IsRateMatrix(self):
        self.assertTrue(is_rate_matrix(self.A), 'A should be a rate matrix')

        # manipulate matrix so it isn't a rate matrix any more
        self.A[0][0] = 3
        self.assertFalse(is_rate_matrix(self.A), 'matrix is not a rate matrix')