FUNCTION regular_indexing
(* SCHEMA mathematical_functions_schema; *)
FUNCTION regular_indexing(sub : LIST OF INTEGER;
base : zero_or_one;
shape : LIST [1:?] OF positive_integer;
inc : LIST [1:?] OF INTEGER;
first : INTEGER) : INTEGER;
LOCAL
k : INTEGER;
index : INTEGER;
END_LOCAL;
IF NOT EXISTS (sub) OR NOT EXISTS (base) OR NOT EXISTS (shape) OR
NOT EXISTS (inc) OR NOT EXISTS (first) THEN
RETURN (?);
END_IF;
IF (SIZEOF (sub) <> SIZEOF (inc)) OR (SIZEOF (sub) <> SIZEOF (shape)) THEN
RETURN (?);
END_IF;
index := first;
REPEAT j := 1 TO SIZEOF (sub);
IF NOT EXISTS (sub[j]) OR NOT EXISTS (inc[j]) THEN
RETURN (?);
END_IF;
k := sub[j] - base;
IF NOT ({0 <= k < shape[j]}) THEN
RETURN (?);
END_IF;
index := index + k*inc[j];
END_REPEAT;
RETURN (index);
END_FUNCTION;
Referenced By
Defintion regular_indexing is references by the following definitions:
[Top Level Definitions] [Exit]Generated by STEP Tools® EXPRESS to HTML Converter
2012-03-27T17:13:59-04:00