api / koma.util.validation

Package koma.util.validation

Types

Name Summary
ValidationContext class ValidationContext
A lambda receiver with state and convenience methods for validating a group of matrices.
Validator interface Validator
Callback used by ValidationContext after evaluating all rules. Subclass this if your validation plugin needs to hold all validation until the end.

Properties

Name Summary
max varValidationContext.max:Double
Maximum value for individual elements in the matrix.
min varValidationContext.min:Double
Minimum value for individual elements in the matrix.
symmetric valValidationContext.symmetric:ValidationContext
Require the current matrix to be symmetric.
transposable valValidationContext.transposable:ValidationContext
Accept a transposed version of the matrix as satisfying the dimensions check. For example, allow a 1 x 3 matrix when dimensions are declared as 3 x 1.

Functions

Name Summary
dim funValidationContext.dim(rows:Int, cols:Int):ValidationContext
Require the current matrix to have exactly the given number of rows and columns.funValidationContext.dim(rows:Int, cols:Char):ValidationContext
Require the current matrix to have exactly the given number of rows and match the number of columns with other dimensions in other matrices based on the cols variable name.funValidationContext.dim(rows:Char, cols:Int):ValidationContext
Require the current matrix to have exactly the given number of columns and match the number of rows with other dimensions in other matrices based on the rows variable name.funValidationContext.dim(rows:Char, cols:Char):ValidationContext
Require the current matrix's dimensions to correspond to the given variable names. Compares with other dimensions in other matrices in the context that are assigned the same variable name and raises an error if they don't all match.
max funValidationContext.max(value:Double):ValidationContext
Ensure all of the elements in the current matrix are >= the given value.
min funValidationContext.min(value:Double):ValidationContext
Ensure all of the elements in the current matrix are >= the given value.
symmetric funValidationContext.symmetric(precision:Double= 1e-5):ValidationContext
testMatrix fun testMatrix(matrix:Matrix<Double>):ValidationContext
Return a validation context that can be used to validate the given matrix with the default name of "matrix".fun testMatrix(matrix:Matrix<Double>, name:String):ValidationContext
Return a validation context that can be used to validate the given matrix with the given name.
validate fun validate(fn:ValidationContext.() ->Unit):Unit
Execute the given rules within a ValidationContext, letting you validate multiple matrices at once with interrelated dimensions, and return a list of matrices that match your validation rules.funMatrix<Double>.validate(fn:ValidationContext.() ->Unit):Unit
Use the given fn to validate a matrix. Return either the matrix itself or a copy that has been transformed to match the validation rules.funMatrix<Double>.validate(name:String, fn:ValidationContext.() ->Unit):Unit
Use the given fn to validate a matrix with the given name. Return either the matrix itself or a copy that has been transformed to match the validation rules.