summaryrefslogtreecommitdiffstats
path: root/test_polymatrix
diff options
context:
space:
mode:
Diffstat (limited to 'test_polymatrix')
-rw-r--r--test_polymatrix/test_expression/test_addition.py9
-rw-r--r--test_polymatrix/test_expression/test_blockdiag.py9
-rw-r--r--test_polymatrix/test_expression/test_derivative.py11
-rw-r--r--test_polymatrix/test_expression/test_divergence.py10
-rw-r--r--test_polymatrix/test_expression/test_eval.py7
-rw-r--r--test_polymatrix/test_expression/test_linearin.py13
-rw-r--r--test_polymatrix/test_expression/test_matrixmult.py10
-rw-r--r--test_polymatrix/test_expression/test_quadraticin.py11
-rw-r--r--test_polymatrix/test_expression/test_substitude.py11
-rw-r--r--test_polymatrix/test_expression/test_subtractmonomials.py12
-rw-r--r--test_polymatrix/test_expression/test_sum.py8
-rw-r--r--test_polymatrix/test_expression/test_symmetric.py8
-rw-r--r--test_polymatrix/test_expression/test_toconstant.py10
-rw-r--r--test_polymatrix/test_expression/test_truncate.py11
-rw-r--r--test_polymatrix/test_expression/test_vstack.py9
-rw-r--r--test_polymatrix/test_tomatrixrepr.py8
16 files changed, 63 insertions, 94 deletions
diff --git a/test_polymatrix/test_expression/test_addition.py b/test_polymatrix/test_expression/test_addition.py
index 6c8a9a2..e3e7f05 100644
--- a/test_polymatrix/test_expression/test_addition.py
+++ b/test_polymatrix/test_expression/test_addition.py
@@ -1,8 +1,7 @@
import unittest
-from polymatrix.expression.init.initadditionexpr import init_addition_expr
from polymatrix.expressionstate.init.initexpressionstate import init_expression_state
-from polymatrix.expression.init.initfromtermsexpr import init_from_terms_expr
+import polymatrix.expression.initexpressionbase
class TestAddition(unittest.TestCase):
@@ -28,17 +27,17 @@ class TestAddition(unittest.TestCase):
},
}
- left = init_from_terms_expr(
+ left = polymatrix.expression.initexpressionbase.init_from_terms_expr(
terms=left_terms,
shape=(2, 2),
)
- right = init_from_terms_expr(
+ right = polymatrix.expression.initexpressionbase.init_from_terms_expr(
terms=right_terms,
shape=(2, 2),
)
- expr = init_addition_expr(
+ expr = polymatrix.expression.initexpressionbase.init_addition_expr(
left=left,
right=right,
)
diff --git a/test_polymatrix/test_expression/test_blockdiag.py b/test_polymatrix/test_expression/test_blockdiag.py
index a66935e..4a67c77 100644
--- a/test_polymatrix/test_expression/test_blockdiag.py
+++ b/test_polymatrix/test_expression/test_blockdiag.py
@@ -1,8 +1,7 @@
import unittest
-from polymatrix.expression.init.initblockdiagexpr import init_block_diag_expr
from polymatrix.expressionstate.init.initexpressionstate import init_expression_state
-from polymatrix.expression.init.initfromtermsexpr import init_from_terms_expr
+import polymatrix.expression.initexpressionbase
class TestBlockDiag(unittest.TestCase):
@@ -26,10 +25,10 @@ class TestBlockDiag(unittest.TestCase):
},
}
- expr = init_block_diag_expr(
+ expr = polymatrix.expression.initexpressionbase.init_block_diag_expr(
underlying=(
- init_from_terms_expr(terms=terms1, shape=(2, 2),),
- init_from_terms_expr(terms=terms2, shape=(2, 2),),
+ polymatrix.expression.initexpressionbase.init_from_terms_expr(terms=terms1, shape=(2, 2),),
+ polymatrix.expression.initexpressionbase.init_from_terms_expr(terms=terms2, shape=(2, 2),),
),
)
diff --git a/test_polymatrix/test_expression/test_derivative.py b/test_polymatrix/test_expression/test_derivative.py
index 27dfbeb..e8f551b 100644
--- a/test_polymatrix/test_expression/test_derivative.py
+++ b/test_polymatrix/test_expression/test_derivative.py
@@ -1,10 +1,7 @@
import unittest
-from polymatrix.expression.init.initderivativeexpr import init_derivative_expr
-from polymatrix.expression.init.initdivergenceexpr import init_divergence_expr
from polymatrix.expressionstate.init.initexpressionstate import init_expression_state
-from polymatrix.expression.init.initfromtermsexpr import init_from_terms_expr
-from polymatrix.expression.init.initlinearinexpr import init_linear_in_expr
+import polymatrix.expression.initexpressionbase
class TestDerivative(unittest.TestCase):
@@ -27,9 +24,9 @@ class TestDerivative(unittest.TestCase):
(2, 0): {((2, 1),): 1},
}
- expr = init_derivative_expr(
- underlying=init_from_terms_expr(terms=underlying_terms, shape=(2, 1)),
- variables=init_from_terms_expr(terms=variable_terms, shape=(3, 1),),
+ expr = polymatrix.expression.initexpressionbase.init_derivative_expr(
+ underlying=polymatrix.expression.initexpressionbase.init_from_terms_expr(terms=underlying_terms, shape=(2, 1)),
+ variables=polymatrix.expression.initexpressionbase.init_from_terms_expr(terms=variable_terms, shape=(3, 1),),
)
state = init_expression_state(n_param=3)
diff --git a/test_polymatrix/test_expression/test_divergence.py b/test_polymatrix/test_expression/test_divergence.py
index 387a30f..2d2b6ad 100644
--- a/test_polymatrix/test_expression/test_divergence.py
+++ b/test_polymatrix/test_expression/test_divergence.py
@@ -1,9 +1,7 @@
import unittest
-from polymatrix.expression.init.initdivergenceexpr import init_divergence_expr
from polymatrix.expressionstate.init.initexpressionstate import init_expression_state
-from polymatrix.expression.init.initfromtermsexpr import init_from_terms_expr
-from polymatrix.expression.init.initlinearinexpr import init_linear_in_expr
+import polymatrix.expression.initexpressionbase
class TestDivergence(unittest.TestCase):
@@ -30,9 +28,9 @@ class TestDivergence(unittest.TestCase):
(2, 0): {((2, 1),): 1},
}
- expr = init_divergence_expr(
- underlying=init_from_terms_expr(terms=underlying_terms, shape=(3, 1)),
- variables=init_from_terms_expr(terms=variable_terms, shape=(3, 1),),
+ expr = polymatrix.expression.initexpressionbase.init_divergence_expr(
+ underlying=polymatrix.expression.initexpressionbase.init_from_terms_expr(terms=underlying_terms, shape=(3, 1)),
+ variables=polymatrix.expression.initexpressionbase.init_from_terms_expr(terms=variable_terms, shape=(3, 1),),
)
state = init_expression_state(n_param=2)
diff --git a/test_polymatrix/test_expression/test_eval.py b/test_polymatrix/test_expression/test_eval.py
index 9b9454f..5787f2a 100644
--- a/test_polymatrix/test_expression/test_eval.py
+++ b/test_polymatrix/test_expression/test_eval.py
@@ -1,8 +1,7 @@
import unittest
-from polymatrix.expression.init.initevalexpr import init_eval_expr
from polymatrix.expressionstate.init.initexpressionstate import init_expression_state
-from polymatrix.expression.init.initfromtermsexpr import init_from_terms_expr
+import polymatrix.expression.initexpressionbase
class TestEval(unittest.TestCase):
@@ -19,8 +18,8 @@ class TestEval(unittest.TestCase):
},
}
- expr = init_eval_expr(
- underlying=init_from_terms_expr(terms=terms, shape=(2, 1)),
+ expr = polymatrix.expression.initexpressionbase.init_eval_expr(
+ underlying=polymatrix.expression.initexpressionbase.init_from_terms_expr(terms=terms, shape=(2, 1)),
variables=(0, 1),
values=(2.0, 3.0),
)
diff --git a/test_polymatrix/test_expression/test_linearin.py b/test_polymatrix/test_expression/test_linearin.py
index 572c34c..d0fb0d9 100644
--- a/test_polymatrix/test_expression/test_linearin.py
+++ b/test_polymatrix/test_expression/test_linearin.py
@@ -1,9 +1,8 @@
import unittest
-from polymatrix.expression.init.initfromsympyexpr import init_from_sympy_expr
+from polymatrix.expression.initexpressionbase import init_from_
from polymatrix.expressionstate.init.initexpressionstate import init_expression_state
-from polymatrix.expression.init.initfromtermsexpr import init_from_terms_expr
-from polymatrix.expression.init.initlinearinexpr import init_linear_in_expr
+import polymatrix.expression.initexpressionbase
class TestLinearIn(unittest.TestCase):
@@ -36,10 +35,10 @@ class TestLinearIn(unittest.TestCase):
(1, 0): {((1, 1),): 1},
}
- expr = init_linear_in_expr(
- underlying=init_from_terms_expr(terms=underlying_terms, shape=(2, 1)),
- monomials=init_from_terms_expr(terms=monomial_terms, shape=(4, 1),),
- variables=init_from_terms_expr(terms=variable_terms, shape=(2, 1),),
+ expr = polymatrix.expression.initexpressionbase.init_linear_in_expr(
+ underlying=polymatrix.expression.initexpressionbase.init_from_terms_expr(terms=underlying_terms, shape=(2, 1)),
+ monomials=polymatrix.expression.initexpressionbase.init_from_terms_expr(terms=monomial_terms, shape=(4, 1),),
+ variables=polymatrix.expression.initexpressionbase.init_from_terms_expr(terms=variable_terms, shape=(2, 1),),
)
state = init_expression_state(n_param=2)
diff --git a/test_polymatrix/test_expression/test_matrixmult.py b/test_polymatrix/test_expression/test_matrixmult.py
index 12d0584..b15f7eb 100644
--- a/test_polymatrix/test_expression/test_matrixmult.py
+++ b/test_polymatrix/test_expression/test_matrixmult.py
@@ -1,9 +1,7 @@
import unittest
-from polymatrix.expression.init.initadditionexpr import init_addition_expr
from polymatrix.expressionstate.init.initexpressionstate import init_expression_state
-from polymatrix.expression.init.initfromtermsexpr import init_from_terms_expr
-from polymatrix.expression.init.initmatrixmultexpr import init_matrix_mult_expr
+import polymatrix.expression.initexpressionbase
class TestMatrixMult(unittest.TestCase):
@@ -32,17 +30,17 @@ class TestMatrixMult(unittest.TestCase):
},
}
- left = init_from_terms_expr(
+ left = polymatrix.expression.initexpressionbase.init_from_terms_expr(
terms=left_terms,
shape=(2, 2),
)
- right = init_from_terms_expr(
+ right = polymatrix.expression.initexpressionbase.init_from_terms_expr(
terms=right_terms,
shape=(2, 1),
)
- expr = init_matrix_mult_expr(
+ expr = polymatrix.expression.initexpressionbase.init_matrix_mult_expr(
left=left,
right=right,
)
diff --git a/test_polymatrix/test_expression/test_quadraticin.py b/test_polymatrix/test_expression/test_quadraticin.py
index debf779..7f3767d 100644
--- a/test_polymatrix/test_expression/test_quadraticin.py
+++ b/test_polymatrix/test_expression/test_quadraticin.py
@@ -1,8 +1,7 @@
import unittest
from polymatrix.expressionstate.init.initexpressionstate import init_expression_state
-from polymatrix.expression.init.initfromtermsexpr import init_from_terms_expr
-from polymatrix.expression.init.initquadraticinexpr import init_quadratic_in_expr
+import polymatrix.expression.initexpressionbase
class TestQuadraticIn(unittest.TestCase):
@@ -35,10 +34,10 @@ class TestQuadraticIn(unittest.TestCase):
(1, 0): {((1, 1),): 1},
}
- expr = init_quadratic_in_expr(
- underlying=init_from_terms_expr(terms=underlying_terms, shape=(1, 1)),
- monomials=init_from_terms_expr(terms=monomial_terms, shape=(3, 1)),
- variables=init_from_terms_expr(terms=variable_terms, shape=(2, 1),),
+ expr = polymatrix.expression.initexpressionbase.init_quadratic_in_expr(
+ underlying=polymatrix.expression.initexpressionbase.init_from_terms_expr(terms=underlying_terms, shape=(1, 1)),
+ monomials=polymatrix.expression.initexpressionbase.init_from_terms_expr(terms=monomial_terms, shape=(3, 1)),
+ variables=polymatrix.expression.initexpressionbase.init_from_terms_expr(terms=variable_terms, shape=(2, 1),),
)
state = init_expression_state(n_param=2)
diff --git a/test_polymatrix/test_expression/test_substitude.py b/test_polymatrix/test_expression/test_substitude.py
index 457d35e..4a1f224 100644
--- a/test_polymatrix/test_expression/test_substitude.py
+++ b/test_polymatrix/test_expression/test_substitude.py
@@ -1,8 +1,7 @@
import unittest
from polymatrix.expressionstate.init.initexpressionstate import init_expression_state
-from polymatrix.expression.init.initfromtermsexpr import init_from_terms_expr
-from polymatrix.expression.init.initsubstituteexpr import init_substitute_expr
+import polymatrix.expression.initexpressionbase
class TestEval(unittest.TestCase):
@@ -28,10 +27,10 @@ class TestEval(unittest.TestCase):
(0, 0): {((0, 1),): 1},
}
- expr = init_substitute_expr(
- underlying=init_from_terms_expr(terms=terms, shape=(1, 1)),
- variables=init_from_terms_expr(terms=variable_terms, shape=(1, 1),),
- values=(init_from_terms_expr(terms=substitution, shape=(1, 1)),),
+ expr = polymatrix.expression.initexpressionbase.init_substitute_expr(
+ underlying=polymatrix.expression.initexpressionbase.init_from_terms_expr(terms=terms, shape=(1, 1)),
+ variables=polymatrix.expression.initexpressionbase.init_from_terms_expr(terms=variable_terms, shape=(1, 1),),
+ values=(polymatrix.expression.initexpressionbase.init_from_terms_expr(terms=substitution, shape=(1, 1)),),
)
state = init_expression_state(n_param=2)
diff --git a/test_polymatrix/test_expression/test_subtractmonomials.py b/test_polymatrix/test_expression/test_subtractmonomials.py
index 8cd8585..77fcc84 100644
--- a/test_polymatrix/test_expression/test_subtractmonomials.py
+++ b/test_polymatrix/test_expression/test_subtractmonomials.py
@@ -1,11 +1,7 @@
import unittest
-from polymatrix.expression.init.initderivativeexpr import init_derivative_expr
-from polymatrix.expression.init.initdivergenceexpr import init_divergence_expr
from polymatrix.expressionstate.init.initexpressionstate import init_expression_state
-from polymatrix.expression.init.initfromtermsexpr import init_from_terms_expr
-from polymatrix.expression.init.initlinearinexpr import init_linear_in_expr
-from polymatrix.expression.init.initsubtractmonomialsexpr import init_subtract_monomials_expr
+import polymatrix.expression.initexpressionbase
class TestDerivative(unittest.TestCase):
@@ -29,9 +25,9 @@ class TestDerivative(unittest.TestCase):
},
}
- expr = init_subtract_monomials_expr(
- underlying=init_from_terms_expr(terms=monomials1, shape=(2, 1)),
- monomials=init_from_terms_expr(terms=monomials2, shape=(2, 1)),
+ expr = polymatrix.expression.initexpressionbase.init_subtract_monomials_expr(
+ underlying=polymatrix.expression.initexpressionbase.init_from_terms_expr(terms=monomials1, shape=(2, 1)),
+ monomials=polymatrix.expression.initexpressionbase.init_from_terms_expr(terms=monomials2, shape=(2, 1)),
)
state = init_expression_state(n_param=3)
diff --git a/test_polymatrix/test_expression/test_sum.py b/test_polymatrix/test_expression/test_sum.py
index 053e428..27c4766 100644
--- a/test_polymatrix/test_expression/test_sum.py
+++ b/test_polymatrix/test_expression/test_sum.py
@@ -1,9 +1,7 @@
import unittest
-from polymatrix.expression.init.initevalexpr import init_eval_expr
from polymatrix.expressionstate.init.initexpressionstate import init_expression_state
-from polymatrix.expression.init.initfromtermsexpr import init_from_terms_expr
-from polymatrix.expression.init.initsumexpr import init_sum_expr
+import polymatrix.expression.initexpressionbase
class TestSum(unittest.TestCase):
@@ -20,8 +18,8 @@ class TestSum(unittest.TestCase):
},
}
- expr = init_sum_expr(
- underlying=init_from_terms_expr(terms=terms, shape=(1, 2)),
+ expr = polymatrix.expression.initexpressionbase.init_sum_expr(
+ underlying=polymatrix.expression.initexpressionbase.init_from_terms_expr(terms=terms, shape=(1, 2)),
)
state = init_expression_state(n_param=2)
diff --git a/test_polymatrix/test_expression/test_symmetric.py b/test_polymatrix/test_expression/test_symmetric.py
index a93d975..5313ff1 100644
--- a/test_polymatrix/test_expression/test_symmetric.py
+++ b/test_polymatrix/test_expression/test_symmetric.py
@@ -1,9 +1,7 @@
import unittest
from polymatrix.expressionstate.init.initexpressionstate import init_expression_state
-from polymatrix.expression.init.initfromtermsexpr import init_from_terms_expr
-from polymatrix.expression.init.initquadraticinexpr import init_quadratic_in_expr
-from polymatrix.expression.init.initsymmetricexpr import init_symmetric_expr
+import polymatrix.expression.initexpressionbase
class TestQuadraticIn(unittest.TestCase):
@@ -22,12 +20,12 @@ class TestQuadraticIn(unittest.TestCase):
},
}
- underlying = init_from_terms_expr(
+ underlying = polymatrix.expression.initexpressionbase.init_from_terms_expr(
terms=terms,
shape=(2, 2),
)
- expr = init_symmetric_expr(
+ expr = polymatrix.expression.initexpressionbase.init_symmetric_expr(
underlying=underlying,
)
diff --git a/test_polymatrix/test_expression/test_toconstant.py b/test_polymatrix/test_expression/test_toconstant.py
index f3a0643..c85c482 100644
--- a/test_polymatrix/test_expression/test_toconstant.py
+++ b/test_polymatrix/test_expression/test_toconstant.py
@@ -1,11 +1,7 @@
import unittest
from polymatrix.expressionstate.init.initexpressionstate import init_expression_state
-from polymatrix.expression.init.initfromtermsexpr import init_from_terms_expr
-from polymatrix.expression.init.initquadraticinexpr import init_quadratic_in_expr
-from polymatrix.expression.init.initsymmetricexpr import init_symmetric_expr
-from polymatrix.expression.init.inittoconstantexpr import init_to_constant_expr
-from polymatrix.expression.init.inittruncateexpr import init_truncate_expr
+import polymatrix.expression.initexpressionbase
class TestToConstant(unittest.TestCase):
@@ -27,8 +23,8 @@ class TestToConstant(unittest.TestCase):
},
}
- expr = init_to_constant_expr(
- underlying=init_from_terms_expr(terms=terms, shape=(2, 2)),
+ expr = polymatrix.expression.initexpressionbase.init_to_constant_expr(
+ underlying=polymatrix.expression.initexpressionbase.init_from_terms_expr(terms=terms, shape=(2, 2)),
)
state = init_expression_state(n_param=2)
diff --git a/test_polymatrix/test_expression/test_truncate.py b/test_polymatrix/test_expression/test_truncate.py
index d6cafbe..c73e98d 100644
--- a/test_polymatrix/test_expression/test_truncate.py
+++ b/test_polymatrix/test_expression/test_truncate.py
@@ -1,10 +1,7 @@
import unittest
from polymatrix.expressionstate.init.initexpressionstate import init_expression_state
-from polymatrix.expression.init.initfromtermsexpr import init_from_terms_expr
-from polymatrix.expression.init.initquadraticinexpr import init_quadratic_in_expr
-from polymatrix.expression.init.initsymmetricexpr import init_symmetric_expr
-from polymatrix.expression.init.inittruncateexpr import init_truncate_expr
+import polymatrix.expression.initexpressionbase
class TestTruncate(unittest.TestCase):
@@ -30,9 +27,9 @@ class TestTruncate(unittest.TestCase):
}
- expr = init_truncate_expr(
- underlying=init_from_terms_expr(terms=terms, shape=(2, 2)),
- variables=init_from_terms_expr(terms=variable_terms, shape=(2, 1),),
+ expr = polymatrix.expression.initexpressionbase.init_truncate_expr(
+ underlying=polymatrix.expression.initexpressionbase.init_from_terms_expr(terms=terms, shape=(2, 2)),
+ variables=polymatrix.expression.initexpressionbase.init_from_terms_expr(terms=variable_terms, shape=(2, 1),),
degrees=(1, 2),
)
diff --git a/test_polymatrix/test_expression/test_vstack.py b/test_polymatrix/test_expression/test_vstack.py
index 8778f8a..27e52f9 100644
--- a/test_polymatrix/test_expression/test_vstack.py
+++ b/test_polymatrix/test_expression/test_vstack.py
@@ -1,8 +1,7 @@
import unittest
from polymatrix.expressionstate.init.initexpressionstate import init_expression_state
-from polymatrix.expression.init.initfromtermsexpr import init_from_terms_expr
-from polymatrix.expression.init.initvstackexpr import init_v_stack_expr
+import polymatrix.expression.initexpressionbase
class TestVStack(unittest.TestCase):
@@ -26,10 +25,10 @@ class TestVStack(unittest.TestCase):
},
}
- expr = init_v_stack_expr(
+ expr = polymatrix.expression.initexpressionbase.init_v_stack_expr(
underlying=(
- init_from_terms_expr(terms=terms1, shape=(2, 2),),
- init_from_terms_expr(terms=terms2, shape=(2, 2),),
+ polymatrix.expression.initexpressionbase.init_from_terms_expr(terms=terms1, shape=(2, 2),),
+ polymatrix.expression.initexpressionbase.init_from_terms_expr(terms=terms2, shape=(2, 2),),
),
)
diff --git a/test_polymatrix/test_tomatrixrepr.py b/test_polymatrix/test_tomatrixrepr.py
index 88a35f2..dc023ca 100644
--- a/test_polymatrix/test_tomatrixrepr.py
+++ b/test_polymatrix/test_tomatrixrepr.py
@@ -1,9 +1,7 @@
import unittest
-import polymatrix
+import polymatrix.expression.initexpressionbase
from polymatrix.expressionstate.init.initexpressionstate import init_expression_state
-from polymatrix.expression.init.initfromtermsexpr import init_from_terms_expr
-from polymatrix.expression.init.initlinearinexpr import init_linear_in_expr
class TestToMatrixRepr(unittest.TestCase):
@@ -29,12 +27,12 @@ class TestToMatrixRepr(unittest.TestCase):
(1, 0): {((1, 1),): 1},
}
- expr = init_from_terms_expr(terms=underlying_terms, shape=(3, 1))
+ expr = polymatrix.expression.initexpressionbase.init_from_terms_expr(terms=underlying_terms, shape=(3, 1))
state = init_expression_state(n_param=2)
state, result = polymatrix.to_matrix_repr(
(expr,),
- init_from_terms_expr(terms=variable_terms, shape=(2, 1),),
+ polymatrix.expression.initexpressionbase.init_from_terms_expr(terms=variable_terms, shape=(2, 1),),
).apply(state)
A0 = result.data[0][0]