logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

vnl-make-matrix - create a matrix from a one-point-per-record vnlog

Author

       Dima Kogan "<dima@secretsauce.net>"

Description

       Vnlog represents each "data item" as a line of text. This is very often what one wants, but at times it
       isn't. One example of this is matrix data: we want each line to contain a whole row of a matrix. This
       script exists for convenience, to bridge this gap.

       The input is an vnlog, coming in on STDIN and/or in files given on the commandline. This vnlog must have
       at least two fields: the least-significant (slowest-changing) index of each point (must be the first
       field), and as many value fields as desired. These points must be written out in order, and it is assumed
       that all entries in the matrix are specified. The output is a set of (non-vnlog) matrix files in the
       directory given in the "--outdir" argument.  These files are named "PREFIX_XXX.matrix" where "PREFIX"
       comes from --prefix (or empty) and "XXX" is the field name. These matrices can be loaded into any
       analysis tool (numpy for instance), or plotted directly with gnuplot:

        set size ratio -1
        plot "/tmp/test_x.matrix" matrix with image
        pause -1

Name

       vnl-make-matrix - create a matrix from a one-point-per-record vnlog

Repository

       https://github.com/dkogan/vnlog/

Synopsis

        $ cat /tmp/dat.vnl
        # i j x
        0 0 1
        0 1 2
        0 2 3
        1 0 4
        1 1 5
        1 2 6
        2 0 7
        2 1 8
        2 2 9
        3 0 10
        3 1 11
        3 2 12

        $ </tmp/dat.vnl vnl-filter -p i,x | vnl-make-matrix --outdir /tmp --prefix test_
        Writing to '/tmp/test_x.matrix'

        $ cat /tmp/test_x.matrix
        1 2 3
        4 5 6
        7 8 9
        10 11 12

See Also