MNP02/main.cpp
2018-05-02 15:52:42 +02:00

29 lines
742 B
C++

#include "matrix.h"
#include <iostream>
#include <utility>
const size_t N = 10;
std::pair<Matrix<double>, Matrix<double>> prepare(size_t index, size_t n) {
double a1, a2, a3;
a2 = a3 = -1;
a1 = 5 + (index / 100) % 10;
auto M = Matrix<double>::diag(n, a1)
+ Matrix<double>::diag(n, a2, 1) + Matrix<double>::diag(n, a2, -1)
+ Matrix<double>::diag(n, a3, 2) + Matrix<double>::diag(n, a3, -2);
Matrix<double> b(n, 1);
for (size_t i = 0; i < n; ++i) {
b(i, 0) = sin((i + 1)*((index / 1000) % 10 + 1));
}
return std::make_pair(M, b);
}
int main(int argc, const char argv[])
{
auto tuple = prepare(165581, N);
auto M = std::get<0>(tuple);
auto b = std::get<1>(tuple);
}