Example 2
Tensor tensor = Tensors.parse("b*a"); TensorBuilder builder = tensor.getBuilder(); //builder of product builder.put(Tensors.parse("2")); builder.put(Tensors.parse("1/2")); builder.put(Tensors.parse("a+q")); assert TensorUtils.equals(builder.build(),Tensors.parse("a+q")); //Resulting tensor class is Sum
There is a mimic infrastructure for tensor creation in the system, see {@link TensorFactory} for more information.
For general tensor creation use factory methods in {@link Tensors}class.
@author Dmitry Bolotin @author Stanislav Poslavsky @see cc.redberry.core.tensor.Tensor#getBuilder() @see TensorUtils#compare(cc.redberry.core.tensor.Tensor,cc.redberry.core.tensor.Tensor) @see TensorUtils#equals(cc.redberry.core.tensor.Tensor,cc.redberry.core.tensor.Tensor) @see http://en.wikipedia.org/wiki/Builder_pattern
|
|
|
|
|
|