|
316 | 316 | function testDiagOp(N=32,K=2;arrayType = Array)
|
317 | 317 | x = arrayType(rand(ComplexF64, K*N))
|
318 | 318 | block = arrayType(rand(ComplexF64, N, N))
|
319 |
| - |
| 319 | + |
320 | 320 | F = arrayType(zeros(ComplexF64, K*N, K*N))
|
321 | 321 | for k = 1:K
|
322 | 322 | start = (k-1)*N + 1
|
@@ -377,36 +377,54 @@ function testDiagOp(N=32,K=2;arrayType = Array)
|
377 | 377 | true
|
378 | 378 | end
|
379 | 379 |
|
380 |
| -# TODO RadonOp |
| 380 | +function testRadonOp(N=32;arrayType = Array) |
| 381 | + x = arrayType(rand(N, N)) |
| 382 | + xop = vec(x) |
| 383 | + geom = RadonParallelCircle(N, -(N-1)÷2:(N-1)÷2) |
| 384 | + angles = collect(range(0, pi, 100)) |
| 385 | + |
| 386 | + op = RadonOp(eltype(x); shape = (N, N), angles, geometry = geom, S = typeof(xop)) |
| 387 | + |
| 388 | + y = Array(radon(x, angles; geometry = geom)) |
| 389 | + y1 = reshape(Array(op * xop), size(y)...) |
| 390 | + @test y ≈ y1 rtol = 1e-2 |
| 391 | + |
| 392 | + xtmp = Array(backproject(arrayType(y), angles; geometry = geom)) |
| 393 | + x2 = reshape(Array(adjoint(op) * arrayType(vec(y1))), size(xtmp)...) |
| 394 | + @test xtmp ≈ x2 rtol = 1e-2 |
| 395 | + true |
| 396 | +end |
381 | 397 |
|
382 | 398 | @testset "Linear Operators" begin
|
383 | 399 | @testset for arrayType in arrayTypes
|
384 |
| - #@info "test DCT-II and DCT-IV Ops: $arrayType" |
385 |
| - #for N in [2,8,16,32] |
386 |
| - # @test testDCT1d(N;arrayType) skip = arrayType != Array # Not implemented for GPUs |
387 |
| - #end |
388 |
| - #@info "test FFTOp: $arrayType" |
389 |
| - #for N in [8,16,32] |
390 |
| - # @test testFFT1d(N,false;arrayType) |
391 |
| - # @test testFFT1d(N,true;arrayType) |
392 |
| - # @test testFFT2d(N,false;arrayType) |
393 |
| - # @test testFFT2d(N,true;arrayType) |
394 |
| - #end |
395 |
| - #@info "test WeightingOp: $arrayType" |
396 |
| - #@test testWeighting(512;arrayType) |
397 |
| - #@info "test GradientOp: $arrayType" |
398 |
| - #@test testGradOp1d(512;arrayType) |
399 |
| - #@test testGradOp2d(64;arrayType) |
400 |
| - #@test testDirectionalGradOp(64;arrayType) |
401 |
| - #@info "test SamplingOp: $arrayType" |
402 |
| - #@test testSampling(64;arrayType) |
403 |
| - #@info "test WaveletOp: $arrayType" |
404 |
| - #@test testWavelet(64,64;arrayType) |
405 |
| - #@test testWavelet(64,60;arrayType) |
406 |
| - #@info "test NFFTOp: $arrayType" |
407 |
| - #@test testNFFT2d(;arrayType) skip = arrayType == JLArray # JLArray does not have a NFFTPlan |
408 |
| - #@test testNFFT3d(;arrayType) skip = arrayType == JLArray # JLArray does not have a NFFTPlan |
| 400 | + @info "test DCT-II and DCT-IV Ops: $arrayType" |
| 401 | + for N in [2,8,16,32] |
| 402 | + @test testDCT1d(N;arrayType) skip = arrayType != Array # Not implemented for GPUs |
| 403 | + end |
| 404 | + @info "test FFTOp: $arrayType" |
| 405 | + for N in [8,16,32] |
| 406 | + @test testFFT1d(N,false;arrayType) |
| 407 | + @test testFFT1d(N,true;arrayType) |
| 408 | + @test testFFT2d(N,false;arrayType) |
| 409 | + @test testFFT2d(N,true;arrayType) |
| 410 | + end |
| 411 | + @info "test WeightingOp: $arrayType" |
| 412 | + @test testWeighting(512;arrayType) |
| 413 | + @info "test GradientOp: $arrayType" |
| 414 | + @test testGradOp1d(512;arrayType) |
| 415 | + @test testGradOp2d(64;arrayType) |
| 416 | + @test testDirectionalGradOp(64;arrayType) |
| 417 | + @info "test SamplingOp: $arrayType" |
| 418 | + @test testSampling(64;arrayType) |
| 419 | + @info "test WaveletOp: $arrayType" |
| 420 | + @test testWavelet(64,64;arrayType) |
| 421 | + @test testWavelet(64,60;arrayType) |
| 422 | + @info "test NFFTOp: $arrayType" |
| 423 | + @test testNFFT2d(;arrayType) skip = arrayType == JLArray # JLArray does not have a NFFTPlan |
| 424 | + @test testNFFT3d(;arrayType) skip = arrayType == JLArray # JLArray does not have a NFFTPlan |
409 | 425 | @info "test DiagOp: $arrayType"
|
410 | 426 | @test testDiagOp(;arrayType)
|
| 427 | + @info "test RadonOp: $arrayType" |
| 428 | + @test testRadonOp(;arrayType) skip = arrayType == JLArray # Stackoverflow for kernelabstraction |
411 | 429 | end
|
412 | 430 | end
|
0 commit comments