1dnl
2dnl --------------------------------------------------------------------
3dnl Usage: PACKED_ADDRESS(order, uplo, AP, row, col, size) ... compute
4dnl        the address of AP[row, column].  Does not check that you are
5dnl        in the right part the matrix.  This routine is very expensive
6dnl        and dangerous and should not be used.  It is a function,
7dnl        returning a mathematical expression.
8dnl --------------------------------------------------------------------
9define(`PACKED_ADDRESS', `ifelse(
10	`$1&&$2', `blas_rowmajor&&blas_upper',
11	`($3 + ($5 + $4 * ($4 - 1) / 2))',
12	`$1&&$2', `blas_colmajor&&blas_upper',
13	`($3 + ($4 + $5 * ($5 - 1) / 2))',
14	`$1&&$2', `blas_rowmajor&&blas_lower',
15	`($3 + ($5 + (2 * $6 - $4) * ($4 - 1) / 2))',
16	`$1&&$2', `blas_colmajor&&blas_lower',
17	`($3 + ($4 + (2 * $6 - $5)*($5 - 1) / 2))')')dnl
18dnl
19dnl --------------------------------------------------------------------
20dnl Usage: COLUMN_STRIDE(index, size, column, order, uplo, inc) ...
21dnl        Advances the index one column to the right in a packed array.
22dnl        In the column major case, this is a function of the present
23dnl        column.
24dnl --------------------------------------------------------------------
25dnl
26define(`COLUMN_STRIDE', `ifelse(
27	`$4&&$5', `blas_colmajor&&blas_lower', `$1 += ($2 - $3 - 1) * $6;',
28	`$4&&$5', `blas_colmajor&&blas_upper', `$1 += ($3 + 1) * $6;',
29	`$1 += $6;')')dnl
30dnl
31dnl --------------------------------------------------------------------
32dnl Usage: ROW_STRIDE(index, size, row, order, uplo, inc) ... Advances
33dnl        the index one row down in a packed array.  In the
34dnl        row major case, this is a function of the present row.
35dnl --------------------------------------------------------------------
36dnl
37define(`ROW_STRIDE', `ifelse(
38	`$4&&$5', `blas_rowmajor&&blas_upper', `$1 += ($2 - $3 - 1) * $6;',
39	`$4&&$5', `blas_rowmajor&&blas_lower', `$1 += ($3 + 1) * $6;',
40	`$1 += $6;')')dnl
41dnl
42dnl The macros below are general usage and might be useful in cblas.m4.h
43dnl
44dnl
45dnl --------------------------------------------------------------------
46dnl Usage: FLIP(flip_enum, variable) ... computes the reversed value of
47dnl        any two-value operator argument.  flip_enum is one of the
48dnl        enumerated types in cblas.h.
49dnl --------------------------------------------------------------------
50define(`FLIP', `ifelse(
51	`$1', `blas_sort_type',
52    `($2 == blas_increasing_order) ? blas_decreasing_order : blas_increasing_order',
53	`$1', `blas_side_type',
54    `($2 == blas_left_side) ? blas_right_side : blas_left_side',
55	`$1', `blas_uplo_type',
56    `($2 == blas_upper) ? blas_lower : blas_upper',
57	`$1', `blas_conj_type',
58    `($2 == blas_conj) ? blas_no_conj : blas_conj',
59	`$1', `blas_diag_type',
60    `($2 == blas_unit_diag) ? blas_non_unit_diag : blas_unit_diag',
61	`$1', `blas_direct_type',
62    `($2 == blas_forward_seq) ? blas_backward_seq : blas_forward_seq',
63	`$1', `blas_order_type',
64    `($2 == blas_rowmajor) ? blas_colmajor : blas_rowmajor')')dnl
65dnl
66dnl
67