Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consistently Treat Reduction with Resampling #34

Open
kaifox opened this issue Jul 15, 2018 · 0 comments
Open

Consistently Treat Reduction with Resampling #34

kaifox opened this issue Jul 15, 2018 · 0 comments

Comments

@kaifox
Copy link
Member

kaifox commented Jul 15, 2018

Now, that a prototype of multidimensional resampling is in place, it is time to think, how to combine the two (i.e. use resampling during reduction). This is basically the generalization of the already available

from(aTensor).reduce(ACoordinate.class).byInterpolatedSlicing(...);

One way is of course to add more methods like this and stay with the dogma, to only reduce one dimension at a time. However, for resampling, another road was probed which probably looks a bit more modern (more stream-like ;-), namely potentially defining several dimension in one clause. The disadvantage would of course be that we have more than one parameter per method ;-)

What I mean could be something like the following:

Tensor<V> reduced = Tensorics.reduce(aTensor)
    .sliceAt(Coord1.class, c1) // exact; only available values would be taken into account
    .then().repeatAt(Coord2.class, c2) // 
    .toTensor();

As a bonus, one could even add at the end things like:

toScalar(); // would throw if not zero dimensions
to(ATensorbacked.class); // would throw if dimensions not compatible

With a starting point that is FieldAware one could accomplish:

TensoricDouble.reduce(aDoubleTensor)
    .sliceAt(Coord1.class, c1) // exact; only available values would be taken into account
    .then().repeatAt(Coord2.class, c2) // 
    .then().linearAt(Coord3.class, c3, Coord3::doubleValue)
    .then().average(Coord4.class)
    .then().rms(Coord5.class)
    .toTensor();

What are your opinions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant