Skip to contents

Returns the all-ones matrix of order n.

Usage

J(n)

Arguments

n

the order of the matrix.

Value

A square matrix of order \(n\) in which every entry is equal to 1. The all-ones matrix is given by \(J_{n\ x\ n} = 1_{n\ x\ 1}1_{n\ x\ 1}^T\).

See also

Examples

# Return the all-ones matrix of order 5.
J(5)
#>      [,1] [,2] [,3] [,4] [,5]
#> [1,]    1    1    1    1    1
#> [2,]    1    1    1    1    1
#> [3,]    1    1    1    1    1
#> [4,]    1    1    1    1    1
#> [5,]    1    1    1    1    1