Module Middle.SizedType

Types which have a concrete size associated, e.g. vector[n]

type 'a t =
  1. | SInt
  2. | SReal
  3. | SComplex
  4. | SVector of Mem_pattern.t * 'a
  5. | SRowVector of Mem_pattern.t * 'a
  6. | SMatrix of Mem_pattern.t * 'a * 'a
  7. | SComplexVector of 'a
  8. | SComplexRowVector of 'a
  9. | SComplexMatrix of 'a * 'a
  10. | SArray of 'a t * 'a
  11. | STuple of 'a t list
val map : ('a -> 'b) -> 'c t -> 'd t
val fold : ('a -> 'b -> 'c) -> 'd -> 'e t -> 'd
val t_of_sexp : 'a. (Sexplib0.Sexp.t -> 'a) -> Sexplib0.Sexp.t -> 'a t
val sexp_of_t : 'a. ('a -> Sexplib0.Sexp.t) -> 'a t -> Sexplib0.Sexp.t
val compare : 'a. ('a -> 'a -> Core__.Import.int) -> 'a t -> 'a t -> Core__.Import.int
val hash_fold_t : 'a. (Ppx_hash_lib.Std.Hash.state -> 'a -> Ppx_hash_lib.Std.Hash.state) -> Ppx_hash_lib.Std.Hash.state -> 'a t -> Ppx_hash_lib.Std.Hash.state
val pp : 'a Fmt.t -> 'b t Fmt.t
val to_unsized : 'a t -> UnsizedType.t
val get_dims_io : Expr.Typed.t t -> Middle__Expr.Typed.Meta.t Middle__Expr.Fixed.t list

Get the dimensions with respect to sizes needed for IO. Note: The main difference from get_dims is complex, where this function treats the complex type as a dual number. Note: Tuples are treated as scalars by this function due to the inherent assumption of rectangularity. Carefully consider new usages and use io_size when possible.

val io_size : Middle__Expr.Typed.Meta.t Middle__Expr.Fixed.t t -> Middle__Expr.Typed.Meta.t Middle__Expr.Fixed.t
val get_dims : 'a t -> 'b list

Get the dimensions of an object. Note: Tuples are treated as scalars by this function due to the inherent assumption of rectangularity. Carefully consider new usages!

val is_recursive_container : 'a t -> bool

* Check whether a SizedType holds indexable SizedTypes.

val get_array_dims : 'a t -> 'a t * 'b list

Return a type's array dimensions and the type inside the (possibly nested) array

val get_scalar_and_dims : 'a t -> 'a t * 'b list

Return a type's dimensions and inner scalar. Differs from get_array_dims in that this also breaks down vectors or matrices, so a SVector d is returned as (SReal, [d]) rather than (SVector d, [])

val internal_scalar : 'a t -> 'a t
val contains_tuple : 'a t -> bool
val is_complex_type : 'a t -> bool
val get_mem_pattern : 'a t -> Mem_pattern.t

* Return the mem_pattern of the SizedType

val demote_sizedtype_mem : 'a t -> 'b t
val promote_sizedtype_mem : 'a t -> 'a t
val modify_sizedtype_mem : Mem_pattern.t -> 'a t -> 'a t
val has_mem_pattern : 'a t -> bool
val build_sarray : 'a list -> 'b t -> 'b t

The inverse of get_array_dims

val flatten_tuple_io : 'a t -> 'a t list