RobinHankin / spray

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

bug in as.character.spray() #43

Closed RobinHankin closed 1 year ago

RobinHankin commented 1 year ago

further to issue #40:

suppressMessages(library("spray"))
a <- diag(26)
options(sprayvars = letters)
a[1 + cbind(0:25, 1:26) %% 26] <- 2
options(polyform=TRUE)
a <- spray(a)
a
#> +a^2*z +x*y^2 +u*v^2 +o*p^2 +t*u^2 +q*r^2 +p*q^2 +v*w^2 +a*b^2 +n*o^2
#> +w*x^2 +m*n^2 +l*m^2 +s*t^2 +b*c^2 +k*l^2 +y*z^2 +j*k^2 +h*i^2 +i*j^2
#> +g*h^2 +d*e^2 +e*f^2 +f*g^2 +c*d^2 +r*s^2
as.character(a)
#> [1] "+a^2*z +x*y^2 +u*v^2 +o*p^2 +t*u^2 +q*r^2 +p*q^2 +v*w^2 +a*b^2 +n*o^2 +w*x^2 +m*n^2 +l*m^2 +s*t^2 +b*c^2 +k*l^2 +y*z^2 +j*k^2 +h*i^2 +i*j^2 +g*h^2 +d*e^2 +e*f^2 +f*g^2 +c*d^2 +r*s^2"
as.character(a,split=TRUE)
#> Error in x@hash: no applicable method for `@` applied to an object of class "numeric"

Created on 2023-07-05 with reprex v2.0.2

(this is one place where returning a dropped disord object is problematic).