ssq {lazy.symbolic} | R Documentation |
Returns the (doubly weighted) sum of squares of all the elements of A
Description
ssq(A,U,V) = tr( t(A) %*% U %*% A %*% V )
Usage
ssq(A, U = NULL, V = NULL, expand = 0)
Arguments
A |
Input matrix or vector |
U |
Row weight matrix: nrow(A) x nrow(A) |
V |
Column weight matrix: ncol(A) x ncol(A) |
expand |
= 1 to distribute the transposition over sum |
Details
Can be used with a character matrix.
When A
is a string of length=1, it is assumed that A
contains an expression. In this case, expand option can be used.
Value
The weighted sum of squares of all the elements of A
Examples
ssq(demomat(3,2)) - sum(demomat(3,2)^2)
# fully symbolic input
ssq("y-X%*%b", U="W")
ssq("y-X%*%b", U="W", expand=1)
ssq("y-X%*%b", U="W", expand=2)
ssq("Y-X%*%B", U="W", V="V", expand=2)
[Package lazy.symbolic version 1.0.0.20250803 ]