diff options
author | David Luevano Alvarado <55825613+luevano@users.noreply.github.com> | 2020-02-25 20:42:15 -0700 |
---|---|---|
committer | David Luevano Alvarado <55825613+luevano@users.noreply.github.com> | 2020-02-25 20:42:15 -0700 |
commit | 2bdd175a6eb1f6edd8689987fef1a29fc1043da1 (patch) | |
tree | 3313b95c0c8d3fbe263a36ca6f3e6571e16442eb | |
parent | adbc889949b8399353ab166b5d9c15734f1f0bb8 (diff) |
Remove frobnorm, already in numpy
-rw-r--r-- | ml_exp/math.py | 29 |
1 files changed, 0 insertions, 29 deletions
diff --git a/ml_exp/math.py b/ml_exp/math.py index 781985118..e7c8dcabc 100644 --- a/ml_exp/math.py +++ b/ml_exp/math.py @@ -21,35 +21,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ import numpy as np -import math - - -def frob_norm(array): - """ - Calculates the frobenius norm of a given array or matrix. - array: array of data. - """ - - arr_sh_len = len(array.shape) - arr_range = range(len(array)) - fn = 0.0 - - # If it is a 'vector'. - if arr_sh_len == 1: - for i in arr_range: - fn += array[i]*array[i] - - return math.sqrt(fn) - - # If it is a matrix. - elif arr_sh_len == 2: - for i in arr_range: - for j in arr_range: - fn += array[i, j]*array[i, j] - - return math.sqrt(fn) - else: - print('Error. Array size greater than 2 ({}).'.format(arr_sh_len)) def cholesky_solve(K, y): |