GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  MATH::GSL::TEST (3)

.ds Aq ’

NAME

Math::GSL::Test - Assertions and such

CONTENTS

SYNOPSIS



    use Math::GSL::Test qw/:all/;
    ok_similar($x,$y, $msg, $eps);



is_windows()

Returns true if current system is Windows-like.

    is_similar($x,$y;$eps,$similarity_function)



    is_similar($x,$y);
    is_similar($x, $y, 1e-7);
    is_similar($x,$y, 1e-3, sub { ... } );



Return true if $x and $y are within $eps of each other, i.e.



    abs($x-$y) <= $eps



If passed a code reference $similarity_function, it will pass $x and $y as parameters to it and will check to see if



    $similarity_function->($x,$y_) <= $eps



The default value of $eps is 1e-8. Don’t try sending anything to the Moon with this value...

verify( CW$results, CW$class)

Takes a hash reference of key/value pairs where the keys are bits of code, which when evaluated should be within some tolerance of the value. For example:



    my $results = {
                    gsl_cdf_ugaussian_P(2.0)        => [ 0.977250, 1e-5 ],
                    gsl_cdf_ugaussian_Q(2.0)        => [ 0.022750, 1e-7 ],
                    gsl_cdf_ugaussian_Pinv(0.977250)=> [ 2.000000 ],
                  };
    verify($results, Math::GSL::CDF);



When no tolerance is given, a value of 1e-8 = 0.00000001 is used. One may use $GSL_NAN and $GSL_INF in comparisons and this routine will use the gsl_isnan() and gsl_isinf() routines to compare them.

Note: Needing to pass in the class name is honky. This may change.

ok_status( CW$got_status; CW$expected_status )



    ok_status( $status );                  # defaults to checking for $GSL_SUCCESS

    ok_status( $status, $GSL_ECONTINUE );



Pass a test if the GSL status codes match, with a default expected status of $GSL_SUCCESS. This function also stringifies the status codes into meaningful messages when it fails.

    is_status_ok($status)



    is_status_ok( $status );



Return true if $status is $GSL_SUCCESS, false otherwise.

ok_similar( CW$x, CW$y, CW$msg, CW$eps)



    ok_similar( $x, $y);
    ok_similar( $x, $y, reason);
    ok_similar( $x, $y, reason, 1e-4);



Pass a test if is_similar($x,$y,$msg,$eps) is true, otherwise fail.

is_similar_relative( CW$x, CW$y, CW$msg, CW$eps )



    is_similar_relative($x, $y, $eps );



Returns true if $x has a relative error with repect to $y less than $eps. The current default for $eps is the same as is_similar(), i.e. 1e-8. This doesn’t seem very useful. What should the default be?

ok_similar_relative( CW$x, CW$y, CW$msg, CW$eps )



    ok_similar_relative($x, $y, $msg, $eps );



Pass a test if $x has a relative error with repect to $y less than $eps.

Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 MATH::GSL::TEST (3) 2016-04-03

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.