Page MenuHomec4science

main.cpp
No OneTemporary

File Metadata

Created
Sat, May 11, 17:17

main.cpp

//
// Created by lionel on 25.11.19.
//
#include <iostream>
#include <Eigen/Dense>
#include <vector>
/**
* This function will correspond to the rhs function g(t), where:
* @param t time at which it has to be computed
* @param dim dimension of the ODE system
* @param result reference to a Eigen::VectorXd where g(t) will be stored
* As it is now designed, it computes the values for a single time. This choice is motivated
* by the fact that we do not need to store the values of g(t) for all time steps, since we do
* not need them again once the integration step which concerns them has been performed.
* (do you agree?)
*/
void function(double t,int dim, Eigen::VectorXd& result);
int main(){
std::cout << "hello world" << std::endl;
Eigen::MatrixXd m(2,2);
Eigen::VectorXd v(2);
Eigen::Vector4d w;
v[0]=1.0,v[1]=2.0;
m(0,0)=1.0, m(0,1)=2.0,m(1,0)=1.5, m(1,1)=4.0;
w[0]=0,w[1]=1,w[2]=2,w[3]=3;
Eigen::VectorXd s(2);
function(2,2,s);
//std::cout<<s<<"\n";
void (*p_function)(double t, int dim,Eigen::VectorXd& result);
p_function=&function;
p_function(3,2,s);
std::cout<<s<<"\n";
std::vector<Eigen::VectorXd*> vec;
vec.push_back(&v);
vec.push_back(&s);
//std::cout<<*vec[0]<<"\n";
vec.erase(vec.begin());
std::cout<<*vec[0]<<"\n";
//std::cout<<*(*vec.begin())<<"\n";
auto k=m*v;
// std::cout<<k<<"\n";
}
void function(double t,int dim, Eigen::VectorXd& result){
result[0]=t;
result[1]=t*t;
}

Event Timeline