rankMatrix package:Matrix R Documentation _R_a_n_k _o_f _a _M_a_t_r_i_x _D_e_s_c_r_i_p_t_i_o_n: Compute the rank of matrix, a well-defined functional in theory, somewhat ambigous in practice. We provide several methods, the default corresponding to Matlab's definition. _U_s_a_g_e: rankMatrix(x, tol = NULL, method = c("tolNorm2", "qrLINPACK", "useGrad", "maybeGrad"), sval = svd(x, 0, 0)$d) _A_r_g_u_m_e_n_t_s: x: numeric matrix, of dimension n x m, say. tol: nonnegative number specifying a tolerance for "practically zero" with specific meaning depending on 'method'; by default, 'max(dim(x)) * .Machine$double.eps * abs(max(sval))' is according to Matlab's default (for its only 'method' "tolNorm2"). method: a character string specifying the computational method, can be abbreviated: _t_o_l_N_o_r_m_2 the number of singular values '>= tol'; _q_r_L_I_N_P_A_C_K = 'qr(x, tol, LAPACK=FALSE)$rank'; this used to be _the_ recommended way to compute a matrix rank for a while in the past. For this method, 'sval' are not used (nor computed). _u_s_e_G_r_a_d considering the "gradient" of the (decreasing) singular values, the index of the _smallest_ gap. _m_a_y_b_e_G_r_a_d choosing method '"useGrad"' only when that seems _reasonable_; otherwise using '"tolNorm2"'. sval: numeric vector of non-increasing singular values of 'x'; typically unspecified and computed from 'x'. _V_a_l_u_e: positive integer in '1:min(dim(x))', with attributes detailing the method used. _A_u_t_h_o_r(_s): Martin Maechler; for the "*Grad" methods, building on suggestions by Ravi Varadhan. _S_e_e _A_l_s_o: 'qr', 'svd'. _E_x_a_m_p_l_e_s: rankMatrix(cbind(1, 0, 1:3)) # 2 (meths <- eval(formals(rankMatrix)$method)) ## a "border" case: H12 <- Hilbert(12) rankMatrix(H12, tol = 1e-20) # 12; but 11 with default method & tol. sapply(meths, function(.m.) rankMatrix(H12, method = .m.)) ## tolNorm2 qrLINPACK useGrad maybeGrad ## 11 12 11 11