Overview Schemas Index

MATHEMATICAL_FUNCTIONS_SCHEMA (jsdai.SMathematical_functions_schema)


FUNCTION extremal_position_check
          (fun : linearized_table_function) : BOOLEAN;

 LOCAL source_domain : maths_space ; source_interval : finite_integer_interval ; index : INTEGER  := 1 ; base : INTEGER  ; shape : LIST  OF  positive_integer ; ndim : positive_integer ; slo , shi : INTEGER  ; sublo : LIST  OF  INTEGER  := [ ] ; subhi : LIST OF INTEGER := [ ] ; END_LOCAL ; IF  NOT  EXISTS ( fun ) THEN  RETURN  ( FALSE  ) ; END_IF  ; source_domain := factor1 ( fun . source . domain ) ; IF  ( schema_prefix + 'tuple_space' ) IN  TYPEOF  ( source_domain ) THEN  source_domain := factor1 ( source_domain ) ; END_IF  ; IF  NOT  ( ( schema_prefix + 'finite_integer_interval' ) IN  TYPEOF  ( source_domain ) ) THEN  RETURN  ( FALSE  ) ; END_IF  ; source_interval := source_domain ; base := fun \ explicit_table_function . index_base ; shape := fun \ explicit_table_function . shape ; IF  ( schema_prefix + 'standard_table_function' ) IN  TYPEOF  ( fun ) THEN  REPEAT  j := 1 TO  SIZEOF  ( shape ) ; index := index * shape [ j ] ; END_REPEAT  ; index := fun . first + index - 1 ; RETURN  ( bool ( { source_interval . min <= index <= source_interval . max } ) ) ; END_IF  ; IF  ( schema_prefix + 'regular_table_function' ) IN TYPEOF ( fun ) THEN  ndim := SIZEOF ( fun \ explicit_table_function . shape ) ; REPEAT j := 1 TO ndim ; slo := base ; shi := base + shape [ j ] - 1 ; IF  fun \ regular_table_function . increments [ j ] >= 0 THEN  INSERT  ( sublo , slo , j - 1 ) ; INSERT  ( subhi , shi , j - 1 ) ; ELSE INSERT  ( sublo , shi , j - 1 ) ; INSERT ( subhi , slo , j - 1 ) ; END_IF  ; END_REPEAT ; index := regular_indexing ( sublo , base , shape , fun \ regular_table_function . increments , fun . first ) ; IF  NOT  ( { source_interval . min <= index <= source_interval . max } ) THEN  RETURN  ( FALSE  ) ; END_IF  ; index := regular_indexing ( subhi , base , shape , fun \ regular_table_function . increments , fun . first ) ; IF NOT ( { source_interval . min <= index <= source_interval . max } ) THEN RETURN  ( FALSE  ) ; END_IF  ; RETURN  ( TRUE ) ; END_IF ; RETURN ( FALSE ) ; 

END_FUNCTION; -- extremal_position_check

public class FExtremal_position_check
          public static Value run(SdaiContext _context, Value fun)