zero_norm {sparsegl}R Documentation

Calculate common norms

Description

Calculate different norms of vectors with or without grouping structures.

Usage

zero_norm(x)

one_norm(x)

two_norm(x)

grouped_zero_norm(x, gr)

grouped_one_norm(x, gr)

grouped_two_norm(x, gr)

grouped_sp_norm(x, gr, asparse)

gr_one_norm(x, gr)

gr_two_norm(x, gr)

sp_group_norm(x, gr, asparse = 0.05)

Arguments

x

A numeric vector.

gr

An integer (or factor) vector of the same length as x.

asparse

Scalar. The weight to put on the l1 norm when calculating the group norm.

Value

A numeric scalar or vector

Functions

Examples

x <- c(rep(-1, 5), rep(0, 5), rep(1,5))
gr <- c(rep(1,5), rep(2,5), rep(3,5))
asparse <- 0.05
grouped_sp_norm(x, gr, asparse)


[Package sparsegl version 1.0.2 Index]