Operator ":" is to Select Parts of Arrays or Strings

The operator ":" provides a sub-vector, sub-matrix, or sub-string for use in (InlineLoop-) expressions or in MatrixExplorer for partial file matrices.

• The FromTo operator ":" for Arrays:
• REAL :: rows=3, cols=4, length=5, X(length), A(rows,cols)
 X = \$ 1 2 3 4 5
 X(3:4) = X(4:3)^2 1 2 16 9 5
• A = \$^2
 1 4 9 16 25 36 49 64 81 100 121 144
• A(2:3, 1:2) = -A(2:3, 1:2)
 1 4 9 16 -25 -36 49 64 -81 -100 121 144
• The FromTo operator ":" for Strings:  beta = alpha(3:) CDEFGH
 beta = alpha(2:4) & alpha(6:8) BCDFGH
 beta = alpha(8:1) HGFEDCBA
• The FromTo operator ":" in InlineLoop:  factorial = * (1 : 5) 1*2*3*4*5 == 120
 X = +( 1 : \$ ) 1 3 6 10 15
 sum = +(2^(0:-10)) 1+1/2+1/4+ .. 1/1024
 x = *(49:1) / (*(6:1)) / (*(49-6:1)) 6 from 49 = 13983816
 y = *(49:49-6+1) / (*(6:1)) 49 choose 6 = 13983816
• The FromTo operator ":" in MatrixExplorer (c.f. InlineLoop, Join):  string = && (filename( 5:7, 2)) string gets joined rows 5 to 7, column 2

Support HicEst   ⇒ Impressum