format_latte()
formats a matrix in latte's style.
write_latte()
writes a latte-formatted file to file.
read_latte()
reads a latte-formatted file from disk.
format_latte(mat, file) write_latte(mat, file) write.latte(mat, file) read_latte(file, format = c("mat", "Ab")) read.latte(file, format = c("mat", "Ab"))
mat | A matrix |
---|---|
file | A filename |
format | "mat" or "Ab" |
format_latte()
-- A character string of the matrix in
latte format.
write_latte()
-- An invisible character
string of the formatted output.
read_latte()
-- An integer matrix.
#> [,1] [,2] [,3] #> [1,] 9 2 7 #> [2,] 5 8 4 #> [3,] 3 6 1format_latte(mat)#> [1] "3 3\n9 2 7\n5 8 4\n3 6 1"#> 3 3 #> 9 2 7 #> 5 8 4 #> 3 6 1#> [1] "/var/folders/r3/126_d6t55f5d32tplbg5mk1d0c48s9/T//RtmpugrA1n/foo.hrep"#> [,1] [,2] [,3] #> [1,] 9 2 7 #> [2,] 5 8 4 #> [3,] 3 6 1read_latte(file, "Ab")#> $A #> [,1] [,2] #> [1,] -2 -7 #> [2,] -8 -4 #> [3,] -6 -1 #> #> $b #> [1] 9 5 3 #>#> [,1] [,2] [,3] #> [1,] 9 2 7 #> [2,] 5 8 4 #> [3,] 3 6 1 #> attr(,"linearity") #> [1] 1 3 #> attr(,"nonnegative") #> [1] 2format_latte(mat)#> [1] "3 3\n9 2 7\n5 8 4\n3 6 1\nlinearity 2 1 3\nnonnegative 1 2"#> 3 3 #> 9 2 7 #> 5 8 4 #> 3 6 1 #> linearity 2 1 3 #> nonnegative 1 2#> [,1] [,2] [,3] #> [1,] 9 2 7 #> [2,] 5 8 4 #> [3,] 3 6 1 #> attr(,"linearity") #> [1] 1 3 #> attr(,"nonnegative") #> [1] 2file.remove(file)#> [1] TRUE