pysdic.check_same_problem#
- check_same_problem(objects)[source]#
Check that the objects of a
pysolvegnproblem (terms and parametrizations) work on the same analysis and the same unknowns, before giving them topysolvegn.solve.The objects are compared two by two, by identity: for each pair,
a.analysis is b.analysisanda.unknowns is b.unknowns, with an analysis of typepysdic.SDICAnalysisand unknowns of typepysdic.SDICUnknowns. Two different (even equivalent) objects are rejected: build all the objects of a problem with the same analysis object and the same unknowns object.pysolvegnonly sees functions: two terms built on different unknowns of the same size (e.g. the frame 1 and the frame 2) would be added without any error. This check makes this mistake explicit.- Parameters:
objects (Sequence) – The objects of the problem, each one with the properties
analysisandunknowns:pysdic.SDICCorrelationTerm,pysdic.SDICTemporalRegularizationTerm,pysdic.SDICFixedParametrization.- Raises:
TypeError – If
objectsis not a sequence, an object has noanalysisorunknowns, or they have a wrong type.ValueError – If
objectsis empty, or two objects have different analyses or different unknowns.
- Return type:
None
Examples
from pysdic import check_same_problem check_same_problem([correlation, regularization, parametrization]) result = pysolvegn.solve([correlation.term, regularization.term], parametrization.reparametrized_pack(), parametrization=parametrization.parametrization)