JWS C Library
C language utility library
matblock_math.h
Go to the documentation of this file.
00001 /*
00002  * This work is licensed under a Creative Commons 
00003  * Attribution-Noncommercial-Share Alike 3.0 United States License.
00004  * 
00005  *    http://creativecommons.org/licenses/by-nc-sa/3.0/us/
00006  * 
00007  * You are free:
00008  * 
00009  *    to Share - to copy, distribute, display, and perform the work
00010  *    to Remix - to make derivative works
00011  * 
00012  * Under the following conditions:
00013  * 
00014  *    Attribution. You must attribute the work in the manner specified by the
00015  *    author or licensor (but not in any way that suggests that they endorse you
00016  *    or your use of the work).
00017  * 
00018  *    Noncommercial. You may not use this work for commercial purposes.
00019  * 
00020  *    Share Alike. If you alter, transform, or build upon this work, you may
00021  *    distribute the resulting work only under the same or similar license to
00022  *    this one.
00023  * 
00024  * For any reuse or distribution, you must make clear to others the license
00025  * terms of this work. The best way to do this is by including this header.
00026  * 
00027  * Any of the above conditions can be waived if you get permission from the
00028  * copyright holder.
00029  * 
00030  * Apart from the remix rights granted under this license, nothing in this
00031  * license impairs or restricts the author's moral rights.
00032  */
00033 
00034 
00049 #ifndef MATBLOCK_MATH_H 
00050 #define MATBLOCK_MATH_H 
00051 
00052 
00053 #include <jwsc/config.h>
00054 
00055 #include <stdlib.h>
00056 #include <inttypes.h>
00057 
00058 #include "jwsc/base/error.h"
00059 #include "jwsc/math/complex.h"
00060 #include "jwsc/matblock/matblock.h"
00061 
00062 
00063 #ifdef __cplusplus
00064 namespace jwsc {
00065 extern "C" {
00066 #endif
00067 
00068 
00077 void add_scalar_to_matblock_f
00078 (
00079     Matblock_f**      m_out, 
00080     const Matblock_f* m_in, 
00081     float             a
00082 );
00083 
00085 void add_scalar_to_matblock_d
00086 (
00087     Matblock_d**      m_out, 
00088     const Matblock_d* m_in, 
00089     double            a
00090 );
00091 
00093 void add_scalar_to_matblock_cf
00094 (
00095     Matblock_cf**      m_out, 
00096     const Matblock_cf* m_in, 
00097     Complex_f          z
00098 );
00099 
00101 void add_scalar_to_matblock_cd
00102 (
00103     Matblock_cd**      m_out, 
00104     const Matblock_cd* m_in, 
00105     Complex_d          z
00106 );
00107 
00121 void multiply_matblock_by_scalar_f
00122 (
00123     Matblock_f**      m_out, 
00124     const Matblock_f* m_in, 
00125     float             a
00126 );
00127 
00129 void multiply_matblock_by_scalar_d
00130 (
00131     Matblock_d**      m_out, 
00132     const Matblock_d* m_in, 
00133     double            a
00134 );
00135 
00137 void multiply_matblock_by_scalar_cf
00138 (
00139     Matblock_cf**      m_out, 
00140     const Matblock_cf* m_in, 
00141     Complex_f          z
00142 );
00143 
00145 void multiply_matblock_by_scalar_cd
00146 (
00147     Matblock_cd**      m_out, 
00148     const Matblock_cd* m_in, 
00149     Complex_d          z
00150 );
00151 
00165 Error* multiply_matblocks_elt_wise_f
00166 (
00167     Matblock_f**      m_out, 
00168     const Matblock_f* m_1, 
00169     const Matblock_f* m_2
00170 );
00171 
00173 Error* multiply_matblocks_elt_wise_d
00174 (
00175     Matblock_d**      m_out, 
00176     const Matblock_d* m_1, 
00177     const Matblock_d* m_2
00178 );
00179 
00184 Error* multiply_matblocks_elt_wise_cf
00185 (
00186     Matblock_cf**      m_out, 
00187     const Matblock_cf* m_1, 
00188     const Matblock_cf* m_2
00189 );
00190 
00195 Error* multiply_matblocks_elt_wise_cd
00196 (
00197     Matblock_cd**      m_out, 
00198     const Matblock_cd* m_1, 
00199     const Matblock_cd* m_2
00200 );
00201 
00215 Error* add_matblocks_f
00216 (
00217     Matblock_f**      m_out, 
00218     const Matblock_f* m_1, 
00219     const Matblock_f* m_2
00220 );
00221 
00223 Error* add_matblocks_d
00224 (
00225     Matblock_d**      m_out, 
00226     const Matblock_d* m_1, 
00227     const Matblock_d* m_2
00228 );
00229 
00243 Error* subtract_matblocks_f
00244 (
00245     Matblock_f**      m_out, 
00246     const Matblock_f* m_1, 
00247     const Matblock_f* m_2
00248 );
00249 
00251 Error* subtract_matblocks_d
00252 (
00253     Matblock_d**      m_out, 
00254     const Matblock_d* m_1, 
00255     const Matblock_d* m_2
00256 );
00257 
00273 void calc_matblock_asum_f(float* sum_out, const Matblock_f* m);
00274 
00278 void calc_matblock_asum_d(double* sum_out, const Matblock_d* m);
00279 
00293 void normalize_matblock_sum_f(Matblock_f** m_out, const Matblock_f* m_in);
00294 
00296 void normalize_matblock_sum_d(Matblock_d** m_out, const Matblock_d* m_in);
00297 
00309 void abs_matblock_f(Matblock_f** m_out, const Matblock_f* m_in);
00310 
00312 void abs_matblock_d(Matblock_d** m_out, const Matblock_d* m_in);
00313 
00314 
00326 void threshold_matblock_f(Matblock_f** m_out, const Matblock_f* m_in, float threshold);
00327 
00329 void threshold_matblock_d(Matblock_d** m_out, const Matblock_d* m_in, double threshold);
00330 
00333 #ifdef __cplusplus
00334 }
00335 }
00336 #endif
00337 
00338 
00339 #endif