Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F81319417
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
Thu, Sep 5, 08:18
Size
1 KB
Mime Type
text/x-c++
Expires
Sat, Sep 7, 08:18 (2 d)
Engine
blob
Format
Raw Data
Handle
20435021
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