Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F90701895
CG_Parallel.hpp
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
Mon, Nov 4, 00:08
Size
1 KB
Mime Type
text/x-c++
Expires
Wed, Nov 6, 00:08 (2 d)
Engine
blob
Format
Raw Data
Handle
22121645
Attached To
R8929 Conjugate Gradient Solver
CG_Parallel.hpp
View Options
//
// Created by shernand on 29/05/19.
//
/**
* @file CG_Serial.hpp
* @author Sergio Hernandez
* This file is part of the Conjugate Gradient Project
*
* This class implements the parallel version of the Conjugate Gradient
*
*/
#ifndef CG_SERIAL_CG_PARALLEL_HPP
#define CG_SERIAL_CG_PARALLEL_HPP
#include <tuple>
#include <vector>
#include <string>
class CG_Parallel {
public:
CG_Parallel(std::vector<double> const &matrixA, std::vector<double> const &vectorB, double const &tol, int const &maxIter);
void computeCG(std::vector<double> &x_0);
std::vector<double> vectorScalarMul(const std::vector<double> &pVector1, const double pScalar);
std::vector<double> vectorVectorSum(const std::vector<double> &pVector1, const std::vector<double> pVector2);
double vectorVectorDot(const std::vector<double> &pVector1, const std::vector<double> pVector2);
std::vector<double> matrixVector(const std::vector<double> &pMatrix, const std::vector<double> pVector);
void saveVector(std::string &filename);
//Getter and Setters methods
const std::vector<double> &getMatrixA() const;
void setMatrixA(const std::vector<double> &matrixA);
const std::vector<double> &getVectorB() const;
void setVectorB(const std::vector<double> &vectorB);
const std::vector<double> &getSolution() const;
void setSolution(const std::vector<double> &vectorSolution);
double getTol() const;
void setTol(double tol);
int getMaxIterations() const;
void setMaxIterations(int maxIterations);
int getNIterations() const;
void setNIterations(int nIterations);
private:
std::vector<double>matrixA;
std::vector<double>vectorB;
std::vector<double>vectorSolution;
double tol;
int max_iterations;
int n_iterations;
};
#endif //CG_SERIAL_CG_PARALLEL_HPP
Event Timeline
Log In to Comment