SEP Solver Library  1.0
 All Classes Namespaces Files Functions Variables Typedefs Macros
Operator.cpp
Go to the documentation of this file.
1 #include "Operator.h"
2 #include <math.h>
3 #include <stdio.h>
4 #include <iostream>
5 
6 using namespace std;
7 
11  domain=dom;
12  }
13 
17  range=ran;
18  }
19 
20 /*
21 void SEP::Map::checkLogic(Vector *model,Vector *data){
22 
23 
24  if(returnDomain()!=model->getSpace()){
25  e<<"The domains of operator model vector not the same";
26  throw e;
27  }
28  if(returnRange()!=data->getSpace()){
29  e<<"The range of operator model vector not the same";
30  throw e;
31  }
32 
33 }
34 */
35 
36 bool SEP::Operator::DotTest(bool verb/*, Space *dom, Space *ran*/){
39 
40  Vector m1(domain);//=new Vector(domain);
41  Vector d1(range);//=new Vector(range);
42  Vector m2(domain);//=new Vector(domain);
43  Vector d2(range);//=new Vector(range);
44 
45  m1.random();
46  d2.random();
47 
48  Forward(false,&m1,&d1);
49 
50  double dot1=d1.innerProd(d2);
51 
52  Adjoint(false,&m2,&d2);
53  double dot2=m2.innerProd(m1);
54 
55  if(verb) std::cout<<"Dot product test with add=false: \n"<<dot1<<"\n"<<dot2<<"\n";
56 
57  Forward(true,&m1,&d1);
58  double dot3=d1.innerProd(d2);
59 
60  Adjoint(true,&m2,&d2);
61  double dot4=m2.innerProd(m1);
62 
63  if(verb) std::cout<<"Dot product test with add=true: \n"<<dot3<<"\n"<<dot4<<"\n";
64 
65  return true;
66 }
67 
68