Learn R Programming

CVXR (version 1.9.2)

vdot: Vector dot product (inner product)

Description

The standard inner product of x and y: both are flattened, multiplied elementwise, and summed. Conjugate-linear in xx is conjugated before multiplying, matching numpy.vdot() and CVXPY's vdot(). For real arguments conjugation is the identity, so this is the ordinary dot product.

Either argument may also be a (possibly nested) list, which is flattened before the product; the two are flattened independently, so their nesting need not match.

Usage

vdot(x, y)

Value

A scalar Expression representing sum(Conj(x) * y).

Arguments

x

An Expression, numeric value, or nested list thereof. The conjugate-linear argument.

y

An Expression, numeric value, or nested list thereof. The linear argument.

See Also

scalar_product(), cvxr_outer(), deep_flatten()

Examples

Run this code
x <- Variable(3)
vdot(x, c(1, 2, 3))

a <- Variable(); b <- Variable()
vdot(list(a, b), c(1, 2))

Run the code above in your browser using DataLab