RobinHankin / stokes

methods for exterior calculus
https://robinhankin.github.io/stokes/
3 stars 0 forks source link

bug in `coeffs<-()` #52

Closed RobinHankin closed 2 years ago

RobinHankin commented 2 years ago

Look:

> a <- rform()
> a + 6
Error in Ops.kform(a, 6) : 
  Binary operator '+' is not implemented for kform <op> other 
> coeffs(a) <- coeffs(a)/2
> a + 6
            val
 1 2 4  =   0.5
 3 5 6  =   1.0
 0 0 0  =   6.0
 1 6 7  =   4.5
 1 3 5  =   5.5
 4 5 7  =  -2.0
 3 4 6  =  -2.5
 1 3 4  =   3.0
 4 6 7  =   3.5
> 

Above, the first call to a+6 gives an error as it should, but the second one does not give an error: after coeffs(a) <- coeffs(a)/2, object a is a spray object and has lost its kform class. So a+6 is interpreted as a spray addition of sparse arrays.