class documentation

This test suite tests various expressions that are used as dimension specifications.

There exists two usage cases where analyzing dimensions specifications are important.

In the first case, the size of output arrays must be defined based on the inputs to a Fortran function. Because Fortran supports arbitrary bases for indexing, for instance, arr(lower:upper), f2py has to evaluate an expression upper - lower + 1 where lower and upper are arbitrary expressions of input parameters. The evaluation is performed in C, so f2py has to translate Fortran expressions to valid C expressions (an alternative approach is that a developer specifies the corresponding C expressions in a .pyf file).

In the second case, when user provides an input array with a given size but some hidden parameters used in dimensions specifications need to be determined based on the input array size. This is a harder problem because f2py has to solve the inverse problem: find a parameter p such that upper(p) - lower(p) + 1 equals to the size of input array. In the case when this equation cannot be solved (e.g. because the input array size is wrong), raise an error before calling the Fortran function (that otherwise would likely crash Python process when the size of input arrays is wrong). f2py currently supports this case only when the equation is linear with respect to unknown parameter.

Method test_array_size Undocumented
Method test_inv_array_size Undocumented
Class Variable all_dimspecs Undocumented
Class Variable code Undocumented
Class Variable code_template Undocumented
Class Variable linear_dimspecs Undocumented
Class Variable lst Undocumented
Class Variable nonlinear_dimspecs Undocumented
Class Variable suffix Undocumented

Inherited from F2PyTest:

Method setup_method Undocumented
Class Variable only Undocumented
Class Variable options Undocumented
Class Variable skip Undocumented
Class Variable sources Undocumented
Instance Variable module Undocumented
Property module_name Undocumented
@pytest.mark.parametrize('dimspec', all_dimspecs)
def test_array_size(self, dimspec): (source)

Undocumented

@pytest.mark.parametrize('dimspec', all_dimspecs)
def test_inv_array_size(self, dimspec): (source)

Undocumented

all_dimspecs = (source)

Undocumented

code_template = (source)

Undocumented

linear_dimspecs: list[str] = (source)

Undocumented

Undocumented

nonlinear_dimspecs: list[str] = (source)

Undocumented