mirror of
https://github.com/Relintai/MLPP.git
synced 2025-02-10 16:10:06 +01:00
Added LinAlg.solve (to solve linear systems)
This commit is contained in:
parent
3a1a85da92
commit
5a1392bdd1
@ -34,7 +34,7 @@ class AutoEncoder{
|
||||
void forwardPass();
|
||||
|
||||
std::vector<std::vector<double>> inputSet;
|
||||
std::vector<std::vector<double>> y_hat; // This is your latent representation
|
||||
std::vector<std::vector<double>> y_hat;
|
||||
|
||||
std::vector<std::vector<double>> weights1;
|
||||
std::vector<std::vector<double>> weights2;
|
||||
|
@ -593,6 +593,10 @@ namespace MLPP{
|
||||
return a;
|
||||
}
|
||||
|
||||
std::vector<double> LinAlg::solve(std::vector<std::vector<double>> A, std::vector<double> b){
|
||||
return mat_vec_mult(inverse(A), b);
|
||||
}
|
||||
|
||||
void LinAlg::printMatrix(std::vector<std::vector<double>> A){
|
||||
for(int i = 0; i < A.size(); i++){
|
||||
for(int j = 0; j < A[i].size(); j++){
|
||||
|
@ -83,6 +83,8 @@ namespace MLPP{
|
||||
double sum_elements(std::vector<std::vector<double>> A);
|
||||
|
||||
std::vector<double> flatten(std::vector<std::vector<double>> A);
|
||||
|
||||
std::vector<double> solve(std::vector<std::vector<double>> A, std::vector<double> b);
|
||||
|
||||
void printMatrix(std::vector<std::vector<double>> A);
|
||||
|
||||
|
Binary file not shown.
1
main.cpp
1
main.cpp
@ -366,6 +366,7 @@ int main() {
|
||||
// alg.printMatrix(alg.diag({1,2,3,4,5}));
|
||||
// alg.printMatrix(alg.kronecker_product({{1,2,3,4,5}}, {{6,7,8,9,10}}));
|
||||
// alg.printMatrix(alg.matrixPower({{5,5},{5,5}}, 2));
|
||||
// alg.printVector(alg.solve({{1,1}, {1.5, 4.0}}, {2200, 5050}));
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user