alpaqa
develop
Nonconvex constrained optimization
Toggle main menu visibility
Main Page
Related Pages
Topics
Namespaces
Namespace List
Namespace Members
All
a
b
c
d
e
f
g
i
j
l
m
n
o
p
r
s
t
u
v
w
Functions
a
b
c
d
e
f
g
i
j
l
m
n
o
p
r
s
t
u
w
Variables
Typedefs
a
c
d
e
f
i
l
m
p
r
s
t
u
v
Enumerations
Concepts
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
û
ŷ
α
γ
δ
ε
ζ
λ
ν
ρ
σ
τ
φ
ψ
ϵ
Functions
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
û
α
ρ
Variables
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
ŷ
α
γ
δ
ε
ζ
λ
ν
ρ
σ
τ
φ
ψ
ϵ
Typedefs
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
v
w
Enumerations
Enumerator
a
f
i
s
u
Related Symbols
Files
File List
File Members
All
a
b
c
d
e
f
g
l
m
p
r
s
t
u
w
Functions
a
c
d
e
f
g
l
m
p
r
s
t
w
Variables
Typedefs
Enumerations
Enumerator
Macros
a
b
c
e
p
u
Examples
Sphinx
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Modules
Pages
Concepts
Loading...
Searching...
No Matches
src
alpaqa
include
alpaqa
functions
indicator-box.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include <
alpaqa/config/config.hpp
>
4
#include <
alpaqa/functions/prox.hpp
>
5
#include <
alpaqa/problem/box.hpp
>
6
#include <cassert>
7
8
namespace
alpaqa::sets
{
9
10
template
<Config Conf>
11
typename
Conf::real_t
12
alpaqa_tag_invoke
(
tag_t<alpaqa::prox>
,
Box<Conf>
&self,
typename
Conf::crmat
in
,
13
typename
Conf::rmat out,
14
[[
maybe_unused
]]
typename
Conf::real_t γ) {
15
assert
(
in
.rows() == out.rows());
16
assert
(
in
.cols() == out.cols());
17
assert
(
in
.size() == self.
lowerbound
.size());
18
assert
(
in
.size() == self.
upperbound
.size());
19
assert
(!(self.
lowerbound
.array() > self.
upperbound
.array()).any());
20
out =
in
.reshaped()
21
.cwiseMax(self.
lowerbound
)
22
.cwiseMin(self.
upperbound
)
23
.reshaped(
in
.rows(),
in
.cols());
24
return
0;
25
}
12
alpaqa_tag_invoke
(
tag_t<alpaqa::prox>
,
Box<Conf>
&self,
typename
Conf::crmat
in
, {
…
}
26
27
template
<Config Conf>
28
typename
Conf::real_t
29
alpaqa_tag_invoke
(
tag_t<alpaqa::prox_step>
,
Box<Conf>
&self,
30
typename
Conf::crmat
in
,
typename
Conf::crmat
fwd_step
,
31
typename
Conf::rmat out,
typename
Conf::rmat
fb_step
,
32
[[
maybe_unused
]]
typename
Conf::real_t γ,
33
typename
Conf::real_t
γ_fwd
) {
34
assert
(
in
.rows() ==
fwd_step
.rows());
35
assert
(
in
.cols() ==
fwd_step
.cols());
36
assert
(
in
.rows() == out.rows());
37
assert
(
in
.cols() == out.cols());
38
assert
(
in
.rows() ==
fb_step
.rows());
39
assert
(
in
.cols() ==
fb_step
.cols());
40
assert
(
in
.size() == self.
lowerbound
.size());
41
assert
(
in
.size() == self.
upperbound
.size());
42
assert
(!(self.
lowerbound
.array() > self.
upperbound
.array()).any());
43
fb_step
= (
γ_fwd
*
fwd_step
)
44
.
reshaped
()
45
.cwiseMax(self.
lowerbound
-
in
.reshaped())
46
.
cwiseMin
(self.
upperbound
-
in
.reshaped())
47
.
reshaped
(
in
.rows(),
in
.cols());
48
out =
in
+
fb_step
;
49
return
0;
50
}
29
alpaqa_tag_invoke
(
tag_t<alpaqa::prox_step>
,
Box<Conf>
&self, {
…
}
51
52
}
// namespace alpaqa
8
namespace
alpaqa::sets
{
…
}
box.hpp
config.hpp
alpaqa::sets
Definition
indicator-box.hpp:8
alpaqa::tag_invoke_ns::alpaqa_tag_invoke
constexpr tag_invoke_fn_ns::tag_invoke_fn alpaqa_tag_invoke
Definition
tag-invoke.hpp:41
alpaqa::tag_t
std::decay_t< decltype(Tag)> tag_t
Definition
tag-invoke.hpp:74
alpaqa::inf
constexpr const auto inf
Definition
config.hpp:112
prox.hpp
alpaqa::sets::Box
Definition
box.hpp:11
alpaqa::sets::Box::upperbound
vec upperbound
Definition
box.hpp:28
alpaqa::sets::Box::lowerbound
vec lowerbound
Definition
box.hpp:27
Generated on Tue Dec 17 2024 for alpaqa by
1.9.8