| stiles.utils {INLA} | R Documentation |
sTiles utils: streaming spy plots and graph<->mtx I/O
Description
Streaming sparsity-pattern plots and conversions between INLA graph
files and MatrixMarket .mtx files. The spy plots stream the input
file (never loading the full matrix), bin entries into a GRID x GRID
grid, and render a log-density image. This makes them usable on
matrices that would otherwise exhaust memory if read into a Matrix.
Arguments
file |
For |
graph_file |
Path to an INLA graph file (ASCII). |
mtx_file |
Path to a MatrixMarket |
out |
Output PNG path. Defaults to the input path with
extension replaced by |
GRID |
Bin grid resolution (default 1000). |
text |
If |
colorbar |
If |
palette |
Colour palette: |
diagonal |
Diagonal value for |
base |
Index base for INLA graph files. |
CHUNK |
Lines read per streaming chunk. Tune for very large files. |
Details
INLA graph files are autodetected as 0-based or 1-based by inspecting
the first data row; override with base = 0L or base = 1L.
MatrixMarket files use the standard 1-based coordinate convention.
inla.stiles.graph2mtx writes a symmetric MatrixMarket file. By
default the diagonal is set to the node degree (matches the typical
precision-matrix convention where Q[i,i] equals the sum of weights of
incident edges, giving a diagonally-dominant Q with unit off-diagonals).
Use diagonal = "one" for unit diagonals, or diagonal = "none" to
omit the diagonal entirely.
Value
The output file path (invisibly).
Author(s)
Esmail Abdul Fattah esmail.abdulfattah@kaust.edu.sa
See Also
inla.spy(), inla.read.graph(), inla.write.graph()
Examples
## Not run:
## spy a large MTX file (streamed, never fully loaded)
inla.stiles.spy.mtx("Q.mtx", "Q.png")
## spy an INLA graph file directly
inla.stiles.spy.graph("inla_graph_animal1", "animal.png")
## convert between formats (round-trips bit-identical up to neighbour order)
inla.stiles.graph2mtx("inla_graph_animal1", "animal.mtx")
inla.stiles.mtx2graph("animal.mtx", "animal.graph")
## End(Not run)