Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Discuss this old branch #19

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ authors = ["Christoph Ortner <[email protected]> and contributors"]
version = "0.0.1"

[deps]
ACE = "3e8ccfd2-c8b0-11ea-32f1-f3a5990fd77a"
ACEbase = "14bae519-eb20-449c-a949-9c58ed33163e"
ACEcore = "44c1e890-45d1-48ea-94d6-c2ea5b573f71"
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
Expand All @@ -15,15 +16,14 @@ Polynomials4ML = "03c4bcba-a943-47e9-bfa1-b1661fc2974f"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"

[compat]
ACEbase = "0.2"
ACEcore = "0.0.1"
BenchmarkTools = "1"
ForwardDiff = "0.10"
JSON = "0.21"
ObjectPools = "0.0.2"
Polynomials4ML = "0.0.2"
julia = "1"
JSON = "0.21"
ACEbase = "0.2"

Polynomials4ML = "0.0.6"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Expand Down
File renamed without changes.
20 changes: 20 additions & 0 deletions examples/backup/bflow-v-1trans.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using ACE
using Polynomials4ML
using ACEpsi

const ↑, ↓, ∅ = '↑','↓','∅'

Nel = 8
Σ = vcat(rand([↑],Int(ceil(Nel/2))),rand([↓],Nel - Int(ceil(Nel/2))))
trans = λ("r -> 2/pi * atan(r)")
MaxDeg = [4, 4]
polys = Polynomials4ML.legendre_basis(maximum(MaxDeg))
U = ACEpsi.BFwf(Nel, polys; ν=length(MaxDeg), totdeg = maximum(MaxDeg), trans = trans,sd_admissible = bb -> (length(bb) == 0 || all([bb[i][1] <= MaxDeg[length(bb)] for i = 1:length(bb)])))

X = rand(Nel)
ACEpsi.evaluate(U,X,Σ)
ACEpsi.gradient(U,X,Σ)




22 changes: 22 additions & 0 deletions examples/backup/bflow-v-mtrans.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using ACE
using Polynomials4ML
using ACEpsi

const ↑, ↓, ∅ = '↑','↓','∅'

Nel = 8
Σ = vcat(rand([↑],Int(ceil(Nel/2))),rand([↓],Nel - Int(ceil(Nel/2))))

pos = [-70.,-50.,-30.,-10.,10.,30.,50.,70.]
trans = [λ("r -> atan(r+70.0)"),λ("r -> atan(r+50.0)"),λ("r -> atan(r+30.0)"),λ("r -> atan(r+10.0)"),λ("r -> atan(r-10.0)"),λ("r -> atan(r-30.0)"),λ("r -> atan(r-50.0)"),λ("r -> atan(r-70.0)")]
tpos = reduce(vcat,pos)
pos = reduce(vcat,pos)
M = length(pos)
MaxDeg = [6, 6, 6]

polys = Polynomials4ML.legendre_basis(maximum(MaxDeg))
wf = ACEpsi.BFwf(Nel, polys, x -> sqrt(1+x^2); pos = pos, tpos = tpos, ν=length(MaxDeg[1]), totdeg = maximum(MaxDeg), trans = trans,sd_admissible = bb -> (length(bb) == 0 || all([bb[i][1] <= MaxDeg[length(bb)] for i = 1:length(bb)])))

X = rand(Nel)
ACEpsi.evaluate(U,X,Σ)
ACEpsi.gradient(U,X,Σ)
47 changes: 47 additions & 0 deletions profile/profile_bflow.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
using Polynomials4ML, ACEcore, ACEpsi, ACEbase, Printf
using ACEpsi: BFwf, gradient, evaluate, laplacian
using LinearAlgebra
using BenchmarkTools

##

N = 8
Σ = vcat(rand([↑],Int(ceil(N/2))),rand([↓],N - Int(ceil(N/2))))

pos = [-70.,-50.,-30.,-10.,10.,30.,50.,70.]
trans = [λ("r -> atan(r+70.0)"),λ("r -> atan(r+50.0)"),λ("r -> atan(r+30.0)"),λ("r -> atan(r+10.0)"),λ("r -> atan(r-10.0)"),λ("r -> atan(r-30.0)"),λ("r -> atan(r-50.0)"),λ("r -> atan(r-70.0)")]
tpos = reduce(vcat,pos)
pos = reduce(vcat,pos)
M = length(pos)
MaxDeg = [6, 6, 6]

polys = Polynomials4ML.legendre_basis(maximum(MaxDeg))
wf = BFwf(N, polys, x -> sqrt(1+x^2); pos = pos, tpos = tpos, ν=length(MaxDeg[1]), totdeg = maximum(MaxDeg), trans = trans,sd_admissible = bb -> (length(bb) == 0 || all([bb[i][1] <= MaxDeg[length(bb)] for i = 1:length(bb)])))

##

X = 2 * rand(Nel) .- 1
Σ = rand([↑, ↓], Nel)
wf(X, Σ)
gradient(wf, X, Σ)
laplacian(wf, X, Σ)

##

@info("evaluate")
@btime wf($X, Σ)

@info("gradient")
@btime gradient($wf, $X, $Σ)

@info("laplacian")
@btime laplacian($wf, $X, $Σ)


##

# @profview let wf=wf, X=X
# for nrun = 1:50_000
# laplacian(wf, X)
# end
# end
21 changes: 11 additions & 10 deletions profile/profile_bflow1.jl → profile/profile_bflows.jl
Original file line number Diff line number Diff line change
@@ -1,34 +1,35 @@


using Polynomials4ML, ACEcore, ACEpsi, ACEbase, Printf
using ACEpsi: BFwf, gradient, evaluate, laplacian
using LinearAlgebra
using BenchmarkTools

##

Nel = 10
polys = legendre_basis(15)
const ↑, ↓, ∅ = '↑','↓','∅'
Nel = 8
polys = legendre_basis(6)
wf = BFwf(Nel, polys; ν=3)


##

X = 2 * rand(Nel) .- 1
wf(X)
gradient(wf, X)
laplacian(wf, X)
Σ = rand([↑, ↓], Nel)
wf(X, Σ)
gradient(wf, X, Σ)
laplacian(wf, X, Σ)

##

@info("evaluate")
@btime $wf($X)
@btime wf($X, Σ)

@info("gradient")
@btime gradient($wf, $X)
@btime gradient($wf, $X, $Σ)

@info("laplacian")
@btime laplacian($wf, $X)
@btime laplacian($wf, $X, $Σ)


##

Expand Down
1 change: 1 addition & 0 deletions src/ACEpsi.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ module ACEpsi

include("bflow.jl")
include("envelope.jl")
include("bflow-mts.jl")

end
Loading