inner.prod(x, y, mass=NULL)
Inner product of vectors (mass-weighted if requested).
This function calculates the inner product between two vectors, or alternatively, the column-wise vector elements of matrices. If atomic masses are provided, the dot products will be mass-weighted.
See examples for more details.
Grant, B.J. et al. (2006) Bioinformatics 22, 2695--2696.
## Matrix operations x <- 1:3 y <- diag(x) z <- matrix(1:9, ncol = 3, nrow = 3) inner.prod(x,y)[1] 1 4 9inner.prod(y,z)[1] 1 10 27## Application to normal modes pdb <- read.pdb( system.file("examples/1hel.pdb", package="bio3d") ) ## Calculate (vibrational) normal modes modes <- nma(pdb)Building Hessian... Done in 0.044 seconds. Diagonalizing Hessian... Done in 0.131 seconds.## Check for orthogonality inner.prod(modes$U[,7], modes$U[,8])[1] -9.829387e-15