SEP Solver Library
1.0
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Macros
base
deriv.cpp
Go to the documentation of this file.
1
#include "
deriv.h
"
2
#include <iostream>
3
#include <cstdlib>
4
5
bool
SEP::Deriv::Forward
(
bool
add,
Vector
*model,
Vector
*data){
6
7
if
(!add) data->
zeroElement
();
8
9
float
*__restrict__ m = ((
dataInCoreFloat
*)model->
getDataContainer
())->getFloatPtr();
10
float
*__restrict__ d = ((
dataInCoreFloat
*)data->
getDataContainer
())->getFloatPtr();
11
12
inCoreFloat
*sp=(
inCoreFloat
*)model->
getSpace
();
//get n?
13
int
n=sp->
get_n123
();
14
15
for
(
int
i=0; i<n-1; i++){
16
d[i]+=m[i+1]-m[i];
17
}
18
19
return
true
;
20
}
21
22
23
bool
SEP::Deriv::Adjoint
(
bool
add,
Vector
*model,
Vector
*data){
24
25
if
(!add) model->
zeroElement
();
26
27
float
*__restrict__ m = ((
dataInCoreFloat
*)model->
getDataContainer
())->getFloatPtr();
28
float
*__restrict__ d = ((
dataInCoreFloat
*)data->
getDataContainer
())->getFloatPtr();
29
30
inCoreFloat
*sp=(
inCoreFloat
*)data->
getSpace
();
//get n?
31
int
n=sp->
get_n123
();
32
33
for
(
int
i=0; i<n-1; i++){
34
m[i+1]+=d[i];
35
m[i]-=d[i];
36
}
37
38
return
true
;
39
40
}
Generated by
1.8.4