Tensorics is a java framework which uses a tensor as a central object. A tensor represents a set of values placed in an N-dimensional space. Wherever you are tempted to use maps of maps, a tensor might be a good choice ;-) Tensorics provides methods to create, transform and performing calculations with those tensors.
Tensor<Double> aTensor = /* whatever it might be */; Map<Position, Double> map = aTensor.asMap();
Here, 'Position' denotes the set of partial keys. For example a position could be something like:
Position position = Position.of("kaifox", Date.now());
where the two coordinates of in the forementioned N-dimensional space (where N=2 in this case) are "kaifox" and Date.now(). The types of the coordinates are denoted as the dimensions (String.class and Date.class in this case - with the disclaimer that Date is not a good choice, because it’s not immutable - but let this aside ;-). Tensorics provides a big featureset of operations to work with such tensors, for example:
-
Structural operations (extractions, slicing) for any value type of tensors
-
Fluent API for all operations on scalars and tensors.
-
Mathematical operations based on algebraic structures (e.g. Field). Mathematical operations are possible any value for which those structures are defined. A default implementation is currently provided for doubles.
-
Physical Quantities (value - unit pair), currently by the use of jscience.
-
Tensors of quantities.
-
Error and Validity propagation for quantities and tensors of quantities.
-
Scripting of all functionality with deferred execution, which opens the possibilities for parallel processing and massive distribution of calculations.
Important
|
Both, the current implementation as well as this document, are work in progress. The main purpose of the actual version is provide some functionality of every of the above mentioned categories and proofing the concepts of their interplay. Still, already the available subset of features should have useful applications in many contexts. Almost no effort put on profiling and performance optimization. Therefore, it might well be that some operations are quite inefficient and/or memory consuming for big objects. Such improvements are definitely planned for later iterations. Any contributions are welcome. |