# dupl.prod: Matrix multiplication envolving the duplication matrix In fastmatrix: Fast Computation of some Matrices Useful in Statistics

## Description

Given the order of a duplication and matrix `x`, performs one of the matrix-matrix operations:

• \bold{Y} = \bold{DX}, if `side = "left"` and `transposed = FALSE`, or

• \bold{Y} = \bold{D}^T\bold{X}, if `side = "left"` and `transposed = TRUE`, or

• \bold{Y} = \bold{XD}, if `side = "right"` and `transposed = FALSE`, or

• \bold{Y} = \bold{XD}^T, if `side = "right"` and `transposed = TRUE`,

where \bold{D} is the duplication matrix of order n. The main aim of `dupl.prod` is to do this matrix multiplication without forming the duplication matrix.

## Usage

 `1` ```dupl.prod(n = 1, x, transposed = FALSE, side = "left") ```

## Arguments

 `n` order of the duplication matrix. `x` numeric matrix (or vector). `transposed` logical. Duplication matrix should be transposed? `side` a string selecting if duplication matrix is pre-multiplying `x`, that is `side = "left"` or post-multiplying `x`, by using `side = "right"`.

## Details

Underlying `C` code only uses information provided by `dupl.info` to performs the matrix multiplication. The duplication matrix is never created.

`duplication`

## Examples

 ```1 2 3 4 5 6``` ```D4 <- duplication(n = 4, matrix = TRUE) x <- matrix(1, nrow = 16, ncol = 2) y <- crossprod(D4, x) z <- dupl.prod(n = 4, x, transposed = TRUE) # D4 is not stored all(z == y) # matrices y and z are equal! ```

### Example output

```[1] TRUE
```

fastmatrix documentation built on Oct. 18, 2021, 5:08 p.m.