repo
stringclasses
454 values
file_path
stringlengths
5
201
extension
stringclasses
1 value
content
stringlengths
8
509k
num_lines
int64
3
16.9k
size_bytes
int64
8
511k
cvxpy
cvxpy/atoms/affine/reshape.py
.py
""" Copyright 2013 Steven Diamond Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
187
6,100
cvxpy
cvxpy/atoms/affine/affine_atom.py
.py
""" Copyright 2013 Steven Diamond Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
181
6,231
cvxpy
cvxpy/atoms/affine/transpose.py
.py
""" Copyright 2013 Steven Diamond Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
191
5,801
cvxpy
cvxpy/atoms/affine/index.py
.py
""" Copyright 2013 Steven Diamond Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
226
7,547
cvxpy
cvxpy/atoms/affine/promote.py
.py
""" Copyright 2013 Steven Diamond Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
121
3,484
cvxpy
cvxpy/atoms/affine/diff.py
.py
""" Copyright 2013 Steven Diamond Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
74
2,395
cvxpy
cvxpy/atoms/affine/conj.py
.py
""" Copyright 2013 Steven Diamond Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
82
2,284
cvxpy
cvxpy/atoms/affine/upper_tri.py
.py
""" Copyright 2013 Steven Diamond Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
208
6,207
cvxpy
cvxpy/atoms/affine/einsum.py
.py
""" Copyright, the CVXPY authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software ...
417
15,707
cvxpy
cvxpy/atoms/affine/cumsum.py
.py
""" Copyright 2013 Steven Diamond Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
137
5,203
cvxpy
cvxpy/atoms/affine/diag.py
.py
""" Copyright 2013 Steven Diamond Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
200
5,765
cvxpy
cvxpy/atoms/affine/vec.py
.py
""" Copyright 2013 Steven Diamond Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
45
1,409
cvxpy
cvxpy/atoms/affine/kron.py
.py
""" Copyright 2013 Steven Diamond Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
127
4,363
cvxpy
cvxpy/atoms/affine/unary_operators.py
.py
""" Copyright 2013 Steven Diamond Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
125
3,773
cvxpy
cvxpy/atoms/affine/sum.py
.py
""" Copyright 2013 Steven Diamond Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
169
6,051
cvxpy
cvxpy/atoms/affine/real.py
.py
""" Copyright 2013 Steven Diamond Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
53
1,458
cvxpy
cvxpy/atoms/affine/conv.py
.py
""" Copyright 2013 Steven Diamond Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
231
7,253
cvxpy
cvxpy/atoms/affine/concatenate.py
.py
""" Copyright, the CVXPY authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software ...
99
3,095
cvxpy
cvxpy/atoms/affine/broadcast_to.py
.py
""" Copyright, the CVXPY authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software ...
81
2,296
cvxpy
cvxpy/atoms/affine/wraps.py
.py
""" Copyright 2013 Steven Diamond, 2022 the CVXPY authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agree...
179
4,779
cvxpy
cvxpy/atoms/affine/vstack.py
.py
""" Copyright 2013 Steven Diamond Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
81
2,378
cvxpy
cvxpy/atoms/affine/stack.py
.py
""" Copyright, the CVXPY authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software ...
108
3,485
cvxpy
cvxpy/atoms/affine/imag.py
.py
""" Copyright 2013 Steven Diamond Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
52
1,414
cvxpy
cvxpy/atoms/affine/bmat.py
.py
""" Copyright 2013 Steven Diamond Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
56
1,852
cvxpy
cvxpy/atoms/affine/hstack.py
.py
""" Copyright 2013 Steven Diamond Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
85
2,553
cvxpy
cvxpy/atoms/affine/squeeze.py
.py
""" Copyright 2025 CVXYPY Developers Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, softw...
62
1,932
cvxpy
cvxpy/atoms/affine/binary_operators.py
.py
""" Copyright 2013 Steven Diamond Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
663
22,630
cvxpy
cvxpy/atoms/affine/partial_trace.py
.py
""" Copyright 2022, adapted from Convex.jl. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing...
95
3,572
cvxpy
cvxpy/atoms/affine/add_expr.py
.py
""" Copyright 2013 Steven Diamond Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
159
5,396
cvxpy
cvxpy/utilities/bounds.py
.py
""" Copyright 2026 The CVXPY Developers Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, so...
902
26,681
cvxpy
cvxpy/utilities/scopes.py
.py
""" Copyright, the CVXPY authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software ...
76
2,412
cvxpy
cvxpy/utilities/canonical.py
.py
""" Copyright 2013 Steven Diamond Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
231
7,055
cvxpy
cvxpy/utilities/psd_utils.py
.py
""" Copyright, the CVXPY authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software ...
148
5,122
cvxpy
cvxpy/utilities/solver_context.py
.py
""" Copyright 2025 CVXPY developers Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, softwa...
29
1,090
cvxpy
cvxpy/utilities/citations.py
.py
""" Copyright 2025, the CVXPY Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, sof...
630
17,412
cvxpy
cvxpy/utilities/einsum_utilities.py
.py
""" Copied from numpy._core.einsumfunc from numpy 2.4.0. Utilities for the einsum atom. Copyright (c) 2005-2025, NumPy Developers. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions ...
646
21,854
cvxpy
cvxpy/utilities/key_utils.py
.py
""" Copyright 2013 Steven Diamond Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
248
7,429
cvxpy
cvxpy/utilities/debug_tools.py
.py
""" Copyright, the CVXPY authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
80
3,264
cvxpy
cvxpy/utilities/__init__.py
.py
""" Copyright 2013 Steven Diamond Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
19
629
cvxpy
cvxpy/utilities/grad.py
.py
""" Copyright 2013 Steven Diamond Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
55
1,423
cvxpy
cvxpy/utilities/perspective_utils.py
.py
""" Copyright, the CVXPY authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
61
2,293
cvxpy
cvxpy/utilities/deterministic.py
.py
def unique_list(duplicates_list): """ Return unique list preserving the order. https://stackoverflow.com/a/480227 """ used = set() unique = [x for x in duplicates_list if not (x in used or used.add(x))] return unique
9
245
cvxpy
cvxpy/utilities/sign.py
.py
from typing import TYPE_CHECKING if TYPE_CHECKING: from cvxpy.expressions.expression import Expression """ Copyright 2013 Steven Diamond Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at ht...
65
1,955
cvxpy
cvxpy/utilities/coo_array_compat.py
.py
""" Copyright 2025, the CVXPY authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, sof...
26
770
cvxpy
cvxpy/utilities/performance_utils.py
.py
""" Copyright 2013 Steven Diamond Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
88
2,811
cvxpy
cvxpy/utilities/power_tools.py
.py
""" Copyright 2013 Steven Diamond Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
697
20,009
cvxpy
cvxpy/utilities/coeff_extractor.py
.py
""" Copyright, the CVXPY authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software ...
489
21,241
cvxpy
cvxpy/utilities/warn.py
.py
""" Copyright, the CVXPY authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software ...
92
3,506
cvxpy
cvxpy/utilities/replace_quad_forms.py
.py
""" Copyright 2017 Robin Verschueren Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, softw...
58
2,378
cvxpy
cvxpy/utilities/versioning.py
.py
""" Copyright 2022, the CVXPY authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, sof...
58
1,851
cvxpy
cvxpy/utilities/shape.py
.py
""" Copyright 2013 Steven Diamond Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
155
4,451
cvxpy
cvxpy/utilities/linalg.py
.py
import numpy as np import qdldl import scipy.linalg as la import scipy.sparse as sp import scipy.sparse.linalg as sparla from scipy.sparse import csc_array import cvxpy.settings as settings def orth(V, tol=1e-12): """Return a matrix whose columns are an orthonormal basis for range(V)""" Q, R, p = la.qr(V, mo...
390
15,014
cvxpy
cvxpy/reductions/canonicalization.py
.py
""" Copyright 2013 Steven Diamond, 2017 Akshay Agrawal, 2017 Robin Verschueren Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by app...
188
7,392
cvxpy
cvxpy/reductions/reduction.py
.py
""" Copyright 2013 Steven Diamond Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
305
9,884
cvxpy
cvxpy/reductions/flip_objective.py
.py
""" Copyright 2017 Robin Verschueren Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, softw...
68
2,051
cvxpy
cvxpy/reductions/chain.py
.py
from cvxpy import settings as s from cvxpy.reductions.reduction import Reduction def _compose_id_map(step_maps): """Compose a sequence of ``{old_id: [new_id, ...]}`` mappings. Each step map comes from a reduction's ``var_id_map`` or ``param_id_map``. The result is a single mapping from the outermost...
162
5,525
cvxpy
cvxpy/reductions/cvx_attr2constr.py
.py
""" Copyright 2017 Steven Diamond Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
385
15,857
cvxpy
cvxpy/reductions/__init__.py
.py
""" Copyright 2017 Robin Verschueren Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, softw...
30
1,303
cvxpy
cvxpy/reductions/utilities.py
.py
""" Copyright 2018 Akshay Agrawal Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
162
5,961
cvxpy
cvxpy/reductions/subexpr_cache.py
.py
""" Copyright, the CVXPY authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software ...
223
9,332
cvxpy
cvxpy/reductions/inverse_data.py
.py
""" Copyright 2016 Jaehyun Park, 2017 Robin Verschueren Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed t...
57
1,944
cvxpy
cvxpy/reductions/solution.py
.py
""" Copyright 2013 Steven Diamond Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
101
3,265
cvxpy
cvxpy/reductions/eval_params.py
.py
from cvxpy import problems from cvxpy.error import ParameterError from cvxpy.expressions.constants.constant import Constant from cvxpy.expressions.constants.parameter import Parameter from cvxpy.reductions.reduction import Reduction def replace_params_with_consts(expr): if isinstance(expr, list): return [...
79
2,689
cvxpy
cvxpy/reductions/eliminate_zero_sized.py
.py
""" Copyright, the CVXPY authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software ...
150
5,613
cvxpy
cvxpy/reductions/matrix_stuffing.py
.py
""" Copyright 2017 Robin Verschueren, 2017 Akshay Agrawal Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
244
8,675
cvxpy
cvxpy/reductions/dgp2dcp/dgp2dcp.py
.py
""" Copyright 2018 Akshay Agrawal Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
224
8,781
cvxpy
cvxpy/reductions/dgp2dcp/util.py
.py
""" Copyright 2024 the CVXPY developers Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, softw...
25
851
cvxpy
cvxpy/reductions/dgp2dcp/canonicalizers/xexp_canon.py
.py
from cvxpy.atoms.elementwise.exp import exp def xexp_canon(expr, args): del expr return args[0] + exp(args[0]), []
7
125
cvxpy
cvxpy/reductions/dgp2dcp/canonicalizers/geo_mean_canon.py
.py
def geo_mean_canon(expr, args): out = 0.0 for x_i, p_i in zip(args[0], expr.p): out += p_i * x_i return (1 / sum(expr.p)) * out, []
6
152
cvxpy
cvxpy/reductions/dgp2dcp/canonicalizers/power_canon.py
.py
def power_canon(expr, args): # u = log x; x^p --> exp(u^p) --> log(exp(u^p)) = p * u return expr.p * args[0], []
4
122
cvxpy
cvxpy/reductions/dgp2dcp/canonicalizers/mulexpression_canon.py
.py
""" Copyright 2024 the CVXPY developers Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, so...
42
1,469
cvxpy
cvxpy/reductions/dgp2dcp/canonicalizers/one_minus_pos_canon.py
.py
from cvxpy.atoms.elementwise.exp import exp from cvxpy.atoms.elementwise.log import log def one_minus_pos_canon(expr, args): return log(expr._ones - exp(args[0])), []
7
173
cvxpy
cvxpy/reductions/dgp2dcp/canonicalizers/constant_canon.py
.py
""" Copyright 2018 Akshay Agrawal Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
24
732
cvxpy
cvxpy/reductions/dgp2dcp/canonicalizers/norm1_canon.py
.py
from cvxpy.atoms.affine.sum import sum from cvxpy.reductions.dgp2dcp.canonicalizers.sum_canon import sum_canon def norm1_canon(expr, args): assert len(args) == 1 tmp = sum(args[0], expr.axis, expr.keepdims) return sum_canon(tmp, tmp.args)
9
253
cvxpy
cvxpy/reductions/dgp2dcp/canonicalizers/quad_form_canon.py
.py
from cvxpy.atoms.affine.hstack import hstack from cvxpy.atoms.log_sum_exp import log_sum_exp def quad_form_canon(expr, args): x = args[0] P = args[1] elems = [] for i in range(P.shape[0]): for j in range(P.shape[0]): elems.append(P[i, j] + x[i] + x[j]) return log_sum_exp(hstack...
13
333
cvxpy
cvxpy/reductions/dgp2dcp/canonicalizers/pf_eigenvalue_canon.py
.py
from cvxpy.atoms.affine.binary_operators import matmul from cvxpy.expressions.variable import Variable from cvxpy.reductions.dgp2dcp.canonicalizers.mul_canon import mul_canon from cvxpy.reductions.dgp2dcp.canonicalizers.mulexpression_canon import ( mulexpression_canon, ) def pf_eigenvalue_canon(expr, args): X...
20
684
cvxpy
cvxpy/reductions/dgp2dcp/canonicalizers/__init__.py
.py
import numpy as np from cvxpy.atoms.affine.add_expr import AddExpression from cvxpy.atoms.affine.binary_operators import (DivExpression, MulExpression, multiply,) from cvxpy.atoms.affine.sum import Sum from cvxpy.atoms.affine.trace import Trace from cvxpy.atoms.cumprod ...
226
9,740
cvxpy
cvxpy/reductions/dgp2dcp/canonicalizers/div_canon.py
.py
def div_canon(expr, args): del expr # x / y == x * y**(-1). return args[0] - args[1], []
5
101
cvxpy
cvxpy/reductions/dgp2dcp/canonicalizers/mul_canon.py
.py
from cvxpy.atoms.affine import add_expr def mul_canon(expr, args): del expr return add_expr.AddExpression(args), []
7
126
cvxpy
cvxpy/reductions/dgp2dcp/canonicalizers/add_canon.py
.py
""" Copyright 2024 the CVXPY developers Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, so...
46
1,587
cvxpy
cvxpy/reductions/dgp2dcp/canonicalizers/pnorm_canon.py
.py
""" Copyright, the CVXPY authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software ...
56
1,910
cvxpy
cvxpy/reductions/dgp2dcp/canonicalizers/sum_canon.py
.py
""" Copyright 2024 the CVXPY developers Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, so...
55
1,921
cvxpy
cvxpy/reductions/dgp2dcp/canonicalizers/quad_over_lin_canon.py
.py
from cvxpy.reductions.dgp2dcp.canonicalizers.add_canon import add_canon from cvxpy.reductions.dgp2dcp.util import explicit_sum def quad_over_lin_canon(expr, args): summed = explicit_sum(2 * args[0]) numerator, _ = add_canon(summed, summed.args) return numerator - args[1], []
9
290
cvxpy
cvxpy/reductions/dgp2dcp/canonicalizers/trace_canon.py
.py
from cvxpy.atoms.affine.diag import diag from cvxpy.reductions.dgp2dcp.canonicalizers.add_canon import add_canon from cvxpy.reductions.dgp2dcp.util import explicit_sum def trace_canon(expr, args): diag_sum = explicit_sum(diag(args[0])) return add_canon(diag_sum, diag_sum.args)
9
288
cvxpy
cvxpy/reductions/dgp2dcp/canonicalizers/exp_canon.py
.py
from cvxpy.atoms.elementwise.exp import exp def exp_canon(expr, args): del expr return exp(args[0]), []
7
114
cvxpy
cvxpy/reductions/dgp2dcp/canonicalizers/eye_minus_inv_canon.py
.py
from cvxpy.atoms.affine.binary_operators import matmul from cvxpy.atoms.affine.diag import diag from cvxpy.atoms.one_minus_pos import one_minus_pos from cvxpy.expressions.variable import Variable from cvxpy.reductions.dgp2dcp.canonicalizers.mulexpression_canon import ( mulexpression_canon, ) from cvxpy.reductions.d...
44
1,434
cvxpy
cvxpy/reductions/dgp2dcp/canonicalizers/log_canon.py
.py
from cvxpy.atoms.elementwise.log import log def log_canon(expr, args): return log(args[0]), []
6
101
cvxpy
cvxpy/reductions/dgp2dcp/canonicalizers/cumprod_canon.py
.py
""" Copyright 2024 the CVXPY developers Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, so...
21
694
cvxpy
cvxpy/reductions/dgp2dcp/canonicalizers/norm_inf_canon.py
.py
from cvxpy.atoms.max import max from cvxpy.reductions.eliminate_pwl.canonicalizers.max_canon import max_canon def norm_inf_canon(expr, args): assert len(args) == 1 tmp = max(args[0], expr.axis, expr.keepdims) return max_canon(tmp, tmp.args)
9
255
cvxpy
cvxpy/reductions/dgp2dcp/canonicalizers/prod_canon.py
.py
from cvxpy.atoms.affine.sum import sum as sum_func def prod_canon(expr, args): return sum_func(args[0], axis=expr.axis, keepdims=expr.keepdims), []
6
154
cvxpy
cvxpy/reductions/dgp2dcp/canonicalizers/finite_set_canon.py
.py
from cvxpy.constraints.finite_set import FiniteSet def finite_set_canon(expr, args): ineq_form, id = expr.get_data() # Log applied already to set of values (i.e., args[1]). return FiniteSet(args[0], args[1], ineq_form, id), []
8
241
cvxpy
cvxpy/reductions/dgp2dcp/canonicalizers/gmatmul_canon.py
.py
def gmatmul_canon(expr, args): return expr.A @ args[0], []
3
63
cvxpy
cvxpy/reductions/dnlp2smooth/__init__.py
.py
""" Copyright 2025 CVXPY developers Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, softwa...
16
565
cvxpy
cvxpy/reductions/dnlp2smooth/dnlp2smooth.py
.py
""" Copyright 2025 CVXPY developers Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, softwa...
112
4,257
cvxpy
cvxpy/reductions/dnlp2smooth/canonicalizers/geo_mean_canon.py
.py
""" Copyright 2025 CVXPY developers Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, softwa...
37
1,246
cvxpy
cvxpy/reductions/dnlp2smooth/canonicalizers/power_canon.py
.py
""" Copyright 2025 CVXPY developers Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, softwa...
48
1,620
cvxpy
cvxpy/reductions/dnlp2smooth/canonicalizers/kl_div_canon.py
.py
""" Copyright 2025 CVXPY developers Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, softwa...
26
906
cvxpy
cvxpy/reductions/dnlp2smooth/canonicalizers/common_smooth_canons.py
.py
""" Copyright 2025 CVXPY developers Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, softwa...
103
4,246
cvxpy
cvxpy/reductions/dnlp2smooth/canonicalizers/__init__.py
.py
""" Copyright 2025 CVXPY developers Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, softwa...
107
4,628
cvxpy
cvxpy/reductions/dnlp2smooth/canonicalizers/div_canon.py
.py
""" Copyright 2025 CVXPY developers Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, softwa...
42
1,460