Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F121623327
class_FixedVectorBlock.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, Jul 12, 13:59
Size
673 B
Mime Type
text/x-c
Expires
Mon, Jul 14, 13:59 (2 d)
Engine
blob
Format
Raw Data
Handle
27360975
Attached To
rDLMA Diffusion limited mixed aggregation
class_FixedVectorBlock.cpp
View Options
#include <Eigen/Core>
#include <iostream>
using
namespace
Eigen
;
using
namespace
std
;
template
<
typename
Derived
>
Eigen
::
VectorBlock
<
Derived
,
2
>
firstTwo
(
MatrixBase
<
Derived
>&
v
)
{
return
Eigen
::
VectorBlock
<
Derived
,
2
>
(
v
.
derived
(),
0
);
}
template
<
typename
Derived
>
const
Eigen
::
VectorBlock
<
const
Derived
,
2
>
firstTwo
(
const
MatrixBase
<
Derived
>&
v
)
{
return
Eigen
::
VectorBlock
<
const
Derived
,
2
>
(
v
.
derived
(),
0
);
}
int
main
(
int
,
char
**
)
{
Matrix
<
int
,
1
,
6
>
v
;
v
<<
1
,
2
,
3
,
4
,
5
,
6
;
cout
<<
firstTwo
(
4
*
v
)
<<
endl
;
// calls the const version
firstTwo
(
v
)
*=
2
;
// calls the non-const version
cout
<<
"Now the vector v is:"
<<
endl
<<
v
<<
endl
;
return
0
;
}
Event Timeline
Log In to Comment