Esempio n. 1
0
def function(tape_tag,x):
	"""
	evaluate the function f(x) recorded on tape with index tape_tag
	"""
	assert type(tape_tag) == int
	ts = tapestats(tape_tag)
	N = ts['NUM_INDEPENDENTS']
	M = ts['NUM_DEPENDENTS']
	x = numpy.asarray(x, dtype=float)
	assert numpy.size(x) == N
	assert numpy.ndim(x) == 1
	y = numpy.zeros(M, dtype=float)
	_adolc.function(tape_tag, M, N, x, y)
	return y
def function(tape_tag, x):
    """
    evaluate the function f(x) recorded on tape with index tape_tag
    """
    assert type(tape_tag) == int
    ts = tapestats(tape_tag)
    N = ts['NUM_INDEPENDENTS']
    M = ts['NUM_DEPENDENTS']
    x = numpy.ascontiguousarray(x, dtype=float)
    assert numpy.size(x) == N
    assert numpy.ndim(x) == 1
    y = numpy.zeros(M, dtype=float)
    rc = _adolc.function(tape_tag, M, N, x, y)
    if (rc < 0):
        raise ErrorReturnCode("function", rc)
    return y
Esempio n. 3
0
def function(tape_tag,x):
    """
    evaluate the function f(x) recorded on tape with index tape_tag
    """
    assert type(tape_tag) == int
    ts = tapestats(tape_tag)
    N = ts['NUM_INDEPENDENTS']
    M = ts['NUM_DEPENDENTS']
    x = numpy.ascontiguousarray(x, dtype=float)
    assert numpy.size(x) == N
    assert numpy.ndim(x) == 1
    y = numpy.zeros(M, dtype=float)
    rc = _adolc.function(tape_tag, M, N, x, y)
    if (rc < 0):
        raise ErrorReturnCode("function",rc)
    return y