Difference between revisions of "AssertEqualsNumericalMatrix"

From ApCoCoAWiki
(New page: <command> <title>AssertEqualsNumericalMatrix</title> <short_description>Compares two numerical matrices.</short_description> <syntax> $apcocoa/ts/assert.AssertEqualsNumericalMatrix(Result:...)
 
Line 18: Line 18:
 
M:=Mat[[0.99,0.02],[0.00,0.98]];
 
M:=Mat[[0.99,0.02],[0.00,0.98]];
 
N:=Mat[[1,0],[0,1]];
 
N:=Mat[[1,0],[0,1]];
$apcocoa/ts/assert.AssertTrue(M, N, 0.1, "Result matrix is numerically not equal the expected matrix.");
+
$apcocoa/ts/assert.AssertTrue(M, N, 0.1, "Result matrix is numerically not equal to the expected matrix.");
 
</example>
 
</example>
  

Revision as of 17:44, 22 June 2010

AssertEqualsNumericalMatrix

Compares two numerical matrices.

Syntax

$apcocoa/ts/assert.AssertEqualsNumericalMatrix(Result: MAT, Expected: MAT, Eps: RAT, ErrMsg: STRING)

Description

This function compares two numerical matrices. Uses AssertEqualsNumericalNumber for every entry of the matrix 'Result' and its corresponding entry in 'Expected'. If the matrices are numerically not the same it throws an error and prints the error message 'ErrMsg'.

  • @param Result: The numerical matrix

  • @param Expected: The expected numerical matrix

  • @param Eps: Epsilon

  • @param ErrMsg: Error message

Example

M:=Mat[[0.99,0.02],[0.00,0.98]];
N:=Mat[[1,0],[0,1]];
$apcocoa/ts/assert.AssertTrue(M, N, 0.1, "Result matrix is numerically not equal to the expected matrix.");