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:...)
 
(Undo revision 12353 by Chruse Arroyo (Talk))
 
(3 intermediate revisions by 2 users not shown)
Line 16: Line 16:
  
 
<example>
 
<example>
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>
  

Latest revision as of 10:00, 30 November 2011

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.");