LCOV - code coverage report
Current view: top level - source - FunctionOntologyRegistry.cpp (source / functions) Hit Total Coverage
Test: LibForBES Unit Tests Lines: 25 25 100.0 %
Date: 2016-04-18 Functions: 10 10 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* 
       2             :  * File:   FunctionOntologyRegistry.cpp
       3             :  * Author: Pantelis Sopasakis
       4             :  * 
       5             :  * Created on October 28, 2015, 8:16 PM
       6             :  * 
       7             :  * ForBES is free software: you can redistribute it and/or modify
       8             :  * it under the terms of the GNU Lesser General Public License as published by
       9             :  * the Free Software Foundation, either version 3 of the License, or
      10             :  * (at your option) any later version.
      11             :  *  
      12             :  * ForBES is distributed in the hope that it will be useful,
      13             :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      14             :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
      15             :  * GNU Lesser General Public License for more details.
      16             :  * 
      17             :  * You should have received a copy of the GNU Lesser General Public License
      18             :  * along with ForBES. If not, see <http://www.gnu.org/licenses/>.
      19             :  */
      20             : 
      21             : #include "FunctionOntologyRegistry.h"
      22             : 
      23           6 : FunctionOntologicalClass FunctionOntologyRegistry::distance() {
      24             :     static bool defines_conjugate = false;
      25             :     static bool defines_conjugate_grad = false;
      26             :     static bool defines_f = true;
      27             :     static bool defines_grad = false;
      28             :     static bool defines_prox = false;
      29             :     static bool defines_hess = false;
      30             :     static bool defines_hess_conj = false;
      31             :     static FunctionOntologicalClass dist(
      32             :             defines_conjugate,
      33             :             defines_conjugate_grad,
      34             :             defines_f,
      35             :             defines_grad,
      36             :             defines_prox,
      37             :             defines_hess,
      38             :             defines_hess_conj,
      39             :             "Distance",
      40           6 :             function());
      41           6 :     return dist;
      42             : }
      43             : 
      44          43 : FunctionOntologicalClass FunctionOntologyRegistry::function() {
      45             :     /*
      46             :      * NOTE:
      47             :      * The lifetime of function static variables begins the first time 
      48             :      * the program flow encounters the declaration and it ends at program 
      49             :      * termination.
      50             :      */
      51          43 :     static FunctionOntologicalClass generic_function("Function");
      52          43 :     return generic_function;
      53             : }
      54             : 
      55          20 : FunctionOntologicalClass FunctionOntologyRegistry::indicator() {
      56             :     static bool defines_conjugate = false;
      57             :     static bool defines_conjugate_grad = false;
      58             :     static bool defines_f = true;
      59             :     static bool defines_grad = false;
      60             :     static bool defines_prox = true;
      61             :     static bool defines_hess = false;
      62             :     static bool defines_hess_conj = false;
      63             :     static FunctionOntologicalClass dist(
      64             :             defines_conjugate,
      65             :             defines_conjugate_grad,
      66             :             defines_f,
      67             :             defines_grad,
      68             :             defines_prox,
      69             :             defines_hess,
      70             :             defines_hess_conj,
      71             :             "Indicator",
      72          20 :             function());
      73          20 :     return dist;
      74             : }
      75             : 
      76          32 : FunctionOntologicalClass FunctionOntologyRegistry::loss() {
      77             :     static bool defines_conjugate = false;
      78             :     static bool defines_conjugate_grad = false;
      79             :     static bool defines_f = true;
      80             :     static bool defines_grad = true;
      81             :     static bool defines_prox = false;
      82             :     static bool defines_hess = false;
      83             :     static bool defines_hess_conj = false;
      84             :     static FunctionOntologicalClass loss(
      85             :             defines_conjugate,
      86             :             defines_conjugate_grad,
      87             :             defines_f,
      88             :             defines_grad,
      89             :             defines_prox,
      90             :             defines_hess,
      91             :             defines_hess_conj,
      92             :             "LossFunction",
      93          32 :             function());
      94          32 :     return loss;
      95             : }
      96             : 
      97          12 : FunctionOntologicalClass FunctionOntologyRegistry::norm() {
      98             :     static bool defines_conjugate = true;
      99             :     static bool defines_conjugate_grad = false;
     100             :     static bool defines_f = true;
     101             :     static bool defines_grad = false;
     102             :     static bool defines_prox = true;
     103             :     static bool defines_hess = false;
     104             :     static bool defines_hess_conj = false;
     105             :     static FunctionOntologicalClass norm(
     106             :             defines_conjugate,
     107             :             defines_conjugate_grad,
     108             :             defines_f,
     109             :             defines_grad,
     110             :             defines_prox,
     111             :             defines_hess,
     112             :             defines_hess_conj,
     113             :             "Norm",
     114          12 :             function());
     115          12 :     return norm;
     116             : }
     117             : 
     118          59 : FunctionOntologicalClass FunctionOntologyRegistry::quadratic() {
     119             :     static bool defines_conjugate = true;
     120             :     static bool defines_conjugate_grad = true;
     121             :     static bool defines_f = true;
     122             :     static bool defines_grad = true;
     123             :     static bool defines_prox = false;
     124             :     static bool defines_hess = false;
     125             :     static bool defines_hess_conj = false;
     126             :     static FunctionOntologicalClass quad(
     127             :             defines_conjugate,
     128             :             defines_conjugate_grad,
     129             :             defines_f,
     130             :             defines_grad,
     131             :             defines_prox,
     132             :             defines_hess,
     133             :             defines_hess_conj,
     134             :             "Quadratic",
     135          59 :             function());
     136          59 :     return quad;
     137             : }
     138             : 
     139          16 : FunctionOntologicalClass FunctionOntologyRegistry::conj_quadratic() {
     140             :     static bool defines_conjugate = true;
     141             :     static bool defines_conjugate_grad = true;
     142             :     static bool defines_f = false;
     143             :     static bool defines_grad = false;
     144             :     static bool defines_prox = false;
     145             :     static bool defines_hess = false;
     146             :     static bool defines_hess_conj = false;
     147             :     static FunctionOntologicalClass quad(
     148             :             defines_conjugate,
     149             :             defines_conjugate_grad,
     150             :             defines_f,
     151             :             defines_grad,
     152             :             defines_prox,
     153             :             defines_hess,
     154             :             defines_hess_conj,
     155             :             "ConjugateQuadratic",
     156          16 :             function());
     157          16 :     return quad;
     158             : }
     159             : 
     160           1 : string FunctionOntologyRegistry::nameSpace() {
     161           1 :     static string ns("fb");
     162           1 :     return ns;
     163          87 : }
     164             : 

Generated by: LCOV version 1.10