View source: R/frobenius.prod.R
frobenius.prod | R Documentation |
This function returns the Fronbenius inner product of two matrices, x and y, with the same row and column dimensions.
frobenius.prod(x, y)
x |
a numeric matrix or vector object |
y |
a numeric matrix or vector object |
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} } } .
A numeric value.
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.
Frederick Novomestky fnovomes@poly.edu
Styan, G. P. H. (1973). Hadamard Products and Multivariate Statistical Analysis, Linear Algebra and Its Applications, Elsevier, 6, 217-240.
hadamard.prod
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 )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.