SEP Solver Library
1.0
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Macros
base
matmul.cpp
Go to the documentation of this file.
1
#include "
matmul.h
"
2
3
bool
SEP::Matmul::Forward
(
bool
add,
Vector
*model,
Vector
*data){
4
5
if
(!add) data->
zeroElement
();
6
7
float
*__restrict__ m = ((
dataInCoreFloat
*)model->
getDataContainer
())->getFloatPtr();
8
float
*__restrict__ d = ((
dataInCoreFloat
*)data->
getDataContainer
())->getFloatPtr();
9
float
*__restrict__ A = ((
dataInCoreFloat
*)
matrix
->
getDataContainer
())->getFloatPtr();
10
11
//array= new float_2d(boost::extents[n1][n2]);
12
13
for
(
long
long
i=0; i<
n1
; i++) {
14
for
(
long
long
j=0; j<
n2
; j++) {
15
d[i] += A[i*n2+j]*m[j];
16
}
17
}
18
19
return
true
;
20
21
}
22
23
24
bool
SEP::Matmul::Adjoint
(
bool
add,
Vector
*model,
Vector
*data){
25
//std::cout<<"in matmul cpp";
26
if
(!add) model->
zeroElement
();
27
28
float
*__restrict__ m = ((
dataInCoreFloat
*)model->
getDataContainer
())->getFloatPtr();
29
float
*__restrict__ d = ((
dataInCoreFloat
*)data->
getDataContainer
())->getFloatPtr();
30
float
*__restrict__ A = ((
dataInCoreFloat
*)matrix->getDataContainer())->getFloatPtr();
31
32
for
(
long
long
i=0; i<n1; i++) {
33
for
(
long
long
j=0; j<n2; j++) {
34
m[j] += A[i*n2+j]*d[i];
35
}
36
}
37
38
return
false
;
39
40
}
Generated by
1.8.4