{% set version = '1.4' %}
{% 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: 98f5e66aefbf50a6a170421316a9f4b96651521a2196424245052340e75f9d1d

build:
  merge_build_host: True  # [win]
  number: 1005

  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
