Skip to content

Commit

Permalink
Empty output, division by zero
Browse files Browse the repository at this point in the history
  • Loading branch information
horta committed Jun 28, 2019
1 parent 72251ba commit 38dcc31
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion glimix_core/_util/solve.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def heigvals(a, b, d):
D = a * d - b * b

t0 = T / 2
t1 = sqrt(T * T / 4 - D)
t1 = sqrt(maximum(T * T / 4 - D, 0))
eig0 = t0 + t1
eig1 = t0 - t1

Expand Down
5 changes: 4 additions & 1 deletion glimix_core/lmm/_lmm.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
)
from numpy.linalg import inv, lstsq, slogdet
from numpy_sugar import epsilon
from optimix import Function, Scalar

from glimix_core._util import cache, log2pi
from optimix import Function, Scalar

from .._util import economic_qs_zeros, numbers
from ._lmm_scan import FastScanner
Expand Down Expand Up @@ -140,6 +140,9 @@ def __init__(self, y, X, QS=None, restricted=False):
if not is_all_finite(y):
raise ValueError("There are non-finite values in the outcome.")

if len(y) == 0:
raise ValueError("The outcome array is empty.")

X = atleast_2d(asarray(X, float).T).T
if not is_all_finite(X):
raise ValueError("There are non-finite values in the covariates matrix.")
Expand Down

0 comments on commit 38dcc31

Please sign in to comment.