Package org.ojalgo.scalar
Interface Scalar<N extends java.lang.Comparable<N>>
-
- All Superinterfaces:
AccessScalar<N>
,java.lang.Comparable<N>
,Field<Scalar<N>>
,Group
,Group.Additive<Scalar<N>>
,Group.Multiplicative<Scalar<N>>
,NormedVectorSpace<Scalar<N>,N>
,NumberDefinition
,Operation
,Operation.Addition<Scalar<N>>
,Operation.Division<Scalar<N>>
,Operation.Multiplication<Scalar<N>>
,Operation.Subtraction<Scalar<N>>
,Ring<Scalar<N>>
,ScalarOperation
,ScalarOperation.Addition<Scalar<N>,N>
,ScalarOperation.Division<Scalar<N>,N>
,ScalarOperation.Multiplication<Scalar<N>,N>
,ScalarOperation.Subtraction<Scalar<N>,N>
,Tensor<N,Scalar<N>>
,VectorSpace<Scalar<N>,N>
- All Known Subinterfaces:
SelfDeclaringScalar<S>
- All Known Implementing Classes:
Amount
,BigScalar
,ComplexNumber
,ExactDecimal
,Money
,Price
,PrimitiveScalar
,Quadruple
,Quantity
,Quaternion
,RationalNumber
public interface Scalar<N extends java.lang.Comparable<N>> extends AccessScalar<N>, Field<Scalar<N>>, ScalarOperation.Addition<Scalar<N>,N>, ScalarOperation.Division<Scalar<N>,N>, ScalarOperation.Subtraction<Scalar<N>,N>, java.lang.Comparable<N>, Tensor<N,Scalar<N>>
A Scalar is:
- An abstraction of a vector/matrix element.
- A Comparable decorator, increasing the number of things you can do with them.
Theoretically it is a Field or at least a Division ring.
The intention is that implementors should be final immutable subclasses of
Comparable
and that they should be inline with the requirements for ValueBased classes.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
Scalar.Factory<N extends java.lang.Comparable<N>>
-
Nested classes/interfaces inherited from interface org.ojalgo.algebra.Group
Group.Additive<T>, Group.Multiplicative<T>
-
Nested classes/interfaces inherited from interface org.ojalgo.algebra.Operation
Operation.Addition<T>, Operation.Division<T>, Operation.Multiplication<T>, Operation.Subtraction<T>
-
Nested classes/interfaces inherited from interface org.ojalgo.algebra.ScalarOperation
ScalarOperation.Addition<T,N extends java.lang.Comparable<N>>, ScalarOperation.Division<T,N extends java.lang.Comparable<N>>, ScalarOperation.Multiplication<T,N extends java.lang.Comparable<N>>, ScalarOperation.Subtraction<T,N extends java.lang.Comparable<N>>
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default Scalar<N>
add(Scalar<N> addend)
static boolean
booleanValue(java.lang.Comparable<?> number)
static byte
byteValue(java.lang.Comparable<?> number)
default int
dimensions()
The range of the indices that identify the scalar components.default Scalar<N>
divide(Scalar<N> divisor)
static double
doubleValue(java.lang.Comparable<?> number)
static float
floatValue(java.lang.Comparable<?> number)
static int
intValue(java.lang.Comparable<?> number)
boolean
isAbsolute()
static long
longValue(java.lang.Comparable<?> number)
default Scalar<N>
multiply(Scalar<N> multiplicand)
default int
rank()
The total number of indices required to uniquely identify each scalar component is called the order, degree or rank of the tensor.static short
shortValue(java.lang.Comparable<?> number)
default Scalar<N>
subtract(Scalar<N> subtrahend)
java.math.BigDecimal
toBigDecimal()
default java.lang.String
toPlainString(NumberContext context)
java.lang.String
toString(NumberContext context)
-
Methods inherited from interface org.ojalgo.structure.AccessScalar
get
-
Methods inherited from interface org.ojalgo.algebra.Group.Additive
negate
-
Methods inherited from interface org.ojalgo.algebra.Group.Multiplicative
invert
-
Methods inherited from interface org.ojalgo.algebra.NormedVectorSpace
isSmall, norm, signum
-
Methods inherited from interface org.ojalgo.type.NumberDefinition
booleanValue, byteValue, doubleValue, floatValue, intValue, longValue, shortValue
-
Methods inherited from interface org.ojalgo.algebra.Operation.Multiplication
power
-
Methods inherited from interface org.ojalgo.algebra.ScalarOperation.Addition
add, add, add
-
Methods inherited from interface org.ojalgo.algebra.ScalarOperation.Division
divide, divide, divide
-
Methods inherited from interface org.ojalgo.algebra.ScalarOperation.Multiplication
multiply, multiply, multiply
-
Methods inherited from interface org.ojalgo.algebra.ScalarOperation.Subtraction
subtract, subtract, subtract
-
Methods inherited from interface org.ojalgo.tensor.Tensor
components, isSameShape
-
Methods inherited from interface org.ojalgo.algebra.VectorSpace
conjugate
-
-
-
-
Method Detail
-
booleanValue
static boolean booleanValue(java.lang.Comparable<?> number)
-
byteValue
static byte byteValue(java.lang.Comparable<?> number)
-
doubleValue
static double doubleValue(java.lang.Comparable<?> number)
-
floatValue
static float floatValue(java.lang.Comparable<?> number)
-
intValue
static int intValue(java.lang.Comparable<?> number)
-
longValue
static long longValue(java.lang.Comparable<?> number)
-
shortValue
static short shortValue(java.lang.Comparable<?> number)
-
add
default Scalar<N> add(Scalar<N> addend)
- Specified by:
add
in interfaceOperation.Addition<N extends java.lang.Comparable<N>>
- Parameters:
addend
- What to add- Returns:
this + addend
-
dimensions
default int dimensions()
Description copied from interface:Tensor
The range of the indices that identify the scalar components. Each index of a tensor ranges over the number of dimensions.
-
divide
default Scalar<N> divide(Scalar<N> divisor)
- Specified by:
divide
in interfaceOperation.Division<N extends java.lang.Comparable<N>>
- Parameters:
divisor
- The divisor- Returns:
this / divisor
.
-
isAbsolute
boolean isAbsolute()
- Returns:
- true if this is equal to its own norm, modulus or absolute value (non-negative real part and no imaginary part); otherwise false.
- See Also:
isAbsolute()
-
multiply
default Scalar<N> multiply(Scalar<N> multiplicand)
- Specified by:
multiply
in interfaceOperation.Multiplication<N extends java.lang.Comparable<N>>
- Parameters:
multiplicand
- The multiplicand- Returns:
this * multiplicand
.
-
rank
default int rank()
Description copied from interface:Tensor
The total number of indices required to uniquely identify each scalar component is called the order, degree or rank of the tensor.
-
subtract
default Scalar<N> subtract(Scalar<N> subtrahend)
- Specified by:
subtract
in interfaceOperation.Subtraction<N extends java.lang.Comparable<N>>
- Parameters:
subtrahend
- The subtrahend- Returns:
this - subtrahend
.
-
toBigDecimal
java.math.BigDecimal toBigDecimal()
-
toPlainString
default java.lang.String toPlainString(NumberContext context)
-
toString
java.lang.String toString(NumberContext context)
-
-