extmath_test.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:mpnum 作者: dseuss 项目源码 文件源码
def test_approximate_range_finder(rows, cols, rank, dtype, piter_normalizer, rgen):
    # only guaranteed to work for low-rank matrices
    if rank is 'fullrank':
        return

    rf_size = rank + 10
    assert min(rows, cols) > rf_size

    A = mptest.random_lowrank(rows, cols, rank, randstate=rgen, dtype=dtype)
    A /= np.linalg.norm(A, ord='fro')
    Q = em.approx_range_finder(A, rf_size, 7, randstate=rgen,
                               piter_normalizer=piter_normalizer)

    Q = np.asmatrix(Q)
    assert Q.shape == (rows, rf_size)
    normdist = np.linalg.norm(A - Q * (Q.H * A), ord='fro')
    assert normdist < 1e-7
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号