Table 1
Summary of DAPPLE extensions to C++.
Links to the details are included.
Vectors Matrices
Types int, char, boolean same
float, double, boolean same
Initializations (none), scalar, array same
function same
another vector another matrix
Subscripting V[i] M[i][j], M[i][_], M[_][j]
Vector products scalar = inner(VA,VB)
matrix = outer(VA,VB)
Elementwise:
Arithmetic operators + - * / % same
Relational operators < <= == != >= > same
Boolean operators && || ! same
Assignment operators = += -= *= /= %= ++ -- same
Function application apply(func, V) apply(func, M)
Reductions:
sum x = sum(V); same
are any nonzero? b = any(V); same
are all nonzero? b = all(V); same
number of nonzeros n = n_nonzeros(V); same
number active n = n_active(V); same
value of first active x = first(V); N/A
index of first active n = first_index(V); N/A
maximum value x = max_value(V); same
minimum value x = min_value(V); same
index of max n = max_index(V); N/A
index of min n = min_index(V); N/A
Scans:
VA = plus_scan(VB); plus_scan_rows, plus_scan_cols
VA = max_scan(VB); max_scan_rows, max_scan_cols
VA = min_scan(VB); min_scan_rows, min_scan_cols
VA = or_scan(VB); or_scan_rows, or_scan_cols
VA = and_scan(VB); and_scan_rows, and_scan_cols
Moving data:
VA = shift(VB, distance); MA = shift(MB, rows, cols);
MA = shift_rows(MB, distance per row);
MA = shift_cols(MB, distance per column);
VA = rotate(VB, distance); MA = rotate(MB, rows, cols);
MA = rotate_rows(MB, distance per row);
MA = rotate_cols(MB, distance per column);
VA = pack(VB); N/A
VA = permute(VB, P); N/A
VA = permute(VB, func); N/A
Input and output:
input cin >> V; same
output cout << V; same
cerr << V; same
Parallel if statement:
ifp() ... else ...