Skip to content

Commit 7b93ac5

Browse files
authored
Add Tensorial scitype (#15)
* Add Tensorial scitype * Add more tests * Update CI.yml
1 parent 5f9fbde commit 7b93ac5

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

.github/workflows/CI.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,11 @@ jobs:
2020
matrix:
2121
version:
2222
- '1.9'
23-
- 'nightly'
23+
- '1'
2424
os:
2525
- ubuntu-latest
26+
- macos-latest
27+
- windows-latest
2628
arch:
2729
- x64
2830
steps:

src/DataScienceTraits.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,13 @@ Scientific type of geometrical data (See Meshes.jl)
4848
"""
4949
abstract type Geometrical <: SciType end
5050

51+
"""
52+
Tensorial
53+
54+
Scientific type of tensorial data (e.g. Vector, Matrix)
55+
"""
56+
abstract type Tensorial <: SciType end
57+
5158
"""
5259
Temporal
5360
@@ -114,6 +121,7 @@ scitype(::Type{<:Number}) = Continuous
114121
scitype(::Type{<:Integer}) = Categorical
115122
scitype(::Type{<:AbstractChar}) = Categorical
116123
scitype(::Type{<:AbstractString}) = Categorical
124+
scitype(::Type{<:AbstractArray}) = Tensorial
117125
scitype(::Type{<:TimeType}) = Temporal
118126
scitype(::Type{Union{T,Missing}}) where {T} = scitype(T)
119127

test/runtests.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@ const DST = DataScienceTraits
3030
@test scitype('a') <: DST.Categorical
3131
@test scitype("a") <: DST.Categorical
3232

33+
# Tensorial
34+
@test scitype(Vector) <: DST.Tensorial
35+
@test scitype(Matrix) <: DST.Tensorial
36+
@test scitype(Array) <: DST.Tensorial
37+
@test scitype(rand(2)) <: DST.Tensorial
38+
@test scitype(rand(2, 2)) <: DST.Tensorial
39+
@test scitype(rand(2, 2, 2)) <: DST.Tensorial
40+
3341
# Unknown
3442
@test scitype(Nothing) <: DST.Unknown
3543
@test scitype(Union{}) <: DST.Unknown

0 commit comments

Comments
 (0)