tropproj.poly {Rtropical}R Documentation

Projection on Tropical Polytope

Description

Project a point onto a given tropical polytope.

Usage

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


# 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)

[Package Rtropical version 1.2.1 Index]