close Warning: Can't synchronize with repository "(default)" (/var/svn/tolp does not appear to be a Subversion repository.). Look in the Trac log for more information.

Ticket #868: test.tol

File test.tol, 1.1 KB (added by Jorge, 15 years ago)
Line 
1Set triplet = {Set Include( "triplet.oza" )[1]};
2
3Set uniqueTriple = Classify( triplet, Real( Set a, Set b ) {
4    Real cmp1 = Compare(a[1],b[1]);
5    If( cmp1, cmp1, Compare( a[2],b[2] ) )
6 } );
7
8Real check_r =  284;
9Real check_c = 137;
10
11Set EvalSet( triplet, Real( Set cell ) {
12    Real If( cell[1] == check_r & cell[2] == check_c, {
13        WriteLn( "check cell in triplet = " << cell[ 3 ] );
14        0
15      }, 0 )
16  } );
17
18Real M = SetMax( EvalSet( triplet, Real( Set t ) { t[1] } ) );
19Real N = SetMax( EvalSet( triplet, Real( Set t ) { t[2] } ) );
20
21Real check1 = Eq( Card( uniqueTriple ), Card( triplet ) );
22
23Real check2 = If( check1, {
24    VMatrix A1 = Convert( Triplet( triplet, M, N ), "Cholmod.R.Sparse" );
25    Real cell1 = VMatDat( A1, check_r, check_c );
26    WriteLn( "check cell in A1 = " << cell1 );
27    VMatrix A2 = Convert( TripletUnique( SetMat(triplet), M, N ), "Cholmod.R.Sparse" );
28    Real cell2 = VMatDat( A2, check_r, check_c );
29    WriteLn( "check cell in A2 = " << cell2 );
30    VMatrix diff = A2 - A1;
31    Real VMatMax( Abs( diff ) )
32  }, 0 );
33
34WriteLn( "Max(Abs(diff)) = " << check2 );
35