Provide dynamic operations currying for Algebra<T> instead of eager calls and add JS code generation support #162

Merged
CommanderTvis merged 44 commits from feature/dynamic-ops-currying into dev 2021-01-05 16:36:51 +03:00
3 changed files with 3 additions and 2 deletions
Showing only changes of commit 9fbca45235 - Show all commits

View File

@ -12,6 +12,8 @@ internal class FieldVerifier<T>(override val algebra: Field<T>, a: T, b: T, c: T
super.verify()
algebra {
assertEquals(a + b, b + a, "Addition in $algebra is not commutative.")
assertEquals(a * b, b * a, "Multiplication in $algebra is not commutative.")
assertNotEquals(a / b, b / a, "Division in $algebra is not anti-commutative.")
assertNotEquals((a / b) / c, a / (b / c), "Division in $algebra is associative.")
assertEquals((a + b) / c, (a / c) + (b / c), "Division in $algebra is not right-distributive.")

View File

@ -10,7 +10,7 @@ internal open class RingVerifier<T>(override val algebra: Ring<T>, a: T, b: T, c
super.verify()
algebra {
assertEquals(a * b, a * b, "Multiplication in $algebra is not commutative.")
assertEquals(a + b, b + a, "Addition in $algebra is not commutative.")
assertEquals(a * b * c, a * (b * c), "Multiplication in $algebra is not associative.")
assertEquals(c * (a + b), (c * a) + (c * b), "Multiplication in $algebra is not distributive.")
assertEquals(a * one, one * a, "$one in $algebra is not a neutral multiplication element.")

View File

@ -15,7 +15,6 @@ internal open class SpaceVerifier<T>(
AlgebraicVerifier<T, Space<T>> {
override fun verify() {
algebra {
assertEquals(a + b, b + a, "Addition in $algebra is not commutative.")
assertEquals(a + b + c, a + (b + c), "Addition in $algebra is not associative.")
assertEquals(x * (a + b), x * a + x * b, "Addition in $algebra is not distributive.")
assertEquals((a + b) * x, a * x + b * x, "Addition in $algebra is not distributive.")