Closed goldingn closed 8 years ago
Hmmm...
There is an S4 generic methods::kronecker
.
There is a non-S4 function base::kronecker
which calls methods::kronecker
if X
and Y
are S4 objects. If not, it calls .kronecker
(also in base
) which is not S4....
%x%
is base, so calls base::kronecker
which calls .kronecker
. So we can't just overload the S4 generic methods::kronecker
, we need to deal with %x%
too.
It would be great to overload the S3 %x%
for our kernel class (to call methods::kronecker
, or just skip straight to the real code), but it seems that %?%
operators can't be overloaded.
Gnnnh.
It looks like it is not possible to provide a working implementation of the %x%
operator, without the startup message. However kron
can be replaced with kronecker
, as implemented in https://github.com/goldingn/gpe/commit/5c6655a034b21adce35bd7bdf83b9402a8824f98. Closing the rest of this issue now as it seems to be a limitation in R as currently implemented
Adding a method for the S4 generic kronecker
ruined the docs, because this: http://stackoverflow.com/questions/18604549/documenting-and-exporting-an-s4-generic-method-that-already-exists-in-base
So it's archived in the kronecker_bullshit
branch and I reverted back to using the separate kron
.
That was a fun afternoon.
Loading the package in a fresh environment currently yields:
which is ugly.
This is because the Kronecker operator
%x%
is overwritten in gpe and reverts to the base version if the object is not a gpe kernel object. gpe also uses the functionkron()
for it's kernel kronecker operator, rather than the generickronecker()
There must be a better way of overloading
kronecker()
than this!Since
%x%
is defined as:overloading
kronecker()
should be sufficient.