analysis.py v 1.2.1.001

This commit is contained in:
ltcptgeneral 2020-05-12 20:19:58 -05:00
parent 55e22df665
commit 6d80ffca59

View File

@ -7,10 +7,14 @@
# current benchmark of optimization: 1.33 times faster # current benchmark of optimization: 1.33 times faster
# setup: # setup:
__version__ = "1.2.1.000" __version__ = "1.2.1.001"
# changelog should be viewed using print(analysis.__changelog__) # changelog should be viewed using print(analysis.__changelog__)
__changelog__ = """changelog: __changelog__ = """changelog:
1.2.1.001:
- added add, mul, neg, and inv functions to ArrayTest class
- added normalize function to ArrayTest class
- added dot and cross functions to ArrayTest class
1.2.1.000: 1.2.1.000:
- added ArrayTest class - added ArrayTest class
- added elementwise mean, median, standard deviation, variance, min, max functions to ArrayTest class - added elementwise mean, median, standard deviation, variance, min, max functions to ArrayTest class
@ -974,4 +978,44 @@ class ArrayTest(): # tests on nd arrays independent of basic_stats
_min = self.elementwise_npmin(*args) _min = self.elementwise_npmin(*args)
_max = self.elementwise_npmax(*args) _max = self.elementwise_npmax(*args)
return _mean, _median, _stdev, _variance, _min, _max return _mean, _median, _stdev, _variance, _min, _max
def normalize(self, array):
a = np.atleast_1d(np.linalg.norm(array))
a[a==0] = 1
return array / np.expand_dims(a)
def add(self, *args):
temp = np.array([])
for a in *args:
temp += a
return temp
def mul(self, *args):
temp = np.array([])
for a in *args:
temp *= a
return temp
def neg(self, array):
return -array
def inv(self, array):
return 1/array
def dot(self, a, b):
return np.dot(a, b)
def cross(self, a, b):
return np.cross(a, b)