python类cond()的实例源码

utils.py 文件源码 项目:anompy 作者: takuti 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def aryule(c, k):
    """Solve Yule-Walker equation.

    Args:
        c (numpy array): Coefficients (i.e. autocorrelation)
        k (int): Assuming the AR(k) model

    Returns:
        numpy array: k model parameters
            Some formulations solve: C a = -c,
            but we actually solve C a = c.

    """
    a = np.zeros(k)

    # ignore a singular matrix
    C = toeplitz(c[:k])
    if not np.all(C == 0.0) and np.isfinite(ln.cond(C)):
        a = np.dot(ln.inv(C), c[1:])

    return a
utils.py 文件源码 项目:datadog-anomaly-detector 作者: takuti 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def aryule(c, k):
    """Solve Yule-Walker equation.

    Args:
        c (numpy array): Coefficients (i.e. autocorrelation)
        k (int): Assuming the AR(k) model

    Returns:
        numpy array: k model parameters
            Some formulations solve: C a = -c,
            but we actually solve C a = c.

    """
    a = np.zeros(k)

    # ignore a singular matrix
    C = toeplitz(c[:k])
    if not np.all(C == 0.0) and np.isfinite(ln.cond(C)):
        a = np.dot(ln.inv(C), c[1:])

    return a
test_linalg.py 文件源码 项目:radar 作者: amoose136 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def do(self, a, b):
        c = asarray(a)  # a might be a matrix
        s = linalg.svd(c, compute_uv=False)
        old_assert_almost_equal(
            s[..., 0] / s[..., -1], linalg.cond(a), decimal=5)
test_linalg.py 文件源码 项目:radar 作者: amoose136 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def test_stacked_arrays_explicitly(self):
        A = np.array([[1., 2., 1.], [0, -2., 0], [6., 2., 3.]])
        assert_equal(linalg.cond(A), linalg.cond(A[None, ...])[0])
test_linalg.py 文件源码 项目:radar 作者: amoose136 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def do(self, a, b):
        c = asarray(a)  # a might be a matrix
        s = linalg.svd(c, compute_uv=False)
        old_assert_almost_equal(
            s[..., 0] / s[..., -1], linalg.cond(a, 2), decimal=5)
test_linalg.py 文件源码 项目:radar 作者: amoose136 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def test_stacked_arrays_explicitly(self):
        A = np.array([[1., 2., 1.], [0, -2., 0], [6., 2., 3.]])
        assert_equal(linalg.cond(A, 2), linalg.cond(A[None, ...], 2)[0])
test_linalg.py 文件源码 项目:radar 作者: amoose136 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def test(self):
        A = array([[1., 0, 0], [0, -2., 0], [0, 0, 3.]])
        assert_almost_equal(linalg.cond(A, inf), 3.)
test_linalg.py 文件源码 项目:krpcScripts 作者: jwvanderbeck 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def do(self, a, b):
        c = asarray(a)  # a might be a matrix
        s = linalg.svd(c, compute_uv=False)
        old_assert_almost_equal(
            s[..., 0] / s[..., -1], linalg.cond(a), decimal=5)
test_linalg.py 文件源码 项目:krpcScripts 作者: jwvanderbeck 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def test_stacked_arrays_explicitly(self):
        A = np.array([[1., 2., 1.], [0, -2., 0], [6., 2., 3.]])
        assert_equal(linalg.cond(A), linalg.cond(A[None, ...])[0])
test_linalg.py 文件源码 项目:krpcScripts 作者: jwvanderbeck 项目源码 文件源码 阅读 32 收藏 0 点赞 0 评论 0
def do(self, a, b):
        c = asarray(a)  # a might be a matrix
        s = linalg.svd(c, compute_uv=False)
        old_assert_almost_equal(
            s[..., 0] / s[..., -1], linalg.cond(a, 2), decimal=5)
test_linalg.py 文件源码 项目:krpcScripts 作者: jwvanderbeck 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def test_stacked_arrays_explicitly(self):
        A = np.array([[1., 2., 1.], [0, -2., 0], [6., 2., 3.]])
        assert_equal(linalg.cond(A, 2), linalg.cond(A[None, ...], 2)[0])
test_linalg.py 文件源码 项目:krpcScripts 作者: jwvanderbeck 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def test(self):
        A = array([[1., 0, 0], [0, -2., 0], [0, 0, 3.]])
        assert_almost_equal(linalg.cond(A, inf), 3.)
test_linalg.py 文件源码 项目:PyDataLondon29-EmbarrassinglyParallelDAWithAWSLambda 作者: SignalMedia 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def do(self, a, b):
        c = asarray(a)  # a might be a matrix
        s = linalg.svd(c, compute_uv=False)
        old_assert_almost_equal(
            s[..., 0] / s[..., -1], linalg.cond(a), decimal=5)
test_linalg.py 文件源码 项目:PyDataLondon29-EmbarrassinglyParallelDAWithAWSLambda 作者: SignalMedia 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def test_stacked_arrays_explicitly(self):
        A = np.array([[1., 2., 1.], [0, -2., 0], [6., 2., 3.]])
        assert_equal(linalg.cond(A), linalg.cond(A[None, ...])[0])
test_linalg.py 文件源码 项目:PyDataLondon29-EmbarrassinglyParallelDAWithAWSLambda 作者: SignalMedia 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def do(self, a, b):
        c = asarray(a)  # a might be a matrix
        s = linalg.svd(c, compute_uv=False)
        old_assert_almost_equal(
            s[..., 0] / s[..., -1], linalg.cond(a, 2), decimal=5)
test_linalg.py 文件源码 项目:PyDataLondon29-EmbarrassinglyParallelDAWithAWSLambda 作者: SignalMedia 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def test_stacked_arrays_explicitly(self):
        A = np.array([[1., 2., 1.], [0, -2., 0], [6., 2., 3.]])
        assert_equal(linalg.cond(A, 2), linalg.cond(A[None, ...], 2)[0])
test_linalg.py 文件源码 项目:PyDataLondon29-EmbarrassinglyParallelDAWithAWSLambda 作者: SignalMedia 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def test(self):
        A = array([[1., 0, 0], [0, -2., 0], [0, 0, 3.]])
        assert_almost_equal(linalg.cond(A, inf), 3.)
test_linalg.py 文件源码 项目:aws-lambda-numpy 作者: vitolimandibhrata 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def do(self, a, b):
        c = asarray(a)  # a might be a matrix
        s = linalg.svd(c, compute_uv=False)
        old_assert_almost_equal(
            s[..., 0] / s[..., -1], linalg.cond(a), decimal=5)
test_linalg.py 文件源码 项目:aws-lambda-numpy 作者: vitolimandibhrata 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def test_stacked_arrays_explicitly(self):
        A = np.array([[1., 2., 1.], [0, -2., 0], [6., 2., 3.]])
        assert_equal(linalg.cond(A), linalg.cond(A[None, ...])[0])
test_linalg.py 文件源码 项目:aws-lambda-numpy 作者: vitolimandibhrata 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def do(self, a, b):
        c = asarray(a)  # a might be a matrix
        s = linalg.svd(c, compute_uv=False)
        old_assert_almost_equal(
            s[..., 0] / s[..., -1], linalg.cond(a, 2), decimal=5)
test_linalg.py 文件源码 项目:aws-lambda-numpy 作者: vitolimandibhrata 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def test_stacked_arrays_explicitly(self):
        A = np.array([[1., 2., 1.], [0, -2., 0], [6., 2., 3.]])
        assert_equal(linalg.cond(A, 2), linalg.cond(A[None, ...], 2)[0])
test_linalg.py 文件源码 项目:aws-lambda-numpy 作者: vitolimandibhrata 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def test(self):
        A = array([[1., 0, 0], [0, -2., 0], [0, 0, 3.]])
        assert_almost_equal(linalg.cond(A, inf), 3.)
test_linalg.py 文件源码 项目:lambda-numba 作者: rlhotovy 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def do(self, a, b):
        c = asarray(a)  # a might be a matrix
        s = linalg.svd(c, compute_uv=False)
        old_assert_almost_equal(
            s[..., 0] / s[..., -1], linalg.cond(a), decimal=5)
test_linalg.py 文件源码 项目:lambda-numba 作者: rlhotovy 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def test_stacked_arrays_explicitly(self):
        A = np.array([[1., 2., 1.], [0, -2., 0], [6., 2., 3.]])
        assert_equal(linalg.cond(A), linalg.cond(A[None, ...])[0])
test_linalg.py 文件源码 项目:lambda-numba 作者: rlhotovy 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def do(self, a, b):
        c = asarray(a)  # a might be a matrix
        s = linalg.svd(c, compute_uv=False)
        old_assert_almost_equal(
            s[..., 0] / s[..., -1], linalg.cond(a, 2), decimal=5)
test_linalg.py 文件源码 项目:lambda-numba 作者: rlhotovy 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def test_stacked_arrays_explicitly(self):
        A = np.array([[1., 2., 1.], [0, -2., 0], [6., 2., 3.]])
        assert_equal(linalg.cond(A, 2), linalg.cond(A[None, ...], 2)[0])
test_linalg.py 文件源码 项目:lambda-numba 作者: rlhotovy 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def test(self):
        A = array([[1., 0, 0], [0, -2., 0], [0, 0, 3.]])
        assert_almost_equal(linalg.cond(A, inf), 3.)
test_linalg.py 文件源码 项目:deliver 作者: orchestor 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def do(self, a, b):
        c = asarray(a)  # a might be a matrix
        s = linalg.svd(c, compute_uv=False)
        old_assert_almost_equal(
            s[..., 0] / s[..., -1], linalg.cond(a), decimal=5)
test_linalg.py 文件源码 项目:deliver 作者: orchestor 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def test_stacked_arrays_explicitly(self):
        A = np.array([[1., 2., 1.], [0, -2., 0], [6., 2., 3.]])
        assert_equal(linalg.cond(A), linalg.cond(A[None, ...])[0])
test_linalg.py 文件源码 项目:deliver 作者: orchestor 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def do(self, a, b):
        c = asarray(a)  # a might be a matrix
        s = linalg.svd(c, compute_uv=False)
        old_assert_almost_equal(
            s[..., 0] / s[..., -1], linalg.cond(a, 2), decimal=5)


问题


面经


文章

微信
公众号

扫码关注公众号