MCPcopy Create free account
hub / github.com/numpy/numpy / test_long_paths

Method test_long_paths

numpy/core/tests/test_einsum.py:1120–1141  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1118 self.assert_path_equal(path, ['einsum_path', (0, 1, 2, 3)])
1119
1120 def test_long_paths(self):
1121 # Long complex cases
1122
1123 # Long test 1
1124 long_test1 = self.build_operands('acdf,jbje,gihb,hfac,gfac,gifabc,hfac')
1125 path, path_str = np.einsum_path(*long_test1, optimize='greedy')
1126 self.assert_path_equal(path, ['einsum_path',
1127 (3, 6), (3, 4), (2, 4), (2, 3), (0, 2), (0, 1)])
1128
1129 path, path_str = np.einsum_path(*long_test1, optimize='optimal')
1130 self.assert_path_equal(path, ['einsum_path',
1131 (3, 6), (3, 4), (2, 4), (2, 3), (0, 2), (0, 1)])
1132
1133 # Long test 2
1134 long_test2 = self.build_operands('chd,bde,agbc,hiad,bdi,cgh,agdb')
1135 path, path_str = np.einsum_path(*long_test2, optimize='greedy')
1136 self.assert_path_equal(path, ['einsum_path',
1137 (3, 4), (0, 3), (3, 4), (1, 3), (1, 2), (0, 1)])
1138
1139 path, path_str = np.einsum_path(*long_test2, optimize='optimal')
1140 self.assert_path_equal(path, ['einsum_path',
1141 (0, 5), (1, 4), (3, 4), (1, 3), (1, 2), (0, 1)])
1142
1143 def test_edge_paths(self):
1144 # Difficult edge cases

Callers

nothing calls this directly

Calls 2

build_operandsMethod · 0.95
assert_path_equalMethod · 0.95

Tested by

no test coverage detected