- 目的
- ベクトルの要素毎の四則演算を行います。
- 書式
-
#include
void svoper(SVector a, char *op, SVector b);
void lvoper(LVector a, char *op, LVector b);
void fvoper(FVector a, char *op, FVector b);
void dvoper(DVector a, char *op, DVector b);
SVector xsvoper(SVector a, char *op, SVector b);
LVector xlvoper(LVector a, char *op, LVector b);
FVector xfvoper(FVector a, char *op, FVector b);
DVector xdvoper(DVector a, char *op, DVector b);
- 引数
-
- a、b
- 入力ベクトル。戻り値がvoid型の場合は、計算結果がaに上書きされます。
- op
- 演算の種類を示す文字列。"+"、"-"、"*"、
"/"はそれぞれ和・差・積・商を表す。
また、"^"はべき乗を表す。
さらに、これらの演算子の前に"!"がある場合、
入力ベクトルの順序を逆にして計算が行われる。
例えば、"!/"の場合は、bの要素を
aで割ったものが求められる。
- 戻り値
- 戻り値がベクトル型の場合は、メモリ確保されたベクトル型が返ります。
- 説明
- 戻り値がベクトル型の場合は、使用しなくなったらメモリの解放をして下さい。
- 関連項目
-
ベクトル型、
ベクトルのメモリ
- 目的
- ベクトルの要素とスカラーの四則演算を行います。
- 書式
-
#include
void svscoper(SVector a, char *op, double t);
void lvscoper(LVector a, char *op, double t);
void fvscoper(FVector a, char *op, float t);
void dvscoper(DVector a, char *op, double t);
SVector xsvscoper(SVector a, char *op, double t);
LVector xlvscoper(LVector a, char *op, double t);
FVector xfvscoper(FVector a, char *op, float t);
DVector xdvscoper(DVector a, char *op, double t);
- 引数
-
- a
- 入力ベクトル。戻り値がvoid型の場合は、計算結果がこれに上書きされます。
- op
- 演算の種類を示す文字列。"+"、"-"、"*"、
"/"はそれぞれ和・差・積・商を表す。
また、"^"はべき乗を表す。
さらに、これらの演算子の前に"!"がある場合、
引数の順序を逆にして計算が行われる。
例えば、"!/"の場合は、tを
aの要素で割ったものが求められる。
- 戻り値
- 戻り値がベクトル型の場合は、メモリ確保されたベクトル型が返ります。
- 説明
- 戻り値がベクトル型の場合は、使用しなくなったらメモリの解放をして下さい。
- 関連項目
-
ベクトル型、
ベクトルのメモリ
- 目的
- ベクトルの要素に対して基本的な演算を行います。
- 書式
-
#include
void svabs(SVector x);
void lvabs(LVector x);
void fvabs(FVector x);
void dvabs(DVector x);
SVector xsvabs(SVector x);
LVector xlvabs(LVector x);
FVector xfvabs(FVector x);
DVector xdvabs(DVector x);
void svsquare(SVector x);
void lvsquare(LVector x);
void fvsquare(FVector x);
void dvsquare(DVector x);
SVector xsvsquare(SVector x);
LVector xlvsquare(LVector x);
FVector xfvsquare(FVector x);
DVector xdvsquare(DVector x);
void svsign(SVector x);
void lvsign(LVector x);
void fvsign(FVector x);
void dvsign(DVector x);
SVector xsvsign(SVector x);
LVector xlvsign(LVector x);
FVector xfvsign(FVector x);
DVector xdvsign(DVector x);
SVector xsvdiff(SVector x);
LVector xlvdiff(LVector x);
FVector xfvdiff(FVector x);
DVector xdvdiff(DVector x);
void lvcumsum(LVector x);
void fvcumsum(FVector x);
void dvcumsum(DVector x);
LVector xlvcumsum(LVector x);
FVector xfvcumsum(FVector x);
DVector xdvcumsum(DVector x);
void lvcumprod(LVector x);
void fvcumprod(FVector x);
void dvcumprod(DVector x);
LVector xlvcumprod(LVector x);
FVector xfvcumprod(FVector x);
DVector xdvcumprod(DVector x);
void fvexp(FVector x);
void dvexp(DVector x);
FVector xfvexp(FVector x);
DVector xdvexp(DVector x);
void fvlog(FVector x);
void dvlog(DVector x);
FVector xfvlog(FVector x);
DVector xdvlog(DVector x);
void fvdecibel(FVector x);
void dvdecibel(DVector x);
FVector xfvdecibel(FVector x);
DVector xdvdecibel(DVector x);
- 引数
-
- x
- 入力ベクトル。戻り値がvoid型の場合は、計算結果がこれに上書きされます。
- 戻り値
- 戻り値がベクトル型の場合は、メモリ確保されたベクトル型が返ります。
- 説明
- 戻り値がベクトル型の場合は、使用しなくなったらメモリの解放をして下さい。
それぞれの関数は、ベクトルの要素に対して、以下のような処理を行います。
- abs: 絶対値を計算します。
- square: 2乗値を計算します。
- sign: 符号関数の出力値を計算します。
0より大きければ1を、0の場合は0を、0未満の場合は-1を出力します。
- diff: 差分を計算します。
- cumsum: 累積和を計算します。
- cumprod: 累積積を計算します。
- exp: 指数関数の出力値を計算します。
- log: 自然対数の出力値を計算します。
- decibel: デシベル値を計算します。
入力の自乗を求めた後、パワーに対するデシベル値を計算しています。
(10*log10(x^2))
- 関連項目
-
ベクトル型、
ベクトルのメモリ
- 目的
- ベクトルの要素の最大値・最小値・総和などを計算します。
- 書式
-
#include
long svsum(SVector x);
long lvsum(LVector x);
float fvsum(FVector x);
double dvsum(DVector x);
long svsqsum(SVector x);
long lvsqsum(LVector x);
float fvsqsum(FVector x);
double dvsqsum(DVector x);
long svabssum(SVector x);
long lvabssum(LVector x);
float fvabssum(FVector x);
double dvabssum(DVector x);
long svmean(SVector x);
long lvmean(LVector x);
float fvmean(FVector x);
double dvmean(DVector x);
float fvstd(FVector x, float *mean);
double dvstd(DVector x, double *mean);
short svmax(SVector x, long *index);
long lvmax(LVector x, long *index);
float fvmax(FVector x, long *index);
double dvmax(DVector x, long *index);
short svmin(SVector x, long *index);
long lvmin(LVector x, long *index);
float fvmin(FVector x, long *index);
double dvmin(DVector x, long *index);
float fvdot(FVector x, FVector y);
double dvdot(DVector x, DVector y);
- 引数
-
- x、y
- 入力ベクトル
- index
- 最大値・最小値を取る要素のインデックスを取得する場合に指定します。
NULLを指定することもできます。
- mean
- 標準偏差の計算において、平均値を知りたい場合に指定します。
NULLを指定することもできます。
- 戻り値
- 関数に応じたスカラー値が返ります。
- 説明
-
それぞれの関数は、以下のような処理を行います。
- sum: 総和を計算します。
- sqsum: 自乗和を計算します。
- abssum: 絶対値を取ったものの総和を計算します。
- mean: 平均値を計算します。
- std: 標準偏差を計算します。
- max: 最大値を計算します。
- min: 最小値を計算します。
- dot: 内積を計算します。
- 関連項目
-
ベクトル型、
ベクトルのメモリ
- 目的
- ベクトルの要素値の検索などを行います。
- 書式
-
#include
SVector xsvremap(SVector x, LVector map);
LVector xlvremap(LVector x, LVector map);
FVector xfvremap(FVector x, LVector map);
DVector xdvremap(DVector x, LVector map);
LVector xsvfind(SVector x);
LVector xlvfind(LVector x);
LVector xfvfind(FVector x);
LVector xdvfind(DVector x);
DVector xdvfindv(DVector x);
DVector xdvsceval(DVector x, char *op, double t);
LVector xdvscfind(DVector x, char *op, double t);
DVector xdvscfindv(DVector x, char *op, double t);
void svscmax(SVector x, short a);
void lvscmax(LVector x, long a);
void fvscmax(FVector x, float a);
void dvscmax(DVector x, double a);
void svscmin(SVector x, short a);
void lvscmin(LVector x, long a);
void fvscmin(FVector x, float a);
void dvscmin(DVector x, double a);
void lvsort(LVector x);
void dvsort(DVector x);
- 引数
-
- x
- 入力ベクトル
- 戻り値
- 戻り値がベクトル型の場合は、メモリ確保されたベクトル型が返ります。
- 説明
- 戻り値がベクトル型の場合は、使用しなくなったらメモリの解放をして下さい。
それぞれの関数は、以下のような処理を行います。
- remap: 入力ベクトルxの要素の順序をmapに従って入れ替えます。
- find: 入力ベクトルxの非零の要素のインデックスを抽出します。
- findv: 入力ベクトルxの非零の要素の値を抽出します。
- sceval: 入力ベクトルxの要素から、条件を満たす要素の値を
1、それ以外を0としたベクトルを出力します。
- scfind: 入力ベクトルxの要素から、条件を満たす要素のインデックスを抽出します。
- scfindv: 入力ベクトルxの要素から、条件を満たす要素の値を抽出します。
- scmax: 入力ベクトルxの要素と引数で与えられるスカラーを比較し、大きい値
をxに上書きします。
- scmin: 入力ベクトルxの要素と引数で与えられるスカラーを比較し、小さい値
をxに上書きします。
- sort: 入力ベクトルxの要素を昇順でソートします。
- 関連項目
-
ベクトル型、
ベクトルのメモリ
Last modified: "2012-06-09 00:34:13 hideki"