comparison LazyTensors/test/runtests.jl @ 331:c8bbb4a83518

Merge
author Vidar Stiernström <vidar.stiernstrom@it.uu.se>
date Fri, 25 Sep 2020 09:36:06 +0200
parents 41c3c25e4e3b
children
comparison
equal deleted inserted replaced
330:8d1a830b0c22 331:c8bbb4a83518
113 @test range_size(A+B, (3,)) == range_size(A, (3,)) == range_size(B,(3,)) 113 @test range_size(A+B, (3,)) == range_size(A, (3,)) == range_size(B,(3,))
114 @test domain_size(A+B, (3,)) == domain_size(A, (3,)) == domain_size(B,(3,)) 114 @test domain_size(A+B, (3,)) == domain_size(A, (3,)) == domain_size(B,(3,))
115 end 115 end
116 116
117 @testset "LazyArray" begin 117 @testset "LazyArray" begin
118 @testset "LazyConstantArray" begin
119 @test LazyTensors.LazyConstantArray(3,(3,2)) isa LazyArray{Int,2}
120
121 lca = LazyTensors.LazyConstantArray(3.0,(3,2))
122 @test eltype(lca) == Float64
123 @test ndims(lca) == 2
124 @test size(lca) == (3,2)
125 @test lca[2] == 3.0
126 end
118 struct DummyArray{T,D, T1<:AbstractArray{T,D}} <: LazyArray{T,D} 127 struct DummyArray{T,D, T1<:AbstractArray{T,D}} <: LazyArray{T,D}
119 data::T1 128 data::T1
120 end 129 end
121 Base.size(v::DummyArray) = size(v.data) 130 Base.size(v::DummyArray) = size(v.data)
122 Base.getindex(v::DummyArray{T,D}, I::Vararg{Int,D}) where {T,D} = v.data[I...] 131 Base.getindex(v::DummyArray{T,D}, I::Vararg{Int,D}) where {T,D} = v.data[I...]