Package com.irurueta.algebra
Class NormComputer
java.lang.Object
com.irurueta.algebra.NormComputer
- Direct Known Subclasses:
FrobeniusNormComputer
,InfinityNormComputer
,OneNormComputer
Class in charge of computing norms of arrays and matrices.
Norms can be computed in different ways depending on the desired norm
measure. For that purpose subclass implementations of this class attempt to
work on different norm types.
By default, Frobenius norm is used for arrays and matrices, which consists
on computing the square root of summation of all the squared elements within
a given matrix or array.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final NormType
Constant defining default norm type to be used. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic NormComputer
create()
Factory method.static NormComputer
Factory method.abstract double
getNorm
(double[] array) Computes norm of provided array.double
Computes norm of provided array and stores the jacobian into provided instance.abstract double
Computes norm of provided matrix.abstract NormType
Returns norm type being used by this class.
-
Field Details
-
DEFAULT_NORM_TYPE
Constant defining default norm type to be used.
-
-
Constructor Details
-
NormComputer
protected NormComputer()Constructor of this class.
-
-
Method Details
-
getNormType
Returns norm type being used by this class.- Returns:
- Norm type being used by this class.
-
getNorm
Computes norm of provided matrix.- Parameters:
m
- Matrix being used for norm computation.- Returns:
- Norm of provided matrix.
-
getNorm
public abstract double getNorm(double[] array) Computes norm of provided array.- Parameters:
array
- Array being used for norm computation.- Returns:
- Norm of provided vector.
-
getNorm
Computes norm of provided array and stores the jacobian into provided instance.- Parameters:
array
- array being used for norm computation.jacobian
- instance where jacobian will be stored. Must be 1xN, where N is length of array.- Returns:
- norm of provided vector.
- Throws:
WrongSizeException
- if provided jacobian is not 1xN, where N is length of array.
-
create
Factory method. Returns a new instance of NormComputer prepared to compute norms using provided NormType.- Parameters:
normType
- Norm type to be used by returned instance.- Returns:
- New instance of NormComputer.
-
create
Factory method. Returns a new instance of NormComputer prepared to compute norms using provided NormType.- Returns:
- New instance of NormComputer.
-