-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix review comments on R package * update R interface in volume and sample_points * update Rcpp modules and S4 classes * replace modules with R classes * update R documentation * fix R tests * fix R bugs * add hpoly new generator, fix bugs in rounding with biw * update the Rd files * fix c++ tests and a bug in volume.coo * fix c++ test * update polytope random generators in R, update rd files * fix bugs in R interface * seperate sdp functions
- Loading branch information
Showing
83 changed files
with
1,134 additions
and
1,036 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#' An R class to represent an H-polytope | ||
#' | ||
#' An H-polytope is a convex polytope defined by a set of linear inequalities or equivalently a \eqn{d}-dimensional H-polytope with \eqn{m} facets is defined by a \eqn{m\times d} matrix A and a \eqn{m}-dimensional vector b, s.t.: \eqn{Ax\leq b}. | ||
#' | ||
#' \describe{ | ||
#' \item{A}{An \eqn{m\times d} numerical matrix.} | ||
#' | ||
#' \item{b}{An \eqn{m}-dimensional vector b.} | ||
#' | ||
#' \item{volume}{The volume of the polytope if it is known, \eqn{NaN} otherwise by default.} | ||
#' | ||
#' \item{type}{A character with default value 'Hpolytope', to declare the representation of the polytope.} | ||
#' } | ||
#' | ||
#' @examples | ||
#' A = matrix(c(-1,0,0,-1,1,1), ncol=2, nrow=3, byrow=TRUE) | ||
#' b = c(0,0,1) | ||
#' P = Hpolytope(A = A, b = b) | ||
#' | ||
#' @name Hpolytope-class | ||
#' @rdname Hpolytope-class | ||
#' @exportClass Hpolytope | ||
Hpolytope <- setClass ( | ||
# Class name | ||
"Hpolytope", | ||
|
||
# Defining slot type | ||
representation ( | ||
A = "matrix", | ||
b = "numeric", | ||
volume = "numeric", | ||
type = "character" | ||
), | ||
|
||
# Initializing slots | ||
prototype = list( | ||
A = as.matrix(0), | ||
b = as.numeric(NULL), | ||
volume = as.numeric(NaN), | ||
type = "Hpolytope" | ||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#' An R class to represent a Spectrahedron | ||
#' | ||
#' A spectrahedron is a convex body defined by a linear matrix inequality of the form \eqn{A_0 + x_1 A_1 + ... + x_n A_n \preceq 0}. | ||
#' The matrices \eqn{A_i} are symmetric \eqn{m \times m} real matrices and \eqn{\preceq 0} denoted negative semidefiniteness. | ||
#' | ||
#' \describe{ | ||
#' \item{matrices}{A List that contains the matrices \eqn{A_0, A_1, ..., A_n}.} | ||
#' } | ||
#' | ||
#' @examples | ||
#' A0 = matrix(c(-1,0,0,0,-2,1,0,1,-2), nrow=3, ncol=3, byrow = TRUE) | ||
#' A1 = matrix(c(-1,0,0,0,0,1,0,1,0), nrow=3, ncol=3, byrow = TRUE) | ||
#' A2 = matrix(c(0,0,-1,0,0,0,-1,0,0), nrow=3, ncol=3, byrow = TRUE) | ||
#' lmi = list(A0, A1, A2) | ||
#' S = Spectrahedron(matrices = lmi); | ||
#' | ||
#' @name Spectrahedron-class | ||
#' @rdname Spectrahedron-class | ||
#' @exportClass Spectrahedron | ||
Spectrahedron <- setClass ( | ||
# Class name | ||
"Spectrahedron", | ||
|
||
# Defining slot type | ||
representation ( | ||
matrices = "list" | ||
), | ||
|
||
# Initializing slots | ||
prototype = list( | ||
matrices = list() | ||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#' An R class to represent a V-polytope | ||
#' | ||
#' A V-polytope is a convex polytope defined by the set of its vertices. | ||
#' | ||
#' \describe{ | ||
#' \item{V}{An \eqn{m\times d} numerical matrix that contains the vertices row-wise.} | ||
#' | ||
#' \item{volume}{The volume of the polytope if it is known, \eqn{NaN} otherwise by default.} | ||
#' | ||
#' \item{type}{A character with default value 'Vpolytope', to declare the representation of the polytope.} | ||
#' } | ||
#' | ||
#' @examples | ||
#' V = matrix(c(2,3,-1,7,0,0),ncol = 2, nrow = 3, byrow = TRUE) | ||
#' P = Vpolytope(V = V) | ||
#' | ||
#' @name Vpolytope-class | ||
#' @rdname Vpolytope-class | ||
#' @exportClass Vpolytope | ||
Vpolytope <- setClass ( | ||
# Class name | ||
"Vpolytope", | ||
|
||
# Defining slot type | ||
representation ( | ||
V = "matrix", | ||
volume = "numeric", | ||
type = "character" | ||
), | ||
|
||
# Initializing slots | ||
prototype = list( | ||
V = as.matrix(0), | ||
volume = as.numeric(NaN), | ||
type = "Vpolytope" | ||
) | ||
) |
Oops, something went wrong.