DClsei: Solve Least Squares with Equality and Inequality Constraints...

View source: R/quantiseqr_helpers.R

DClseiR Documentation

Solve Least Squares with Equality and Inequality Constraints (LSEI) problem

Description

Solve Least Squares with Equality and Inequality Constraints (LSEI) problem

Usage

DClsei(b, A, G, H, scaling = NULL)

Arguments

b

Numeric vector containing the right-hand side of the quadratic function to be minimized.

A

Numeric matrix containing the coefficients of the quadratic function to be minimized.

G

Numeric matrix containing the coefficients of the inequality constraints.

H

Numeric vector containing the right-hand side of the inequality constraints.

scaling

A vector of scaling factors to by applied to the estimates. Its length should equal the number of columns of A.

Details

The limSolve::lsei() function is used as underlying framework. Please refer to that function for more details.

Value

A vector containing the solution of the LSEI problem.

Examples

data(dataset_racle)
mixture <- dataset_racle$expr_mat
signature.file <- system.file(
  "extdata", "TIL10_signature.txt", package = "quantiseqr", mustWork = TRUE)
signature <- read.table(signature.file, header = TRUE, sep = "\t", row.names = 1)
scaling.file <- system.file(
  "extdata", "TIL10_mRNA_scaling.txt", package = "quantiseqr", mustWork = TRUE)
scaling <- as.vector(
  as.matrix(read.table(scaling.file, header = FALSE, sep = "\t", row.names = 1)))

cgenes <- intersect(rownames(signature), rownames(mixture))
b <- as.vector(as.matrix(mixture[cgenes,1, drop=FALSE]))
A <- as.matrix(signature[cgenes,])

G <- matrix(0, ncol = ncol(A), nrow = ncol(A))
diag(G) <- 1
G <- rbind(G, rep(-1, ncol(G)))
H <- c(rep(0, ncol(A)), -1)
# cellfrac <- quantiseqr:::DClsei(b = b, A = A, G= G, H = H, scaling = scaling)

federicomarini/quantiseqr documentation built on Dec. 20, 2024, 2:39 a.m.