Yes for the general behavior I had in mind it would be nearly impossible to keep the view constructor type-safe. For certain uses, that's less important than keeping the subsequent operations fast and type-safe, but that may be a very steep hill to climb.
As I'm thinking about the problem a little more, it might be very hard to have a good general solution, but maybe I could implement some small problem-specific methods that are fast for a limited purpose. There are 2 examples that come to mind in OnlineStats: extending a vector/matrix representing the X from a regression with a scalar/vector of ones for the bias term, and concatenating an X and Y to pass through the sweep operation. It would be nice if there was a low-overhead way to do that without needing to re-write the math. Another use I have in mind is for VAR/VECM impact analysis, where there is a large matrix with dense upper and sparse lower... it would be nice to abstract that away. These are actually very different problems, and it's probably too ambitious to have good solutions for both at the same time. Long story short, I might continue to work on some problem specific solutions in a semi-reusable way... I'll post here if I think they could be useful to anyone else. If anyone looks at Blox.jl and thinks I should NOT abandon what I was doing, please let me know. :) On Monday, July 6, 2015 at 2:02:04 PM UTC-4, Tim Holy wrote: > > On Monday, July 06, 2015 10:59:48 AM Tom Breloff wrote: > > I plan on adding "views" to this as well, which will probably just check > to > > see if the indices are contained within a sub-array to return an > > ArrayViews::view, otherwise a light wrapper around a "BlockView" > > You're not going to be able to do that in a type-stable way, because it's > something that depends on the values of the indexes rather than their > type. > > --Tim > >