Skip to content

Commit d90fe83

Browse files
authored
Removing BlockArrays (#17)
* removed blockarrays * dropped julia 0.7 * removed some weird comments * no test in indaffine for 1.0 * fixing docs * fix docs 2
1 parent f4a6908 commit d90fe83

18 files changed

+190
-178
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
*.jpg
99
*.wav
1010
*.tex
11+
*.DS_Store
1112

1213
demos/.ipynb_checkpoints/
1314
docs/build/
1415
docs/site/
16+
docs/Manifest.toml

.travis.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ os:
44
- linux
55
- osx
66
julia:
7-
- 0.7
87
- 1.0
8+
- 1.1
99
- nightly
1010
matrix:
1111
allow_failures:
@@ -15,5 +15,14 @@ notifications:
1515
after_success:
1616
- julia -e 'using Pkg; cd(Pkg.dir("StructuredOptimization")); Pkg.add("Coverage"); using Coverage; Coveralls.submit(process_folder())'
1717
- julia -e 'using Pkg; cd(Pkg.dir("StructuredOptimization")); Pkg.add("Coverage"); using Coverage; Codecov.submit(Codecov.process_folder())'
18-
- julia -e 'using Pkg; ps=Pkg.PackageSpec(name="Documenter", version="0.19"); Pkg.add(ps); Pkg.pin(ps)'
19-
- julia -e 'using Pkg; cd(Pkg.dir("StructuredOptimization")); include(joinpath("docs", "make.jl"))'
18+
19+
jobs:
20+
include:
21+
- stage: "Documentation"
22+
julia: 1.1
23+
os: linux
24+
script:
25+
- julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd()));
26+
Pkg.instantiate()'
27+
- julia --project=docs/ docs/make.jl
28+
after_success: skip

REQUIRE

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
julia 0.7
1+
julia 1.0
22
FFTW 0.2.4
33
DSP 0.5.1
44
AbstractOperators 0.1.0
55
ProximalOperators 0.8.0
66
ProximalAlgorithms 0.1.0
7+
RecursiveArrayTools 0.18.0

TODO.md

Lines changed: 0 additions & 14 deletions
This file was deleted.

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
environment:
22
matrix:
3-
- julia_version: 0.7
43
- julia_version: 1
4+
- julia_version: 1.1
55
- julia_version: nightly
66

77
platform:

docs/Project.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[deps]
2+
AbstractOperators = "d9c5613a-d543-52d8-9afd-8f241a8c3f1c"
3+
DSP = "717857b8-e6f2-59f4-9121-6e50c889abd2"
4+
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
5+
FFTW = "7a1cc6ca-52ef-59f5-83cd-3a7055c09341"

docs/make.jl

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
using Documenter, StructuredOptimization, LinearAlgebra, DSP, AbstractFFTs, FFTW, AbstractOperators
1+
using Documenter, StructuredOptimization, LinearAlgebra, DSP, FFTW, AbstractOperators
22

33
makedocs(
44
modules = [StructuredOptimization],
5-
format = :html,
5+
format = Documenter.HTML(),
66
sitename = "StructuredOptimization",
77
authors = "Niccolò Antonello and Lorenzo Stella",
8-
pages = Any[
8+
pages = [
99
"Home" => "index.md",
1010
"Quick Tutorial Guide" => "tutorial.md",
1111
"Expressions" => "expressions.md",
@@ -16,10 +16,6 @@ makedocs(
1616
)
1717

1818
deploydocs(
19-
repo = "github.com/kul-forbes/StructuredOptimization.jl.git",
20-
julia = "1.0",
21-
osname = "linux",
19+
repo = "github.com/kul-forbes/AbstractOperators.jl.git",
2220
target = "build",
23-
deps = nothing,
24-
make = nothing,
2521
)

src/StructuredOptimization.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ __precompile__()
33
module StructuredOptimization
44

55
using LinearAlgebra
6+
using RecursiveArrayTools
67
using AbstractOperators
7-
using AbstractOperators.BlockArrays
88
using ProximalOperators
99
using ProximalAlgorithms
1010

src/calculus/precomposeNonlinear.jl

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,26 @@
1-
import ProximalOperators: gradient! # this can be removed when moved to Prox
1+
import ProximalOperators: gradient!, gradient # this can be removed when moved to Prox
22

33
export PrecomposeNonlinear
44

55
struct PrecomposeNonlinear{P <: ProximableFunction,
66
T <: AbstractOperator,
7-
D, C
7+
D <: AbstractArray,
8+
C <: AbstractArray
89
} <: ProximableFunction
910
g::P
10-
G::T
11-
bufD::D
12-
bufC::C
13-
bufC2::C
11+
G::T
12+
bufD::D
13+
bufC::C
14+
bufC2::C
1415
end
1516

1617
function PrecomposeNonlinear(g::P, G::T) where {P, T}
17-
bufD = blockzeros(domainType(G), size(G,2))
18-
bufC = blockzeros(codomainType(G),size(G,1))
19-
bufC2 = blockzeros(codomainType(G),size(G,1))
20-
PrecomposeNonlinear{P, T, typeof(bufD), typeof(bufC)}(g, G, bufD, bufC, bufC2)
18+
t, s = domainType(G), size(G,2)
19+
bufD = eltype(s) <: Int ? zeros(t,s) : ArrayPartition(zeros.(t,s))
20+
t, s = codomainType(G), size(G,1)
21+
bufC = eltype(s) <: Int ? zeros(t,s) : ArrayPartition(zeros.(t,s))
22+
bufC2 = eltype(s) <: Int ? zeros(t,s) : ArrayPartition(zeros.(t,s))
23+
PrecomposeNonlinear{P, T, typeof(bufD), typeof(bufC)}(g, G, bufD, bufC, bufC2)
2124
end
2225

2326
is_smooth(f::PrecomposeNonlinear) = is_smooth(f.g)
@@ -26,7 +29,22 @@ function (f::PrecomposeNonlinear)(x)
2629
return f.g(f.G*x)
2730
end
2831

29-
function gradient!(y::D, f::PrecomposeNonlinear{P,T,D,C}, x::D) where {P,T,D,C}
32+
function gradient(f::PrecomposeNonlinear, x::ArrayPartition)
33+
y = zero(x)
34+
fy = gradient!(y,f,x)
35+
return y, fy
36+
end
37+
38+
#TODO simplify this
39+
function gradient!(y::D, f::PrecomposeNonlinear{P,T,D,C}, x::D) where {P,T,D <: ArrayPartition,C}
40+
mul!(f.bufC, f.G, x)
41+
v = gradient!(f.bufC2, f.g, f.bufC)
42+
J = Jacobian(f.G, x)
43+
y = mul!(y, J', f.bufC2)
44+
return v
45+
end
46+
47+
function gradient!(y::D, f::PrecomposeNonlinear{P,T,D,C}, x::D) where {P,T,D <: AbstractArray,C}
3048
mul!(f.bufC, f.G, x)
3149
v = gradient!(f.bufC2, f.g, f.bufC)
3250
J = Jacobian(f.G, x)

src/solvers/build_solve.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ julia> solve!(x_solver);
8585
function solve!(x_and_iter::Tuple{Tuple{Vararg{Variable}}, ProximalAlgorithms.ProximalAlgorithm})
8686
x, iterator = x_and_iter
8787
it, x_star = ProximalAlgorithms.run!(iterator)
88-
blockset!(~x, x_star)
88+
~x .= x_star
8989
return it, iterator
9090
end
9191

0 commit comments

Comments
 (0)