Hadamard_Matrix: Hadamard_Matrix

Description Usage Arguments Details Value Examples

View source: R/Hadamard_matrix.R

Description

Hadamard_Matrix is generic function for construction of Hadamard matrix.

Usage

1

Arguments

order

integer

Details

function Hadamard_matrix was created which does not require known of construction methods. Hadamard_matrix() takes an integer as input and returns Hadamard matrix if it is available. In case, it is not possible to construct, NULL value is returned.

Value

Hadamard Matrix of given Order

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
Hadamard_Matrix(1)
#1
Hadamard_Matrix(2)
#      [,1] [,2]
# [1,]    1    1
# [2,]    1   -1
Hadamard_Matrix(8)
      # [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8]
# [1,]    1    1    1    1    1    1    1    1
# [2,]    1   -1    1   -1    1   -1    1   -1
# [3,]    1    1   -1   -1    1    1   -1   -1
# [4,]    1   -1   -1    1    1   -1   -1    1
# [5,]    1    1    1    1   -1   -1   -1   -1
# [6,]    1   -1    1   -1   -1    1   -1    1
# [7,]    1    1   -1   -1   -1   -1    1    1
# [8,]    1   -1   -1    1   -1    1    1   -1
Hadamard_Matrix(10)
#"Order is not a Hadamard number"
Hadamard_Matrix(668)
#"Not possible to construct or order is not a multiple of 4"

Example output

[1] 1
     [,1] [,2]
[1,]    1    1
[2,]    1   -1
     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8]
[1,]    1    1    1    1    1    1    1    1
[2,]    1   -1    1   -1    1   -1    1   -1
[3,]    1    1   -1   -1    1    1   -1   -1
[4,]    1   -1   -1    1    1   -1   -1    1
[5,]    1    1    1    1   -1   -1   -1   -1
[6,]    1   -1    1   -1   -1    1   -1    1
[7,]    1    1   -1   -1   -1   -1    1    1
[8,]    1   -1   -1    1   -1    1    1   -1
[1] "Order is not a Hadamard number"
[1] "Not possible to construct or order is not a multiple of 4"

HadamardR documentation built on April 14, 2020, 7:01 p.m.