⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 arrop.3t

📁 speech signal process tools
💻 3T
字号:
.\" Copyright (c) 1993 Entropic Research Laboratory, Inc. All rights reserved..\" @(#)arrop.3t	1.4 23 Sep 1997 ERL.ds ]W (c) 1993 Entropic Research Laboratory, Inc..TH ARR_OP 3\-ESPSsp 23 Sep 1997.SH NAMEarr_op \- element-by-element binary operations on numeric arrays.SH SYNOPSIS.nf.ft B#include <esps/esps.h>#include <esps/op.h>char *arr_op(op, num, src1, src1_type, src2, src2_type, dest, dest_type)int	op;long	num;char	*src1;int	src1_type;char    *src2;int	src2_type;char    *dest;int	dest_type;.ft.fi.SH DESCRIPTION.PPThe function.I arr_optakes.I numnumeric values of type.I src_type1starting at the location.I src1and.I numcorresponding numeric values of type.I src_type2starting at the location.I src2and applies to each pair of corresponding values a binary operation,such as addition or multiplication, selected by the argument.I op.It stores the results, converted to.I dest_type,starting at the location.I destif.I destis non-NULL;otherwise it allocates space and stores the results there.In either casethe returned value of the function is the starting location of the results..PPThe types are indicated by numeric codesthat have symbolic names defined in the include file.I esps/esps.h.The following table shows the data type for each code..PP.TScenter, box, tab(;);c | cl | ll | l.code;type=BYTE;signed charSHORT;shortLONG;longFLOAT;floatDOUBLE;doubleBYTE_CPLX;byte_cplxSHORT_CPLX;short_cplxLONG_CPLX;long_cplxFLOAT_CPLX;float_cplxDOUBLE_CPLX;double_cplx.TE.DT.PPThe result is as though the input values were converted tothe ``largest'' type appropriate to the operation,the computations done with arithmetic appropriate to that type,and the result converted to the output type.Typically that is DOUBLE_CPLX arithmetic;any exceptions are noted in the discussions of the individual functions.However, a more direct method is actually used internallywhen the input and output types permit;for example, if these are all real, real arithmetic is used.Type conversions are done by.IR type_convert (3-ESPS).Briefly, conversion from complex to real discards the imaginary part,conversion from float or double to an integral typerounds rather than truncating,and conversion from one type to another type with a narrower numerical rangemay entail clipping; in the latter case a warning message is printed.See the.I type_convertmanual page for more details on type conversions..PPThe arguments.I src1and.I src2should each pointto a scalar or array element of the type indicated by.I src_type1or.I src_type2,respectively.The pointers must be cast to.RI ( "char *" )when passed as arguments to the function.Likewise,.I destshould be the result of casting a pointer to.RI ( "char *" ):either NULL or a pointer to the type indicated by.I dest_type..PPThe destination storage area, if supplied by the user,should not overlap the source storage areas;otherwise storing to the destination may destroy a part of a sourcethat has not yet been processed.The sources may overlap..PPThe returned value of the functionshould be cast to a pointer to the destination type..PPThe operation to be applied is indicated by an integer code.I op.The possible values of.I ophave symbolic names defined in the include file.I esps/op.h.These are.PP.TScenter, tab(;);l l l l l.OP_ADD;OP_SUB;OP_MUL;OP_DIVOP_PWR;OP_CPLX;;.TE.DT.LPThere is available a NULL-terminated string array.I operation_namesthat contains the Ascii names of these symbols, minus the prefix "OP_".This is useful for getting a printable operation name,given the integer code, or vice versa.For example.IR operation_names [ OP_MUL ]is the string "MUL", and.IR lin_search ( "operation_names,"MUL") is the integer.I OP_MUL.(See.IR lin_search (3-ESPSu),.IR lin_search2 (3-ESPSu).)The array is declared for the user as.LP.IR "extern char " * "operation_names" [];.LPin the include file.I esps/op.h,and there is an initialized definition in.I arr_op.c,the ESPS library module that contains the function.I arr_op..PPNotes on the individual operations follow.In the formulas,.I xand.I ydenote the first and second operands of the operation..TPADDSum:.RI ( x " + " y )..TPSUBDifference:.RI ( x " \- " y )..TPMULProduct:.RI ( xy )..TPDIVQuotient:.RI ( x "/" y ).The result may be a non-integer even when the operands are integers.For example, the quotient of 2 and 3 is 0.666..., not 0,which would be obtained by C fixed-point arithmetic.If the result type is specified as an integer type,this result is converted, by rounding, to 1..TPPWRThe result of raising.I xto the power.IR y :.if n .RI ( x "^" y )..if t .RI ( "\x'0'x\v'-24u'\s-3\|y\s+3\|\v'24u'" ).If.I xis 0, the result is 1 if.I yis 0, 0 if.I yhas a positive real part, and undefined otherwise.If.I xis not 0, the result is mathematically defined by.RI "exp (" y " log " x ).The result may be complex, even for real operands.For example,  \-4 to the power 0.25 yields the result.RI "1 + " i.If the result type is specified as a real type,this result is converted, by discarding the imaginary part, to 1..TPCPLXThe result is given by.RI ( x " + " iy ).This operation is mainly intended for forming a complex numberfrom its real and imaginary parts, given separately as real numbers.However, the result is that given by the formula,even for complex operands..SH EXAMPLES.PP.SH ERRORS AND DIAGNOSTICS.PP.SH FUTURE CHANGES.PPPossible additional operations, such as integer quotients,remainder and residue.RI ( mod ),.I maxand.I min,comparisons, or Boolean operations.Possible version with an interface permitting operands to bescalars or arrays with non-unit strides..SH BUGS.PPNone known..SH REFERENCES.PP.SH "SEE ALSO".PP.nf\fIfeaop\fR(1-ESPS), \fIfeafunc\fR(1-ESPS), \fIarr_func\fR(3-ESPSsp),\fItype_convert\fR(3-ESPSsp), \fIlin_search\fR(3-ESPSu),\fIlin_search2\fR(3-ESPSu).fi.SH AUTHORRodney Johnson, ERL.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -