Form row and column sums of squares for numeric matrices.
The functions are introduced as faster analogs of
The function is implemented in C for better performance.
Return a vector of sums of values in each row/column for matrix
Andrey A Shabalin [email protected]
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
x = matrix( 1:99, 9, 11) # Calculate sums of squared elements in each row rsum2 = rowSumsSq(x) # Compare with alternative calculation stopifnot( all.equal( rsum2, rowSums(x^2) )) # Calculate sums of squared elements in each column csum2 = colSumsSq(x) # Compare with alternative calculation stopifnot( all.equal( csum2, colSums(x^2) ))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.