8d60cb0e1b7d501cf774039f55b450e26cceb26b,brian2/stateupdaters/exact.py,LinearStateUpdater,__call__,#LinearStateUpdater#Any#Any#Any#,94

Before Change


        // As every symbol in the matrix should be either in the namespace or
        // the specifiers dictionary, it should be sufficient to just check for
        // the presence of any non-constant specifiers.
        for spec in specifiers.itervalues():
            if (any(Symbol(spec.name) in element for element in matrix) and
                not getattr(spec, "constant", False)):
                raise ValueError(("The coefficient matrix for the equations "
                                 "contains "%s", which is not constant.") %
                                 spec.name)
        
        symbols = [Symbol(variable) for variable in variables]
        solution = sp.solve_linear_system(matrix.row_join(constants), *symbols)
        b = sp.Matrix([solution[symbol] for symbol in symbols]).transpose()
        

After Change


        // As every symbol in the matrix should be either in the namespace or
        // the specifiers dictionary, it should be sufficient to just check for
        // the presence of any non-constant specifiers.
        symbols = reduce(operator.add, (el.atoms() for el in matrix))
        // Only check true symbols, not numbers
        symbols = set([str(symbol) for symbol in symbols
                       if isinstance(symbol, Symbol)])

        for symbol in symbols:
            if symbol in specifiers and not getattr(specifiers[symbol],
                                                    "constant", False):
                raise ValueError(("The coefficient matrix for the equations "
                                 "contains "%s", which is not constant.") %
                                 symbol)
        
        symbols = [Symbol(variable, real=True) for variable in variables]
        solution = sp.solve_linear_system(matrix.row_join(constants), *symbols)
        b = sp.Matrix([solution[symbol] for symbol in symbols]).transpose()
        
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: brian-team/brian2
Commit Name: 8d60cb0e1b7d501cf774039f55b450e26cceb26b
Time: 2013-05-03
Author: marcel.stimberg@ens.fr
File Name: brian2/stateupdaters/exact.py
Class Name: LinearStateUpdater
Method Name: __call__


Project Name: matplotlib/matplotlib
Commit Name: 18b5c87e2318218ada9799a069c0b65fae0b1e28
Time: 2017-12-18
Author: anntzer.lee@gmail.com
File Name: lib/matplotlib/rcsetup.py
Class Name:
Method Name:


Project Name: markovmodel/PyEMMA
Commit Name: dbfe2afe79ac497075e50a3e569a1d63a346fb4d
Time: 2017-04-06
Author: m.scherer@fu-berlin.de
File Name: pyemma/_base/serialization/serialization.py
Class Name: SerializableMixIn
Method Name: _validate_interpolation_map