mpctool

include/mtx_ops.h

00001 #ifndef MTX_OPS_H
00002 #define MTX_OPS_H
00003 
00004 #include "mpc_base.h"  /* typedefs */
00005 
00006 /* matrix-vector multiplication: pout = pmtx * pvec.
00007  * pmtx has size (rows x columns) */
00008 extern void mtx_multiply_mtx_vec(real_t pout[], const real_t pmtx[],
00009                 const real_t pvec[],
00010                 const uint32_t rows,
00011                 const uint32_t cols);
00012 
00013 /* element-wise matrix factorisation: pout = pmtx * factor.
00014  * pmtx has size (rows x columns) */
00015 extern void mtx_scale(real_t pout[], const real_t pmtx[],
00016                 const real_t factor, const uint32_t rows,
00017                 const uint32_t cols);
00018 
00019 /* matrix addition: pmtxc = pmta + pmtxb.
00020  * pmta, pmtb, pmtc have size (rows x columns) */
00021 extern void mtx_add(real_t pmtxc[], const real_t pmtxa[],
00022                 const real_t pmtxb[], const uint32_t rows,
00023                 const uint32_t cols);
00024 
00025 /* matrix substraction: pmtxc = pmta - pmtxb.
00026  * pmta, pmtb, pmtc have size (rows x columns) */
00027 extern void mtx_substract(real_t pmtxc[], const real_t pmtxa[],
00028                 const real_t pmtxb[], const uint32_t rows,
00029                 const uint32_t cols);
00030 
00031 /* elementwise 2-sided vector saturation. 
00032  * lower[i] < vec[i] < upper[i]. pvec has size (rows x 1) */
00033 extern void mtx_saturate_vec(real_t pvec[], const real_t plower[],
00034                 const real_t pupper[],
00035                 const uint32_t rows);
00036 
00037 /* matrix transposition. mtxout[j,i] = mtxin[i,j].
00038  * mtxin has size (rows x columns) */
00039 extern void mtx_transpose(real_t * mtxout, const real_t * mtxin,
00040                 const uint32_t rows, const uint32_t cols);
00041 
00042 /* elementwise vector maximum against zero
00043  * pmax[i] = max(pa[i], 0). pmax has size (rows x 1) */
00044 extern void mtx_max_vec_zero(real_t pmax[],     const uint32_t rows);
00045 
00046 /* elementwise vector minimum against zero
00047  *  pmin[i] = min(pa[i], 0). pmin has size (rows x 1) */
00048 extern void mtx_min_vec_zero(real_t pmin[], const uint32_t rows);
00049 
00050 #endif
 All Data Structures Files Functions Variables Typedefs