R: Frobenius innter product of matrices

frobenius.prod {matrixcalc} | R Documentation

## Frobenius innter product of matrices

### Description

This function returns the Fronbenius inner product of two matrices, x and y, with the same row and column dimensions.

### Usage

    frobenius.prod(x, y)

### Arguments

`x` | a numeric matrix or vector object
`y` | a numeric matrix or vector object

### Details

The Frobenius inner product is the element-by-element sum of the Hadamard or Shur product of two numeric matrices. Let {\bf{x}} and {\bf{y}} be two m \times n matrices. Then Frobenious inner product is computed as ∑\limits_{i = 1}^m {∑\limits_{j = 1}^n {x_{i,j} \;y_{i,j} } } .

### Value

A numeric value.

### Note

The function converts vectors to matrices if necessary. The function stops running if x or y is not numeric and an error message is displayed. The function also stops running if x and y do not have the same row and column dimensions and an error mesage is displayed.

### Author(s)

Frederick Novomestky fnovomes@poly.edu

### References

Styan, G. P. H. (1973). Hadamard Products and Multivariate Statistical Analysis, Linear Algebra and Its Applications, Elsevier, 6, 217-240.

### See Also

`hadamard.prod`

### Examples

    x <- matrix( c( 1, 2, 3, 4 ), nrow=2, byrow=TRUE )
    y <- matrix( c( 2, 4, 6, 8 ), nrow=2, byrow=TRUE )
    z <- frobenius.prod( x, y )
    print( z )

[Package matrixcalc version 1.0-3 Index]