Skip to content

Commit

Permalink
add getAngle judge
Browse files Browse the repository at this point in the history
  • Loading branch information
RoryuOu committed Jan 8, 2025
1 parent 7ec996e commit fde6bb4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion include/gwmodelpp/GTWR.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,11 @@ class GTWR : public GWRBase, public IBandwidthSelectable, public IParallelizabl
}

const double getAngle(){
return mStdistance->angle();
if (mStdistance != nullptr) {
return mStdistance->angle();
} else {
throw std::runtime_error("mStdistance is not initialized");
}
}

private:
Expand Down
1 change: 1 addition & 0 deletions test/testGTWR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ TEST_CASE("GTWR: londonhp100")
REQUIRE(algorithm.hasIntercept() == true);
////lambda=1
REQUIRE_THAT(algorithm.getLambda(), Catch::Matchers::WithinAbs(1.0, 1e-12));
REQUIRE_THAT(algorithm.getAngle(), Catch::Matchers::WithinAbs(arma::datum::pi / 2, 1e-12));
REQUIRE_THAT(diagnostic.AIC, Catch::Matchers::WithinAbs(2436.6044573089, 1e-8));
REQUIRE_THAT(diagnostic.AICc, Catch::Matchers::WithinAbs(2448.2720652516, 1e-8));
REQUIRE_THAT(diagnostic.RSquare, Catch::Matchers::WithinAbs(0.7080106320292, 1e-8));
Expand Down

0 comments on commit fde6bb4

Please sign in to comment.