| 1 |
|
| 2 |
|
| 3 |
#ifndef eslVECTOROPS_INCLUDED |
| 4 |
#define eslVECTOROPS_INCLUDED |
| 5 |
#include <esl_config.h> |
| 6 |
|
| 7 |
#include "esl_random.h" |
| 8 |
#include "esl_rand64.h" |
| 9 |
|
| 10 |
extern void esl_vec_DSet(double *vec, int64_t n, double value); |
| 11 |
extern void esl_vec_FSet(float *vec, int64_t n, float value); |
| 12 |
extern void esl_vec_ISet(int *vec, int64_t n, int value); |
| 13 |
extern void esl_vec_LSet(int64_t *vec, int64_t n, int64_t value); |
| 14 |
|
| 15 |
extern void esl_vec_DScale(double *vec, int64_t n, double scale); |
| 16 |
extern void esl_vec_FScale(float *vec, int64_t n, float scale); |
| 17 |
extern void esl_vec_IScale(int *vec, int64_t n, int scale); |
| 18 |
extern void esl_vec_LScale(int64_t *vec, int64_t n, int64_t scale); |
| 19 |
|
| 20 |
extern void esl_vec_DIncrement(double *v, int64_t n, double x); |
| 21 |
extern void esl_vec_FIncrement(float *v, int64_t n, float x); |
| 22 |
extern void esl_vec_IIncrement(int *v, int64_t n, int x); |
| 23 |
extern void esl_vec_LIncrement(int64_t *v, int64_t n, int64_t x); |
| 24 |
|
| 25 |
extern void esl_vec_DAdd(double *vec1, const double *vec2, int64_t n); |
| 26 |
extern void esl_vec_FAdd(float *vec1, const float *vec2, int64_t n); |
| 27 |
extern void esl_vec_IAdd(int *vec1, const int *vec2, int64_t n); |
| 28 |
extern void esl_vec_LAdd(int64_t *vec1, const int64_t *vec2, int64_t n); |
| 29 |
|
| 30 |
extern void esl_vec_DAddScaled(double *vec1, const double *vec2, double a, int64_t n); |
| 31 |
extern void esl_vec_FAddScaled(float *vec1, const float *vec2, float a, int64_t n); |
| 32 |
extern void esl_vec_IAddScaled(int *vec1, const int *vec2, int a, int64_t n); |
| 33 |
extern void esl_vec_LAddScaled(int64_t *vec1, const int64_t *vec2, int64_t a, int64_t n); |
| 34 |
|
| 35 |
extern double esl_vec_DSum(const double *vec, int64_t n); |
| 36 |
extern float esl_vec_FSum(const float *vec, int64_t n); |
| 37 |
extern int esl_vec_ISum(const int *vec, int64_t n); |
| 38 |
extern int64_t esl_vec_LSum(const int64_t *vec, int64_t n); |
| 39 |
|
| 40 |
extern double esl_vec_DDot(const double *vec1, const double *vec2, int64_t n); |
| 41 |
extern float esl_vec_FDot(const float *vec1, const float *vec2, int64_t n); |
| 42 |
extern int esl_vec_IDot(const int *vec1, const int *vec2, int64_t n); |
| 43 |
extern int64_t esl_vec_LDot(const int64_t *vec1, const int64_t *vec2, int64_t n); |
| 44 |
|
| 45 |
extern double esl_vec_DMax(const double *vec, int64_t n); |
| 46 |
extern float esl_vec_FMax(const float *vec, int64_t n); |
| 47 |
extern int esl_vec_IMax(const int *vec, int64_t n); |
| 48 |
extern int64_t esl_vec_LMax(const int64_t *vec, int64_t n); |
| 49 |
|
| 50 |
extern double esl_vec_DMin(const double *vec, int64_t n); |
| 51 |
extern float esl_vec_FMin(const float *vec, int64_t n); |
| 52 |
extern int esl_vec_IMin(const int *vec, int64_t n); |
| 53 |
extern int64_t esl_vec_LMin(const int64_t *vec, int64_t n); |
| 54 |
|
| 55 |
extern int64_t esl_vec_DArgMax(const double *vec, int64_t n); |
| 56 |
extern int64_t esl_vec_FArgMax(const float *vec, int64_t n); |
| 57 |
extern int64_t esl_vec_IArgMax(const int *vec, int64_t n); |
| 58 |
extern int64_t esl_vec_LArgMax(const int64_t *vec, int64_t n); |
| 59 |
|
| 60 |
extern int64_t esl_vec_DArgMin(const double *vec, int64_t n); |
| 61 |
extern int64_t esl_vec_FArgMin(const float *vec, int64_t n); |
| 62 |
extern int64_t esl_vec_IArgMin(const int *vec, int64_t n); |
| 63 |
extern int64_t esl_vec_LArgMin(const int64_t *vec, int64_t n); |
| 64 |
|
| 65 |
extern void esl_vec_DCopy(const double *src, int64_t n, double *dest); |
| 66 |
extern void esl_vec_FCopy(const float *src, int64_t n, float *dest); |
| 67 |
extern void esl_vec_ICopy(const int *src, int64_t n, int *dest); |
| 68 |
extern void esl_vec_LCopy(const int64_t *src, int64_t n, int64_t *dest); |
| 69 |
extern void esl_vec_WCopy(const int16_t *src, int64_t n, int16_t *dest); |
| 70 |
extern void esl_vec_BCopy(const int8_t *src, int64_t n, int8_t *dest); |
| 71 |
|
| 72 |
extern void esl_vec_DSwap(double *vec1, double *vec2, int64_t n); |
| 73 |
extern void esl_vec_FSwap(float *vec1, float *vec2, int64_t n); |
| 74 |
extern void esl_vec_ISwap(int *vec1, int *vec2, int64_t n); |
| 75 |
extern void esl_vec_LSwap(int64_t *vec1, int64_t *vec2, int64_t n); |
| 76 |
|
| 77 |
extern void esl_vec_DReverse(const double *vec, double *rev, int64_t n); |
| 78 |
extern void esl_vec_FReverse(const float *vec, float *rev, int64_t n); |
| 79 |
extern void esl_vec_IReverse(const int *vec, int *rev, int64_t n); |
| 80 |
extern void esl_vec_LReverse(const int64_t *vec, int64_t *rev, int64_t n); |
| 81 |
extern void esl_vec_CReverse(const char *vec, char *rev, int64_t n); |
| 82 |
|
| 83 |
extern void esl_vec_DSortIncreasing(double *vec, int64_t n); |
| 84 |
extern void esl_vec_FSortIncreasing(float *vec, int64_t n); |
| 85 |
extern void esl_vec_ISortIncreasing(int *vec, int64_t n); |
| 86 |
extern void esl_vec_LSortIncreasing(int64_t *vec, int64_t n); |
| 87 |
|
| 88 |
extern void esl_vec_DSortDecreasing(double *vec, int64_t n); |
| 89 |
extern void esl_vec_FSortDecreasing(float *vec, int64_t n); |
| 90 |
extern void esl_vec_ISortDecreasing(int *vec, int64_t n); |
| 91 |
extern void esl_vec_LSortDecreasing(int64_t *vec, int64_t n); |
| 92 |
|
| 93 |
extern int esl_vec_DShuffle(ESL_RANDOMNESS *r, double *v, int64_t n); |
| 94 |
extern int esl_vec_FShuffle(ESL_RANDOMNESS *r, float *v, int64_t n); |
| 95 |
extern int esl_vec_IShuffle(ESL_RANDOMNESS *r, int *v, int64_t n); |
| 96 |
extern int esl_vec_LShuffle(ESL_RANDOMNESS *r, int64_t *v, int64_t n); |
| 97 |
|
| 98 |
extern int esl_vec_DShuffle64(ESL_RAND64 *rng, double *v, int64_t n); |
| 99 |
extern int esl_vec_FShuffle64(ESL_RAND64 *rng, float *v, int64_t n); |
| 100 |
extern int esl_vec_IShuffle64(ESL_RAND64 *rng, int *v, int64_t n); |
| 101 |
extern int esl_vec_LShuffle64(ESL_RAND64 *rng, int64_t *v, int64_t n); |
| 102 |
|
| 103 |
extern int esl_vec_DCompare(const double *vec1, const double *vec2, int64_t n, double tol); |
| 104 |
extern int esl_vec_FCompare(const float *vec1, const float *vec2, int64_t n, float tol); |
| 105 |
extern int esl_vec_ICompare(const int *vec1, const int *vec2, int64_t n); |
| 106 |
extern int esl_vec_LCompare(const int64_t *vec1, const int64_t *vec2, int64_t n); |
| 107 |
|
| 108 |
extern int esl_vec_DDump(FILE *ofp, const double *v, int64_t n, const char *label); |
| 109 |
extern int esl_vec_FDump(FILE *ofp, const float *v, int64_t n, const char *label); |
| 110 |
extern int esl_vec_IDump(FILE *ofp, const int *v, int64_t n, const char *label); |
| 111 |
extern int esl_vec_LDump(FILE *ofp, const int64_t *v, int64_t n, const char *label); |
| 112 |
|
| 113 |
extern void esl_vec_D2F(double *src, int64_t n, float *dst); |
| 114 |
extern void esl_vec_F2D(float *src, int64_t n, double *dst); |
| 115 |
extern void esl_vec_I2F(int *src, int64_t n, float *dst); |
| 116 |
extern void esl_vec_I2D(int *src, int64_t n, double *dst); |
| 117 |
|
| 118 |
extern void esl_vec_DNorm(double *vec, int64_t n); |
| 119 |
extern void esl_vec_FNorm(float *vec, int64_t n); |
| 120 |
|
| 121 |
extern void esl_vec_DLogNorm (double *vec, int64_t n); |
| 122 |
extern void esl_vec_FLogNorm (float *vec, int64_t n); |
| 123 |
extern void esl_vec_DLog2Norm(double *vec, int64_t n); |
| 124 |
extern void esl_vec_FLog2Norm(float *vec, int64_t n); |
| 125 |
|
| 126 |
extern void esl_vec_DLog (double *vec, int64_t n); |
| 127 |
extern void esl_vec_FLog (float *vec, int64_t n); |
| 128 |
extern void esl_vec_DLog2(double *vec, int64_t n); |
| 129 |
extern void esl_vec_FLog2(float *vec, int64_t n); |
| 130 |
|
| 131 |
extern void esl_vec_DExp (double *vec, int64_t n); |
| 132 |
extern void esl_vec_FExp (float *vec, int64_t n); |
| 133 |
extern void esl_vec_DExp2(double *vec, int64_t n); |
| 134 |
extern void esl_vec_FExp2(float *vec, int64_t n); |
| 135 |
|
| 136 |
extern double esl_vec_DEntropy(const double *p, int64_t n); |
| 137 |
extern float esl_vec_FEntropy(const float *p, int64_t n); |
| 138 |
|
| 139 |
extern double esl_vec_DRelEntropy(const double *p, const double *q, int64_t n); |
| 140 |
extern float esl_vec_FRelEntropy(const float *p, const float *q, int64_t n); |
| 141 |
|
| 142 |
extern double esl_vec_DLogSum (const double *vec, int64_t n); |
| 143 |
extern float esl_vec_FLogSum (const float *vec, int64_t n); |
| 144 |
extern double esl_vec_DLog2Sum(const double *vec, int64_t n); |
| 145 |
extern float esl_vec_FLog2Sum(const float *vec, int64_t n); |
| 146 |
|
| 147 |
extern void esl_vec_DCDF(const double *p, int64_t n, double *cdf); |
| 148 |
extern void esl_vec_FCDF(const float *p, int64_t n, float *cdf); |
| 149 |
|
| 150 |
extern int esl_vec_DValidate(const double *vec, int64_t n, double tol, char *errbuf); |
| 151 |
extern int esl_vec_FValidate(const float *vec, int64_t n, float tol, char *errbuf); |
| 152 |
|
| 153 |
extern int esl_vec_DLogValidate (const double *vec, int64_t n, double tol, char *errbuf); |
| 154 |
extern int esl_vec_FLogValidate (const float *vec, int64_t n, float tol, char *errbuf); |
| 155 |
extern int esl_vec_DLog2Validate(const double *vec, int64_t n, double tol, char *errbuf); |
| 156 |
extern int esl_vec_FLog2Validate(const float *vec, int64_t n, float tol, char *errbuf); |
| 157 |
|
| 158 |
#endif |
| 159 |
|