'Dispatch to the right submethod depending on the chosen solver.'

def _fit(self, X):

    if issparse(X):
        raise TypeError('PCA    does    not    support    sparse    input.    See    TruncatedSVD    for    a    possible    alternative.')
    X = check_array(X, dtype=[np.float64, np.float32], ensure_2d=True, copy=self.copy)
    if (self.n_components is None):
        n_components = X.shape[1]
    else:
        n_components = self.n_components
    svd_solver = self.svd_solver
    if (svd_solver == 'auto'):
        if (max(X.shape) <= 500):
            svd_solver = 'full'
        elif ((n_components >= 1) and (n_components < (0.8 * min(X.shape)))):
            svd_solver = 'randomized'
        else:
            svd_solver = 'full'
    if (svd_solver == 'full'):
        return self._fit_full(X, n_components)
    elif (svd_solver in ['arpack', 'randomized']):
        return self._fit_truncated(X, n_components, svd_solver)
    else:
        raise ValueError("Unrecognized    svd_solver='{0}'".format(svd_solver))
