Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F73692645
condition_number.cpp
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 23, 18:26
Size
835 B
Mime Type
text/x-c
Expires
Thu, Jul 25, 18:26 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
19250048
Attached To
rSPECMICP SpecMiCP / ReactMiCP
condition_number.cpp
View Options
#include "catch.hpp"
#include <Eigen/Dense>
#include "micpsolver/estimate_cond_number.hpp"
TEST_CASE("Condition number") {
SECTION("Lower matrix") {
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>());
CHECK(cond == 4);
}
SECTION("Upper matrix") {
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>());
CHECK(cond == 4);
}
// TODO : more tests
}
Event Timeline
Log In to Comment