Skip to content

Commit

Permalink
Fix formatting issues (#54)
Browse files Browse the repository at this point in the history
* Fix formatting issues

* Fix Requires import

* Add missing LinearAlgebra in extension

* Fix conditional import
  • Loading branch information
juliohm committed May 20, 2023
1 parent e10b61b commit 4a4a11e
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 13 deletions.
1 change: 1 addition & 0 deletions ext/DensityRatioEstimationChainRulesCoreExt.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# ------------------------------------------------------------------
# Licensed under the MIT License. See LICENSE in the project root.
# ------------------------------------------------------------------

module DensityRatioEstimationChainRulesCoreExt

if isdefined(Base, :get_extension)
Expand Down
1 change: 1 addition & 0 deletions ext/DensityRatioEstimationConvexExt.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# ------------------------------------------------------------------
# Licensed under the MIT License. See LICENSE in the project root.
# ------------------------------------------------------------------

module DensityRatioEstimationConvexExt

if isdefined(Base, :get_extension)
Expand Down
1 change: 1 addition & 0 deletions ext/DensityRatioEstimationGPUArraysExt.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# ------------------------------------------------------------------
# Licensed under the MIT License. See LICENSE in the project root.
# ------------------------------------------------------------------

module DensityRatioEstimationGPUArraysExt

if isdefined(Base, :get_extension)
Expand Down
1 change: 1 addition & 0 deletions ext/DensityRatioEstimationJuMPExt.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# ------------------------------------------------------------------
# Licensed under the MIT License. See LICENSE in the project root.
# ------------------------------------------------------------------

module DensityRatioEstimationJuMPExt

if isdefined(Base, :get_extension)
Expand Down
3 changes: 3 additions & 0 deletions ext/DensityRatioEstimationOptimExt.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# ------------------------------------------------------------------
# Licensed under the MIT License. See LICENSE in the project root.
# ------------------------------------------------------------------

module DensityRatioEstimationOptimExt

if isdefined(Base, :get_extension)
Expand All @@ -12,7 +13,9 @@ else
using ..DensityRatioEstimation: KLIEP, LSIF, OptimLib
using ..Optim
end

using LinearAlgebra

include("../src/kliep/optim.jl")
include("../src/lsif/optim.jl")

Expand Down
13 changes: 5 additions & 8 deletions src/DensityRatioEstimation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,27 +32,25 @@ include("lcv.jl")
# pure Julia implementations
include("kmm/julia.jl")

# implementations that require extra dependencies
if !isdefined(Base, :get_extension)
using Requires
end
# implementations that require extra dependencies
@static if !isdefined(Base, :get_extension)
function __init__()

#Solvers

#JuMP: KMM, LSIF
# JuMP: KMM, LSIF
@require JuMP = "4076af6c-e467-56ae-b986-b466b2749572" begin
@require Ipopt = "b6b21f68-93f8-5de0-b562-5493be1d77c9" begin
include("../ext/DensityRatioEstimationJuMPExt.jl")
end
end
#Optim: KLIEP, LSIF

# Optim: KLIEP, LSIF
@require Optim = "429524aa-4258-5aef-a3af-852621145aeb" begin
include("../ext/DensityRatioEstimationOptimExt.jl")
end

#Convex: KLIEP
# Convex: KLIEP
@require Convex = "f65535da-76fb-5f13-bab9-19810c17039a" begin
@require ECOS = "e2685f51-7e38-5353-a97d-a921fd2c8199" begin
include("../ext/DensityRatioEstimationConvexExt.jl")
Expand All @@ -63,7 +61,6 @@ end
@require ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" begin
include("../ext/DensityRatioEstimationChainRulesCoreExt.jl")
end

@require GPUArrays = "0c68f7d7-f131-5f86-a1c3-88cf8149b2d7" begin
include("../ext/DensityRatioEstimationGPUArraysExt.jl")
end
Expand Down
2 changes: 1 addition & 1 deletion src/kliep/convex.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Licensed under the MIT License. See LICENSE in the project root.
# ------------------------------------------------------------------

#This file is part of the module DensityRatioEstimationConvexExt.
# This file is part of the module DensityRatioEstimationConvexExt.

function DensityRatioEstimation._kliep_coeffs(K_nu, K_de, dre::KLIEP, optlib::Type{ConvexLib})
# retrieve parameters
Expand Down
2 changes: 1 addition & 1 deletion src/kliep/optim.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Licensed under the MIT License. See LICENSE in the project root.
# ------------------------------------------------------------------

#This file is part of the module DensityRatioEstimationOptimExt.
# This file is part of the module DensityRatioEstimationOptimExt.

function DensityRatioEstimation._kliep_coeffs(K_nu, K_de, dre::KLIEP, optlib::Type{OptimLib})
# retrieve parameters
Expand Down
2 changes: 1 addition & 1 deletion src/kmm/jump.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Licensed under the MIT License. See LICENSE in the project root.
# ------------------------------------------------------------------

#This file is part of the module DensityRatioEstimationJuMPExt.
# This file is part of the module DensityRatioEstimationJuMPExt.

function _kmm_jump_model(K, κ, dre::AbstractKMM, optlib::Type{JuMPLib})
# number of denominator samples
Expand Down
2 changes: 1 addition & 1 deletion src/lsif/jump.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Licensed under the MIT License. See LICENSE in the project root.
# ------------------------------------------------------------------

#This file is part of the module DensityRatioEstimationJuMPExt.
# This file is part of the module DensityRatioEstimationJuMPExt.

function DensityRatioEstimation._lsif_coeffs(H, h, dre::LSIF, optlib::Type{JuMPLib})
# retrieve parameters
Expand Down
2 changes: 1 addition & 1 deletion src/lsif/optim.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Licensed under the MIT License. See LICENSE in the project root.
# ------------------------------------------------------------------

#This file is part of the module DensityRatioEstimationOptimExt.
# This file is part of the module DensityRatioEstimationOptimExt.

function DensityRatioEstimation._lsif_coeffs(H, h, dre::LSIF, optlib::Type{OptimLib})
# retrieve parameters
Expand Down

0 comments on commit 4a4a11e

Please sign in to comment.