<commit_before>"""
   Copyright (c) 2015, <NAME>, Duke University.
   All rights reserved.

   This file is part of RCNMF and is under the BSD 3-Clause License,
   which can be found in the LICENSE file in the root directory, or at
   http://opensource.org/licenses/BSD-3-Clause
"""

from __future__ import absolute_import, print_function
import numpy as np
from dask.array import from_array
from dask.array.into import discover # required by dask.array
import timeit
import matplotlib.pyplot as plt
import csnmf.compression as randcomp
import csnmf.tsqr


def select_blocksize(k):
    return min(k/10, int(1e4))


def compression_vs_qr(m, n, q):

    x = np.random.standard_normal(size=(m, n))

    t = timeit.default_timer()
    randcomp.compress(x, q, n_power_iter=0)
    tim_comp = timeit.default_timer() - t

    t = timeit.default_timer()
    np.linalg.qr(x)
    tim_qr = timeit.default_timer() - t

    return tim_comp, tim_qr<commit_msg>Removed unused import<commit_after>"""
   Copyright (c) 2015, <NAME>, Duke University.
   All rights reserved.

   This file is part of RCNMF and is under the BSD 3-Clause License,
   which can be found in the LICENSE file in the root directory, or at
   http://opensource.org/licenses/BSD-3-Clause
"""

from __future__ import absolute_import, print_function
import numpy as np
from dask.array import from_array
from dask.array.into import discover # required by dask.array
import timeit
import matplotlib.pyplot as plt
import csnmf.compression as randcomp


def select_blocksize(k):
    return min(k/10, int(1e4))


def compression_vs_qr(m, n, q):

    x = np.random.standard_normal(size=(m, n))

    t = timeit.default_timer()
    randcomp.compress(x, q, n_power_iter=0)
    tim_comp = timeit.default_timer() - t

    t = timeit.default_timer()
    np.linalg.qr(x)
    tim_qr = timeit.default_timer() - t

    return tim_comp, tim_qr
{'fraction_non_alphanumeric': 0.09414893617021276, 'fraction_numerical': 0.011702127659574468, 'mean_word_length': 3.7741116751269037, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1661871', 'n_tokens_mistral': 661, 'n_tokens_neox': 629, 'n_words': 197}