{% set version = "1.4-1" %}
{% set posix = 'm2-' if win else '' %}
{% set native = 'm2w64-' if win else '' %}

package:
  name: r-softimpute
  version: {{ version|replace("-", "_") }}

source:
  fn: softImpute_{{ version }}.tar.gz
  url:
    - {{ cran_mirror }}/src/contrib/softImpute_{{ version }}.tar.gz
    - {{ cran_mirror }}/src/contrib/Archive/softImpute/softImpute_{{ version }}.tar.gz
  sha256: ea4c39831dee834204f6d6594aad6b937540ba4f2adf3f37fb4546844c234aec

build:
  merge_build_host: true  # [win]
  number: 0

  rpaths:
    - lib/R/lib/
    - lib/

requirements:
  build:
    - {{ compiler('c') }}        # [not win]
    - {{ compiler('fortran') }}  # [not win]
    - {{ compiler('m2w64_c') }}        # [win]
    - {{ compiler('m2w64_fortran') }}        # [win]
    - {{ posix }}filesystem        # [win]
    - {{ posix }}make
    - {{ posix }}sed  # [win]
    - {{ posix }}coreutils  # [win]
    - {{ posix }}sed               # [win]
    - {{ posix }}coreutils         # [win]
    - {{ posix }}zip               # [win]

  host:
    - r-base
    - r-matrix

  run:
    - r-base
    - {{ native }}gcc-libs         # [win]
    - r-matrix

test:
  commands:
    - $R -e "library('softImpute')"           # [not win]
    - "\"%R%\" -e \"library('softImpute')\""  # [win]

about:
  home: https://CRAN.R-project.org/package=softImpute
  license: GPL-2
  summary: Iterative methods for matrix completion that use nuclear-norm regularization. There are two main approaches.The one approach uses iterative soft-thresholded svds to impute the missing values. The second approach uses alternating least squares. Both have an "EM" flavor, in that at each iteration the matrix is completed
    with the current estimate. For large matrices there is a special sparse-matrix class named "Incomplete" that efficiently handles all computations. The package includes procedures for centering and scaling rows, columns or both, and for computing low-rank SVDs on large sparse centered matrices (i.e. principal components)
  license_family: GPL2
  license_file: {{ environ["PREFIX"] }}/lib/R/share/licenses/GPL-2

extra:
  recipe-maintainers:
    - conda-forge/r
    - apcamargo
