Package com.google.common.math
Class LinearTransformation
- java.lang.Object
- 
- com.google.common.math.LinearTransformation
 
- 
 @GwtIncompatible public abstract class LinearTransformation extends Object The representation of a linear transformation between real numbersxandy. Graphically, this is the specification of a straight line on a plane. The transformation can be expressed asy = m * x + cfor finitemandc, unless it is a vertical transformation in which casexhas a constant value for ally. In the non-vertical case,mis the slope of the transformation (and a horizontal transformation has zero slope).- Since:
- 20.0
- Author:
- Pete Gillin
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classLinearTransformation.LinearTransformationBuilderThis is an intermediate stage in the construction process.
 - 
Constructor SummaryConstructors Constructor Description LinearTransformation()Deprecated.Create instances by using the static factory methods of the class.
 - 
Method SummaryAll Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static LinearTransformationforNaN()Builds an instance for datasets which containsDouble.NaN.static LinearTransformationhorizontal(double y)Builds an instance representing a horizontal transformation with a constant value ofy.abstract LinearTransformationinverse()Returns the inverse linear transformation.abstract booleanisHorizontal()Returns whether this is a horizontal transformation.abstract booleanisVertical()Returns whether this is a vertical transformation.static LinearTransformation.LinearTransformationBuildermapping(double x1, double y1)Start building an instance which mapsx = x1toy = y1.abstract doubleslope()Returns the slope of the transformation, i.e. the rate of change ofywith respect tox.abstract doubletransform(double x)Returns theycorresponding to the givenx.static LinearTransformationvertical(double x)Builds an instance representing a vertical transformation with a constant value ofx.
 
- 
- 
- 
Constructor Detail- 
LinearTransformation@Deprecated public LinearTransformation() Deprecated.Create instances by using the static factory methods of the class.Constructor for use by subclasses inside Guava.
 
- 
 - 
Method Detail- 
mappingpublic static LinearTransformation.LinearTransformationBuilder mapping(double x1, double y1) Start building an instance which mapsx = x1toy = y1. Both arguments must be finite. Call eitherLinearTransformation.LinearTransformationBuilder.and(double, double)orLinearTransformation.LinearTransformationBuilder.withSlope(double)on the returned object to finish building the instance.
 - 
verticalpublic static LinearTransformation vertical(double x) Builds an instance representing a vertical transformation with a constant value ofx. (The inverse of this will be a horizontal transformation.)
 - 
horizontalpublic static LinearTransformation horizontal(double y) Builds an instance representing a horizontal transformation with a constant value ofy. (The inverse of this will be a vertical transformation.)
 - 
forNaNpublic static LinearTransformation forNaN() Builds an instance for datasets which containsDouble.NaN. TheisHorizontal()andisVertical()methods returnfalseand theslope(), andtransform(double)methods all returnDouble.NaN. Theinverse()method returns the same instance.
 - 
isVerticalpublic abstract boolean isVertical() Returns whether this is a vertical transformation.
 - 
isHorizontalpublic abstract boolean isHorizontal() Returns whether this is a horizontal transformation.
 - 
slopepublic abstract double slope() Returns the slope of the transformation, i.e. the rate of change ofywith respect tox. This must not be called on a vertical transformation (i.e. whenisVertical()is true).
 - 
transformpublic abstract double transform(double x) Returns theycorresponding to the givenx. This must not be called on a vertical transformation (i.e. whenisVertical()is true).
 - 
inversepublic abstract LinearTransformation inverse() Returns the inverse linear transformation. The inverse of a horizontal transformation is a vertical transformation, and vice versa. The inverse of theforNaN()transformation is itself. In all other cases, the inverse is a transformation such that applying both the original transformation and its inverse to a value gives you the original value give-or-take numerical errors. Calling this method multiple times on the same instance will always return the same instance. Calling this method on the result of calling this method on an instance will always return that original instance.
 
- 
 
-