Command Reference : Function Reference : Function Reference: I
  
 
@incr
Increment rows or columns of matrix.
Syntax: @incr(m, v[,p])
m: matrix
v: vector, rowvector
p: (optional) number
Return: matrix
Increment the rows or columns of a matrix by the corresponding vector times p. By default, p is equal to 1.
If m is a matrix and v is a vector, increment each column of m by p times v.
If m is a matrix and v is a rowvector, increment each column of m by p times v.
Examples
matrix x = @mrnd(5, 3)
creates a matrix X filled with random normals.
The commands
vector v1 = @fill(1, 2, 3, 4, 5)
matrix x1 = @incr(x, v1)
form X1 by taking X and adding the vector V1 to each column (which is equivalent to adding 1 to the first row, 2 to the second, etc).
The commands
rowvector v2 = @transpose(@fill(1, 2, 3))
matrix x2 = @incr(x, v2, -1)
creates X2 by taking X and subtracting the rowvector V2 from each row (which is the equivalent of subtracting 1 from the first column, 2 from the second, etc.),
Cross-references
See also @scale.