Gscaler

From Eigenvector Research Documentation Wiki
Revision as of 17:33, 3 September 2008 by imported>Jeremy (Importing text file)
Jump to navigation Jump to search

Purpose

GSCALER Applies group/block scaling to submatrices of a single matrix.

Synopsis

gys = gscaler(xin,numblocks,mxs,stdxs)
xin = gscaler(gys,numblocks,mxs,stdxs,undo)

Description

Inputs are a matrix (xin) (class "double"), the number of sub-matrices/ blocks (numblocks), an offset vector (mxs), and a scale vector (stdxs).

See GSCALE for descriptions of (mxs) and (stdxs).

Note that size(xin,2)/numblocks must be a whole number.

When numblocks = 1, all variables are scaled as a single block.

When numblocks = 0, each variable is handled on its own and gscaler is equivalent to the SCALE function.

If the optional input (undo) is included with a value of 1 (one), then the input is assumed to be (gys) and is unscaled and uncentered to give the original (xin) matrix.

In a standard call, the output is the scaled matrix (gys). When undo is provided, the output is the unscaled original matrix (xin).

Examples

Scale a matrix a that has two blocks augmented together using GSCALE:

>> a = [[1 2 3; 4 5 6; 7 8 9] [11 12 13; 14 15 16; 17 18 19]];

>> [gxs,mxs,stdxs] = gscale(a,2);

>> gxs

gxs =

  -0.5774   -0.5774   -0.5774   -0.5774   -0.5774   -0.5774
        0         0         0         0         0         0
   0.5774    0.5774    0.5774    0.5774    0.5774    0.5774

>> mxs

mxs =

    4     5     6    14    15    16

>> stdxs

stdxs =

    3     3     3     3     3     3

Now scale a new matrix b that has two blocks augmented together:

>> b = [[2 3 4; 4 5 6; 6 7 8] [10 11 12; 14 15 16; 18 19 20]]

b =

    2     3     4    10    11    12
    4     5     6    14    15    16
    6     7     8    18    19    20

>> gys = gscaler(b,2,mxs,stdxs)

gys =

  -0.3849   -0.3849   -0.3849   -0.7698   -0.7698   -0.7698
        0         0         0         0         0         0
   0.3849    0.3849    0.3849    0.7698    0.7698    0.7698

See Also

auto, gscale, mncn, mpca, scale, unfoldm