Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F101936392
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, Feb 15, 08:32
Size
673 B
Mime Type
text/x-c
Expires
Mon, Feb 17, 08:32 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
24248987
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