Skip to content

Commit

Permalink
Add docstring to matmul
Browse files Browse the repository at this point in the history
  • Loading branch information
DorianDepriester committed Dec 11, 2024
1 parent e38fcbe commit c47ee77
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions tests/test_ThermalExpansion.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,21 @@
coeff = np.array([[11, 12, 13], [12, 22, 23], [13, 23, 33]])
alpha = ThEx(coeff)

class MyTestCase(unittest.TestCase):
class TestThermalExpansion(unittest.TestCase):
def test_constructor_isotropic(self):
coeff = 23e-6
alpha = ThEx.isotropic(coeff)
eps = alpha * 1.0
np.testing.assert_almost_equal(eps.matrix, np.eye(3)*coeff)
temp = 25
eps = alpha * temp
np.testing.assert_almost_equal(eps.matrix, np.eye(3) * coeff * temp)

def test_monoclinic_mul(self):
n=50
rotations = Rotation.random(n)
alphas = alpha * rotations
temp = np.linspace(0,10,n)
eps = alphas * temp
assert eps.shape == (n,)
for i in range(n):
rot_mat = rotations[i].as_matrix()
rotated_strain_matrix = np.matmul(rot_mat.T, np.matmul(coeff, rot_mat)) * temp[i]
Expand Down

0 comments on commit c47ee77

Please sign in to comment.