Page MenuHomec4science

test_cond_number.hpp
No OneTemporary

File Metadata

Created
Mon, Nov 11, 14:59

test_cond_number.hpp

/*-------------------------------------------------------
- Module : test/micpsolver
- File : test_cond_number.hpp
- Author : Fabien Georget
Copyright (c) 2014, Fabien Georget, Princeton University
---------------------------------------------------------*/
#include <Eigen/Dense>
#include <cxxtest/TestSuite.h>
#include <iostream>
#include "micpsolver/estimate_cond_number.hpp"
class ConditionNumber : public CxxTest::TestSuite
{
public:
void test_condition_number_lower()
{
Eigen::MatrixXd mat(4,4);
mat << 1, 0, 0 , 0,
1, 1, 0, 0,
1, 1, 1, 0,
1, 1, 1, 1;
double cond = specmicp::micpsolver::estimate_condition_number(
mat.triangularView<Eigen::Lower>());
TS_ASSERT_EQUALS(cond, 4);
}
void test_condition_number_upper()
{
Eigen::MatrixXd mat(4,4);
mat << 1, 0, 0 , 0,
1, 1, 0, 0,
1, 1, 1, 0,
1, 1, 1, 1;
double cond = specmicp::micpsolver::estimate_condition_number(
mat.transpose().triangularView<Eigen::Upper>());
TS_ASSERT_EQUALS(cond, 4);
}
};

Event Timeline