package bigarray-overlap

  1. Overview
  2. Docs
Bigarray.overlap

Install

Dune Dependency

Authors

Maintainers

Sources

bigarray-overlap-0.2.1.tbz
sha256=2f520ac470054e335883eba9254bf28b6676ddb57753cfb58b22cf84ae1a66e0
sha512=223f15f815cd944cf2e9955ed9e3cf5608a9db36103e9bb017c2fe452dfb319908228b419f416f6239b8562208027068b7c44e8fb4be6c6a7858ecba540d5439

Description

A minimal library to know that 2 bigarray share physically the same memory or not.

Published: 08 Apr 2022

README

bigarray-overlap

This little library allows us to check if to bigarray share same memory area:

                    ba2
            ba1    .-------.
           .------|.        |
          |       | |       |
0x000800: [-------###-------]
                  | |
		   .
		  ba3

In this example, ba1 and ba2 share a small area and bigarray-overlap can returns this small area to you as a new ba3 value.

open Bigarray

let () =
  let ba = Array1.create Char Bigarray.c_layout 17 in
  let ba1 = Array1.sub ba 0 10 in
  let ba2 = Array1.sub ba 7 17 in
  match Overlap.array1 ba1 ba2 with
  | Some (len, x, _y) ->
    let ba3 = Array1.sub ba x len in
    ...
  | None -> ...

overlap returns the length of the shared area, the x point from ba1 and the y point from ba2.

A js_of_ocaml support

overlap is compatible with js_of_ocaml but it lies about expected results. Indeed, we are not able to know the position in memory of given bigarray in the JS world. By this fact, Overlap with js_of_ocaml will always returns None.

Dependencies (3)

  1. conf-pkg-config build
  2. dune >= "2.6"
  3. ocaml >= "4.08.0"

Dev Dependencies (5)

  1. ocamlfind with-test
  2. bos with-test
  3. fpath with-test
  4. astring with-test
  5. alcotest with-test

Used by (3)

  1. encore = "0.5"
  2. mrmime >= "0.2.0"
  3. prettym

Conflicts (2)

  1. ocaml-freestanding < "0.4.3"
  2. mirage-xen-posix < "3.1.0"
OCaml

Innovation. Community. Security.