mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-02 00:02:38 +02:00
deleted list array
This commit is contained in:
parent
643c90010b
commit
cb0fb9d593
1 changed files with 6 additions and 3 deletions
|
|
@ -4,10 +4,13 @@
|
||||||
__updated__ = '2013-12-16'
|
__updated__ = '2013-12-16'
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from parameter_core import Observable
|
from parameter_core import Observable, Constrainable, Gradcheckable
|
||||||
|
|
||||||
class ParamList(list):
|
class ParamList(list):
|
||||||
|
"""
|
||||||
|
List to store ndarray-likes in.
|
||||||
|
It will look for 'is' instead of calling __eq__ on each element.
|
||||||
|
"""
|
||||||
def __contains__(self, other):
|
def __contains__(self, other):
|
||||||
for el in self:
|
for el in self:
|
||||||
if el is other:
|
if el is other:
|
||||||
|
|
@ -26,7 +29,7 @@ class ObservableArray(np.ndarray, Observable):
|
||||||
__array_priority__ = -1 # Never give back ObservableArray
|
__array_priority__ = -1 # Never give back ObservableArray
|
||||||
def __new__(cls, input_array):
|
def __new__(cls, input_array):
|
||||||
cls.__name__ = "ObservableArray\n "
|
cls.__name__ = "ObservableArray\n "
|
||||||
obj = super(ObservableArray, cls).__new__(cls, input_array).view(cls)
|
obj = np.atleast_1d(input_array).view(cls)
|
||||||
obj._observers_ = {}
|
obj._observers_ = {}
|
||||||
return obj
|
return obj
|
||||||
def __array_finalize__(self, obj):
|
def __array_finalize__(self, obj):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue