|
FUNCTION derive_function_domain (func : maths_function) : tuple_space; LOCAL typenames : SET OF STRING := stripped_typeof ( func ) ; tspace : tuple_space := make_listed_product_space ( [ ] ) ; shape : LIST OF positive_integer ; sidxs : LIST OF INTEGER := [ 0 ] ; itvl : finite_integer_interval ; factors : LIST OF finite_integer_interval := [ ] ; is_uniform : BOOLEAN := TRUE ; END_LOCAL ; IF 'finite_function' IN typenames THEN RETURN ( derive_finite_function_domain ( func \ finite_function . pairs ) ) ; END_IF ; IF 'constant_function' IN typenames THEN RETURN ( domain_from ( func \ constant_function . source_of_domain ) ) ; END_IF ; IF 'selector_function' IN typenames THEN RETURN ( domain_from ( func \ selector_function . source_of_domain ) ) ; END_IF ; IF 'elementary_function' IN typenames THEN RETURN ( derive_elementary_function_domain ( func \ elementary_function . func_id ) ) ; END_IF ; IF 'restriction_function' IN typenames THEN RETURN ( one_tuples_of ( func \ restriction_function . operand ) ) ; END_IF ; IF 'repackaging_function' IN typenames THEN IF func \ repackaging_function . input_repack = ro_nochange THEN RETURN ( func \ repackaging_function . operand . domain ) ; END_IF ; IF func \ repackaging_function . input_repack = ro_wrap_as_tuple THEN RETURN ( factor1 ( func \ repackaging_function . operand . domain ) ) ; END_IF ; IF func \ repackaging_function . input_repack = ro_unwrap_tuple THEN RETURN ( one_tuples_of ( func \ repackaging_function . operand . domain ) ) ; END_IF ; RETURN ( ? ) ; END_IF ; IF 'reindexed_array_function' IN typenames THEN shape := shape_of_array ( func \ unary_generic_expression . operand ) ; sidxs := func \ reindexed_array_function . starting_indices ; REPEAT i := 1 TO SIZEOF ( shape ) ; itvl := make_finite_integer_interval ( sidxs [ i ] , sidxs [ i ] + shape [ i ] - 1 ) ; INSERT ( factors , itvl , i - 1 ) ; IF shape [ i ] <> shape [ 1 ] THEN is_uniform := FALSE ; END_IF ; END_REPEAT ; IF is_uniform THEN RETURN ( make_uniform_product_space ( factors [ 1 ] , SIZEOF ( shape ) ) ) ; END_IF ; RETURN ( make_listed_product_space ( factors ) ) ; END_IF ; IF 'series_composed_function' IN typenames THEN RETURN ( func \ series_composed_function . operands [ 1 ] . domain ) ; END_IF ; IF 'parallel_composed_function' IN typenames THEN RETURN ( domain_from ( func \ parallel_composed_function . source_of_domain ) ) ; END_IF ; IF 'explicit_table_function' IN typenames THEN shape := func \ explicit_table_function . shape ; sidxs [ 1 ] := func \ explicit_table_function . index_base ; REPEAT i := 1 TO SIZEOF ( shape ) ; itvl := make_finite_integer_interval ( sidxs [ 1 ] , sidxs [ 1 ] + shape [ i ] - 1 ) ; INSERT ( factors , itvl , i - 1 ) ; IF shape [ i ] <> shape [ 1 ] THEN is_uniform := FALSE ; END_IF ; END_REPEAT ; IF is_uniform THEN RETURN ( make_uniform_product_space ( factors [ 1 ] , SIZEOF ( shape ) ) ) ; END_IF ; RETURN ( make_listed_product_space ( factors ) ) ; END_IF ; IF 'homogeneous_linear_function' IN typenames THEN RETURN ( one_tuples_of ( make_uniform_product_space ( factor1 ( func \ homogeneous_linear_function . mat . range ) , func \ homogeneous_linear_function . mat \ explicit_table_function . shape [ func \ homogeneous_linear_function . sum_index ] ) ) ) ; END_IF ; IF 'general_linear_function' IN typenames THEN RETURN ( one_tuples_of ( make_uniform_product_space ( factor1 ( func \ general_linear_function . mat . range ) , func \ general_linear_function . mat \ explicit_table_function . shape [ func \ general_linear_function . sum_index ] - 1 ) ) ) ; END_IF ; IF 'b_spline_basis' IN typenames THEN RETURN ( one_tuples_of ( make_finite_real_interval ( func \ b_spline_basis . repeated_knots [ func \ b_spline_basis . order ] , closed , func \ b_spline_basis . repeated_knots [ func \ b_spline_basis . num_basis + 1 ] , closed ) ) ) ; END_IF ; IF 'b_spline_function' IN typenames THEN REPEAT i := 1 TO SIZEOF ( func \ b_spline_function . basis ) ; tspace := assoc_product_space ( tspace , func \ b_spline_function . basis [ i ] . domain ) ; END_REPEAT ; RETURN ( one_tuples_of ( tspace ) ) ; END_IF ; IF 'rationalize_function' IN typenames THEN RETURN ( func \ rationalize_function . fun . domain ) ; END_IF ; IF 'partial_derivative_function' IN typenames THEN RETURN ( func \ partial_derivative_function . derivand . domain ) ; END_IF ; IF 'definite_integral_function' IN typenames THEN RETURN ( derive_definite_integral_domain ( func ) ) ; END_IF ; IF 'abstracted_expression_function' IN typenames THEN REPEAT i := 1 TO SIZEOF ( func \ abstracted_expression_function . variables ) ; tspace := assoc_product_space ( tspace , one_tuples_of ( values_space_of ( func \ abstracted_expression_function . variables [ i ] ) ) ) ; END_REPEAT ; RETURN ( tspace ) ; END_IF ; IF 'expression_denoted_function' IN typenames THEN RETURN ( values_space_of ( func \ expression_denoted_function . expr ) \ function_space . domain_argument ) ; END_IF ; IF 'imported_point_function' IN typenames THEN RETURN ( one_tuples_of ( make_listed_product_space ( [ ] ) ) ) ; END_IF ; IF 'imported_curve_function' IN typenames THEN RETURN ( func \ imported_curve_function . parametric_domain ) ; END_IF ; IF 'imported_surface_function' IN typenames THEN RETURN ( func \ imported_surface_function . parametric_domain ) ; END_IF ; IF 'imported_volume_function' IN typenames THEN RETURN ( func \ imported_volume_function . parametric_domain ) ; END_IF ; IF 'application_defined_function' IN typenames THEN RETURN ( func \ application_defined_function . explicit_domain ) ; END_IF ; RETURN ( ? ) ; END_FUNCTION; -- derive_function_domain |
|
public class FDerive_function_domain public static Value run(SdaiContext _context, Value func) |