Interface Algebra<T>
-
- Type Parameters:
T-
- All Known Implementing Classes:
- Array
public interface Algebra<T>This interface defines algebric operators
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method and Description Tabs()AppliesMath.abs(double)to every element ofthisinstance.doubleaccumulate()Accumulate values in a range.doubleaccumulate(double init)Accumulate values in a range.doubleaccumulate(int from, int to, double init)Accumulate values in a range.Tadd(double scalar)Adds ascalarto every element ofthisinstance of<T>.Tadd(T another)Addsthisinstance andanotherinstance of<T>.TaddAssign(double scalar)Adds ascalarto every element ofthisinstance of<T>.TaddAssign(T another)Addsthisinstance andanotherinstance of<T>.TadjacentDifference()Return differences between adjacent values.TadjacentDifference(int from, int to)Return differences between adjacent values.TadjacentDifference(int from, int to, Ops.BinaryDoubleOp f)Return differences between adjacent values.TadjacentDifference(Ops.BinaryDoubleOp f)Return differences between adjacent values.Tdiv(double scalar)Divides every element ofthisinstance of<T>by ascalar.Tdiv(T another)Dividesthisinstance byanotherinstance of<T>.TdivAssign(double scalar)Divides every element ofthisinstance of<T>by ascalar.TdivAssign(T another)Dividesthisinstance byanotherinstance of<T>.doubledotProduct(T another)The inner product generalizes the dot product to abstract vector spaces and is normally denoted by .doubledotProduct(T another, int from, int to)The inner product generalizes the dot product to abstract vector spaces and is normally denoted by .Texp()AppliesMath.exp(double)to every element ofthisinstance.doubleinnerProduct(T another)The inner product generalizes the dot product to abstract vector spaces and is normally denoted by .doubleinnerProduct(T another, int from, int to)The inner product generalizes the dot product to abstract vector spaces and is normally denoted by .Tlog()AppliesMath.log(double)to every element ofthisinstance.intlowerBound(double val)Finds the first position in which val could be inserted without changing the ordering.intlowerBound(double val, Ops.BinaryDoublePredicate f)Finds the first position in which val could be inserted without changing the ordering.intlowerBound(int from, int to, double val)Finds the first position in which val could be inserted without changing the ordering.intlowerBound(int from, int to, double val, Ops.BinaryDoublePredicate f)Finds the first position in which val could be inserted without changing the ordering.doublemax()Return the maximum element in a range using comparison functor.doublemax(int from, int to)Return the maximum element in a range using comparison functor.doublemin()Return the minimum element in a range using comparison functor.doublemin(int from, int to)Return the minimum element in a range using comparison functor.Tmul(double scalar)Multiplies every element ofthisinstance of<T>by ascalar.Tmul(Matrix matrix)Vectorial multiplication ofthisinstance by aMatrix.Tmul(T another)Multipliesthisinstance byanotherinstance of<T>.TmulAssign(double scalar)Multiplies every element ofthisinstance of<T>by ascalar.TmulAssign(T another)Multipliesthisinstance byanotherinstance of<T>.Tnegative()Unary negative function applied to every element ofthisinstanceMatrixouterProduct(T another)In linear algebra, the outer product typically refers to the tensor product of two vectors.MatrixouterProduct(T another, int from, int to)In linear algebra, the outer product typically refers to the tensor product of two vectors.Tsqr()AppliesMath#sqr(double)to every element ofthisinstance.Tsqrt()AppliesMath.sqrt(double)to every element ofthisinstance.Tsub(double scalar)Subtracts ascalarto every element ofthisinstance of<T>.Tsub(T another)Subtractsthisinstance byanotherinstance of<T>.TsubAssign(double scalar)Subtracts ascalarto every element ofthisinstance of<T>.TsubAssign(T another)Subtractsthisinstance byanotherinstance of<T>.Ttransform(int first, int last, Ops.DoubleOp f)Perform an operation on a sequence in a range [first,last)Ttransform(Ops.DoubleOp func)Perform an operation on a sequence in a range [first,last)intupperBound(double val)Finds the last position in which val could be inserted in a sequence [begin(), end()] without changing the ordering.intupperBound(double val, Ops.BinaryDoublePredicate f)Finds the last position in which val could be inserted in a sequence [begin(), end()] without changing the ordering.intupperBound(int first, int last, double val)Finds the last position in which val could be inserted in a sequence [first,last] without changing the ordering.intupperBound(int first, int last, double val, Ops.BinaryDoublePredicate f)Finds the last position in which val could be inserted in a sequence [first,last] without changing the ordering.
-
-
-
Method Detail
-
addAssign
T addAssign(double scalar)
Adds ascalarto every element ofthisinstance of<T>.- Parameters:
scalar-- Returns:
this
-
addAssign
T addAssign(T another)
Addsthisinstance andanotherinstance of<T>.- Parameters:
another-- Returns:
- this
-
subAssign
T subAssign(double scalar)
Subtracts ascalarto every element ofthisinstance of<T>.- Parameters:
scalar-- Returns:
this
-
subAssign
T subAssign(T another)
Subtractsthisinstance byanotherinstance of<T>.- Parameters:
another-- Returns:
- this
-
mulAssign
T mulAssign(double scalar)
Multiplies every element ofthisinstance of<T>by ascalar.- Parameters:
scalar-- Returns:
this
-
mulAssign
T mulAssign(T another)
Multipliesthisinstance byanotherinstance of<T>.- Parameters:
another-- Returns:
- this
-
divAssign
T divAssign(double scalar)
Divides every element ofthisinstance of<T>by ascalar.- Parameters:
scalar-- Returns:
this
-
divAssign
T divAssign(T another)
Dividesthisinstance byanotherinstance of<T>.- Parameters:
another-- Returns:
- this
-
add
T add(double scalar)
Adds ascalarto every element ofthisinstance of<T>.- Parameters:
scalar-- Returns:
- a new instance
-
add
T add(T another)
Addsthisinstance andanotherinstance of<T>.- Parameters:
another-- Returns:
- a new instance
-
sub
T sub(double scalar)
Subtracts ascalarto every element ofthisinstance of<T>.- Parameters:
scalar-- Returns:
- a new instance
-
sub
T sub(T another)
Subtractsthisinstance byanotherinstance of<T>.- Parameters:
another-- Returns:
- a new instance
-
mul
T mul(double scalar)
Multiplies every element ofthisinstance of<T>by ascalar.- Parameters:
scalar-- Returns:
- a new instance
-
mul
T mul(T another)
Multipliesthisinstance byanotherinstance of<T>.- Parameters:
another-- Returns:
- a new instance
-
div
T div(double scalar)
Divides every element ofthisinstance of<T>by ascalar.- Parameters:
scalar-- Returns:
- a new instance
-
div
T div(T another)
Dividesthisinstance byanotherinstance of<T>.- Parameters:
another-- Returns:
- a new instance
-
negative
T negative()
Unary negative function applied to every element ofthisinstance- Returns:
- a new instance
-
mul
T mul(Matrix matrix)
Vectorial multiplication ofthisinstance by aMatrix.- Parameters:
another-- Returns:
- a new instance
-
dotProduct
double dotProduct(T another)
The inner product generalizes the dot product to abstract vector spaces and is normally denoted by .As we are working in space (real numbers), it's sufficient to understand that both inner product and dot operator give equivalent results.
- Parameters:
another- Iterator- Returns:
- the inner product between this Matrix and another Matrix
- See Also:
- Inner Product
-
dotProduct
double dotProduct(T another, int from, int to)
The inner product generalizes the dot product to abstract vector spaces and is normally denoted by .As we are working in space (real numbers), it's sufficient to understand that both inner product and dot operator give equivalent results.
- Parameters:
another- Iteratorfrom- is the start element, inclusiveto- is the end element, exclusive- Returns:
- the inner product between this Matrix and another Matrix
- See Also:
- Inner Product
-
innerProduct
double innerProduct(T another)
The inner product generalizes the dot product to abstract vector spaces and is normally denoted by .As we are working in space (real numbers), it's sufficient to understand that both inner product and dot operator give equivalent results.
- Parameters:
another- Iterator- Returns:
- the inner product between this Matrix and another Matrix
- See Also:
- Inner Product
-
innerProduct
double innerProduct(T another, int from, int to)
The inner product generalizes the dot product to abstract vector spaces and is normally denoted by .As we are working in space (real numbers), it's sufficient to understand that both inner product and dot operator give equivalent results.
- Parameters:
another- Iteratorfrom- is the start element, inclusiveto- is the end element, exclusive- Returns:
- the inner product between this Matrix and another Matrix
- See Also:
- Inner Product
-
outerProduct
Matrix outerProduct(T another)
In linear algebra, the outer product typically refers to the tensor product of two vectors. The result of applying the outer product to a pair of vectors is a matrix. The name contrasts with the inner product, which takes as input a pair of vectors and produces a scalar.Given a vector with ''m'' elements and a vector with ''n'' elements, their outer product is defined as the matrix obtained by multiplying each element of by each element of :
Note that .
- Parameters:
another- Iterator- Returns:
- the outer product between this Matrix and another Matrix
- See Also:
- Outer Product
-
outerProduct
Matrix outerProduct(T another, int from, int to)
In linear algebra, the outer product typically refers to the tensor product of two vectors. The result of applying the outer product to a pair of vectors is a matrix. The name contrasts with the inner product, which takes as input a pair of vectors and produces a scalar.Given a vector with ''m'' elements and a vector with ''n'' elements, their outer product is defined as the matrix obtained by multiplying each element of by each element of :
Note that .
- Parameters:
another- Iteratorfrom- is the start element, inclusiveto- is the end element, exclusive- Returns:
- the outer product between this Matrix and another Matrix
- See Also:
- Outer Product
-
adjacentDifference
T adjacentDifference()
Return differences between adjacent values.Computes the difference between adjacent values in the range [first,last) using subtraction to compute differences and returns the results as an Array.
- Returns:
- an array which contains the computed adjacent differences.
- See Also:
- std::adjacent_difference
-
adjacentDifference
T adjacentDifference(int from, int to)
Return differences between adjacent values.Computes the difference between adjacent values in the range [first,last) using subtraction to compute differences and returns the results as an Array.
- Parameters:
first- is the start of rangelast- is the end of range- Returns:
- an array which contains the computed adjacent differences.
- See Also:
- std::adjacent_difference
-
adjacentDifference
T adjacentDifference(Ops.BinaryDoubleOp f)
Return differences between adjacent values.Computes the difference between adjacent values in the range [begin(),end()+1) using a function for computing the differences and returns the results as an Array.
- Parameters:
f- is a function- Returns:
- an array which contains the computed adjacent differences.
- See Also:
- std::adjacent_difference
-
adjacentDifference
T adjacentDifference(int from, int to, Ops.BinaryDoubleOp f)
Return differences between adjacent values.Computes the difference between adjacent values in the range [first,last) using a function for computing the differences and returns the results as an Array.
- Parameters:
first- is the start of rangelast- is the end of rangef- is a function- Returns:
- an array which contains the computed adjacent differences.
- See Also:
- std::adjacent_difference
-
min
double min()
Return the minimum element in a range using comparison functor.- Returns:
- the minimum value computed
- See Also:
- std::min_element
-
min
double min(int from, int to)Return the minimum element in a range using comparison functor.- Parameters:
from- is the initial index, inclusiveto- is the final index, exclusive- Returns:
- the minimum value computed
- See Also:
- std::min_element
-
max
double max()
Return the maximum element in a range using comparison functor.- Returns:
- the maximum value computed
- See Also:
- std::max_element
-
max
double max(int from, int to)Return the maximum element in a range using comparison functor.- Parameters:
from- is the initial index, inclusiveto- is the final index, exclusive- Returns:
- the maximum value computed
- See Also:
- std::max_element
-
abs
T abs()
AppliesMath.abs(double)to every element ofthisinstance.- Returns:
- a new instance
-
sqr
T sqr()
AppliesMath#sqr(double)to every element ofthisinstance.- Returns:
- a new instance
-
sqrt
T sqrt()
AppliesMath.sqrt(double)to every element ofthisinstance.- Returns:
- a new instance
-
log
T log()
AppliesMath.log(double)to every element ofthisinstance.- Returns:
- a new instance
-
exp
T exp()
AppliesMath.exp(double)to every element ofthisinstance.- Returns:
- a new instance
-
accumulate
double accumulate()
Accumulate values in a range.Accumulates the values in the range [begin,end+1). The initial value is zero. The values are processed in order.
- Returns:
- the final sum
- See Also:
- std::accumulate
-
accumulate
double accumulate(double init)
Accumulate values in a range.Accumulates the values in the range [begin(),end()+1). The initial value is init. The values are processed in order.
- Parameters:
init- is the starting value to add other values to.- Returns:
- the final sum
- See Also:
- std::accumulate
-
accumulate
double accumulate(int from, int to, double init)Accumulate values in a range.Accumulates the values in the range [first,last). The initial value is init. The values are processed in order.
- Parameters:
first- is the start of range, inclusivelast- is the end of range, exclusiveinit- is the starting value to add other values to.- Returns:
- the final sum
- See Also:
- std::accumulate
-
transform
T transform(Ops.DoubleOp func)
Perform an operation on a sequence in a range [first,last)Applies the operator to each element in the input range and assigns the results to itself. Evaluates input[first+N] = unary_op(array[first+N]) for each
Nin the range [0, end()-begin() ).- Parameters:
f- is an unary function to be applied- Returns:
this, i.e: performs the transformation in place- See Also:
- std::transform
-
transform
T transform(int first, int last, Ops.DoubleOp f)
Perform an operation on a sequence in a range [first,last)Applies the operator to each element in the input range and assigns the results to itself. Evaluates input[first+N] = unary_op(array[first+N]) for each
Nin the range [0, last-first).- Parameters:
first- is the start of range, inclusivelast- is the end of range, exclusivef- is an unary function to be applied- Returns:
this, i.e: performs the transformation in place- See Also:
- std::transform
-
lowerBound
int lowerBound(double val)
Finds the first position in which val could be inserted without changing the ordering.- Parameters:
value- to be searched- Returns:
- an index pointing to the first element "not less than"
val, or end() if every element is less thanval. - See Also:
- std::lower_bound
-
lowerBound
int lowerBound(int from, int to, double val)Finds the first position in which val could be inserted without changing the ordering.- Parameters:
first- element, inclusivelast- element, inclusivevalue- to be searched- Returns:
- an index pointing to the first element "not less than"
val, or end() if every element is less thanval. - See Also:
- std::lower_bound
-
lowerBound
int lowerBound(double val, Ops.BinaryDoublePredicate f)Finds the first position in which val could be inserted without changing the ordering.- Parameters:
value- to be searchedf- is a BinaryDoublePredicate which defines the comparison function- Returns:
- an index pointing to the first element "not less than"
val, or end() if every element is less thanval. - See Also:
- std::lower_bound
-
lowerBound
int lowerBound(int from, int to, double val, Ops.BinaryDoublePredicate f)Finds the first position in which val could be inserted without changing the ordering.- Parameters:
first- element, inclusivelast- element, inclusivevalue- to be searchedf- is a BinaryDoublePredicate which defines the comparison function- Returns:
- an index pointing to the first element "not less than"
val, or end() if every element is less thanval. - See Also:
- std::lower_bound
-
upperBound
int upperBound(double val)
Finds the last position in which val could be inserted in a sequence [begin(), end()] without changing the ordering.- Parameters:
value- to be searched- Returns:
- an index pointing to the first element greater than
val, or end() if no elements are greater thanval. - See Also:
- std::upper_bound
-
upperBound
int upperBound(int first, int last, double val)Finds the last position in which val could be inserted in a sequence [first,last] without changing the ordering.- Parameters:
first- element, inclusivelast- element, inclusivevalue- to be searched- Returns:
- an index pointing to the first element greater than
val, or end() if no elements are greater thanval. - See Also:
- std::upper_bound
-
upperBound
int upperBound(double val, Ops.BinaryDoublePredicate f)Finds the last position in which val could be inserted in a sequence [begin(), end()] without changing the ordering.- Parameters:
value- to be searchedf- is a BinaryDoublePredicate which defines the comparison function- Returns:
- an index pointing to the first element greater than
val, or end() if no elements are greater thanval. - See Also:
- std::upper_bound
-
upperBound
int upperBound(int first, int last, double val, Ops.BinaryDoublePredicate f)Finds the last position in which val could be inserted in a sequence [first,last] without changing the ordering.- Parameters:
first- element, inclusivelast- element, inclusivevalue- to be searchedf- is a BinaryDoublePredicate which defines the comparison function- Returns:
- an index pointing to the first element greater than
val, or end() if no elements are greater thanval. - See Also:
- std::upper_bound
-
-
DataMelt 3.0 © DataMelt by jWork.ORG