'Computes SVD on matrix *M*, :math:`M = U \Sigma V^T`
:param k: number of dimensions
:type k: int
:param min_values: min. number of non-zeros (or non-empty values) any row or col must have
:type min_values: int
:param pre_normalize: normalize input matrix. Possible values are tfidf, rows, cols, all.
:type pre_normalize: string
:param mean_center: centering the input matrix (aka mean substraction)
:type mean_center: Boolean
:param post_normalize: Normalize every row of :math:`U \Sigma` to be a unit vector. Thus, row similarity (using cosine distance) returns :math:`[-1.0 .. 1.0]`
:type post_normalize: Boolean
:param savefile: path to save the SVD factorization (U, Sigma and V matrices)
:type savefile: string'

def compute(self, k=100, min_values=None, pre_normalize=None, mean_center=False, post_normalize=True, savefile=None):

    super(SVD, self).compute(min_values)
    if VERBOSE:
        sys.stdout.write(('Computing    svd    k=%s,    min_values=%s,    pre_normalize=%s,    mean_center=%s,    post_normalize=%s\n' % (k, min_values, pre_normalize, mean_center, post_normalize)))
        if (not min_values):
            sys.stdout.write('[WARNING]    min_values    is    set    to    None,    meaning    that    some    funky    recommendations    might    appear!\n')
    matrix = self._matrix.get()
    (shifts, row_shift, col_shift, total_shift) = (None, None, None, None)
    if mean_center:
        if VERBOSE:
            sys.stdout.write("[WARNING]    mean_center    is    True.    svd.similar(...)    might    return    nan's.    If    so,    then    do    svd.compute(...,    mean_center=False)\n")
        (matrix, row_shift, col_shift, total_shift) = matrix.mean_center()
        self._shifts = (row_shift, col_shift, total_shift)
    if pre_normalize:
        "\n                                                Divisi2    divides    each    entry    by    the    geometric    mean    of    its    row    norm    and    its    column    norm.    \n                                                The    rows    and    columns    don't    actually    become    unit    vectors,    but    they    all    become    closer    to    unit    vectors.\n                                                "
        if (pre_normalize == 'tfidf'):
            matrix = matrix.normalize_tfidf()
        elif (pre_normalize == 'rows'):
            matrix = matrix.normalize_rows()
        elif (pre_normalize == 'cols'):
            matrix = matrix.normalize_cols()
        elif (pre_normalize == 'all'):
            matrix = matrix.normalize_all()
        else:
            raise ValueError(("Pre-normalize    option    (%s)    is    not    correct.\n                                                                                                                                            Possible    values    are:    'tfidf',    'rows',    'cols'    or    'all'" % pre_normalize))
    (self._U, self._S, self._V) = matrix.svd(k)
    self._reconstruct_similarity(post_normalize=post_normalize, force=True)
    self._reconstruct_matrix(shifts=self._shifts, force=True)
    if savefile:
        options = {'k': k, 'min_values': min_values, 'pre_normalize': pre_normalize, 'mean_center': mean_center, 'post_normalize': post_normalize}
        self.save_model(savefile, options)
