Programmer Guide/Command Reference/EVAL/vmrow: Difference between revisions

From STX Wiki
Jump to navigationJump to search
(initial import)
 
No edit summary
 
(5 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
=====vmrow=====
Create a matrix by merging columns of source vectors and/or matrices into the rows of the result.
;Usage: <code><var>vmrow(x1</var> {, <var>x2</var> {, .. }})</code>
:;<var>x1</var>, <var>x2</var>, ..: source vectors and/or matrices with the same number of rows
;Result: A matrix with <code>nrow(''x1'')</code> columns. The columns of the arguments are merged from left to right into the rows of the result matrix.
:Note: <code>vmrow(a,b,c)</code> returns the same result as <code>trn(vmcol(a,b,c))</code>, but <code>vmrow</code> is faster and uses less memory than the nested command.
;See also: [[../vv|vv]], [[../vvset|vvget]], [[../vvset|vvset]], [[../vvcat|vvcat]], [[../vmcol|vmcol]], [[../vsubn|vsubn]], [[../vsubc|vsubc]]


{|
[[../#Functions|<function list>]]
|-
 
|vmrow(x1M, <var>x2</var>M,...)
 
|Create a matrix using the matrices x1M, <var>x2</var>M,... (the matrices must have the same number of rows as arguments).
Example:
|-
#a := eval vv(1,2,3,4,5)
|vmrow(x1V, <var>x2</var>V,...)
#b := eval init(5,2,0)
|Create a matrix using the vectors x1v, <var>x2</var>v, .. (vectors with the same length) - one vector per row.The result is: a matrix (the number of vectors * the number of vector elements)
#c := eval vmcol($#a, $#b, $#a)  
|}
// -> $#c is a matrix with 4 rows and 5 columns:
//    $#c[*,*] = $#a,  #c[1,*] = $#b[*,0],  $#c[2,*] = $#b[*,1],  $#c[3,*] = $#a

Latest revision as of 12:05, 21 April 2011

Create a matrix by merging columns of source vectors and/or matrices into the rows of the result.

Usage
vmrow(x1 {, x2 {, .. }})
x1, x2, ..
source vectors and/or matrices with the same number of rows
Result
A matrix with nrow(x1) columns. The columns of the arguments are merged from left to right into the rows of the result matrix.
Note: vmrow(a,b,c) returns the same result as trn(vmcol(a,b,c)), but vmrow is faster and uses less memory than the nested command.
See also
vv, vvget, vvset, vvcat, vmcol, vsubn, vsubc

<function list>


Example:

#a := eval vv(1,2,3,4,5)
#b := eval init(5,2,0)
#c := eval vmcol($#a, $#b, $#a) 
// -> $#c is a matrix with 4 rows and 5 columns:
//    $#c[*,*] = $#a,  #c[1,*] = $#b[*,0],  $#c[2,*] = $#b[*,1],  $#c[3,*] = $#a

Navigation menu

Personal tools