Normalize cols: Difference between revisions
Jump to navigation
Jump to search
Created page with "{{Function |name=normalize_cols |desc=Scales the columns of a matrix to have norm 1 |upd=January 2, 2013 |v=1.00 |helper=1}} <tt>'''normalize_cols'''</tt> is a [[List of funct..." |
No edit summary |
||
| Line 3: | Line 3: | ||
|desc=Scales the columns of a matrix to have norm 1 | |desc=Scales the columns of a matrix to have norm 1 | ||
|upd=January 2, 2013 | |upd=January 2, 2013 | ||
|cat=[[List of functions#Helper_functions|Helper functions]] | |||
|v=1.00 | |v=1.00 | ||
|helper=1}} | |helper=1}} | ||
| Line 14: | Line 15: | ||
==Examples== | ==Examples== | ||
< | <syntaxhighlight> | ||
>> X = [1 0 1;0 2 1i;0 0 -1;0 0 -1i] | >> X = [1 0 1;0 2 1i;0 0 -1;0 0 -1i] | ||
| Line 32: | Line 33: | ||
0 0 -0.5000 | 0 0 -0.5000 | ||
0 0 0 - 0.5000i | 0 0 0 - 0.5000i | ||
</ | </syntaxhighlight> | ||
{{SourceCode|name=normalize_cols|helper=1}} | |||
Latest revision as of 16:00, 29 September 2014
| normalize_cols | |
| Scales the columns of a matrix to have norm 1 | |
| Other toolboxes required | none |
|---|---|
| Function category | Helper functions |
| This is a helper function that only exists to aid other functions in QETLAB. If you are an end-user of QETLAB, you likely will never have a reason to use this function. |
normalize_cols is a function that scales each column of a matrix so that it has norm 1. That is, each column of the matrix is divided by its norm.
Syntax
- Y = normalize_cols(X)
Argument descriptions
- X: A matrix to have its columns normalized.
Examples
>> X = [1 0 1;0 2 1i;0 0 -1;0 0 -1i]
X =
1.0000 0 1.0000
0 2.0000 0 + 1.0000i
0 0 -1.0000
0 0 0 - 1.0000i
>> normalize_cols(X)
ans =
1.0000 0 0.5000
0 1.0000 0 + 0.5000i
0 0 -0.5000
0 0 0 - 0.5000iSource code
Click here to view this function's source code on github.