Skip to content

Commit fae918e

Browse files
authored
Add support for Base.log1p (#718)
1 parent 5c02127 commit fae918e

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

src/reformulations/log1p.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Copyright (c) 2014: Madeleine Udell and contributors
2+
#
3+
# Use of this source code is governed by a BSD-style license that can be found
4+
# in the LICENSE file or at https://opensource.org/license/bsd-2-clause
5+
6+
Base.log1p(x::AbstractExpr) = log(1 + x)

test/test_atoms.jl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2272,6 +2272,20 @@ function test_inner_product()
22722272
return
22732273
end
22742274

2275+
### reformulations/log1p
2276+
2277+
function test_log1p()
2278+
target = """
2279+
variables: t, x
2280+
minobjective: 1.0 * t + 0.0
2281+
[1.0 * t, 1.0, 1.0 * x + 1.0] in ExponentialCone()
2282+
"""
2283+
_test_reformulation(target) do context
2284+
return log1p(Variable(1))
2285+
end
2286+
return
2287+
end
2288+
22752289
### reformulations/norm
22762290

22772291
function test_norm()

0 commit comments

Comments
 (0)