Upsurge
Upsurge copied to clipboard
How can I compute sum of a slice of matrix?
// S is a Matrix
sum(S[0..<1, 5..<10])? // doesn't work because MatrixSlice is not LinearType
Is there a workaround for it?
Ultimately, it would be easier to maintain I guess if there are less number of data types, e.g., everything is ndarray
in numpy.. until then, hopefully more documents to come! ReadTheDocs would be perfect, but simple readme.md
s would do the work pretty well, too, for APIs/inheritance/etc. I'm up for contributing to it if there's anything I can.
It doesn't work because it is a 2D data structure (QuadraticType) but sum
expects a 1D data structure (LinearType). You would need to flatten it first. I think it would be good to have a flatten
method on TensorTypes to convert to an array.
I'll look into ReadTheDocs, it already has some docs in the code it's just a matter of running Jazzy on it. I do think it could use some simplification, but it's always a compromise between performance and convenience.
think it would be good to have a flatten method
Agreed!
ReadTheDocs
I think so, at the moment RTD could be a burden. I'll keep the hackmd document updated, could be useful later :)