This script is meant to demonstrate the use of the LateX interface functions.

Dense matrices

A Dense matrix is generated with random values

neq = 5
matrix = MatrixDense_createFillRandom(neq, neq)
err = matrix$display()
## - Number of rows    = 5
## - Number of columns = 5
##                  [,  0]     [,  1]     [,  2]     [,  3]     [,  4]
##       [  0,]     -1.497      1.570     -0.786      0.678      0.864
##       [  1,]      2.214     -1.391      0.290     -0.383      1.101
##       [  2,]     -1.618      1.640     -1.911      0.515      1.763
##       [  3,]     -0.639     -1.670     -0.927     -0.464     -1.280
##       [  4,]      1.798      0.470      0.349     -0.180     -1.858
a = matrix$toLatex()
cat(a)

\[\left[\begin{array}{ccccc}-1.497 & 1.570 & -0.786 & 0.678 & 0.864 \\2.214 & -1.391 & 0.290 & -0.383 & 1.101 \\-1.618 & 1.640 & -1.911 & 0.515 & 1.763 \\-0.639 & -1.670 & -0.927 & -0.464 & -1.280 \\1.798 & 0.470 & 0.349 & -0.180 & -1.858\end{array}\right]\]

Sparse matrices

Sparse matrices

A Sparse matrix is generated with random values

neq       = 5
matrix = MatrixSparse_createFillRandom(neq, neq, 0.2)
matrix$display()
## - Number of rows    = 5
## - Number of columns = 5
## - Sparse Format
##                  [,  0]     [,  1]     [,  2]     [,  3]     [,  4]
##       [  0,]      1.637      2.123          .     -0.148      1.484
##       [  1,]      1.406      0.906     -0.007          .     -1.947
##       [  2,]      0.693          .          .     -0.738          .
##       [  3,]     -0.401          .     -0.445      0.220      0.573
##       [  4,]      1.697      0.556      0.640     -0.492     -0.148
## NULL
a = matrix$toLatex()
cat(a)

\[\left[\begin{array}{ccccc}1.637 & 2.123 & 0.000 & -0.148 & 1.484 \\1.406 & 0.906 & -0.007 & 0.000 & -1.947 \\0.693 & 0.000 & 0.000 & -0.738 & 0.000 \\-0.401 & 0.000 & -0.445 & 0.220 & 0.573 \\1.697 & 0.556 & 0.640 & -0.492 & -0.148\end{array}\right]\]

Tables

A Table is generated by storing the statistics calculated on an input Db.

mydb = Db_createFillRandom(100, 2, 3)
table = mydb$getStatsAsTable()
table$display()
##           Number     Minimum     Maximum        Mean    St. Dev.    Variance
## rank     100.000       1.000     100.000      50.500      28.866     833.250
##  x-1     100.000       0.000       0.987       0.517       0.288       0.083
##  x-2     100.000       0.001       0.941       0.475       0.253       0.064
##  z-1     100.000      -2.242       2.180       0.008       0.930       0.864
##  z-2     100.000      -3.212       2.161      -0.112       1.053       1.109
##  z-3     100.000      -2.283       2.424       0.022       0.938       0.880
## NULL
a = table$toLatex()
cat(a)

\[\left[\begin{array}{ccccccc} & Number & Minimum & Maximum & Mean & St. Dev. & Variance \\rank & 100.000 & 1.000 & 100.000 & 50.500 & 28.866 & 833.250 \\x-1 & 100.000 & 0.000 & 0.987 & 0.517 & 0.288 & 0.083 \\x-2 & 100.000 & 0.001 & 0.941 & 0.475 & 0.253 & 0.064 \\z-1 & 100.000 & -2.242 & 2.180 & 0.008 & 0.930 & 0.864 \\z-2 & 100.000 & -3.212 & 2.161 & -0.112 & 1.053 & 1.109 \\z-3 & 100.000 & -2.283 & 2.424 & 0.022 & 0.938 & 0.880\end{array}\right]\]