Line data Source code
1 : /*
2 : * File: FBProblem.h
3 : * Author: Lorenzo Stella
4 : * Author: Pantelis Sopasakis
5 : *
6 : * ForBES is free software: you can redistribute it and/or modify
7 : * it under the terms of the GNU Lesser General Public License as published by
8 : * the Free Software Foundation, either version 3 of the License, or
9 : * (at your option) any later version.
10 : *
11 : * ForBES is distributed in the hope that it will be useful,
12 : * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 : * GNU Lesser General Public License for more details.
15 : *
16 : * You should have received a copy of the GNU Lesser General Public License
17 : * along with ForBES. If not, see <http://www.gnu.org/licenses/>.
18 : */
19 :
20 : #include "FBProblem.h"
21 :
22 : #define QUADRATIC_NAME "Quadratic"
23 :
24 13 : void FBProblem::init() {
25 13 : m_f1 = NULL;
26 13 : m_f2 = NULL;
27 13 : m_g = NULL;
28 13 : m_L1 = NULL;
29 13 : m_L2 = NULL;
30 13 : m_d1 = NULL;
31 13 : m_d2 = NULL;
32 13 : m_lin = NULL;
33 13 : }
34 :
35 0 : FBProblem::FBProblem(
36 : Function& fun_f1,
37 : LinearOperator& L_1,
38 : Matrix& d_1,
39 : Function& fun_f2,
40 : LinearOperator& L_2,
41 : Matrix& d_2,
42 : Matrix& linear,
43 0 : Function& fun_g) {
44 0 : m_f1 = &fun_f1;
45 0 : m_L1 = &L_1;
46 0 : m_d1 = &d_1;
47 0 : m_f2 = &fun_f2;
48 0 : m_L2 = &L_2;
49 0 : m_d2 = &d_2;
50 0 : m_lin = &linear;
51 0 : m_g = &fun_g;
52 0 : }
53 :
54 7 : FBProblem::FBProblem(
55 : Function& fun_f,
56 : LinearOperator& L,
57 : Matrix& d,
58 7 : Function& fun_g) {
59 7 : init();
60 7 : if (fun_f.category().is_quadratic()) {
61 4 : m_f1 = &fun_f;
62 4 : m_L1 = &L;
63 4 : m_d1 = &d;
64 : } else {
65 3 : m_f2 = &fun_f;
66 3 : m_L2 = &L;
67 3 : m_d2 = &d;
68 : }
69 7 : m_g = &fun_g;
70 7 : }
71 :
72 1 : FBProblem::FBProblem(
73 : Function& fun_f,
74 : LinearOperator& L,
75 1 : Function& fun_g) {
76 1 : init();
77 1 : if (fun_f.category().is_quadratic()) {
78 1 : m_f1 = &fun_f;
79 1 : m_L1 = &L;
80 : } else {
81 0 : m_f2 = &fun_f;
82 0 : m_L2 = &L;
83 : }
84 1 : m_g = &fun_g;
85 1 : }
86 :
87 5 : FBProblem::FBProblem(
88 : Function& fun_f,
89 5 : Function& fun_g) {
90 5 : init();
91 5 : if (fun_f.category().is_quadratic()) {
92 4 : m_f1 = &fun_f;
93 : } else {
94 1 : m_f2 = &fun_f;
95 : }
96 5 : m_g = &fun_g;
97 5 : }
98 :
99 199950 : LinearOperator * FBProblem::L1() {
100 199950 : return m_L1;
101 : }
102 :
103 79127 : LinearOperator * FBProblem::L2() {
104 79127 : return m_L2;
105 : }
106 :
107 101168 : Matrix* FBProblem::d1() {
108 101168 : return m_d1;
109 : }
110 :
111 40512 : Matrix* FBProblem::d2() {
112 40512 : return m_d2;
113 : }
114 :
115 244336 : Function* FBProblem::f1() {
116 244336 : return m_f1;
117 : }
118 :
119 182798 : Function* FBProblem::f2() {
120 182798 : return m_f2;
121 : }
122 :
123 81139 : Function* FBProblem::g() {
124 81139 : return m_g;
125 : }
126 :
127 162272 : Matrix* FBProblem::lin() {
128 162272 : return m_lin;
129 : }
130 :
131 16 : FBProblem::~FBProblem() {
132 : // nothing to delete
133 31 : }
|