<< skeleton Image_Processing_Tool_3

Image_Processing_Tool_3 >> Image_Processing_Tool_3 > sqrform

sqrform

Converts a vector of appropriate length to a square matrix form and vice versa.

Calling Sequence

y = sqrform(x)

Parameters

x

A vector of appropriate length or a square matrix.

y

A square matrix or a vector depending on whether the input is a vector or a square matrix.

Description

It converts a vector of appropriate length to a square matrix or a square square matrix to a 1-d or 2d array. If the input is a vector of length 3,6,10,15,21 etc then a symmmetric square matrix is formed. If a symmetrix square matrix is given as input, the lower diagonal elements are returned in a vector. If the square matrix given as input is not symmetrix, the elements of the upper and lower trinagular matrices are retruned as a 2-d array.

Examples

x=[1 2 3 4 5 6 7 8 9 10];
// Converting a vector to a square form
y=sqrform(x)

// Extracting upper trigular matrix from a square matrix
y1=sqrform(y)

// Magic square of size 8x8
x=testmatrix('magic',8);
// Extracting upper and lower trinagular matrices of the magic square
y2=sqrform(x)

See Also

Authors

<< skeleton Image_Processing_Tool_3