25 lines
425 B
C++
25 lines
425 B
C++
#include "GeneralAlgorithm.hpp"
|
|
#include <armadillo>
|
|
#include <iostream>
|
|
|
|
double f(double x) {
|
|
return 100. * std::exp(-10.*x);
|
|
}
|
|
|
|
double a_sol(double x) {
|
|
return 1. - (1. - std::exp(-10)) * x - std::exp(-10*x);
|
|
}
|
|
|
|
int main() {
|
|
arma::mat A = arma::eye(3,3);
|
|
|
|
GeneralAlgorithm ga(3, &A, f, a_sol, 0., 1.);
|
|
|
|
ga.solve();
|
|
std::cout << "Time: " << ga.time(5) << std::endl;
|
|
ga.error();
|
|
|
|
return 0;
|
|
|
|
}
|