cvxgrp / CVXR

Compare ab4836f ... +0 ... 8fb1229

Showing 1 of 300 files from the diff.
Other files ignored by Codecov
docs/index.html has changed.
docs/404.html has changed.
docs/authors.html has changed.
docs/pkgdown.yml has changed.
NEWS.md has changed.
DESCRIPTION has changed.

@@ -99,7 +99,7 @@
Loading
99 99
setMethod("is_decr", "Abs", function(object, idx) { is_nonpos(object@args[[idx]]) })
100 100
101 101
#' @describeIn Abs Is \code{x} piecewise linear?
102 -
setMethod("is_pwl", "Abs", function(object) { 
102 +
setMethod("is_pwl", "Abs", function(object) {
103 103
  is_pwl(object@args[[1]]) && (is_real(object@args[[1]]) || is_imag(object@args[[1]]))
104 104
})
105 105
@@ -291,7 +291,7 @@
Loading
291 291
    result <- 2*sapply(val, function(v) { huber_loss(M_val, v) })
292 292
  else
293 293
    result <- 2*apply(val, 1:length(dim(val)), function(v) { huber_loss(M_val, v) })
294 -
  
294 +
295 295
  if(all(dim(result) == 1))
296 296
    result <- as.vector(result)
297 297
  return(result)
@@ -744,22 +744,22 @@
Loading
744 744
    rows <- size(object@args[[idx]])
745 745
    cols <- size(object)
746 746
    grad_vals <- (value == min_vals) & unused
747 -
    
747 +
748 748
    # Remove all the min_vals that were used
749 749
    unused[value == min_vals] <- FALSE
750 750
    grad_list <- c(grad_list, list(Elementwise.elemwise_grad_to_diag(grad_vals, rows, cols)))
751 751
    idx <- idx + 1
752 752
  }
753 753
  grad_list
754 754
})
755 -
#' 
755 +
#'
756 756
#' An alias for -MinElemwise(x, 0)
757 -
#' 
757 +
#'
758 758
#' @param x An R numeric value or \linkS4class{Expression}.
759 759
#' @return An alias for -MinElemwise(x, 0)
760 760
#' @rdname Neg-int
761 761
Neg <- function(x) { -MinElemwise(x, 0) }
762 -
#' 
762 +
#'
763 763
#' An alias for MaxElemwise(x, 0)
764 764
#'
765 765
#' @param x An R numeric value or \linkS4class{Expression}.
@@ -773,24 +773,14 @@
Loading
773 773
#' This class represents the elementwise power function \eqn{f(x) = x^p}.
774 774
#' If \code{expr} is a CVXR expression, then \code{expr^p} is equivalent to \code{Power(expr, p)}.
775 775
#'
776 -
#' #' For \eqn{p = 0}, \eqn{f(x) = 1}, constant, positive.
777 -
#' For \eqn{p = 1}, \eqn{f(x) = x}, affine, increasing, same sign as \eqn{x}.
778 -
#' For \eqn{p = 2,4,8,...}, \eqn{f(x) = |x|^p}, convex, signed monotonicity, positive.
779 -
#' For \eqn{p < 0} and \eqn{f(x) = }
780 -
#' \itemize{
781 -
#'   \item{\eqn{x^p}}{ for \eqn{x > 0}}
782 -
#'   \item{\eqn{+\infty}}{\eqn{x \leq 0}}
783 -
#' }, this function is convex, decreasing, and positive.
784 -
#' For \eqn{0 < p < 1} and \eqn{f(x) =}
785 -
#' \itemize{
786 -
#'   \item{\eqn{x^p}}{ for \eqn{x \geq 0}}
787 -
#'   \item{\eqn{-\infty}}{\eqn{x < 0}}
788 -
#' }, this function is concave, increasing, and positive.
789 -
#' For \eqn{p > 1, p \neq 2,4,8,\ldots} and \eqn{f(x) = }
790 -
#' \itemize{
791 -
#'   \item{\eqn{x^p}}{ for \eqn{x \geq 0}}
792 -
#'   \item{\eqn{+\infty}}{\eqn{x < 0}}
793 -
#' }, this function is convex, increasing, and positive.
776 +
#' \describe{
777 +
#' \item{For \eqn{p = 0}}{\eqn{f(x) = 1}, constant, positive}
778 +
#' \item{For \eqn{p = 1}}{\eqn{f(x) = x}, affine, increasing, same sign as \eqn{x}}
779 +
#' \item{For \eqn{p = 2,4,8,...}}{\eqn{f(x) = |x|^p}, convex, signed monotonicity, positive}
780 +
#' \item{For \eqn{p < 0}}{\eqn{f(x) = \begin{cases} x^p & \text{for $x > 0$} \\ +\infty & \text{ for $x \leq 0$} \end{cases}}, this function is convex, decreasing, and positive}
781 +
#' \item{For \eqn{0 < p < 1}}{\eqn{f(x) = \begin{cases} x^p & \text{for $x \geq 0$} \\ -\infty & \text{ for $x < 0$} \end{cases}}, this function is concave, increasing, and positive}
782 +
#' \item{For \eqn{p > 1, p \neq 2,4,8,\ldots}}{\eqn{f(x) = \begin{cases} x^p & \text{for $x \geq 0$} \\ +\infty & \text{for $x < 0$} \end{cases}}, this function is convex, increasing, and positive.}
783 +
#' }
794 784
#'
795 785
#' @slot x The \linkS4class{Expression} to be raised to a power.
796 786
#' @slot p A numeric value indicating the scalar power.
@@ -865,15 +855,15 @@
Loading
865 855
})
866 856
867 857
#' @describeIn Power Is \eqn{p \leq 0} or \eqn{p \geq 1}?
868 -
setMethod("is_atom_convex", "Power", function(object) { 
858 +
setMethod("is_atom_convex", "Power", function(object) {
869 859
  # p == 0 is affine here.
870 -
  object@p <= 0 || object@p >= 1 
860 +
  object@p <= 0 || object@p >= 1
871 861
})
872 862
873 863
#' @describeIn Power Is \eqn{p \geq 0} or \eqn{p \leq 1}?
874 864
setMethod("is_atom_concave", "Power", function(object) {
875 865
  # p == 0 is affine here.
876 -
  object@p >= 0 && object@p <= 1 
866 +
  object@p >= 0 && object@p <= 1
877 867
})
878 868
879 869
#' @describeIn Power Is the atom log-log convex?

Learn more Showing 1 files with coverage changes found.

Changes in R/conic_solvers.R
-211
+211
Loading file...
Files Coverage
R -3.05% 56.82%
inst/include 100.00%
src 73.96%
Project Totals (45 files) 58.51%
Loading