Example #1
0
def jacobian(tape_tag,x):
	"""
	evaluate the jacobian J = F'(x), F:R^N -> R^M
	"""
	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
	J = numpy.zeros((M,N), dtype=float)
	_adolc.jacobian(tape_tag, M, N, x, J)
	return J
def jacobian(tape_tag, x):
    """
    evaluate the jacobian J = F'(x), F:R^N -> R^M
    """
    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
    J = numpy.zeros((M, N), dtype=float)
    rc = _adolc.jacobian(tape_tag, M, N, x, J)
    if (rc < 0):
        raise ErrorReturnCode("jacobian", rc)
    return J
Example #3
0
def jacobian(tape_tag,x):
    """
    evaluate the jacobian J = F'(x), F:R^N -> R^M
    """
    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
    J = numpy.zeros((M,N), dtype=float)
    rc = _adolc.jacobian(tape_tag, M, N, x, J)
    if (rc < 0):
        raise ErrorReturnCode("jacobian", rc)
    return J