Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F74908813
test_cond_number.hpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Tue, Jul 30, 08:22
Size
1 KB
Mime Type
text/x-c++
Expires
Thu, Aug 1, 08:22 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
19450212
Attached To
rSPECMICP SpecMiCP / ReactMiCP
test_cond_number.hpp
View Options
/*-------------------------------------------------------
- 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
Log In to Comment