interval_intersection: Finds the intersection between two unions of intervals.

View source: R/domain.R

interval_intersectionR Documentation

Finds the intersection between two unions of intervals.

Description

Finds the intersection between two unions of intervals.

Usage

interval_intersection(A, B)

Arguments

A

A list of vectors of size 2, each representing an interval. It is required that A[[i]][1] <= A[[i]][2] <= A[[j]][1] for any i < j.

B

A list of vectors of size 2, each representing an interval. It is required that A[[i]][1] <= A[[i]][2] <= A[[j]][1] for any i < j.

Details

Finds the intersection between the union of all intervals in A and the union of all intervals in B.

Value

A list of vectors of size 2, whose union represents the intersection between A and B.

Examples

interval_intersection(list(c(1.2,1.5), c(2.3,2.7)),
       list(c(0.6,1.4), c(2.5,3.6), c(6.3,6.9)))
interval_intersection(list(c(-0.3,0.55), c(2.35,2.8)),
       list(c(0.54,0.62), c(2.5,2.9)))
interval_intersection(list(c(0,1)), list(c(1,2)))
interval_intersection(list(c(0,1+1e-8)), list(c(1,2)))
interval_intersection(list(c(0,1), c(2,3)),
       list(c(1,2)))
interval_intersection(list(c(0,1+1e-8), c(2-1e-8,3)),
       list(c(1,2)))
interval_intersection(list(c(0,1)), list())

genscore documentation built on May 31, 2023, 6:28 p.m.