示例#1
0
def jac_vec(tape_tag, x, v):
	"""
	evaluate  F'(x)v, F:R^N -> R^M
	"""
	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
	v = numpy.asarray(v, dtype=float)
	assert numpy.size(v) == N
	assert numpy.ndim(v) == 1
	z = numpy.zeros(M, dtype=float)
	_adolc.jac_vec(tape_tag, M, N, x, v, z)
	return z
def jac_vec(tape_tag, x, v):
    """
    evaluate  F'(x)v, F:R^N -> R^M
    """
    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
    v = numpy.ascontiguousarray(v, dtype=float)
    assert numpy.size(v) == N
    assert numpy.ndim(v) == 1
    z = numpy.zeros(M, dtype=float)
    rc = _adolc.jac_vec(tape_tag, M, N, x, v, z)
    if (rc < 0):
        raise ErrorReturnCode("jac_vec", rc)
    return z
示例#3
0
def jac_vec(tape_tag, x, v):
    """
    evaluate  F'(x)v, F:R^N -> R^M
    """
    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
    v = numpy.ascontiguousarray(v, dtype=float)
    assert numpy.size(v) == N
    assert numpy.ndim(v) == 1
    z = numpy.zeros(M, dtype=float)
    rc = _adolc.jac_vec(tape_tag, M, N, x, v, z)
    if (rc < 0):
        raise ErrorReturnCode("jac_vec", rc)
    return z