Class ErrorMessages
java.lang.Object
org.flag4j.util.ErrorMessages
Contains error messages for common errors which may occur.
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
equalShapeErrMsg
(Shape shape1, Shape shape2) Gets an error message for two tensors with mismatching shapes.static String
getArrayHasLengthErr
(int expLength, int actLength, String arrayName) Gets an error message for when an array does not have the expected length.static String
getArrayLengthsMismatchErr
(int... lengths) Gets an error message for arrays which were expected to be the same length.static String
getAxisErr
(int axis) Gets an error message for a disallowed axis.static String
getAxisErr
(int axis, int... allowedAxes) Gets an error message for a disallowed axis.static String
getGreaterEqErr
(double threshold, double value) Gets an error message for a value which was expected to be greater than of equal to a specified threshold but wasn't.static String
getIndicesRankErr
(int numIndices, int rank) Gets an error message for a tensor being indexed with a number of indices not equal to the rank of the tensor.static String
getLessEqErr
(double threshold, double value) Gets an error message for a value which was expected to be less than of equal to a specified threshold but wasn't.static String
getNamedGreaterEqErr
(double threshold, double value, String name) Gets an error message for a value which was expected to be greater than of equal to a specified threshold but wasn't.static String
getNamedLessEqErr
(double threshold, double value, String name) Gets an error message for a value which was expected to be less than of equal to a specified threshold but wasn't.static String
getNamedLessEqErr
(BigInteger threshold, double value, String name) Gets an error message for a value which was expected to be less than of equal to a specified threshold but wasn't.static String
getNegValueErr
(double value) Gets an error message for a negative value when a non-negative was expected.static String
getNonPosErr
(double value) Gets an error message for a non-positive value when a positive, non-zero value was expected.static String
getRangeErr
(double value, double lowerBound, double upperBound, String paramName) Gets an error message for a value which is not within the expected range.static String
getShapeTotalEntriesErr
(Shape shape1, Shape shape2) Gets an error message for two shapes which cannot be broadcast together.static String
getSquareShapeErr
(Shape shape) Gets an error message for a shape which was expected to be square but was notstatic String
Gets an error message for arrays which do not have the same total number of data.static String
Gets an error message for an attempted instantiation of a utility class.static String
Gets an error message for an attempted instantiation of a utility class.static String
matMultShapeErrMsg
(Shape shape1, Shape shape2) Gets an error message for two matrices with shapes not conducive with matrix multiplication.static String
negativeDimErrMsg
(int[] dims) Gets an error message for an attempted construction of a tensor with a negative dimension.static String
shapeEntriesError
(Shape shape, int numEntries) Gets an error message for a shape which cannot hold a specified number of data.static String
shapeRankErr
(int actRank, int expRank) Gets an error message for an incorrect shape.
-
Method Details
-
equalShapeErrMsg
-
matMultShapeErrMsg
Gets an error message for two matrices with shapes not conducive with matrix multiplication.- Parameters:
shape1
- The shape of the first matrix.shape2
- The shape of the second matrix.- Returns:
- An error message for matrices with shapes not conducive with matrix multiplication.
-
negativeDimErrMsg
Gets an error message for an attempted construction of a tensor with a negative dimension.- Parameters:
dims
- Shape of the tensor.- Returns:
- An error message for negative dimension.
-
getUtilityClassErrMsg
Gets an error message for an attempted instantiation of a utility class.- Returns:
- An error message for the attempted instantiation of a utility class.
-
getUtilityClassErrMsg
-
getNegValueErr
Gets an error message for a negative value when a non-negative was expected.- Parameters:
value
- Negative value.- Returns:
- An error message for a negative value.
-
getNonPosErr
Gets an error message for a non-positive value when a positive, non-zero value was expected.- Parameters:
value
- Non-positive value.- Returns:
- An error message for a Non-positive value.
-
getAxisErr
Gets an error message for a disallowed axis.- Parameters:
axis
- Negative value.allowedAxes
- An array containing allowed axes.- Returns:
- An error message for a disallowed axis.
-
getAxisErr
Gets an error message for a disallowed axis.- Parameters:
axis
- Negative value.- Returns:
- An error message for a disallowed axis.
-
shapeRankErr
Gets an error message for an incorrect shape.- Parameters:
actRank
- Actual rank of the shape.expRank
- Expected rank of the shape.- Returns:
- An error message for a shape object with wrong shape.
-
shapeEntriesError
-
getArrayLengthsMismatchErr
Gets an error message for arrays which were expected to be the same length.- Parameters:
lengths
- Lengths of arrays.- Returns:
- An error message for arrays which were expected to be the same length.
-
getIndicesRankErr
Gets an error message for a tensor being indexed with a number of indices not equal to the rank of the tensor.- Parameters:
numIndices
- Number of indices.rank
- Rank of the tensor.- Returns:
- An error message for a tensor being indexed with a number if indices not equal ot the rank of the tensor.
-
getShapeTotalEntriesErr
-
getTotalEntriesErr
Gets an error message for arrays which do not have the same total number of data.- Returns:
- An error message for arrays which do not have the same total number of data.
-
getGreaterEqErr
Gets an error message for a value which was expected to be greater than of equal to a specified threshold but wasn't.- Parameters:
threshold
- Threshold value.value
- Value expected to be greater than or equal to the threshold value.- Returns:
- An error message for a value which was expected to be greater than of equal to a specified threshold but wasn't.
-
getNamedGreaterEqErr
Gets an error message for a value which was expected to be greater than of equal to a specified threshold but wasn't.- Parameters:
threshold
- Threshold value.value
- Value expected to be greater than or equal to the threshold value.- Returns:
- An error message for a value which was expected to be greater than of equal to a specified threshold but wasn't.
-
getLessEqErr
Gets an error message for a value which was expected to be less than of equal to a specified threshold but wasn't.- Parameters:
threshold
- Threshold value.value
- Value expected to be less than or equal to the threshold value.- Returns:
- An error message for a value which was expected to be greater than of equal to a specified threshold but wasn't.
-
getNamedLessEqErr
Gets an error message for a value which was expected to be less than of equal to a specified threshold but wasn't.- Parameters:
threshold
- Threshold value.value
- Value expected to be less than or equal to the threshold value.- Returns:
- An error message for a value which was expected to be greater than of equal to a specified threshold but wasn't.
-
getNamedLessEqErr
Gets an error message for a value which was expected to be less than of equal to a specified threshold but wasn't.- Parameters:
threshold
- Threshold value.value
- Value expected to be less than or equal to the threshold value.- Returns:
- An error message for a value which was expected to be greater than of equal to a specified threshold but wasn't.
-
getSquareShapeErr
-
getRangeErr
public static String getRangeErr(double value, double lowerBound, double upperBound, String paramName) Gets an error message for a value which is not within the expected range.- Parameters:
value
- Value of interest.lowerBound
- Lower bound of expected range.upperBound
- Upper bound of expected range.paramName
- Name of the parameter which has the specifiedvalue
.- Returns:
- An error message for the parameter being out of the expected range.
-
getArrayHasLengthErr
Gets an error message for when an array does not have the expected length.- Parameters:
expLength
- Expected length of the array.actLength
- Actual length of the array.arrayName
- Name of the array parameter. May benull
if no name is desired.- Returns:
- An error message for when an array does not have the expected length.
-