Home | Trees | Indices | Help |
---|
|
1 # -*- coding: utf-8 -*- 2 """ 3 Created on Mon Nov 25 11:26:45 2013 4 5 Copyright (c) 2013-2014, CEA/DSV/I2BM/Neurospin. All rights reserved. 6 7 @author: Tommy Löfstedt 8 @email: tommy.loefstedt@cea.fr 9 @license: BSD 3-clause. 10 """ 11 import numpy as np 12 13 __all__ = ["TOLERANCE", "MAX_ITER", "FLOAT_EPSILON", "FLOAT_INF"] 14 15 # Settings 16 TOLERANCE = 5e-8 17 # TODO: MAX_ITER is heavily algorithm-dependent, so we have to think about if 18 # we should include a package-wide maximum at all. 19 MAX_ITER = 10000 20 #mu_zero = 5e-8 21 22 FLOAT_EPSILON = np.finfo(float).eps 23 24 FLOAT_INF = np.inf 25 26 27 ## TODO: This class should be replaced with Enum. 28 #class Info(object): 29 # """Enum-like class for information constants. 30 # 31 # Fields may _NOT_ be None. 32 # 33 # This class will be replaced with Enum, so do not rely on the actual values 34 # of the fields. Never use "ok", always use Info.ok. 35 # """ 36 # ok = "ok" # Did everything go well? 37 # converged = "converged" # Did the algorithm converge? 38 # num_iter = "num_iter" # Number of iterations. 39 # time = "time" # Time of e.g. every iteration. 40 # fvalue = "fvalue" # Function value at e.g. every iteration. 41 # gap = "gap" # The gap at e.g. every iteration. 42 # mu = "mu" # Smoothing constant at e.g. every iteration. 43 # bound = "bound" # Upper bound at e.g. every iteration. 44 # beta = "beta" # E.g. the start vector used. 45 46 47 #class UndefinedType(object): 48 # 49 # def __eq__(self, other): 50 # if isinstance(other, UndefinedType): 51 # return True 52 # else: 53 # return False 54 # 55 # def __ne__(self, other): 56 # return not self.__eq__(other) 57 # 58 # def __le__(self, other): 59 # return self.__eq__(other) 60 # 61 # def __ge__(self, other): 62 # return self.__eq__(other) 63 # 64 # def __lt__(self, other): 65 # return False # Same behaviour as None. 66 # 67 # def __gt__(self, other): 68 # return False # Same behaviour as None. 69 # 70 # def __cmp__(self, other): 71 # if self.__eq__(other): 72 # return 0 73 # else: 74 # return -1 # Same behaviour as None. 75 # 76 # def __str__(self): 77 # return "Undefined" 78 # 79 # def __repr__(self): 80 # return "Undefined" 81 # 82 # def __setattr__(self, name, value): 83 # if hasattr(self, name): 84 # raise AttributeError("'UndefinedType' object attribute '%s' is " \ 85 # "read-only." % (name,)) 86 # else: 87 # raise AttributeError("'UndefinedType' object has no attribute " \ 88 # "'%s'." % (name,)) 89 # 90 # def __getattr__(self, name): 91 # if hasattr(self, name): 92 # return super(UndefinedType, self).__getattr__(name) 93 # else: 94 # raise AttributeError("'UndefinedType' object has no attribute " \ 95 # "'%s'." % (name,)) 96 # 97 # def __delattr__(self, name): 98 # if hasattr(self, name): 99 # raise AttributeError("'UndefinedType' object attribute '%s' is " \ 100 # "read-only." % (name,)) 101 # else: 102 # raise AttributeError("'UndefinedType' object has no attribute " \ 103 # "'%s'." % (name,)) 104 # 105 # # Make it unhashable. We can't e.g. allow Undefined to be the key in a 106 # # dictionary. 107 # __hash__ = None 108 # 109 #Undefined = UndefinedType() 110
Home | Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Mon Apr 6 23:52:13 2015 | http://epydoc.sourceforge.net |