SuperSCS  1.3.2
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
linAlg.h
Go to the documentation of this file.
1 /*
2  * The MIT License (MIT)
3  *
4  * Copyright (c) 2017 Pantelis Sopasakis (https://alphaville.github.io),
5  * Krina Menounou (https://www.linkedin.com/in/krinamenounou),
6  * Panagiotis Patrinos (http://homes.esat.kuleuven.be/~ppatrino)
7  * Copyright (c) 2012 Brendan O'Donoghue (bodonoghue85@gmail.com)
8  *
9  * Permission is hereby granted, free of charge, to any person obtaining a copy
10  * of this software and associated documentation files (the "Software"), to deal
11  * in the Software without restriction, including without limitation the rights
12  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13  * copies of the Software, and to permit persons to whom the Software is
14  * furnished to do so, subject to the following conditions:
15  *
16  * The above copyright notice and this permission notice shall be included in all
17  * copies or substantial portions of the Software.
18  *
19  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25  * SOFTWARE.
26  *
27  */
28 #ifndef SCS_LINALG_H_GUARD
29 #define SCS_LINALG_H_GUARD
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
35 #include "scs.h"
36 #include <math.h>
37 
48  scs_int m,
49  scs_int n
50  );
51 
63  scs_int m,
64  scs_int n
65  );
66 
91  scs_int m,
92  scs_int n,
93  scs_float * RESTRICT A,
94  scs_float * RESTRICT b,
95  scs_float * RESTRICT wspace,
96  scs_int wsize
97  );
98 
128  scs_int m,
129  scs_int n,
130  scs_float * RESTRICT A,
131  scs_float * RESTRICT b,
132  scs_float * RESTRICT wspace,
133  scs_int wsize,
134  scs_float rcond,
135  scs_float * RESTRICT singular_values,
136  scs_int * RESTRICT rank
137  );
138 
139 
155  scs_float * RESTRICT x,
156  const scs_float * RESTRICT a,
157  const scs_float b,
158  scs_int len);
159 
170  void scs_scale_array(
171  scs_float * RESTRICT a,
172  const scs_float b,
173  scs_int len);
174 
187  const scs_float * RESTRICT x,
188  const scs_float * RESTRICT y,
189  scs_int len);
190 
200  const scs_float * RESTRICT v,
201  scs_int len);
202 
210  const scs_float * RESTRICT v,
211  scs_int len);
212 
220  const scs_float * RESTRICT a,
221  scs_int l);
222 
223 
237  scs_float * RESTRICT a,
238  const scs_float * RESTRICT b,
239  scs_int n,
240  const scs_float sc);
241 
253  void scs_add_array(
254  scs_float * RESTRICT a,
255  const scs_float * RESTRICT b,
256  scs_int n);
257 
265  void scs_axpy(
266  scs_float * RESTRICT x,
267  const scs_float * RESTRICT u,
268  const scs_float * RESTRICT v,
269  scs_float a,
270  scs_float b,
271  scs_int n);
272 
284  void scs_subtract_array(
285  scs_float * RESTRICT a,
286  const scs_float * RESTRICT b,
287  scs_int n);
288 
297  const scs_float * RESTRICT a,
298  const scs_float * RESTRICT b,
299  scs_int l);
300 
309  const scs_float * RESTRICT a,
310  const scs_float * RESTRICT b,
311  scs_int l);
312 
313 
314 
330  void scs_matrix_multiply(
331  scs_int rows_A,
332  scs_int cols_B,
333  scs_int cols_A,
334  scs_float alpha,
335  const scs_float * RESTRICT A,
336  scs_float beta,
337  const scs_float * RESTRICT B,
338  scs_float *C);
339 
357  scs_int rows_A,
358  scs_int cols_B,
359  scs_int cols_A,
360  scs_float alpha,
361  const scs_float * RESTRICT A,
362  scs_float beta,
363  const scs_float * RESTRICT B,
364  scs_float *C);
365 
366 
395 
423  scs_int m,
424  scs_int n,
425  const scs_float * RESTRICT A,
426  const scs_float * RESTRICT b,
428  scs_float tol,
429  scs_int*RESTRICT maxiter,
430  scs_float *RESTRICT wspace
431  );
432 
433 
434 #ifdef __cplusplus
435 }
436 #endif
437 #endif
scs_int scs_qr_workspace_size(scs_int m, scs_int n)
Compute the optimal size of workspace for scs_qrls.
scs_int scs_svdls(scs_int m, scs_int n, scs_float *RESTRICT A, scs_float *RESTRICT b, scs_float *RESTRICT wspace, scs_int wsize, scs_float rcond, scs_float *RESTRICT singular_values, scs_int *RESTRICT rank)
Solves a least squares problem using the SVD factorization.
#define RESTRICT
Definition: glbopts.h:44
scs_int scs_cgls(scs_int m, scs_int n, const scs_float *RESTRICT A, const scs_float *RESTRICT b, scs_float *RESTRICT x, scs_float tol, scs_int *RESTRICT maxiter, scs_float *RESTRICT wspace)
void scs_add_array(scs_float *RESTRICT a, const scs_float *RESTRICT b, scs_int n)
void scs_add_scaled_array(scs_float *RESTRICT a, const scs_float *RESTRICT b, scs_int n, const scs_float sc)
void scs_axpy(scs_float *RESTRICT x, const scs_float *RESTRICT u, const scs_float *RESTRICT v, scs_float a, scs_float b, scs_int n)
scs_float scs_norm_infinity(const scs_float *RESTRICT a, scs_int l)
void scs_matrix_transpose_multiply(scs_int rows_A, scs_int cols_B, scs_int cols_A, scs_float alpha, const scs_float *RESTRICT A, scs_float beta, const scs_float *RESTRICT B, scs_float *C)
void scs_set_as_scaled_array(scs_float *RESTRICT x, const scs_float *RESTRICT a, const scs_float b, scs_int len)
scs_float scs_norm_infinity_difference(const scs_float *RESTRICT a, const scs_float *RESTRICT b, scs_int l)
int scs_int
Definition: glbopts.h:96
void scs_matrix_multiply(scs_int rows_A, scs_int cols_B, scs_int cols_A, scs_float alpha, const scs_float *RESTRICT A, scs_float beta, const scs_float *RESTRICT B, scs_float *C)
scs_float scs_norm_difference(const scs_float *RESTRICT a, const scs_float *RESTRICT b, scs_int l)
void scs_subtract_array(scs_float *RESTRICT a, const scs_float *RESTRICT b, scs_int n)
scs_int scs_svd_workspace_size(scs_int m, scs_int n)
Computes the optimal workspace size for scs_svdls.
scs_float scs_inner_product(const scs_float *RESTRICT x, const scs_float *RESTRICT y, scs_int len)
double scs_float
Definition: glbopts.h:100
scs_int scs_qrls(scs_int m, scs_int n, scs_float *RESTRICT A, scs_float *RESTRICT b, scs_float *RESTRICT wspace, scs_int wsize)
Solves a least squares problem using the QR factorization.
scs_float scs_norm(const scs_float *RESTRICT v, scs_int len)
scs_float scs_norm_squared(const scs_float *RESTRICT v, scs_int len)
scs_float * scs_cgls_malloc_workspace(scs_int m, scs_int n)
void scs_scale_array(scs_float *RESTRICT a, const scs_float b, scs_int len)