RobinHankin / spray

sparse arrays and fast multivariate polynomials
https://robinhankin.github.io/spray/
2 stars 2 forks source link

infelicity in print method #50

Closed RobinHankin closed 1 month ago

RobinHankin commented 1 month ago
library("spray")
#> 
#> Attaching package: 'spray'
#> The following objects are masked from 'package:base':
#> 
#>     pmax, pmin
(a <- rspray()*1e-11)
#>            val
#>  1 2 2  =    0
#>  0 2 0  =    0
#>  0 1 0  =    0
#>  2 1 0  =    0
#>  2 2 2  =    0
#>  1 1 1  =    0
#>  2 2 1  =    0
#>  2 0 1  =    0
#>  0 1 1  =    0
coeffs(a)
#> A disord object with hash fb41c08d1948e5af3eb06fb0bcc9169b0fef441d and elements
#> [1] 9e-11 8e-11 7e-11 6e-11 5e-11 3e-11 2e-11 4e-11 1e-11
#> (in some order)

The coefficients are perfectly sensible but somehow show up as zeros. The issue is the following line in print_spray_matrixform():

round(elements(coeffs(S)),getOption("digits"))

I need to capture the output that R would make and use that.