numpy.linalg.solve with right-hand side of more than three dimensions
问题 I'm trying to solve an equation system with a 3x3 matrix a and a right hand side b of arbitrary shape (3, ...) . If b has one or two dimensions, numpy.linalg.solve does the trick. It breaks down for more dimensions though: import numpy a = numpy.random.rand(3, 3) b = numpy.random.rand(3) numpy.linalg.solve(a, b) # okay b = numpy.random.rand(3, 4) numpy.linalg.solve(a, b) # okay b = numpy.random.rand(3, 4, 5) numpy.linalg.solve(a, b) # ERR ValueError: solve: Input operand 1 has a mismatch in