# Crate totsu_core

source ·## Expand description

Totsu (凸 in Japanese) means convex.

This crate for Rust provides **a first-order conic linear program solver** for convex optimization.

## Target problem

A common target problem is continuous scalar **convex optimization** such as LP, QP, QCQP, SOCP and SDP.
Each of those problems can be represented as a conic linear program:
\[
\begin{array}{ll}
{\rm minimize} & c^T x \\
{\rm subject \ to} & A x + s = b \\
& s \in \mathcal{K},
\end{array}
\]
where

- variables \( x \in \mathbb{R}^n,\ s \in \mathbb{R}^m \)
- \( c \in \mathbb{R}^n \) as an objective linear operator
- \( A \in \mathbb{R}^{m \times n} \) and \( b \in \mathbb{R}^m \) as constraint linear operators
- a nonempty, closed, convex cone \( \mathcal{K} \).

## Algorithm and design concepts

The author combines the two papers [1] [2] so that the homogeneous self-dual embedding matrix in [2] is formed as a linear operator in [1].

A core method `solver::Solver::solve`

takes the following arguments:

- objective and constraint linear operators that implement
`solver::Operator`

trait and - a projection onto a cone that implements
`solver::Cone`

trait.

Therefore solving a specific problem requires an implementation of those traits.
You can use pre-defined implementations: `totsu`

crate,
as well as construct a user-defined tailored version for the reason of functionality and efficiency.
This crate also contains several basic structs
that implement `solver::Operator`

and `solver::Cone`

trait.

Core linear algebra operations that `solver::Solver`

requires
are abstracted by `solver::LinAlg`

trait,
while subtrait `LinAlgEx`

is used for the basic structs.
This crate contains a `LinAlgEx`

implementor:

`FloatGeneric`

-`num::Float`

-generic implementation (pure Rust but slow).

Other crates are also available:

`totsu_f64lapack`

crate -`f64`

-specific implementation using BLAS/LAPACK.`totsu_f32cuda`

crate -`f32`

-specific implementation using CUDA(cuBLAS/cuSOLVER).

## Features

This crate can be used without the standard library (`#![no_std]`

).
Use this in `Cargo.toml`

:

```
[dependencies.totsu_core]
version = "0.*"
default-features = false
features = ["libm"]
```

## Examples

See examples in GitHub.

## References

- T. Pock and A. Chambolle. “Diagonal preconditioning for first order primal-dual algorithms in convex optimization.” 2011 International Conference on Computer Vision. IEEE, 2011.
- B. O’donoghue, et al. “Conic optimization via operator splitting and homogeneous self-dual embedding.” Journal of Optimization Theory and Applications 169.3 (2016): 1042-1068.
- N. Parikh and S. Boyd. “Proximal algorithms.” Foundations and Trends in optimization 1.3 (2014): 127-239.
- Mosek ApS. “MOSEK modeling cookbook.” (2020).
- S. Boyd and L. Vandenberghe. “Convex Optimization.” (2004).

## Modules

## Macros

`SliceMut`

into multiple ones.## Structs

`num::Float`

-generic `LinAlgEx`

implementation