aboutsummaryrefslogtreecommitdiff
path: root/beliefs/utils/math_helper.py
diff options
context:
space:
mode:
authorCathy Yeh <cathy@driver.xyz>2017-11-13 14:42:52 -0800
committerCathy Yeh <cathy@driver.xyz>2017-11-17 13:48:16 -0800
commit77d8b323d4f6e05ca97d9cbef43ac85fd8040d61 (patch)
treebd589afff10efce13b6f017e544958454f3a8ef7 /beliefs/utils/math_helper.py
parent6a1b35f5bf122232d058ed0f3ea19c15629c0cbc (diff)
downloadbeliefs-77d8b323d4f6e05ca97d9cbef43ac85fd8040d61.tar.gz
beliefs-77d8b323d4f6e05ca97d9cbef43ac85fd8040d61.tar.bz2
beliefs-77d8b323d4f6e05ca97d9cbef43ac85fd8040d61.zip
copy scripts from lgs branch
Diffstat (limited to 'beliefs/utils/math_helper.py')
-rw-r--r--beliefs/utils/math_helper.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/beliefs/utils/math_helper.py b/beliefs/utils/math_helper.py
new file mode 100644
index 0000000..a25ea68
--- /dev/null
+++ b/beliefs/utils/math_helper.py
@@ -0,0 +1,19 @@
+"""Random math utils."""
+
+
+def is_kronecker_delta(vector):
+ """Returns True if vector is a kronecker delta vector, False otherwise.
+ Specific evidence ('YES' or 'NO') is a kronecker delta vector, whereas
+ virtual evidence ('MAYBE') is not.
+ """
+ count = 0
+ for x in vector:
+ if x == 1:
+ count += 1
+ elif x != 0:
+ return False
+
+ if count == 1:
+ return True
+ else:
+ return False