spLib
Loading...
Searching...
No Matches
vector.h
Go to the documentation of this file.
1
4#ifndef SPLIB_VECTOR_H
5#define SPLIB_VECTOR_H
6
7#include <stdlib.h>
8#include <sp/spPlugin.h>
9
10#ifdef __cplusplus
11extern "C" {
12#endif
13
50 /*----@addtogroup vectorGroup----*/
51
67
81
82#define SP_LOW_FLOAT_PRECISION SP_32BIT_PRECISION
83#define SP_LONG_PRECISION SP_32BIT_PRECISION
84#define SP_SHORT_PRECISION SP_16BIT_PRECISION
85#define SP_CHAR_PRECISION SP_8BIT_PRECISION
87#ifdef SP_USE_VECTOR_ENGINE
88
89#define SP_VECTOR_LOCK_SWITCH_NORMAL 0
90#define SP_VECTOR_LOCK_SWITCH_SYNC_ONLY 1
91#define SP_VECTOR_LOCK_SWITCH_NOSYNC 2
92
93/* currently unofficial plugin */
94#define SP_PLUGIN_VECTOR "vector 1.2"
95
96typedef struct _spVectorPluginRec spVectorPluginRec;
97
98#ifdef SP_USE_VECTOR_LINEAR_ALGEBRA_ENGINE
99#define SP_PLUGIN_BLAS "blas 0.1"
100#define SP_PLUGIN_LAPACK "lapack 0.1"
101
102#define SP_PLUGIN_CAPS_SUPPORT_BLAS_FUNCTIONS (1<<13)
103#define SP_PLUGIN_CAPS_SUPPORT_LAPACK_FUNCTIONS (1<<14)
104#define SP_PLUGIN_CAPS_SUPPORT_LINEAR_ALGEBRA_FUNCTIONS (SP_PLUGIN_CAPS_SUPPORT_BLAS_FUNCTIONS|SP_PLUGIN_CAPS_SUPPORT_LAPACK_FUNCTIONS)
105
106#define SP_LINEAR_ALGEBRA_INSTANCE_STATUS_CHILD_PLUGIN (1<<1)
107#define SP_LINEAR_ALGEBRA_INSTANCE_STATUS_UNLOCKED (1<<2)
108#define SP_LINEAR_ALGEBRA_INSTANCE_STATUS_SYNCED (1<<3)
109#define SP_LINEAR_ALGEBRA_INSTANCE_STATUS_DATA_IN_REAL (1<<4)
110#define SP_LINEAR_ALGEBRA_INSTANCE_STATUS_DATA_IN_IMAG (1<<5)
111#define SP_LINEAR_ALGEBRA_INSTANCE_STATUS_DATA_IN_CPLX (1<<6)
112
113typedef enum {
114 SP_MATRIX_MEMORY_LAYOUT_COLUMN_MAJOR = 0,
115 SP_MATRIX_MEMORY_LAYOUT_ROW_MAJOR = 1,
116} spMatrixMemoryLayout;
117
118typedef struct _spLinearAlgebraPluginRec spLinearAlgebraPluginRec;
119typedef struct _spLinearAlgebraPluginList *spLinearAlgebraPluginList;
120
121struct _spLinearAlgebraPluginList {
122 spPlugin *plugin;
123 void *instance;
124 unsigned long status_mask;
125 struct _spLinearAlgebraPluginList *prev;
126 struct _spLinearAlgebraPluginList *next;
127};
128
129#define SpVectorLinearAlgebraPluginRec(vec) ((spLinearAlgebraPluginRec *)((vec)->la_current_list->plugin->rec))
130#define SpMatrixLinearAlgebraPluginRec(mat) ((spLinearAlgebraPluginRec *)((mat)->la_current_list->plugin->rec))
131
132#endif /* SP_USE_VECTOR_LINEAR_ALGEBRA_ENGINE */
133#endif /* SP_USE_VECTOR_ENGINE */
134
135typedef struct _spSVector *spSVector;
136typedef struct _spLVector *spLVector;
137typedef struct _spFVector *spFVector;
138typedef struct _spDVector *spDVector;
139
146struct _spSVector {
149 long length;
150
154 short *data;
155
160 short *imag;
161
162#ifdef SP_USE_VECTOR_ENGINE
163 spPlugin *plugin;
164 void *instance;
165 spBool locked;
166#ifdef SP_USE_VECTOR_LINEAR_ALGEBRA_ENGINE
167 spLinearAlgebraPluginList la_plugin_list;
168 spLinearAlgebraPluginList la_current_list;
169 unsigned long la_status_mask;
170#endif
171#endif
172};
173
180struct _spLVector {
183 long length;
184
188 long *data;
189
194 long *imag;
195
196#ifdef SP_USE_VECTOR_ENGINE
197 spPlugin *plugin;
198 void *instance;
199 spBool locked;
200#ifdef SP_USE_VECTOR_LINEAR_ALGEBRA_ENGINE
201 spLinearAlgebraPluginList la_plugin_list;
202 spLinearAlgebraPluginList la_current_list;
203 unsigned long la_status_mask;
204#endif
205#endif
206};
207
214struct _spFVector {
217 long length;
218
222 float *data;
223
228 float *imag;
229
230#ifdef SP_USE_VECTOR_ENGINE
231 spPlugin *plugin;
232 void *instance;
233 spBool locked;
234#ifdef SP_USE_VECTOR_LINEAR_ALGEBRA_ENGINE
235 spLinearAlgebraPluginList la_plugin_list;
236 spLinearAlgebraPluginList la_current_list;
237 unsigned long la_status_mask;
238#endif
239#endif
240};
241
248struct _spDVector {
251 long length;
252
256 double *data;
257
262 double *imag;
263
264#ifdef SP_USE_VECTOR_ENGINE
265 spPlugin *plugin;
266 void *instance;
267 spBool locked;
268#ifdef SP_USE_VECTOR_LINEAR_ALGEBRA_ENGINE
269 spLinearAlgebraPluginList la_plugin_list;
270 spLinearAlgebraPluginList la_current_list;
271 unsigned long la_status_mask;
272#endif
273#endif
274};
275
276typedef struct _spSVectors *spSVectors;
277typedef struct _spLVectors *spLVectors;
278typedef struct _spFVectors *spFVectors;
279typedef struct _spDVectors *spDVectors;
280
281struct _spSVectors {
282 long num_vector;
283 spSVector *vector;
284};
285
286struct _spLVectors {
287 long num_vector;
288 spLVector *vector;
289};
290
291struct _spFVectors {
292 long num_vector;
293 spFVector *vector;
294};
295
296struct _spDVectors {
297 long num_vector;
298 spDVector *vector;
299};
300
301 /*----@addtogroup vectorGroup----*/
302
303#define spvlength(x) ((x)->length)
304#define spvdata(x) ((x)->data)
305#define spvreal(x) ((x)->data)
306#define spvimag(x) ((x)->imag)
307
308#define SVector spSVector
309#define LVector spLVector
310#define FVector spFVector
311#define DVector spDVector
312#define _SVector _spSVector
313#define _LVector _spLVector
314#define _FVector _spFVector
315#define _DVector _spDVector
316
317#define SVectors spSVectors
318#define LVectors spLVectors
319#define FVectors spFVectors
320#define DVectors spDVectors
321#define _SVectors _spSVectors
322#define _LVectors _spLVectors
323#define _FVectors _spFVectors
324#define _DVectors _spDVectors
325
326#define vlength spvlength
327#define vdata spvdata
328#define vreal spvreal
329#define vimag spvimag
330
331/* Version 0.9.1+ */
332#define SP_DVECTOR_NO_CALLBACK 0L
333#define SP_DVECTOR_READ_STARTED_CALLBACK (1L<<0) /* callback_data: 0 */
334#define SP_DVECTOR_READ_PROGRESS_CALLBACK (1L<<1) /* callback_data: (long)current_read_length */
335#define SP_DVECTOR_READ_FINISHED_CALLBACK (1L<<2) /* callback_data: (long)total_read_length */
336#define SP_DVECTOR_WRITE_STARTED_CALLBACK (1L<<3) /* callback_data: 0 */
337#define SP_DVECTOR_WRITE_PROGRESS_CALLBACK (1L<<4) /* callback_data: (long)current_write_length */
338#define SP_DVECTOR_WRITE_FINISHED_CALLBACK (1L<<5) /* callback_data: (long)total_write_length */
339typedef spBool (*spDVectorCallbackFunc)(spDVector x, unsigned long callback_type, void *callback_data, void *user_data);
340
341#if defined(MACOS)
342#pragma import on
343#endif
344
345#ifdef SP_USE_VECTOR_ENGINE
346extern int spGetNumVectorPlugin(void);
347extern char *xspSearchVectorPluginFile(int *index);
348extern spPlugin *spSetDefaultVectorPlugin(const char *name);
349extern spBool spIsVectorPlugin(spPlugin *plugin);
350extern spPlugin *spLoadVectorPlugin(const char *name);
351extern spBool spFreeVectorPlugin(spPlugin *plugin);
352extern spPlugin *spGetDefaultVectorPlugin(void);
353extern spBool spFreeDefaultVectorPlugin(void);
354
355extern spBool spGetVectorPluginNumUnit(spPlugin *plugin, int *num_unit);
356extern const char *spGetVectorPluginUnitName(spPlugin *plugin, int index);
357extern spBool spSelectVectorPluginUnit(spPlugin *plugin, int index);
358
359extern spBool spGetDefaultVectorPluginNumUnit(int *num_unit);
360extern const char *spGetDefaultVectorPluginUnitName(int index);
361extern spBool spSelectDefaultVectorPluginUnit(int index);
362
363extern spBool spIsVectorPluginPrecisionSupported(spPlugin *plugin, spPrecision precision, spComputeSpeed *speed);
364extern spBool spSetVectorPluginPrecision(spPlugin *plugin, spPrecision precision);
365extern spBool spGetVectorPluginPrecision(spPlugin *plugin, spPrecision *precision);
366
367extern spBool spIsVectorPluginFastModeSupported(spPlugin *plugin, spBool fast_flag);
368extern spBool spSetVectorPluginFastMode(spPlugin *plugin, spBool fast_flag);
369extern spBool spGetVectorPluginFastMode(spPlugin *plugin, spBool *fast_flag);
370extern spBool spSetDefaultVectorPluginFastMode(spBool fast_flag);
371extern spBool spGetDefaultVectorPluginFastMode(spBool *fast_flag);
372#endif /* SP_USE_VECTOR_ENGINE */
373
374extern long spsizeof(char type);
375
376extern spPlugin *svgetplugin(spSVector x);
377extern spPlugin *lvgetplugin(spLVector x);
378extern spPlugin *fvgetplugin(spFVector x);
379extern spPlugin *dvgetplugin(spDVector x);
380
381extern spBool svsetplugin(spSVector x, spPlugin *plugin);
382extern spBool lvsetplugin(spLVector x, spPlugin *plugin);
383extern spBool fvsetplugin(spFVector x, spPlugin *plugin);
384extern spBool dvsetplugin(spDVector x, spPlugin *plugin);
385
390extern spSVector xsvalloc(long length);
392extern spLVector xlvalloc(long length);
394extern spFVector xfvalloc(long length);
396extern spDVector xdvalloc(long length);
398extern void xsvfree(spSVector vector);
400extern void xlvfree(spLVector vector);
402extern void xfvfree(spFVector vector);
404extern void xdvfree(spDVector vector);
405
406extern spSVector xsvallocfrominstance(spPlugin *plugin, void *instance, long length, spBool imag_flag);
407extern spLVector xlvallocfrominstance(spPlugin *plugin, void *instance, long length, spBool imag_flag);
408extern spFVector xfvallocfrominstance(spPlugin *plugin, void *instance, long length, spBool imag_flag);
409extern spDVector xdvallocfrominstance(spPlugin *plugin, void *instance, long length, spBool imag_flag);
410
412extern spSVector xsvallocul(spPlugin *plugin, long length, spBool unlock_flag);
414extern spLVector xlvallocul(spPlugin *plugin, long length, spBool unlock_flag);
416extern spFVector xfvallocul(spPlugin *plugin, long length, spBool unlock_flag);
418extern spDVector xdvallocul(spPlugin *plugin, long length, spBool unlock_flag);
419
421extern spSVector xsvalloculfromv(spSVector x, long length);
423extern spLVector xlvalloculfromv(spLVector x, long length);
425extern spFVector xfvalloculfromv(spFVector x, long length);
427extern spDVector xdvalloculfromv(spDVector x, long length);
428
430extern void svrfree(spSVector x);
432extern void lvrfree(spLVector x);
434extern void fvrfree(spFVector x);
436extern void dvrfree(spDVector x);
437
439extern void svialloc(spSVector x);
441extern void lvialloc(spLVector x);
443extern void fvialloc(spFVector x);
445extern void dvialloc(spDVector x);
446
448extern void svifree(spSVector x);
450extern void lvifree(spLVector x);
452extern void fvifree(spFVector x);
454extern void dvifree(spDVector x);
455
457extern spSVector xsvriallocul(spPlugin *plugin, long length, spBool unlock_flag);
459extern spLVector xlvriallocul(spPlugin *plugin, long length, spBool unlock_flag);
461extern spFVector xfvriallocul(spPlugin *plugin, long length, spBool unlock_flag);
463extern spDVector xdvriallocul(spPlugin *plugin, long length, spBool unlock_flag);
464
466extern spSVector xsvrialloc(long length);
468extern spLVector xlvrialloc(long length);
470extern spFVector xfvrialloc(long length);
472extern spDVector xdvrialloc(long length);
473
476extern spSVector xsvrealloc(spSVector x, long length);
479extern spLVector xlvrealloc(spLVector x, long length);
482extern spFVector xfvrealloc(spFVector x, long length);
486extern spDVector xdvrealloc(spDVector x, long length);
487
505
518
543
556
570
574extern spSVectors xsvsalloc(long num);
575extern spLVectors xlvsalloc(long num);
576extern spFVectors xfvsalloc(long num);
577extern spDVectors xdvsalloc(long num);
578extern spSVectors xsvsrealloc(spSVectors xs, long num);
579extern spLVectors xlvsrealloc(spLVectors xs, long num);
580extern spFVectors xfvsrealloc(spFVectors xs, long num);
581extern spDVectors xdvsrealloc(spDVectors xs, long num);
582extern void xsvsfree(spSVectors xs);
583extern void xlvsfree(spLVectors xs);
584extern void xfvsfree(spFVectors xs);
585extern void xdvsfree(spDVectors xs);
586
587extern void lvsshift(spLVectors xs, long shift);
588extern void svsshift(spSVectors xs, long shift);
589extern void fvsshift(spFVectors xs, long shift);
590extern void dvsshift(spDVectors xs, long shift);
591
592extern void svsmemshift(spSVectors xs, long shift);
593extern void lvsmemshift(spLVectors xs, long shift);
594extern void fvsmemshift(spFVectors xs, long shift);
595extern void dvsmemshift(spDVectors xs, long shift);
596
612
615extern void svreal(spSVector x);
618extern void lvreal(spLVector x);
621extern void fvreal(spFVector x);
624extern void dvreal(spDVector x);
625
628extern void svimag(spSVector x);
631extern void lvimag(spLVector x);
634extern void fvimag(spFVector x);
637extern void dvimag(spDVector x);
638
651
664
667extern void svconj(spSVector x);
670extern void lvconj(spLVector x);
673extern void fvconj(spFVector x);
676extern void dvconj(spDVector x);
689
692extern void svriswap(spSVector x);
695extern void lvriswap(spLVector x);
698extern void fvriswap(spFVector x);
701extern void dvriswap(spDVector x);
714
722extern void svcopy(spSVector y, spSVector x);
725extern void lvcopy(spLVector y, spLVector x);
728extern void fvcopy(spFVector y, spFVector x);
731extern void dvcopy(spDVector y, spDVector x);
732
735extern void svrcopyi(spSVector y, spSVector x);
738extern void lvrcopyi(spLVector y, spLVector x);
741extern void fvrcopyi(spFVector y, spFVector x);
744extern void dvrcopyi(spDVector y, spDVector x);
745
748extern void svicopyr(spSVector y, spSVector x);
751extern void lvicopyr(spLVector y, spLVector x);
754extern void fvicopyr(spFVector y, spFVector x);
757extern void dvicopyr(spDVector y, spDVector x);
758
761extern long svcopyfromarray(spSVector y, long y_offset, short *data, long length);
764extern long lvcopyfromarray(spLVector y, long y_offset, long *data, long length);
767extern long fvcopyfromarray(spFVector y, long y_offset, float *data, long length);
770extern long dvcopyfromarray(spDVector y, long y_offset, double *data, long length);
771
774extern long svcopyfromriarray(spSVector y, long y_offset, short *data, short *imag, long length);
777extern long lvcopyfromriarray(spLVector y, long y_offset, long *data, long *imag, long length);
780extern long fvcopyfromriarray(spFVector y, long y_offset, float *data, float *imag, long length);
783extern long dvcopyfromriarray(spDVector y, long y_offset, double *data, double *imag, long length);
784
787extern long svcopytoarray(spSVector x, long x_offset, short *data, long length);
790extern long lvcopytoarray(spLVector x, long x_offset, long *data, long length);
793extern long fvcopytoarray(spFVector x, long x_offset, float *data, long length);
796extern long dvcopytoarray(spDVector x, long x_offset, double *data, long length);
797
800extern long svcopytoriarray(spSVector x, long x_offset, short *data, short *imag, long length);
803extern long lvcopytoriarray(spLVector x, long x_offset, long *data, long *imag, long length);
806extern long fvcopytoriarray(spFVector x, long x_offset, float *data, float *imag, long length);
809extern long dvcopytoriarray(spDVector x, long x_offset, double *data, double *imag, long length);
810
829
842
857extern void svcat(spSVector x, spSVector y);
860extern void lvcat(spLVector x, spLVector y);
863extern void fvcat(spFVector x, spFVector y);
866extern void dvcat(spDVector x, spDVector y);
867
873extern long lvgetinitcount(long x_length, long m, long incr, long n);
874extern long fvgetinitcount(long x_length, float m, float incr, float n);
875extern long dvgetinitcount(long x_length, double m, double incr, double n);
876
879extern spBool svinit(spSVector x, long m, long incr, long n);
882extern spBool lvinit(spLVector x, long m, long incr, long n);
885extern spBool fvinit(spFVector x, float m, float incr, float n);
888extern spBool dvinit(spDVector x, double m, double incr, double n);
889
892extern spSVector xsvinit(long m, long incr, long n);
895extern spLVector xlvinit(long m, long incr, long n);
898extern spFVector xfvinit(float m, float incr, float n);
901extern spDVector xdvinit(double m, double incr, double n);
902
905extern spSVector xsvinitul(spPlugin *plugin, long m, long incr, long n, spBool unlock_flag);
908extern spLVector xlvinitul(spPlugin *plugin, long m, long incr, long n, spBool unlock_flag);
911extern spFVector xfvinitul(spPlugin *plugin, float m, float incr, float n, spBool unlock_flag);
914extern spDVector xdvinitul(spPlugin *plugin, double m, double incr, double n, spBool unlock_flag);
915
918extern spBool sviinit(spSVector x, long m, long incr, long n);
921extern spBool lviinit(spLVector x, long m, long incr, long n);
924extern spBool fviinit(spFVector x, float m, float incr, float n);
927extern spBool dviinit(spDVector x, double m, double incr, double n);
928
931extern spBool svriinit(spSVector x, long m, long incr, long n);
934extern spBool lvriinit(spLVector x, long m, long incr, long n);
937extern spBool fvriinit(spFVector x, float m, float incr, float n);
940extern spBool dvriinit(spDVector x, double m, double incr, double n);
941
944extern spSVector xsvriinit(long m, long incr, long n);
947extern spLVector xlvriinit(long m, long incr, long n);
950extern spFVector xfvriinit(float m, float incr, float n);
953extern spDVector xdvriinit(double m, double incr, double n);
954
957extern spSVector xsvriinitul(spPlugin *plugin, long m, long incr, long n, spBool unlock_flag);
960extern spLVector xlvriinitul(spPlugin *plugin, long m, long incr, long n, spBool unlock_flag);
963extern spFVector xfvriinitul(spPlugin *plugin, float m, float incr, float n, spBool unlock_flag);
966extern spDVector xdvriinitul(spPlugin *plugin, double m, double incr, double n, spBool unlock_flag);
967
968extern spBool svidxnums(spSVector x, spLVector idx, short value);
969extern spBool sviidxnums(spSVector x, spLVector idx, short value);
970extern spBool svriidxnums(spSVector x, spLVector idx, short r, short i);
971extern spSVector xsvidxnums(spSVector x, spLVector idx, short value);
972extern spSVector xsviidxnums(spSVector x, spLVector idx, short value);
973extern spSVector xsvriidxnums(spSVector x, spLVector idx, short r, short i);
974extern spBool lvidxnums(spLVector x, spLVector idx, long value);
975extern spBool lviidxnums(spLVector x, spLVector idx, long value);
976extern spBool lvriidxnums(spLVector x, spLVector idx, long r, long i);
977extern spLVector xlvidxnums(spLVector x, spLVector idx, long value);
978extern spLVector xlviidxnums(spLVector x, spLVector idx, long value);
979extern spLVector xlvriidxnums(spLVector x, spLVector idx, long r, long i);
980extern spBool fvidxnums(spFVector x, spLVector idx, float value);
981extern spBool fviidxnums(spFVector x, spLVector idx, float value);
982extern spBool fvriidxnums(spFVector x, spLVector idx, float r, float i);
983extern spFVector xfvidxnums(spFVector x, spLVector idx, float value);
984extern spFVector xfviidxnums(spFVector x, spLVector idx, float value);
985extern spFVector xfvriidxnums(spFVector x, spLVector idx, float r, float i);
986extern spBool dvidxnums(spDVector x, spLVector idx, double value);
987extern spBool dviidxnums(spDVector x, spLVector idx, double value);
988extern spBool dvriidxnums(spDVector x, spLVector idx, double r, double i);
989extern spDVector xdvidxnums(spDVector x, spLVector idx, double value);
990extern spDVector xdviidxnums(spDVector x, spLVector idx, double value);
991extern spDVector xdvriidxnums(spDVector x, spLVector idx, double r, double i);
992
997#define svnums(x, length, value) svinit(x, (long)(value), 0, (long)(length))
1000#define lvnums(x, length, value) lvinit(x, (long)(value), 0, (long)(length))
1003#define fvnums(x, length, value) fvinit(x, (float)(value), 0.0, (float)(length))
1006#define dvnums(x, length, value) dvinit(x, (double)(value), 0.0, (double)(length))
1007
1010#define svzeros(x, length) svnums(x, length, 0)
1013#define lvzeros(x, length) lvnums(x, length, 0)
1016#define fvzeros(x, length) fvnums(x, length, 0.0)
1019#define dvzeros(x, length) dvnums(x, length, 0.0)
1020
1023#define svones(x, length) svnums(x, length, 1)
1026#define lvones(x, length) lvnums(x, length, 1)
1029#define fvones(x, length) fvnums(x, length, 1.0)
1032#define dvones(x, length) dvnums(x, length, 1.0)
1033
1036#define svinums(x, length, value) sviinit(x, (long)(value), 0, (long)(length))
1039#define lvinums(x, length, value) lviinit(x, (long)(value), 0, (long)(length))
1042#define fvinums(x, length, value) fviinit(x, (float)(value), 0.0, (float)(length))
1045#define dvinums(x, length, value) dviinit(x, (double)(value), 0.0, (double)(length))
1046
1049#define svizeros(x, length) svinums(x, length, 0.0)
1052#define lvizeros(x, length) lvinums(x, length, 0.0)
1055#define fvizeros(x, length) fvinums(x, length, 0.0)
1058#define dvizeros(x, length) dvinums(x, length, 0.0)
1059
1062#define sviones(x, length) svinums(x, length, 1.0)
1065#define lviones(x, length) lvinums(x, length, 1.0)
1068#define fviones(x, length) fvinums(x, length, 1.0)
1071#define dviones(x, length) dvinums(x, length, 1.0)
1072
1075#define svrinums(x, length, value) svriinit(x, (long)(value), 0, (long)(length))
1078#define lvrinums(x, length, value) lvriinit(x, (long)(value), 0, (long)(length))
1081#define fvrinums(x, length, value) fvriinit(x, (float)(value), 0.0, (float)(length))
1084#define dvrinums(x, length, value) dvriinit(x, (double)(value), 0.0, (double)(length))
1085
1088#define svrizeros(x, length) svrinums(x, length, 0.0)
1091#define lvrizeros(x, length) lvrinums(x, length, 0.0)
1094#define fvrizeros(x, length) fvrinums(x, length, 0.0)
1097#define dvrizeros(x, length) dvrinums(x, length, 0.0)
1098
1101#define svriones(x, length) svrinums(x, length, 1.0)
1104#define lvriones(x, length) lvrinums(x, length, 1.0)
1107#define fvriones(x, length) fvrinums(x, length, 1.0)
1110#define dvriones(x, length) dvrinums(x, length, 1.0)
1111
1114#define xsvnums(length, value) xsvinit((long)(value), 0, (long)(length))
1117#define xlvnums(length, value) xlvinit((long)(value), 0, (long)(length))
1120#define xfvnums(length, value) xfvinit((float)(value), 0.0, (float)(length))
1123#define xdvnums(length, value) xdvinit((double)(value), 0.0, (double)(length))
1124
1127#define xsvnumsul(plugin, length, value, unlock_flag) xsvinitul(plugin, (long)(value), 0, (long)(length), unlock_flag)
1130#define xlvnumsul(plugin, length, value, unlock_flag) xlvinitul(plugin, (long)(value), 0, (long)(length), unlock_flag)
1133#define xfvnumsul(plugin, length, value, unlock_flag) xfvinitul(plugin, (float)(value), 0.0, (float)(length), unlock_flag)
1136#define xdvnumsul(plugin, length, value, unlock_flag) xdvinitul(plugin, (double)(value), 0.0, (double)(length), unlock_flag)
1137
1140#define xsvzeros(length) xsvnums(length, 0)
1143#define xlvzeros(length) xlvnums(length, 0)
1146#define xfvzeros(length) xfvnums(length, 0.0)
1149#define xdvzeros(length) xdvnums(length, 0.0)
1150
1153#define xsvzerosul(plugin, length, unlock_flag) xsvnumsul(plugin, length, 0, unlock_flag)
1156#define xlvzerosul(plugin, length, unlock_flag) xlvnumsul(plugin, length, 0, unlock_flag)
1159#define xfvzerosul(plugin, length, unlock_flag) xfvnumsul(plugin, length, 0.0, unlock_flag)
1162#define xdvzerosul(plugin, length, unlock_flag) xdvnumsul(plugin, length, 0.0, unlock_flag)
1163
1166#define xsvones(length) xsvnums(length, 1)
1169#define xlvones(length) xlvnums(length, 1)
1172#define xfvones(length) xfvnums(length, 1.0)
1175#define xdvones(length) xdvnums(length, 1.0)
1176
1179#define xsvonesul(plugin, length, unlock_flag) xsvnumsul(plugin, length, 1, unlock_flag)
1182#define xlvonesul(plugin, length, unlock_flag) xlvnumsul(plugin, length, 1, unlock_flag)
1185#define xfvonesul(plugin, length, unlock_flag) xfvnumsul(plugin, length, 1.0, unlock_flag)
1188#define xdvonesul(plugin, length, unlock_flag) xdvnumsul(plugin, length, 1.0, unlock_flag)
1189
1192#define xsvnull() xsvalloc(0)
1195#define xlvnull() xlvalloc(0)
1198#define xfvnull() xfvalloc(0)
1201#define xdvnull() xdvalloc(0)
1202
1205#define xsvnullul(plugin, unlock_flag) xsvallocul(plugin, 0, unlock_flag)
1208#define xlvnullul(plugin, unlock_flag) xlvallocul(plugin, 0, unlock_flag)
1211#define xfvnullul(plugin, unlock_flag) xfvallocul(plugin, 0, unlock_flag)
1214#define xdvnullul(plugin, unlock_flag) xdvallocul(plugin, 0, unlock_flag)
1215
1218#define xsvrinums(length, value) xsvriinit((long)(value), 0, (long)(length))
1221#define xlvrinums(length, value) xlvriinit((long)(value), 0, (long)(length))
1224#define xfvrinums(length, value) xfvriinit((float)(value), 0.0, (float)(length))
1227#define xdvrinums(length, value) xdvriinit((double)(value), 0.0, (double)(length))
1228
1231#define xsvrinumsul(plugin, length, value, unlock_flag) xsvriinitul(plugin, (long)(value), 0, (long)(length), unlock_flag)
1234#define xlvrinumsul(plugin, length, value, unlock_flag) xlvriinitul(plugin, (long)(value), 0, (long)(length), unlock_flag)
1237#define xfvrinumsul(plugin, length, value, unlock_flag) xfvriinitul(plugin, (float)(value), 0.0, (float)(length), unlock_flag)
1240#define xdvrinumsul(plugin, length, value, unlock_flag) xdvriinitul(plugin, (double)(value), 0.0, (double)(length), unlock_flag)
1241
1244#define xsvrizeros(length) xsvrinums(length, 0)
1247#define xlvrizeros(length) xlvrinums(length, 0)
1250#define xfvrizeros(length) xfvrinums(length, 0.0)
1253#define xdvrizeros(length) xdvrinums(length, 0.0)
1254
1257#define xsvrizerosul(plugin, length, unlock_flag) xsvrinumsul(plugin, length, 0, unlock_flag)
1260#define xlvrizerosul(plugin, length, unlock_flag) xlvrinumsul(plugin, length, 0, unlock_flag)
1263#define xfvrizerosul(plugin, length, unlock_flag) xfvrinumsul(plugin, length, 0.0, unlock_flag)
1266#define xdvrizerosul(plugin, length, unlock_flag) xdvrinumsul(plugin, length, 0.0, unlock_flag)
1267
1270#define xsvriones(length) xsvrinums(length, 1)
1273#define xlvriones(length) xlvrinums(length, 1)
1276#define xfvriones(length) xfvrinums(length, 1.0)
1279#define xdvriones(length) xdvrinums(length, 1.0)
1280
1283#define xsvrionesul(plugin, length, unlock_flag) xsvrinumsul(plugin, length, 1, unlock_flag)
1286#define xlvrionesul(plugin, length, unlock_flag) xlvrinumsul(plugin, length, 1, unlock_flag)
1289#define xfvrionesul(plugin, length, unlock_flag) xfvrinumsul(plugin, length, 1.0, unlock_flag)
1292#define xdvrionesul(plugin, length, unlock_flag) xdvrinumsul(plugin, length, 1.0, unlock_flag)
1293
1299extern spSVector xsvcut(spSVector x, long offset, long length);
1302extern spLVector xlvcut(spLVector x, long offset, long length);
1305extern spFVector xfvcut(spFVector x, long offset, long length);
1308extern spDVector xdvcut(spDVector x, long offset, long length);
1309
1312extern long svpaste(spSVector y, spSVector x, long y_offset, long x_length, spBool overlap);
1315extern long lvpaste(spLVector y, spLVector x, long y_offset, long x_length, spBool overlap);
1318extern long fvpaste(spFVector y, spFVector x, long y_offset, long x_length, spBool overlap);
1322extern long dvpaste(spDVector y, spDVector x, long y_offset, long x_length, spBool overlap);
1323
1326extern long svadd(spSVector y, long y_offset, spSVector x, long x_offset, long x_length, spBool overlap);
1329extern long lvadd(spLVector y, long y_offset, spLVector x, long x_offset, long x_length, spBool overlap);
1332extern long fvadd(spFVector y, long y_offset, spFVector x, long x_offset, long x_length, spBool overlap);
1336extern long dvadd(spDVector y, long y_offset, spDVector x, long x_offset, long x_length, spBool overlap);
1337
1340extern void sverase(spSVector x, long offset, long length, spBool inv);
1343extern void lverase(spLVector x, long offset, long length, spBool inv);
1346extern void fverase(spFVector x, long offset, long length, spBool inv);
1350extern void dverase(spDVector x, long offset, long length, spBool inv);
1351
1359extern void svset(spSVector x, short *data, long length);
1362extern void lvset(spLVector x, long *data, long length);
1365extern void fvset(spFVector x, float *data, long length);
1368extern void dvset(spDVector x, double *data, long length);
1369
1372extern void sviset(spSVector x, short *imag, long length);
1375extern void lviset(spLVector x, long *imag, long length);
1378extern void fviset(spFVector x, float *imag, long length);
1381extern void dviset(spDVector x, double *imag, long length);
1382
1385extern spSVector xsvsetve(spPlugin *plugin, short *data, long length);
1388extern spLVector xlvsetve(spPlugin *plugin, long *data, long length);
1391extern spFVector xfvsetve(spPlugin *plugin, float *data, long length);
1394extern spDVector xdvsetve(spPlugin *plugin, double *data, long length);
1395
1398extern spSVector xsvset(short *data, long length);
1401extern spLVector xlvset(long *data, long length);
1404extern spFVector xfvset(float *data, long length);
1407extern spDVector xdvset(double *data, long length);
1408
1411extern spSVector xsvsetnew(short *data, long length);
1414extern spLVector xlvsetnew(long *data, long length);
1417extern spFVector xfvsetnew(float *data, long length);
1420extern spDVector xdvsetnew(double *data, long length);
1421
1424extern spBool svsetval(spSVector x, long index, short value);
1427extern spBool lvsetval(spLVector x, long index, long value);
1430extern spBool fvsetval(spFVector x, long index, float value);
1433extern spBool dvsetval(spDVector x, long index, double value);
1434
1437extern spBool svsetival(spSVector x, long index, short value);
1440extern spBool lvsetival(spLVector x, long index, long value);
1443extern spBool fvsetival(spFVector x, long index, float value);
1446extern spBool dvsetival(spDVector x, long index, double value);
1447
1452#define svunset(x) svset(x, NULL, 0)
1455#define lvunset(x) lvset(x, NULL, 0)
1458#define fvunset(x) fvset(x, NULL, 0)
1461#define dvunset(x) dvset(x, NULL, 0)
1462
1465#define sviunset(x) sviset(x, NULL, 0)
1468#define lviunset(x) lviset(x, NULL, 0)
1471#define fviunset(x) fviset(x, NULL, 0)
1474#define dviunset(x) dviset(x, NULL, 0)
1475
1476#if defined(MACOS)
1477#pragma import off
1478#endif
1479
1480#define spvsset(xs, index, x) {(xs)->vector[index]=(x);}
1481#define svsset spvsset
1482#define lvsset spvsset
1483#define fvsset spvsset
1484#define dvsset spvsset
1485
1486/* for backwards compatibility */
1487typedef spSVector SVECTOR;
1488typedef spLVector LVECTOR;
1489typedef spFVector FVECTOR;
1490typedef spDVector DVECTOR;
1491
1492typedef spSVectors SVECTORS;
1493typedef spLVectors LVECTORS;
1494typedef spFVectors FVECTORS;
1495typedef spDVectors DVECTORS;
1496
1497#ifdef __cplusplus
1498} /* Close scope of 'extern "C"' declaration */
1499#endif
1500
1501#endif /* SPLIB_VECTOR_H */
int spBool
spPrecision
Definition vector.h:53
spComputeSpeed
Definition vector.h:69
@ SP_DOUBLE_PRECISION
Definition vector.h:56
@ SP_8BIT_PRECISION
Definition vector.h:63
@ SP_UNKNOWN_PRECISION
Definition vector.h:65
@ SP_HIGH_DOUBLE_PRECISION
Definition vector.h:55
@ SP_HIGH_FLOAT_PRECISION
Definition vector.h:58
@ SP_FLOAT_PRECISION
Definition vector.h:59
@ SP_LOW_DOUBLE_PRECISION
Definition vector.h:57
@ SP_32BIT_PRECISION
Definition vector.h:60
@ SP_24BIT_PRECISION
Definition vector.h:61
@ SP_HIGHEST_PRECISION
Definition vector.h:54
@ SP_16BIT_PRECISION
Definition vector.h:62
@ SP_IGNORE_PRECISION
Definition vector.h:64
@ SP_COMPUTE_SPEED_NORMAL
Definition vector.h:74
@ SP_COMPUTE_SPEED_UNKNOWN
Definition vector.h:79
@ SP_COMPUTE_SPEED_VERY_FAST
Definition vector.h:71
@ SP_COMPUTE_SPEED_FASTER
Definition vector.h:72
@ SP_COMPUTE_SPEED_SLOW
Definition vector.h:75
@ SP_COMPUTE_SPEED_SLOWER
Definition vector.h:76
@ SP_COMPUTE_SPEED_FAST
Definition vector.h:73
@ SP_COMPUTE_SPEED_EXTREMELY_SLOW
Definition vector.h:78
@ SP_COMPUTE_SPEED_EXTREMELY_FAST
Definition vector.h:70
@ SP_COMPUTE_SPEED_VERY_SLOW
Definition vector.h:77
Vector type that contains the elements of double type.
Definition vector.h:248
long dvcopyfromriarray(spDVector y, long y_offset, double *data, double *imag, long length)
spDVector xdvcat(spDVector x, spDVector y)
void dvifree(spDVector x)
long dvpaste(spDVector y, spDVector x, long y_offset, long x_length, spBool overlap)
void dvconj(spDVector x)
spDVector xdvcut(spDVector x, long offset, long length)
double * data
Definition vector.h:256
void dvcopy(spDVector y, spDVector x)
spBool dvsetval(spDVector x, long index, double value)
spBool dvriinit(spDVector x, double m, double incr, double n)
void dvriswap(spDVector x)
long dvcopyfromarray(spDVector y, long y_offset, double *data, long length)
spDVector xdvimag(spDVector x)
void dvset(spDVector x, double *data, long length)
spDVector xdvriinit(double m, double incr, double n)
spDVector xdvclone(spDVector x)
spDVector xdvsetve(spPlugin *plugin, double *data, long length)
void xdvfree(spDVector vector)
void dviset(spDVector x, double *imag, long length)
void dvrfree(spDVector x)
spDVector xdvinitul(spPlugin *plugin, double m, double incr, double n, spBool unlock_flag)
spBool dvislocked(spDVector x)
spDVector xdvconj(spDVector x)
long dvadd(spDVector y, long y_offset, spDVector x, long x_offset, long x_length, spBool overlap)
spDVector xdvriswap(spDVector x)
spDVector xdvallocul(spPlugin *plugin, long length, spBool unlock_flag)
spBool dvinit(spDVector x, double m, double incr, double n)
spDVector xdvrialloc(long length)
spSVector xdvtos(spDVector x)
long dvcopytoarray(spDVector x, long x_offset, double *data, long length)
spBool dvsync(spDVector x)
spDVector xdvset(double *data, long length)
spDVector xdvriinitul(spPlugin *plugin, double m, double incr, double n, spBool unlock_flag)
spDVector xdvsetnew(double *data, long length)
spDVector xdvcplx(spDVector xr, spDVector xi)
spBool dvisplugincomputable(spDVector x)
spDVector xdvreal(spDVector x)
long dvcopytoriarray(spDVector x, long x_offset, double *data, double *imag, long length)
void dverase(spDVector x, long offset, long length, spBool inv)
spDVector xdvalloc(long length)
spFVector xdvtof(spDVector x)
spDVector xdvriallocul(spPlugin *plugin, long length, spBool unlock_flag)
void dvcat(spDVector x, spDVector y)
spLVector xdvtol(spDVector x)
void dvicopyr(spDVector y, spDVector x)
void dvialloc(spDVector x)
void dvrcopyi(spDVector y, spDVector x)
double * imag
Definition vector.h:262
void dvreal(spDVector x)
spBool dvunlock(spDVector x)
spBool dvlock(spDVector x)
spDVector xdvrealloc(spDVector x, long length)
long length
Definition vector.h:251
spDVector xdvinit(double m, double incr, double n)
spBool dviinit(spDVector x, double m, double incr, double n)
void dvimag(spDVector x)
spBool dvsetlock(spDVector x, spBool lock)
spDVector xdvalloculfromv(spDVector x, long length)
spBool dvsetival(spDVector x, long index, double value)
Vector type that contains the elements of float type.
Definition vector.h:214
void xfvfree(spFVector vector)
spFVector xfvconj(spFVector x)
void fvrcopyi(spFVector y, spFVector x)
spFVector xfvrealloc(spFVector x, long length)
spFVector xfvcat(spFVector x, spFVector y)
void fvifree(spFVector x)
spFVector xfvriinitul(spPlugin *plugin, float m, float incr, float n, spBool unlock_flag)
spBool fvsync(spFVector x)
spFVector xfvrialloc(long length)
spBool fvriinit(spFVector x, float m, float incr, float n)
spBool fvlock(spFVector x)
spFVector xfvimag(spFVector x)
void fviset(spFVector x, float *imag, long length)
spFVector xfvclone(spFVector x)
long fvpaste(spFVector y, spFVector x, long y_offset, long x_length, spBool overlap)
spFVector xfvalloculfromv(spFVector x, long length)
spBool fvinit(spFVector x, float m, float incr, float n)
void fvialloc(spFVector x)
float * data
Definition vector.h:222
void fvrfree(spFVector x)
void fvreal(spFVector x)
void fvimag(spFVector x)
spBool fvsetival(spFVector x, long index, float value)
spFVector xfvinitul(spPlugin *plugin, float m, float incr, float n, spBool unlock_flag)
float * imag
Definition vector.h:228
void fvicopyr(spFVector y, spFVector x)
long fvcopytoriarray(spFVector x, long x_offset, float *data, float *imag, long length)
void fverase(spFVector x, long offset, long length, spBool inv)
long fvcopyfromarray(spFVector y, long y_offset, float *data, long length)
spFVector xfvset(float *data, long length)
void fvcat(spFVector x, spFVector y)
spBool fvsetlock(spFVector x, spBool lock)
spFVector xfvriswap(spFVector x)
spFVector xfvalloc(long length)
spBool fvisplugincomputable(spFVector x)
spFVector xfvsetve(spPlugin *plugin, float *data, long length)
spBool fvunlock(spFVector x)
long fvcopyfromriarray(spFVector y, long y_offset, float *data, float *imag, long length)
spBool fvislocked(spFVector x)
long fvadd(spFVector y, long y_offset, spFVector x, long x_offset, long x_length, spBool overlap)
spFVector xfvcut(spFVector x, long offset, long length)
void fvconj(spFVector x)
spFVector xfvriinit(float m, float incr, float n)
spBool fviinit(spFVector x, float m, float incr, float n)
long fvcopytoarray(spFVector x, long x_offset, float *data, long length)
spFVector xfvinit(float m, float incr, float n)
spFVector xfvcplx(spFVector xr, spFVector xi)
spBool fvsetval(spFVector x, long index, float value)
spFVector xfvallocul(spPlugin *plugin, long length, spBool unlock_flag)
long length
Definition vector.h:217
spFVector xfvreal(spFVector x)
void fvset(spFVector x, float *data, long length)
void fvcopy(spFVector y, spFVector x)
spFVector xfvriallocul(spPlugin *plugin, long length, spBool unlock_flag)
void fvriswap(spFVector x)
spFVector xfvsetnew(float *data, long length)
Vector type that contains the elements of long type.
Definition vector.h:180
spLVector xlvinit(long m, long incr, long n)
spLVector xlvconj(spLVector x)
void lvrfree(spLVector x)
spBool lvinit(spLVector x, long m, long incr, long n)
void lvcopy(spLVector y, spLVector x)
spBool lvsync(spLVector x)
void lverase(spLVector x, long offset, long length, spBool inv)
void xlvfree(spLVector vector)
void lvset(spLVector x, long *data, long length)
long lvadd(spLVector y, long y_offset, spLVector x, long x_offset, long x_length, spBool overlap)
spLVector xlvsetnew(long *data, long length)
void lviset(spLVector x, long *imag, long length)
long lvcopytoarray(spLVector x, long x_offset, long *data, long length)
spLVector xlvriinitul(spPlugin *plugin, long m, long incr, long n, spBool unlock_flag)
spLVector xlvcut(spLVector x, long offset, long length)
spLVector xlvsetve(spPlugin *plugin, long *data, long length)
spLVector xlvreal(spLVector x)
spLVector xlvriswap(spLVector x)
void lvicopyr(spLVector y, spLVector x)
long lvpaste(spLVector y, spLVector x, long y_offset, long x_length, spBool overlap)
long lvcopytoriarray(spLVector x, long x_offset, long *data, long *imag, long length)
long lvcopyfromarray(spLVector y, long y_offset, long *data, long length)
spLVector xlvimag(spLVector x)
long * data
Definition vector.h:188
spBool lvsetval(spLVector x, long index, long value)
long * imag
Definition vector.h:194
spBool lviinit(spLVector x, long m, long incr, long n)
spBool lvriinit(spLVector x, long m, long incr, long n)
spBool lvislocked(spLVector x)
void lvimag(spLVector x)
void lvialloc(spLVector x)
spLVector xlvclone(spLVector x)
spLVector xlvcat(spLVector x, spLVector y)
spLVector xlvriallocul(spPlugin *plugin, long length, spBool unlock_flag)
spBool lvisplugincomputable(spLVector x)
void lvrcopyi(spLVector y, spLVector x)
spLVector xlvalloculfromv(spLVector x, long length)
spLVector xlvrialloc(long length)
void lvifree(spLVector x)
spBool lvsetlock(spLVector x, spBool lock)
void lvreal(spLVector x)
void lvcat(spLVector x, spLVector y)
spLVector xlvcplx(spLVector xr, spLVector xi)
spLVector xlvriinit(long m, long incr, long n)
spBool lvunlock(spLVector x)
long length
Definition vector.h:183
spLVector xlvalloc(long length)
void lvriswap(spLVector x)
spLVector xlvset(long *data, long length)
spBool lvsetival(spLVector x, long index, long value)
spLVector xlvrealloc(spLVector x, long length)
long lvcopyfromriarray(spLVector y, long y_offset, long *data, long *imag, long length)
spLVector xlvinitul(spPlugin *plugin, long m, long incr, long n, spBool unlock_flag)
spBool lvlock(spLVector x)
void lvconj(spLVector x)
spLVector xlvallocul(spPlugin *plugin, long length, spBool unlock_flag)
Vector type that contains the elements of short type.
Definition vector.h:146
spSVector xsvrialloc(long length)
long svcopyfromriarray(spSVector y, long y_offset, short *data, short *imag, long length)
spSVector xsvalloc(long length)
void svifree(spSVector x)
long svadd(spSVector y, long y_offset, spSVector x, long x_offset, long x_length, spBool overlap)
spBool svsync(spSVector x)
spFVector xsvtof(spSVector x)
spBool svinit(spSVector x, long m, long incr, long n)
spDVector xsvtod(spSVector x)
void svset(spSVector x, short *data, long length)
spBool svsetval(spSVector x, long index, short value)
spBool svlock(spSVector x)
spSVector xsvriswap(spSVector x)
long svpaste(spSVector y, spSVector x, long y_offset, long x_length, spBool overlap)
void svialloc(spSVector x)
spBool sviinit(spSVector x, long m, long incr, long n)
spSVector xsvset(short *data, long length)
void svconj(spSVector x)
spSVector xsvrealloc(spSVector x, long length)
long svcopyfromarray(spSVector y, long y_offset, short *data, long length)
void xsvfree(spSVector vector)
spSVector xsvsetnew(short *data, long length)
short * data
Definition vector.h:154
void svrfree(spSVector x)
void svriswap(spSVector x)
void sviset(spSVector x, short *imag, long length)
spBool svislocked(spSVector x)
spBool svsetival(spSVector x, long index, short value)
void sverase(spSVector x, long offset, long length, spBool inv)
long svcopytoriarray(spSVector x, long x_offset, short *data, short *imag, long length)
spSVector xsvimag(spSVector x)
spSVector xsvclone(spSVector x)
spBool svsetlock(spSVector x, spBool lock)
void svrcopyi(spSVector y, spSVector x)
void svicopyr(spSVector y, spSVector x)
spSVector xsvriinitul(spPlugin *plugin, long m, long incr, long n, spBool unlock_flag)
spSVector xsvcplx(spSVector xr, spSVector xi)
short * imag
Definition vector.h:160
spSVector xsvcut(spSVector x, long offset, long length)
void svreal(spSVector x)
spSVector xsvallocul(spPlugin *plugin, long length, spBool unlock_flag)
spSVector xsvconj(spSVector x)
spSVector xsvreal(spSVector x)
long svcopytoarray(spSVector x, long x_offset, short *data, long length)
void svcat(spSVector x, spSVector y)
spBool svriinit(spSVector x, long m, long incr, long n)
spSVector xsvsetve(spPlugin *plugin, short *data, long length)
spBool svisplugincomputable(spSVector x)
spSVector xsvinitul(spPlugin *plugin, long m, long incr, long n, spBool unlock_flag)
long length
Definition vector.h:149
spSVector xsvcat(spSVector x, spSVector y)
spLVector xsvtol(spSVector x)
void svcopy(spSVector y, spSVector x)
spSVector xsvriallocul(spPlugin *plugin, long length, spBool unlock_flag)
spBool svunlock(spSVector x)
spSVector xsvinit(long m, long incr, long n)
spSVector xsvalloculfromv(spSVector x, long length)
spSVector xsvriinit(long m, long incr, long n)
void svimag(spSVector x)