externalFormats            package:Matrix            R Documentation

_R_e_a_d _a_n_d _w_r_i_t_e _e_x_t_e_r_n_a_l _m_a_t_r_i_x _f_o_r_m_a_t_s

_D_e_s_c_r_i_p_t_i_o_n:

     Read matrices stored in the Harwell-Boeing or MatrixMarket formats
     or write sparseMatrix objects to one of these formats.

_U_s_a_g_e:

     readHB(file)
     readMM(file)
     writeMM(obj, file, ...)

_A_r_g_u_m_e_n_t_s:

     obj: a real sparse matrix

    file: for 'writeMM' - the name of the file to be written. For
          'readHB' and 'readMM' the name of the file to read, as a
          character scalar.  The names of files storing matrices in the
          Harwell-Boeing format usually end in '".rua"' or '".rsa"'.
          Those storing matrices in the MatrixMarket format usually end
          in '".mtx"'.

          Alternatively, 'readHB' and 'readMM' accept connection
          objects.

     ...: optional additional arguments. Currently none are used in any
          methods.

_V_a_l_u_e:

     The 'readHB' and 'readMM' functions return an object that inherits
     from the '"Matrix"' class.  Methods for the 'writeMM' generic
     functions usually return 'NULL' and, as a side effect, the matrix
     'obj' is written to 'file' in the MatrixMarket format (writeMM).

_N_o_t_e:

     The Harwell-Boeing format is older and less flexible than the
     MatrixMarket format.  The function 'writeHB' was deprecated and
     has now been removed.  Please use 'writeMM' instead.

_R_e_f_e_r_e_n_c_e_s:

     <URL: http://math.nist.gov/MatrixMarket>

     <URL: http://www.cise.ufl.edu/research/sparse/matrices>

_E_x_a_m_p_l_e_s:

     str(pores <- readMM(system.file("external/pores_1.mtx",
                                     package = "Matrix")))
     str(utm <- readHB(system.file("external/utm300.rua",
                                    package = "Matrix")))
     str(lundA <- readMM(system.file("external/lund_a.mtx",
                                     package = "Matrix")))
     str(lundA <- readHB(system.file("external/lund_a.rsa",
                                     package = "Matrix")))
     ## Not run: 
     ## NOTE: The following examples take quite some time
     ## ----  even on a fast internet connection:
     if(FALSE) # the URL has been corrected, but we need an un-tar step!
     str(sm <-
      readHB(gzcon(url("http://www.cise.ufl.edu/research/sparse/RB/Boeing/msc00726.tar.gz"))))

     str(jgl009 <-
      readMM(gzcon(url("ftp://math.nist.gov/pub/MatrixMarket2/Harwell-Boeing/counterx/jgl009.mtx.gz"))))
     ## End(Not run)
     data(KNex)
     writeMM(KNex$mm, "mmMM.mtx")

