Mac OS 9
vectorOps.h
Go to the documentation of this file.
1 
19 #ifndef __VECTOROPS__
20 #define __VECTOROPS__
21 
22 #ifndef __CONDITIONALMACROS__
23 #include <ConditionalMacros.h>
24 #endif
25 
26 #if PRAGMA_ONCE
27 #pragma once
28 #endif
29 
30 #ifdef __cplusplus
31 extern "C"
32 {
33 #endif
34 
35 #if PRAGMA_IMPORT
36 #pragma import on
37 #endif
38 
39 #if PRAGMA_STRUCT_ALIGN
40 #pragma options align = mac68k
41 #elif PRAGMA_STRUCT_PACKPUSH
42 #pragma pack(push, 2)
43 #elif PRAGMA_STRUCT_PACK
44 #pragma pack(2)
45 #endif
46 
61 #ifdef __VEC__
67  /***************************************************
68  vIsamax finds the position of the first vector
69  element having the largest magnitude.
70  count length of vector x (count is a
71  multiple of 4)
72  x array of floats
73  **************************************************/
82  long
83  vIsamax(long count, const vector float x[]);
84 
85  /***************************************************
86  vIsamin finds the position of the first vector
87  element having minimum absolute value.
88  count length of vector x (count is a
89  multiple of 4)
90  x array of floats
91  **************************************************/
100  long
101  vIsamin(long count, const vector float x[]);
102 
103  /***************************************************
104  vIsmax finds the position of the first vector
105  element having maximum value.
106  count length of vector x (count is a
107  multiple of 4)
108  x array of floats
109  **************************************************/
118  long
119  vIsmax(long count, const vector float x[]);
120 
121  /***************************************************
122  vIsmin finds the position of the first vector
123  element having minimum value.
124  count length of vector x (count is a
125  multiple of 4)
126  x array of floats
127  **************************************************/
136  long
137  vIsmin(long count, const vector float x[]);
138 
139  /***************************************************
140  vSasum finds the sum of the magnitudes of the
141  elements in a vector.
142  count length of vector x (count is a
143  multiple of 4)
144  x array of floats
145  **************************************************/
154  float
155  vSasum(long count, const vector float x[]);
156 
157  /***************************************************
158  vSsum is the vector version of sasum but without
159  the absolute value. It takes the value of each
160  element of the array and adds them together.
161  multiple of 4)
162  x array of floats
163  **************************************************/
172  float
173  vSsum(long count, const vector float x[]);
174 
175  /***************************************************
176  vSaxpy multiplies a vector x, by a scalar and
177  adds it to a vector y and stores the result in y
178  n number of floats in x (n is a
179  multiple of 4)
180  alpha scalar number is single-precision
181  floating-point
182  x array of vector floats
183  y array of vector floats, where the
184  the result is stored
185  **************************************************/
194  void
195  vSaxpy(long n, float alpha, const vector float x[], vector float y[]);
196 
197  /**************************************************************
198  vScopy copies a vector x, into another vector y.
199  n mumber of floats in x and y (n is a
200  multiple of 4)
201  x array of vector floats
202  y array of vector floats
203  *************************************************************/
212  void
213  vScopy(long n, const vector float x[], vector float y[]);
214 
215  /**************************************************************
216  vSdot finds the dot product of two vectors.
217  n mumber of floats in x and y (n is a
218  multiple of 4)
219  x array of vector floats
220  y array of vector floats
221  *************************************************************/
230  float
231  vSdot(long n, const vector float x[], const vector float y[]);
232 
233  /**************************************************************
234  vSnaxpy computes saxpy "n" times.
235  n number of saxpyV computations to be
236  performed and the number of elements
237  in vector A (n is a multiple of 4)
238  m number of floats in each vector x(i)
239  or y(i)
240  a array of vector floats containing
241  scalars a(i)
242  x matrix containing arrays of vector-
243  floats x(i)
244  y matrix containing vectors y(i)
245  *************************************************************/
254  void
255  vSnaxpy(long n, long m, const vector float a[], const vector float x[],
256  vector float y[]);
257 
258  /**************************************************************
259  vSndot computes the dot products "n" times.
260  n number of dot product computations
261  to be performed and the number of
262  elements in vector S
263  m number of elements in vectors x(i)
264  and y(i) for each dot product
265  computation (m is a multiple of 4)
266  s array of floats. Depending on the
267  value of "isw" different computations/
268  are performed and the results are
269  stored in the array S
270  isw indicates the type of computation
271  to perform.
272  if isw=1, S(i) <-- x(i) y(i)
273  if isw=2, S(i) <-- - x(i) y(i)
274  if isw=3, S(i) <-- S(i) + x(i) y(i)/
275  if isw=4, S(i) <-- S(i) - x(i) y(i)/
276  x matrix containing arrays x(i)
277  y matrix containing arrays y(i)
278  *************************************************************/
287  void
288  vSndot(long n, long m, float s[], long isw, const vector float x[],
289  const vector float y[]);
290 
291  /**************************************************************
292  vSnrm2 finds the Euclidean length of a vector
293  with scaling of input to avoid destructive
294  underflow and overflow.
295  count length of vector (multiple of 4)
296  x array of vector floats
297  *************************************************************/
306  float
307  vSnrm2(long count, const vector float x[]);
308 
309  /**************************************************************
310  vSnorm2 finds the Euclidean length of a vector
311  with no scaling of input.
312  count length of vector (multiple of 4)
313  x array of vector floats
314  *************************************************************/
323  float
324  vSnorm2(long count, const vector float x[]);
325 
326  /**************************************************************
327  vSrot applies a plane rotation.
328  n number of points to be rotated, also
329  number of elements in x and y (n is
330  a multiple of 4)
331  x array of vector floats. It is a
332  vector of length n, containing x(i)
333  coordinates of points to be rotated
334  y array of vector floats. It is a
335  vector of length n, containing y(i)
336  coordinates of points to be rotated
337  c cosine of angle of rotation
338  s sine of angle of rotation
339  *************************************************************/
348  void
349  vSrot(long n, vector float x[], vector float y[], float c, float s);
350 
351  /**************************************************************
352  vSscal multiplies a vector x, by a scalar and
353  stores the result in the vector x.
354  n number of floats in x (n is a
355  multiple of 4)
356  alpha scalar number is single-precision
357  floating-point
358  x array of vector floats
359  *************************************************************/
368  void
369  vSscal(long n, float alpha, vector float x[]);
370 
371  /**************************************************************
372  vSswap interchanges the elements of vectors x
373  and y
374  n number of floats in x and y (n is a
375  multiple of 4)
376  x array of vector floats
377  y array of vector floats
378  *************************************************************/
387  void
388  vSswap(long n, vector float x[], vector float y[]);
389 
390  /**************************************************************
391  vSyax multiplies a vector x, by a scalar and
392  stores the result in a vector y.
393  n number of floats in x (n is a
394  multiple of 4)
395  alpha scalar number is single-precision
396  floating-point
397  x array of vector floats
398  y array of vector floats
399  *************************************************************/
408  void
409  vSyax(long n, float alpha, const vector float x[], vector float y[]);
410 
411  /**************************************************************
412  vSzaxpy multiplies a vector x, by a scalar and
413  adds it to a vector y and stores the result in
414  vector Z.
415  n number of floats in x (n is a
416  multiple of 4)
417  alpha scalar number is single-precision
418  floating-point
419  x array of vector floats
420  y array of vector floats
421  Z array of vector floats, where the
422  is stored
423  *************************************************************/
432  void
433  vSzaxpy(long n, float alpha, const vector float x[], const vector float yY[],
434  vector float z[]);
435 
441  /**************************************************************
442  vSgemv multiplies an array of vector floats y by
443  a scalar beta, and takes the result and adds it
444  to the product of a scalar alpha multiplied by
445  a matrix A multiplied by a vector x. The above
446  result is stored in array y. Futhermore, the
447  same function also performs the above calculation/
448  with the transpose of matrix A, instead of
449  matrix A. In this function argument "forma"
450  distinguishes between the above two cases.
451  forma indicates the form of matrix A to
452  use in the computation, where:
453  If forma = "n", Matrix A is used
454  If forma = "T", Transpose of Matrix
455  A is used
456  m number of rows in matrix A and
457  depending on value of forma
458  if forma = "n", it is the length of
459  vector y
460  if forma = "T", it is the length of
461  vector x. m is a multiple of 4
462  n number of columns in matrix A and
463  depending on value of forma
464  if forma = "n", it is the length of
465  vector x
466  if forma = "T", it is the length of
467  vector y. m is a multiple of 4
468  alpha is a scaling constant
469  A is an m by n matrix. Its elements
470  are vector floats
471  x is an array of vector floats
472  beta is a scaling constant
473  y is an array of vector floats
474  *************************************************************/
483  void
484  vSgemv(char forma, long m, long n, float alpha, const vector float a[],
485  const vector float x[], float beta, vector float y[]);
486 
487  /**************************************************************
488  vSgemx adds an array of vector floats y to the
489  product of an scalar alpha by a mtrix A
490  multiplied by an array of vector floats x. It
491  then stores the result in the vector y.
492  m number of rows in matrix A and
493  the length of vector y. m is a
494  multiple of 4
495  n number of columns in matrix A and
496  the length of vector x. m is a
497  multiple of 4
498  alpha is a scaling constant
499  a is an m by n matrix. Its elements
500  are vector floats
501  x is an array of vector floats
502  y is an array of vector floats
503  *************************************************************/
512  void
513  vSgemx(long m, long n, float alpha, const vector float a[],
514  const vector float x[], vector float y[]);
515 
516  /**************************************************************
517  vSgemtx takes the transpose of a mtrix A and
518  multiplies it by an array x. It then multiplies
519  the result by a scalar alpha. Finally adds the
520  above result to an array y and stores the result
521  in array y.
522  m number of rows in matrix A and
523  the length of vector x. m is a
524  multiple of 4
525  n number of columns in matrix A and
526  the length of vector y. m is a
527  multiple of 4
528  alpha is a scaling constant
529  a is an m by n matrix. Its elements
530  are vector floats
531  x is an array of vector floats
532  y is an array of vector floats
533  *************************************************************/
542  void
543  vSgemtx(long m, long n, float alpha, const vector float a[],
544  const vector float x[], vector float y[]);
545 
552  /**************************************************************
553  vSgeadd performs matrix addition for general
554  matrices or their transposes.
555  height height of the matrix (it is multiple
556  of 4)
557  width width of the matrix (it is multiple
558  of 4)
559  A matrix A, and depending on forma:
560  if forma='n', A is used in the
561  computation, and A has m rows and
562  n columns
563  if forma='T', A(T) is used in the
564  computation, and A has n rows and
565  m columns
566  forma indicates the form of matrix A to
567  use in the computation, where:
568  if forma='n', A is used in the
569  computation
570  if forma='T', A(T) is used in the
571  computation
572  b matrix b, and depending on formb:
573  if formb='n', b is used in the
574  computation, and b has m rows and
575  n columns
576  if formb='T', b(T) is used in the
577  computation, and b has n rows and
578  m columns
579  formb indicates the form of matrix b to
580  use in the computation, where:
581  if forma='n', b is used in the
582  computation
583  if forma='T', b(T) is used in the
584  computation
585  c is an m by n matrix c, containing
586  the reults of the computation
587  *************************************************************/
596  void
597  vSgeadd(long height, long width, const vector float a[], char forma,
598  const vector float b[], char formb, vector float c[]);
599 
600  /**************************************************************
601  vSgesub performs matrix subtraction for general
602  matrices or their transposes.
603  height height of the matrix (it is multiple
604  of 4)
605  width width of the matrix (it is multiple
606  of 4)
607  A matrix A, and depending on forma:
608  if forma='n', A is used in the
609  computation, and A has m rows and
610  n columns
611  if forma='T', A(T) is used in the
612  computation, and A has n rows and
613  m columns
614  forma indicates the form of matrix A to
615  use in the computation, where:
616  if forma='n', A is used in the
617  computation
618  if forma='T', A(T) is used in the
619  computation
620  b matrix b, and depending on formb:
621  if formb='n', b is used in the
622  computation, and b has m rows and
623  n columns
624  if formb='T', b(T) is used in the
625  computation, and b has n rows and
626  m columns
627  formb indicates the form of matrix b to
628  use in the computation, where:
629  if forma='n', b is used in the
630  computation
631  if forma='T', b(T) is used in the
632  computation
633  c is an m by n matrix c, containing
634  the reults of the computation
635  *************************************************************/
644  void
645  vSgesub(long height, long width, const vector float a[], char forma,
646  const vector float b[], char formb, vector float c[]);
647 
648  /**************************************************************
649  vSgemul performs matrix multiplication for
650  general matrices or their transposes.
651  l height of the matrix A (it is
652  multiple of 4)
653  m width of matrix A (it is multiple
654  of 4)
655  n width of matrix b (it is multiple
656  of 4)
657  A matrix A, and depending on forma:
658  if forma='n', A is used in the
659  computation, and A has l rows and
660  m columns
661  if forma='T', A(T) is used in the
662  computation, and A has m rows and
663  l columns
664  forma indicates the form of matrix A to
665  use in the computation, where:
666  if forma='n', A is used in the
667  computation
668  if forma='T', A(T) is used in the
669  computation
670  b matrix b, and depending on formb:
671  if formb='n', b is used in the
672  computation, and b has m rows and
673  n columns
674  if formb='T', b(T) is used in the
675  computation, and b has n rows and
676  m columns
677  formb indicates the form of matrix b to
678  use in the computation, where:
679  if forma='n', b is used in the
680  computation
681  if forma='T', b(T) is used in the
682  computation
683  matrix is the matrix containing the
684  results of the computation
685  *************************************************************/
694  void
695  vSgemul(long l, long m, long n, const vector float a[], char forma,
696  const vector float b[], char formb, vector float matrix[]);
697 
698  /**************************************************************
699  vSgemm performs combined matrix multiplication
700  and addition for general matrices or their transposes.
701  l number of rows in matrix c (it is
702  multiple of 4)
703  m has the following meaning:
704  if forma='n', it is the number of
705  columns in matrix A
706  if forma='T', it is the number of
707  rows in matrix A. In addition
708  if formb='n', it is the number of
709  rows in matrix b
710  if formb='T', it is the number of
711  columns in matrix b
712  n columns in matrix c
713  A matrix A, and depending on forma:
714  if forma='n', A is used in the
715  computation, and A has l rows and
716  m columns
717  if forma='T', A(T) is used in the
718  computation, and A has m rows and
719  l columns
720  forma indicates the form of matrix A to
721  use in the computation, where:
722  if forma='n', A is used in the
723  computation
724  if forma='T', A(T) is used in the
725  computation
726  b matrix b, and depending on formb:
727  if formb='n', b is used in the
728  computation, and b has m rows and
729  n columns
730  if formb='T', b(T) is used in the
731  computation, and b has n rows and
732  m columns
733  formb indicates the form of matrix b to
734  use in the computation, where:
735  if forma='n', b is used in the
736  computation
737  if forma='T', b(T) is used in the
738  computation
739  alpha is a scalar
740  beta is a scalar
741  matrix is the l by n matrix
742  *************************************************************/
751  void
752  vSgemm(long l, long m, long n, const vector float a[], char forma,
753  const vector float b[], char formb, vector float c[], float alpha,
754  float beta, vector float matrix[]);
755 
756  /**************************************************************
757  vSgetmi performs general matrix transpose (in place).
758  size is the number of rows and columns
759  in matrix x
760  *************************************************************/
769  void
770  vSgetmi(long size, vector float x[]);
771 
772  /**************************************************************
773  vSgetmo performs general matrix transpose (out-of-place).
774  height is the height of the matrix
775  width is the width of the matrix
776  x array of vector floats
777  y array of vector floats
778  *************************************************************/
787  void
788  vSgetmo(long height, long width, const vector float x[], vector float y[]);
789 
790  /**************************************************************
791  vSgevv is a new function. It takes matrix A and
792  multiplies it by matrix b and puts the result in
793  matrix m.
794  l is the height of the matrix
795  n is the width of the matrix
796  A array of vector floats of at least
797  l * m in length
798  b array of vector floats of at least
799  m * n in length
800  m array of vector floats, containing
801  the results of multiplication. It
802  is m * n in size
803  *************************************************************/
812  void
813  vSgevv(long l, long n, const vector float a[], const vector float b[],
814  vector float m[]);
815 
816 #endif
818 #if PRAGMA_STRUCT_ALIGN
819 #pragma options align = reset
820 #elif PRAGMA_STRUCT_PACKPUSH
821 #pragma pack(pop)
822 #elif PRAGMA_STRUCT_PACK
823 #pragma pack()
824 #endif
825 
826 #ifdef PRAGMA_IMPORT_OFF
827 #pragma import off
828 #elif PRAGMA_IMPORT
829 #pragma import reset
830 #endif
831 
832 #ifdef __cplusplus
833 }
834 #endif
835 
836 #endif
Set up for compiler independent conditionals.
x
Definition: ToolUtils.h:163