From: mgsloan <mg...@gm...> - 2007-04-14 06:54:56
|
Hmm, I think i may not have sent it to the lists... After playing a bit with the library, I came up with some todos and > wishes, that I submit before I forget them; some might already be there > but I was not aware, or some might be bad ideas for some other reason... > These are just suggestions: > > First, things would be more pleasant if we had: > - automatic conversions: sb to pw<sb> (Linear to sb, double to Linear). > - allow +,-,* between double,sb,pw<sb>,d2<pw<sb>>,d2<pw<sb>>. > - allow composition sb(pw<sb>) > - allow composition d2<pw<sb>>(sb) and pw<d2<sb>>(sb) > - define a plotter function for d2<pw<sb>> and pw<d2<sb>> (for toys/tests) > Sounds good! There's at least an explicit constructor for sb -> pw<sb>, and I know there is a Linear -> SBasis. I think I have an accidental double -> Linear too. Turns out single parameter constructors are interpreted as conversions! At somepoint I'll probably switch the single param constructors over to explicit conversions, and stick explicit on all non-conversion constructors. One thing I'd like to avoid is too many operators. Often times when it can't figure out what you mean by a particular operator, it'll print out all of the declerations associated with it. However, we certainly want a complete, predictable set of operations across all. It's possible we might be able to leverage implicit conversion to minimize operator numbers. As far as the plotters, cairo_md_sb can handle D2<Piecewise<SBasis> >. Actually, Piecewise<D2<SBasis> > would be loads easier to implement - will do next time. Some remarks about our conventions: > - define "bridges" between d2<pw<sb>> and pw<d2<sb>>. > Although d2<pw<sb>> is usefull in some situations (plotting a function > for instance), many operations require synchronous cuts, so pw<d2<sb>> > instead. Note that once a d2<pw<sb>> has synchronous cuts, there is no > synchronizing for each new operation... To make this implicit, our > functions should accept both d2<pw<sb>> and pw<d2<sb>>, and do some > conversion if needed. Or should we get rid of d2<pw<sb>>? I actually think pw<d2<sb>> might be a good way to handle that. currently i've got a sectionize function that does d2<pw<sb>> -> vector<d2<sb>> but that's not very good. pw<d2<sb>> would be a much better output for it. - fix convention about empty sb/pw<sb>: an empty sb is the constant 0 > while empty pw<sb> are not allowed. How do we represent 0 in pw<sb> > world? as (pw<sb>)Linear(0)? The thing is, either way there's going to be a check. I suppose the good thing about disallowing it is that it doesn't matter what the function actually does. The current convention is that it is indeed constant zero, but i suppose concat does need a bit of work in that respect. Yes, that's the main way to reasonably represent 0. Some less relevant todos: > - define some standard functions for pw<sb>: sqrt, cos, sin... > - define pw<sb> and d2<pw<sb>> bounds. Sounds good. yeah, I never really put much time into d2, more of a copy paste and modify of multidim What do you think? some good ideas! |