Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F62218018
main.cpp
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
Sat, May 11, 17:17
Size
1 KB
Mime Type
text/x-c
Expires
Mon, May 13, 17:17 (2 d)
Engine
blob
Format
Raw Data
Handle
17620692
Attached To
R9686 PCSCproject
main.cpp
View Options
//
// 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
Log In to Comment