示例#1
0
def test_cauchy():
    """Simple test of cauchy.  We test by checking against a hilbert
    matrix
    """
    x = np.arange(1, 11) - 0.5
    a = rogues.cauchy(x)
    b = rogues.hilb(10)
    npt.assert_array_equal(a, b)

    # scalar argument
    a = rogues.cauchy(10)
    b = rogues.cauchy(np.arange(1, 10))
    npt.assert_array_equal(a, b)
示例#2
0
def test_cauchy():
    """Simple test of cauchy.  We test by checking against a hilbert
    matrix
    """
    x = np.arange(1, 11) - 0.5
    a = rogues.cauchy(x)
    b = rogues.hilb(10)
    npt.assert_array_equal(a, b)

    # scalar argument
    a = rogues.cauchy(10)
    b = rogues.cauchy(np.arange(1, 10))
    npt.assert_array_equal(a, b)
def second_class_tp(p,n):
    """This class  is rather ill conditioned test problems 
    defined by a Hilbert Matrix"""
    c = np.zeros(n)
    d = np.zeros(p)
    ucon = np.zeros(n)
    lcon = np.zeros(n)
    
    #uvar = np.ones(n)*1
    uvar = np.ones(n)*5
    lvar = np.ones(n)*0.5
    name = str(p)+'_'+str(n)+'_'+str(n)+'_l1_tp'+'.txt'
    #name = str(n)+'_'+str(p)+'_'+'_second_tp'+'.txt'
    Q = rog.hilb(p,n)
    # d=(di), di=sum qij for i= 1,...,p
    for i in range(p): 
        d[i]= Q[i,:].sum()
    B = np.zeros((n,n))
    return Q,B,d,c,lcon,ucon,lvar,uvar,name
示例#4
0
def test_hilb():
    """Simple test of hilb() Hilbert matrices"""
    a = rogues.hilb(10)
    cond = nl.cond(a)
    assert(cond > 1e+12)
示例#5
0
def test_hilb():
    """Simple test of hilb() Hilbert matrices"""
    a = rogues.hilb(10)
    cond = nl.cond(a)
    assert (cond > 1e+12)