{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Functions"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "This section of the tutorial describes the functions that can be applied to CVXPY expressions. CVXPY uses the function information in this section and the [DCP rules](dcp-rules) to mark expressions with a sign and curvature."
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Operators"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "The infix operators `+, -, *, /` are treated as functions. `+` and `-` are certainly affine functions. `*` and `/` are affine in CVXPY because  `expr1*expr2` is allowed only when one of the expressions is constant and `expr1/expr2` is allowed only when `expr2` is a scalar constant.\n",
      "\n",
      "#### Indexing and Slicing\n",
      "All non-scalar expressions can be indexed using the syntax `expr[i, j]`. Indexing is an affine function. The syntax `expr[i]` can be used as a shorthand for `expr[i, 0]` when `expr` is a column vector. Similarly, `expr[i]` is shorthand for `expr[0, i]` when `expr` is a row vector.\n",
      "\n",
      "Non-scalar Expressions can also be sliced into using the standard Python slicing syntax. For example, `expr[i:j:k, r]` selects every kth element in column r of `expr`, starting at row i and ending at row j-1.\n",
      "\n",
      "#### Iteration\n",
      "Expressions are iterable. Iterating over an expression returns indices into the expression in column-major order. If `expr` is a 2 by 2 matrix, `[elem for elem in expr]` evaluates to `[expr[0, 0], expr[1, 0], expr[0, 1], expr[1, 1]]`. The built-in Python `sum` can be used on expressions because of the support for iteration.\n",
      "\n",
      "#### Transpose\n",
      "The transpose of any expression can be obtained using the syntax `expr.T`. Transpose is an affine function."
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Scalar Functions"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "These functions resolve to a scalar value."
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Elementwise Functions"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "These functions operate on each element of their argument."
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Vector Functions"
     ]
    }
   ],
   "metadata": {}
  }
 ]
}