tropproj.poly: Projection on Tropical Polytope

Description Usage Arguments Value Examples

View source: R/troproj.poly.R

Description

Project a point onto a given tropical polytope.

Usage

1
tropproj.poly(x, tconv)

Arguments

x

a data vector, of length e.

tconv

a data matrix, of size e x s, with each column a vertex of the tropical polytope. e is the dimension of the tropical space and s is the number of vertices of the polytope

Value

A projected vector on the given tropical polytope.

Examples

1
2
3
4
5
6
7
8
9
# Generate a tropical polytope consisting of three trees each with 5 leaves
library(ape)
pltp <- sapply(1:3, function(i) {
  as.vector(rcoal(5))
})
# Generate an observation and vectorize it
tree <- rcoal(5)
tree_vec <- as.vector(tree)
tropproj.poly(tree_vec, pltp)

Rtropical documentation built on Nov. 10, 2021, 1:07 a.m.