LCOV - code coverage report
Current view: top level - source - Norm.cpp (source / functions) Hit Total Coverage
Test: LibForBES Unit Tests Lines: 11 12 91.7 %
Date: 2016-04-18 Functions: 3 4 75.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* 
       2             :  * File:   Norm.cpp
       3             :  * Author: chung
       4             :  * 
       5             :  * Created on October 30, 2015, 5:32 PM
       6             :  */
       7             : 
       8             : #include "Norm.h"
       9             : 
      10          36 : Norm::Norm() : Function() {
      11          36 : }
      12             : 
      13          35 : Norm::~Norm() {
      14          35 : }
      15             : 
      16          82 : int Norm::callConj(Matrix& x, double& f_star) {
      17             :     double dNorm;
      18          82 :     int status = dualNorm(x, dNorm);
      19          82 :     if (ForBESUtils::STATUS_OK != status) {
      20           0 :         return status;
      21             :     }
      22          82 :     if (dNorm <= 1) {
      23          81 :         f_star = 0.0;
      24             :     } else {
      25           1 :         f_star = INFINITY;
      26             :     }
      27          82 :     return ForBESUtils::STATUS_OK;
      28             : }
      29             : 
      30             : //LCOV_EXCL_START
      31             : int Norm::dualNorm(Matrix& x, double& norm) {
      32             :     /* 
      33             :      * Method dualNorm is to be reimplemented in derived classes (if at all),
      34             :      * otherwise, this method will return STATUS_UNDEFINED_FUNCTION.
      35             :      * Use the class's #category to tell whether this is implemented.
      36             :      * It is highly recommended to implement dualNorm for all Norms.
      37             :      */
      38             :     return ForBESUtils::STATUS_UNDEFINED_FUNCTION;
      39             : }
      40             : 
      41             : FunctionOntologicalClass Norm::category() {
      42             :     return FunctionOntologyRegistry::norm();
      43             : }
      44             : //LCOV_EXCL_STOP

Generated by: LCOV version 1.10