Use array interface for CSC matrix. (#8672)

* Use array interface for CSC matrix.

Use array interface for CSC matrix and align the interface with CSR and dense.

- Fix nthread issue in the R package DMatrix.
- Unify the behavior of handling `missing` with other inputs.
- Unify the behavior of handling `missing` around R, Python, Java, and Scala DMatrix.
- Expose `num_non_missing` to the JVM interface.
- Deprecate old CSR and CSC constructors.
This commit is contained in:
Jiaming Yuan
2023-02-05 01:59:46 +08:00
committed by GitHub
parent 213b5602d9
commit c1786849e3
23 changed files with 673 additions and 380 deletions

View File

@@ -1,5 +1,5 @@
/*
Copyright (c) 2014 by Contributors
Copyright (c) 2014-2023 by Contributors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -54,6 +54,9 @@ class DMatrixSuite extends FunSuite {
dmat1.setLabel(label1)
val label2 = dmat1.getLabel
assert(label2 === label1)
val dmat2 = new DMatrix(rowHeaders, colIndex, data, JDMatrix.SparseType.CSR, 5, 1.0f, -1)
assert(dmat2.nonMissingNum === 9);
}
test("create DMatrix from CSREx") {
@@ -94,6 +97,9 @@ class DMatrixSuite extends FunSuite {
dmat1.setLabel(label1)
val label2 = dmat1.getLabel
assert(label2 === label1)
val dmat2 = new DMatrix(colHeaders, rowIndex, data, JDMatrix.SparseType.CSC, 5, 1.0f, -1)
assert(dmat2.nonMissingNum === 9);
}
test("create DMatrix from CSCEx") {