def test_2(): n = 3 lda = n a = zeros((lda, n)) a[0, 0] = 0.0 a[0, 1] = 1.0 a[0, 2] = 2.0 a[1, 0] = 4.0 a[1, 1] = 5.0 a[1, 2] = 6.0 a[2, 0] = 7.0 a[2, 1] = 8.0 a[2, 2] = 0.0 info = -1 ipiv = zeros(n, 'int') dgetrf(n, n, a, lda, ipiv, info) # assert(info == 0) iwork = zeros(n, 'int') lwork = 4 * n work = zeros(lwork) # Get the condition number. anorm = 1.0 rcond = -1.0 dgecon('I', n, a, lda, anorm, rcond, work, iwork, info)
def test_3(): n = 3 lda = n a = zeros((lda, n)) a[0, 0] = 0.0 a[0, 1] = 1.0 a[0, 2] = 2.0 a[1, 0] = 4.0 a[1, 1] = 5.0 a[1, 2] = 6.0 a[2, 0] = 7.0 a[2, 1] = 8.0 a[2, 2] = 0.0 info = -1 ipiv = zeros(n, 'int') dgetrf(n, n, a, lda, ipiv, info) # assert(info == 0) iwork = zeros(n, 'int') lwork = 4 * n work = zeros(lwork) # Compute the inverse matrix. dgetri(n, a, lda, ipiv, work, lwork, info)
def test_4(): n = 3 lda = n a = zeros((lda, n)) a[0, 0] = 0.0 a[0, 1] = 1.0 a[0, 2] = 2.0 a[1, 0] = 4.0 a[1, 1] = 5.0 a[1, 2] = 6.0 a[2, 0] = 7.0 a[2, 1] = 8.0 a[2, 2] = 0.0 info = -1 ipiv = zeros(n, 'int') dgetrf(n, n, a, lda, ipiv, info) # assert(info == 0) # Compute the inverse matrix. b = zeros(n) b[0] = 14.0 b[1] = 32.0 b[2] = 23.0 # Solve the linear system. dgetrs('n', n, 1, a, lda, ipiv, b, n, info)