Clone
Override .Clone for the various matrix storage classes. Right now it's in the generic class and calls .At a zillion times instead of just doing an array block copy.
Confirmed, managed dense matrix implementations are missing a proper override of CopyTo (some other implementations already do override it). Needs a github ticket.
4 comments
-
AdminChristoph Rüegg
(Admin, Math.NET)
commented
Good point though concerning the unnecessary Clone calls, need think about some options there...
-
AdminChristoph Rüegg
(Admin, Math.NET)
commented
github issue #24
-
AdminChristoph Rüegg
(Admin, Math.NET)
commented
Clone is just a call to CopyTo. Are we talking about the same codebase?
-
Lacko
commented
Actually, it's Clone and not CopyTo that has to be overridden, as CopyTo might be called with a matrix in another storage format.
I've just started using math.net a few days ago to replace my not so elaborate matrix implementation and mkl wrappers with something that's community supported. I'm pretty much satisfied but the first application already revealed some performance bootleneck. For instance, there's no direct access to the U and Vt matrices of the SVD class, only via a clone call which I think is unnecessary. I'd change the U() function to a simple property. To prevent changes to the matrix (which is probably not a big issue because users of math libs are usually aware of what they're doing) an immutable matrix class could be added to the lib. Unfortunately, changing U() to a property would break the interface. Well, Clone could be removed though. I've changed the clone function to do a block copy instead of an itemwise clone via the At function and still this single Copy uses 5% of my runtime.
I don't know how to contribute to the package but would happily implement some of these changes. Also, I have a piece of robust principal component code that I can port to math.net and make it part of the package if anyone's interested.