# ########################################################################
# Copyright (c) 2019 Advanced Micro Devices, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
# ########################################################################

---
include: rocsparse_common.yaml
include: known_bugs.yaml

Definitions:
  - &M_N_range_quick
    - { M:  50, N:  50 }
    - { M: 187, N: 187 }

  - &M_N_range_checkin
    - { M:  -1, N:  -1 }
    - { M:   0, N:   0 }
    - { M:  79, N:  79 }
    - { M: 367, N: 367 }

  - &M_N_range_nightly
    - { M:   9381, N:   9381 }
    - { M:  37017, N:  37017 }
    - { M: 505216, N: 505216 }

  - &alpha_range_quick
    - { alpha:   1.0, alphai:  0.75 }
    - { alpha:  -0.5, alphai: -0.25 }

  - &alpha_range_checkin
    - { alpha:   2.0, alphai:  0.0 }
    - { alpha:   0.0, alphai:  0.5 }
    - { alpha:   3.0, alphai: -1.0 }

  - &alpha_range_nightly
    - { alpha:   0.0,  alphai: -0.75 }
    - { alpha:   0.25, alphai:  0.0 }
    - { alpha:  -0.75, alphai:  0.25 }

Tests:
- name: csrsv_bad_arg
  category: pre_checkin
  function: csrsv_bad_arg
  precision: *single_double_precisions_complex_real

- name: csrsv
  category: quick
  function: csrsv
  precision: *single_double_precisions_complex_real
  M_N: *M_N_range_quick
  alpha_alphai: *alpha_range_quick
  transA: [rocsparse_operation_none]
  diag: [rocsparse_diag_type_non_unit, rocsparse_diag_type_unit]
  uplo: [rocsparse_fill_mode_lower, rocsparse_fill_mode_upper]
  apol: [rocsparse_analysis_policy_reuse, rocsparse_analysis_policy_force]
  spol: [rocsparse_solve_policy_auto]
  baseA: [rocsparse_index_base_zero, rocsparse_index_base_one]
  matrix: [rocsparse_matrix_random]

- name: csrsv
  category: pre_checkin
  function: csrsv
  precision: *single_double_precisions_complex_real
  M_N: *M_N_range_checkin
  alpha_alphai: *alpha_range_checkin
  transA: [rocsparse_operation_none]
  diag: [rocsparse_diag_type_non_unit, rocsparse_diag_type_unit]
  uplo: [rocsparse_fill_mode_lower, rocsparse_fill_mode_upper]
  apol: [rocsparse_analysis_policy_reuse, rocsparse_analysis_policy_force]
  spol: [rocsparse_solve_policy_auto]
  baseA: [rocsparse_index_base_zero, rocsparse_index_base_one]
  matrix: [rocsparse_matrix_random]

- name: csrsv
  category: nightly
  function: csrsv
  precision: *single_double_precisions_complex_real
  M_N: *M_N_range_nightly
  alpha_alphai: *alpha_range_nightly
  transA: [rocsparse_operation_none]
  diag: [rocsparse_diag_type_non_unit, rocsparse_diag_type_unit]
  uplo: [rocsparse_fill_mode_lower, rocsparse_fill_mode_upper]
  apol: [rocsparse_analysis_policy_reuse, rocsparse_analysis_policy_force]
  spol: [rocsparse_solve_policy_auto]
  baseA: [rocsparse_index_base_zero, rocsparse_index_base_one]
  matrix: [rocsparse_matrix_random]

- name: csrsv_file
  category: quick
  function: csrsv
  precision: *single_double_precisions
  M: 1
  N: 1
  alpha_alphai: *alpha_range_quick
  transA: [rocsparse_operation_none]
  diag: [rocsparse_diag_type_non_unit] # TODO rocsparse_diag_type_unit
  uplo: [rocsparse_fill_mode_lower, rocsparse_fill_mode_upper]
  apol: [rocsparse_analysis_policy_reuse, rocsparse_analysis_policy_force]
  spol: [rocsparse_solve_policy_auto]
  baseA: [rocsparse_index_base_zero, rocsparse_index_base_one]
  matrix: [rocsparse_matrix_file_rocalution]
  filename: [mac_econ_fwd500,
             nos2,
             nos4,
             nos6,
             scircuit]

- name: csrsv_file
  category: pre_checkin
  function: csrsv
  precision: *single_double_precisions
  M: 1
  N: 1
  alpha_alphai: *alpha_range_checkin
  transA: [rocsparse_operation_none]
  diag: [rocsparse_diag_type_non_unit] # TODO rocsparse_diag_type_unit
  uplo: [rocsparse_fill_mode_lower, rocsparse_fill_mode_upper]
  apol: [rocsparse_analysis_policy_reuse, rocsparse_analysis_policy_force]
  spol: [rocsparse_solve_policy_auto]
  baseA: [rocsparse_index_base_zero, rocsparse_index_base_one]
  matrix: [rocsparse_matrix_file_rocalution]
  filename: [rma10,
             mc2depi,
             ASIC_320k,
             nos1,
             nos3,
             nos5,
             nos7]

- name: csrsv_file
  category: nightly
  function: csrsv
  precision: *single_double_precisions
  M: 1
  N: 1
  alpha_alphai: *alpha_range_nightly
  transA: [rocsparse_operation_none]
  diag: [rocsparse_diag_type_non_unit] # TODO rocsparse_diag_type_unit
  uplo: [rocsparse_fill_mode_lower, rocsparse_fill_mode_upper]
  apol: [rocsparse_analysis_policy_reuse, rocsparse_analysis_policy_force]
  spol: [rocsparse_solve_policy_auto]
  baseA: [rocsparse_index_base_zero, rocsparse_index_base_one]
  matrix: [rocsparse_matrix_file_rocalution]
  filename: [bmwcra_1,
             amazon0312,
             Chebyshev4,
             sme3Dc,
             shipsec1]

- name: csrsv_file
  category: quick
  function: csrsv
  precision: *single_double_precisions_complex
  M: 1
  N: 1
  alpha_alphai: *alpha_range_quick
  transA: [rocsparse_operation_none]
  diag: [rocsparse_diag_type_non_unit, rocsparse_diag_type_unit]
  uplo: [rocsparse_fill_mode_lower, rocsparse_fill_mode_upper]
  apol: [rocsparse_analysis_policy_reuse, rocsparse_analysis_policy_force]
  spol: [rocsparse_solve_policy_auto]
  baseA: [rocsparse_index_base_zero, rocsparse_index_base_one]
  matrix: [rocsparse_matrix_file_rocalution]
  filename: [Chevron2]

- name: csrsv_file
  category: pre_checkin
  function: csrsv
  precision: *single_double_precisions_complex
  M: 1
  N: 1
  alpha_alphai: *alpha_range_checkin
  transA: [rocsparse_operation_none]
  diag: [rocsparse_diag_type_non_unit, rocsparse_diag_type_unit]
  uplo: [rocsparse_fill_mode_lower, rocsparse_fill_mode_upper]
  apol: [rocsparse_analysis_policy_reuse, rocsparse_analysis_policy_force]
  spol: [rocsparse_solve_policy_auto]
  baseA: [rocsparse_index_base_zero, rocsparse_index_base_one]
  matrix: [rocsparse_matrix_file_rocalution]
  filename: [mplate,
             Chevron3]

- name: csrsv_file
  category: nightly
  function: csrsv
  precision: *single_double_precisions_complex
  M: 1
  N: 1
  alpha_alphai: *alpha_range_nightly
  transA: [rocsparse_operation_none]
  diag: [rocsparse_diag_type_non_unit, rocsparse_diag_type_unit]
  uplo: [rocsparse_fill_mode_lower, rocsparse_fill_mode_upper]
  apol: [rocsparse_analysis_policy_reuse, rocsparse_analysis_policy_force]
  spol: [rocsparse_solve_policy_auto]
  baseA: [rocsparse_index_base_zero, rocsparse_index_base_one]
  matrix: [rocsparse_matrix_file_rocalution]
  filename: [Chevron4]
