---
include: rocblas_common.yaml
include: known_bugs.yaml

Definitions:
  - &special_case_range
    - { N: 0, incx: 1, incy: 1, batch_count: 1 }
    - { N: 1, incx: 1, incy: 1, batch_count: 0 }

    - { N: -1, incx: 1, incy: 1, batch_count:  0 }
    - { N:  0, incx: 0, incy: 1, batch_count:  0 }
    - { N:  0, incx: 1, incy: 0, batch_count:  0 }
    - { N:  0, incx: 1, incy: 1, batch_count: -1 }

  - &medium_matrix_size_range
    - { N:    -1 }
    - { N:     3 }
    - { N:    10 }
    - { N:   500 }

  - &large_matrix_size_range
    - { N:  4011 }
    - { N:  8000 }

  - &incx_incy_range
    - { incx:   1, incy:   1 }
    - { incx:   0, incy:  -1 }
    - { incx:   2, incy:   1 }
    - { incx:  -1, incy:  -1 }

  - &incx_incy_range_small
    - { incx: 2, incy: -2 }

  - &alpha_beta_range
    - { alpha:  1.0, beta:  0.0 }
    - { alpha:  0.0, beta:  1.0 }
    - { alpha: -1.0, beta: -1.0 }
    - { alpha:  2.0, beta:  1.0 }

  - &alpha_beta_range_small
    - { alpha: 2.0, beta: 1.5 }

  - &alpha_beta_range_nan
    - { alpha: .NaN, beta: 1.5 }
    - { alpha: 1.2, beta: .NaN }

Tests:
- name: spmv_bad
  category: pre_checkin
  function: spmv_bad_arg
  precision: *single_precision
  fortran: [ false, true ]

- name: spmv_arg_check
  category: quick
  function:
  - spmv
  - spmv_batched
  - spmv_strided_batched
  precision: *single_double_precisions
  uplo: L
  matrix_size: *special_case_range

- name: spmv_fortran
  category: quick
  function: spmv
  precision: *single_double_precisions
  uplo: [ U, L ]
  matrix_size: *medium_matrix_size_range
  incx_incy: *incx_incy_range_small
  alpha_beta: *alpha_beta_range_small
  fortran: true

- name: spmv_NaN
  category: pre_checkin
  function: spmv
  precision: *single_double_precisions
  uplo: [ U ]
  N: [ 33 ]
  incx_incy: *incx_incy_range_small
  alpha_beta: *alpha_beta_range_nan

- name: spmv_medium
  category: pre_checkin
  function: spmv
  precision: *single_double_precisions
  uplo: [ U, L ]
  matrix_size: *medium_matrix_size_range
  incx_incy: *incx_incy_range
  alpha_beta: *alpha_beta_range

- name: spmv_large
  category: nightly
  function: spmv
  precision: *single_double_precisions
  uplo: [ U, L ]
  matrix_size: *large_matrix_size_range
  incx_incy: *incx_incy_range_small
  alpha_beta: *alpha_beta_range_small

  # batched
- name: spmv_batched_bad
  category: pre_checkin
  function: spmv_batched_bad_arg
  precision: *single_precision
  fortran: [ false, true ]

- name: spmv_batched_fortran
  category: quick
  function: spmv_batched
  precision: *single_double_precisions
  uplo: [ U, L ]
  matrix_size: *medium_matrix_size_range
  incx_incy: *incx_incy_range_small
  alpha_beta: *alpha_beta_range_small
  batch_count: [ -1, 0, 3 ]
  fortran: true

- name: spmv_batched_medium
  category: pre_checkin
  function: spmv_batched
  precision: *single_double_precisions
  uplo: [ U, L ]
  matrix_size: *medium_matrix_size_range
  incx_incy: *incx_incy_range
  alpha_beta: *alpha_beta_range
  batch_count: [ -1, 0, 1, 257 ]

- name: spmv_batched_large
  category: nightly
  function: spmv_batched
  precision: *single_double_precisions
  uplo: [ U, L ]
  matrix_size: *large_matrix_size_range
  incx_incy: *incx_incy_range_small
  alpha_beta: *alpha_beta_range_small
  batch_count: [ 1, 3 ]

  # strided batched
- name: spmv_strided_batched_bad
  category: pre_checkin
  function: spmv_strided_batched_bad_arg
  precision: *single_precision
  fortran: [ false, true ]

- name: spmv_strided_batched_fortran
  category: quick
  function: spmv_strided_batched
  precision: *single_double_precisions
  uplo: [ U, L ]
  matrix_size: *medium_matrix_size_range
  incx_incy: *incx_incy_range_small
  alpha_beta: *alpha_beta_range_small
  batch_count: [ -1, 0, 3 ]
  fortran: true

- name: spmv_strided_batched_medium
  category: pre_checkin
  function: spmv_strided_batched
  precision: *single_double_precisions
  uplo: [ U, L ]
  matrix_size: *medium_matrix_size_range
  incx_incy: *incx_incy_range
  alpha_beta: *alpha_beta_range
  batch_count: [ -1, 0, 1, 257 ]

- name: spmv_strided_batched_large
  category: nightly
  function: spmv_strided_batched
  precision: *single_double_precisions
  uplo: [ U, L ]
  matrix_size: *large_matrix_size_range
  incx_incy: *incx_incy_range_small
  alpha_beta: *alpha_beta_range_small
  batch_count: [ 1, 3 ]

...
