Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F82676884
Vector.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
Thu, Sep 12, 19:54
Size
1 KB
Mime Type
text/x-c
Expires
Sat, Sep 14, 19:54 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
20730222
Attached To
rLAMMPS lammps
Vector.cpp
View Options
#include "DenseVector.h"
///////////////////////////////////////////////////////////////////////////////
//* performs a matrix-vector multiply with optional transposes BLAS version
void
MultMv
(
const
Matrix
<
double
>
&
A
,
const
Vector
<
double
>
&
v
,
DenseVector
<
double
>
&
c
,
const
bool
At
,
double
a
,
double
b
)
{
static
char
t
[
2
]
=
{
'N'
,
'T'
};
char
*
ta
=
t
+
At
;
int
sA
[
2
]
=
{
A
.
nRows
(),
A
.
nCols
()};
// sizes of A
int
sV
[
2
]
=
{
v
.
size
(),
1
};
// sizes of v
GCK
(
A
,
v
,
sA
[
!
At
]
!=
sV
[
0
],
"MultAB<double>: matrix-vector multiply"
);
if
(
c
.
size
()
!=
sA
[
At
])
{
c
.
resize
(
sA
[
At
]);
// set size of C to final size
c
.
zero
();
}
// get pointers to the matrix sizes needed by BLAS
int
*
M
=
sA
+
At
;
// # of rows in op[A] (op[A] = A' if At='T' else A)
int
*
N
=
sV
+
1
;
// # of cols in op[B]
int
*
K
=
sA
+!
At
;
// # of cols in op[A] or # of rows in op[B]
double
*
pa
=
A
.
get_ptr
(),
*
pv
=
v
.
get_ptr
(),
*
pc
=
c
.
get_ptr
();
#ifdef COL_STORAGE
dgemm_
(
ta
,
t
,
M
,
N
,
K
,
&
a
,
pa
,
sA
,
pv
,
sV
,
&
b
,
pc
,
M
);
#else
dgemm_
(
t
,
ta
,
N
,
M
,
K
,
&
a
,
pv
,
sV
+
1
,
pa
,
sA
+
1
,
&
b
,
pc
,
N
);
#endif
}
Event Timeline
Log In to Comment