amino
Lightweight Robot Utility Library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
la_doc.c
Go to the documentation of this file.
1 # 1 "doc/la_doc.c"
2 # 1 "<built-in>"
3 # 1 "<command-line>"
4 # 1 "/usr/include/stdc-predef.h" 1 3 4
5 /* Copyright (C) 1991-2014 Free Software Foundation, Inc.
6  This file is part of the GNU C Library.
7 
8  The GNU C Library is free software; you can redistribute it and/or
9  modify it under the terms of the GNU Lesser General Public
10  License as published by the Free Software Foundation; either
11  version 2.1 of the License, or (at your option) any later version.
12 
13  The GNU C Library is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  Lesser General Public License for more details.
17 
18  You should have received a copy of the GNU Lesser General Public
19  License along with the GNU C Library; if not, see
20  <http://www.gnu.org/licenses/>. */
21 
22 
23 
24 
25 /* This header is separate from features.h so that the compiler can
26  include it implicitly at the start of every compilation. It must
27  not itself include <features.h> or any other header that includes
28  <features.h> because the implicit include comes before any feature
29  test macros that may be defined in a source file before it first
30  explicitly includes a system header. GCC knows the name of this
31  header in order to preinclude it. */
32 
33 /* glibc's intent is to support the IEC 559 math functionality, real
34  and complex. If the GCC (4.9 and later) predefined macros
35  specifying compiler intent are available, use them to determine
36  whether the overall intent is to support these features; otherwise,
37  presume an older compiler has intent to support these features and
38  define these macros by default. */
39 # 52 "/usr/include/stdc-predef.h" 3 4
40 /* wchar_t uses ISO/IEC 10646 (2nd ed., published 2011-03-15) /
41  Unicode 6.0. */
42 
43 
44 /* We do not support C11 <threads.h>. */
45 # 1 "<command-line>" 2
46 # 1 "doc/la_doc.c"
47 
48 
49 /* The file is preprocess to give Doxygen some useful input */
50 
53 # 1 "./include/amino/la.h" 1
54 /* -*- mode: C; c-basic-offset: 4 -*- */
55 /* ex: set shiftwidth=4 tabstop=4 expandtab: */
56 /*
57  * Copyright (c) 2011-2012, Georgia Tech Research Corporation
58  * All rights reserved.
59  *
60  * Author(s): Neil T. Dantam <ntd@gatech.edu>
61  * Georgia Tech Humanoid Robotics Lab
62  * Under Direction of Prof. Mike Stilman <mstilman@cc.gatech.edu>
63  *
64  *
65  * This file is provided under the following "BSD-style" License:
66  *
67  *
68  * Redistribution and use in source and binary forms, with or
69  * without modification, are permitted provided that the following
70  * conditions are met:
71  *
72  * * Redistributions of source code must retain the above copyright
73  * notice, this list of conditions and the following disclaimer.
74  *
75  * * Redistributions in binary form must reproduce the above
76  * copyright notice, this list of conditions and the following
77  * disclaimer in the documentation and/or other materials provided
78  * with the distribution.
79  *
80  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
81  * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
82  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
83  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
84  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
85  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
86  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
87  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
88  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
89  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
90  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
91  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
92  * POSSIBILITY OF SUCH DAMAGE.
93  *
94  */
95 
96 
97 
99 
101 # 1 "./include/amino/la_impl.h" 1
102 /* -*- mode: C; c-basic-offset: 4 -*- */
103 /* ex: set shiftwidth=4 tabstop=4 expandtab: */
104 /*
105  * Copyright (c) 2011-2012, Georgia Tech Research Corporation
106  * All rights reserved.
107  *
108  * Author(s): Neil T. Dantam <ntd@gatech.edu>
109  * Georgia Tech Humanoid Robotics Lab
110  * Under Direction of Prof. Mike Stilman <mstilman@cc.gatech.edu>
111  *
112  *
113  * This file is provided under the following "BSD-style" License:
114  *
115  *
116  * Redistribution and use in source and binary forms, with or
117  * without modification, are permitted provided that the following
118  * conditions are met:
119  *
120  * * Redistributions of source code must retain the above copyright
121  * notice, this list of conditions and the following disclaimer.
122  *
123  * * Redistributions in binary form must reproduce the above
124  * copyright notice, this list of conditions and the following
125  * disclaimer in the documentation and/or other materials provided
126  * with the distribution.
127  *
128  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
129  * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
130  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
131  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
132  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
133  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
134  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
135  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
136  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
137  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
138  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
139  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
140  * POSSIBILITY OF SUCH DAMAGE.
141  *
142  */
143 
144 
145 # 1 "./include/amino/def.h" 1
146 # 42 "./include/amino/def.h"
147 # 1 "./include/amino/mangle.h" 1
148 # 43 "./include/amino/def.h" 2
149 # 45 "./include/amino/la_impl.h" 2
150 
161 ( size_t m, size_t n,
162  const double *A, size_t lda,
163  double *B, size_t ldb );
164 
174 AA_API double aa_la_d_ssd ( size_t n, const double *x, size_t incx, const double *y, size_t incy );
175 
176 
177 
178 
189 AA_API void aa_la_d_lerp
190 ( size_t n, double u,
191  const double *v1, size_t inc1,
192  const double *v2, size_t inc2,
193  double *vu, size_t incu );
194 
195 
196 
199 ( size_t n, double tf,
200  const double *x1, size_t incx1,
201  const double *dx1, size_t incdx1,
202  const double *x2, size_t inc2,
203  const double *dx2, size_t incdx2,
204  double *a2, double *a3 );
205 
208 ( size_t n, double tf,
209  const double *x1, size_t incx1,
210  const double *dx1, size_t incdx1,
211  const double *a2, const double *a3,
212  double *x, size_t incx,
213  double *dx, size_t incdx,
214  double *ddx, size_t incddx );
215 
218 ( size_t n, double tf,
219  const double *x1, size_t incx1,
220  const double *dx1, size_t incdx1,
221  const double *ddx1, size_t incddx1,
222  const double *x2, size_t inc2,
223  const double *dx2, size_t incdx2,
224  const double *ddx2, size_t incddx2,
225  double *a3, double *a4, double *a5 );
226 
229 ( size_t n, double tf,
230  const double *x1, size_t incx1,
231  const double *dx1, size_t incdx1,
232  const double *ddx1, size_t incddx1,
233  const double *a3, const double *a4, const double *a5,
234  double *x, size_t incx,
235  double *dx, size_t incdx,
236  double *ddx, size_t incddx );
237 
244 AA_API double aa_la_d_vecstd ( size_t n, const double *x, size_t incx, double mu );
245 
246 
247  ;
248 
258 AA_API void aa_la_d_colmean ( size_t m, size_t n, const double *A, size_t lda, double *x );
259 
260 
261  ;
262 
272 AA_API void aa_la_d_rowmean ( size_t m, size_t n, const double *A, size_t lda, double *x );
273 
274 
275  ;
276 
277 /* AA_API void AA_NAME(la,_cmean) */
278 /* ( size_t m, size_t n, */
279 /* const AA_TYPE *A, size_t lda, */
280 /* AA_TYPE *x ); */
281 
293 AA_API void aa_la_d_colcov ( size_t m, size_t n, const double *A, size_t lda, const double *x, double *E, size_t lde );
294 
295 
296 
297  ;
298 
299 /* AA_API void AA_NAME(la,_ccov) */
300 /* ( size_t m, size_t n, */
301 /* const AA_TYPE *A, size_t lda, */
302 /* const AA_TYPE *x, */
303 /* AA_TYPE *E, size_t lde ); */
304 
305 
306 
307 /* Hungarian algorithm to solve min assignment problem
308  * \param n rows and cols of A
309  * \param A cost matrix, column major, destroyed on exit
310  * \param[out] row_assign array of column assigned to row at index i,
311  * length m. Unmatched elements have the value of -1.
312  * \param col_assign mapping from col to matched row
313  * \param lda leading dimension of A
314  * \param row_assign array of column assigned to row at index i
315  * \param iwork array of size 3*n*n +2*n
316  */
317 /* AA_API void AA_NAME(la,opt_hungarian) */
318 /* ( size_t n, AA_TYPE *A, size_t lda, */
319 /* ssize_t *row_assign, */
320 /* ssize_t *col_assign, */
321 /* ssize_t *iwork); */
322 
323 
324 /* Compute minimum iwork size for hungarian algorithm
325  *
326  * \sa aa_la_d_opt_hungarian
327  */
328 /* static inline size_t AA_NAME(la,opt_hungarian_iworksize) */
329 /* ( size_t n ) { */
330 /* return 3*n*n + 2*n; */
331 /* } */
332 
333 /* Hungarian algorithm for rectangular distance matrix by padding with zeros.
334  *
335  * \param m rows of A
336  * \param n cols of A
337  * \param A distance matrix for minimization problem
338  * \param lda leading dimension of A
339  * \param[out] row_assign array of column assigned to row at index i,
340  * length m. Unmatched elements have the value of -1.
341  * \param[out] col_assign mapping from col to matched row
342  * \param work work array of length max(m,n)**2
343  * \param iwork integer work array of length (3*max(m,n)**2 + 4*max(m,n))
344  */
345 /* AA_API void AA_NAME(la,opt_hungarian_pad) */
346 /* ( size_t m, size_t n, const AA_TYPE *A, size_t lda, */
347 /* ssize_t *row_assign, */
348 /* ssize_t *col_assign, */
349 /* AA_TYPE *work, ssize_t *iwork); */
350 
351 /* Compute minimum iwork size for padded hungarian algorithm
352  *
353  * \sa aa_la_d_opt_hungarian_pad
354  */
355 /* static inline size_t AA_NAME(la,opt_hungarian_pad_iworksize) */
356 /* (size_t m,size_t n) { */
357 /* size_t p = AA_MAX(m,n); */
358 /* return AA_NAME(la,opt_hungarian_iworksize)(p) + 2*p; */
359 /* } */
360 
361 
362 /* Compute minimum work size for padded hungarian algorithm
363  *
364  * \sa aa_la_d_opt_hungarian_pad
365  */
366 /* static inline size_t AA_NAME(la,opt_hungarian_pad_worksize) */
367 /* (size_t m,size_t n) { */
368 /* size_t p = AA_MAX(m,n); */
369 /* return p*p; */
370 /* } */
371 
372 
373 /* Converts max assignment to min assignment for Hungarian algorithm.
374  * \param m rows of A
375  * \param n cols of A
376  * \param A cost matrix for max problem,
377  * converted to matrix for min proble on exit
378  * \param lda leading dimension of A
379  */
380 /* AA_API void AA_NAME(la,opt_hungarian_max2min) */
381 /* ( size_t m, size_t n, AA_TYPE *A, size_t lda ); */
382 
383 
393 AA_API void aa_la_d_assign_hungarian ( size_t m, size_t n, const double *A, size_t lda, ssize_t *row_assign, ssize_t *col_assign );
394 
395 
396  ;
397 
406 AA_API void aa_la_d_assign_hungarian_max2min ( size_t m, size_t n, double *A, size_t lda );
407 
408  ;
409 
410 
412 static inline size_t aa_la_d_minloc
413 ( size_t n, double *x, size_t incx ) {
414  size_t imin = 0;
415  double xmin = *x;
416  for( size_t i = 1; i < n; i ++ ) {
417  if( x[i*incx] < xmin ) {
418  imin = i;
419  xmin = x[i*incx];
420  }
421  }
422  return imin;
423 }
424 
426 static inline double aa_la_d_mat_max
427 ( size_t m, size_t n, double *A, size_t lda,
428  size_t *pi, size_t *pj ) {
429  size_t im = 0;
430  size_t jm = 0;
431  double xm = *A;
432  for( size_t i = 0; i < m; i++) {
433  for( size_t j = 0; j < n; j++) {
434  if( AA_MATREF(A, lda, i, j ) > xm ) {
435  im = i;
436  jm = j;
437  xm = AA_MATREF(A, lda, i, j );
438  }
439  }
440  }
441  if( pi ) *pi = im;
442  if( pj ) *pj = jm;
443  return xm;
444 }
445 
446 
448 static inline size_t aa_la_d_maxloc
449 ( size_t n, double *x, size_t incx ) {
450  size_t imax = 0;
451  double xmax = *x;
452  for( size_t i = 1; i < n; i ++ ) {
453  if( x[i*incx] > xmax ) {
454  imax = i;
455  xmax = x[i*incx];
456  }
457  }
458  return imax;
459 }
460 
471 AA_API double aa_la_d_angle ( size_t n, const double *x, size_t incx, const double *y, size_t incy );
472 
473 
474 
475 
476 
491 ( size_t m, size_t n, size_t p,
492  const double *A, size_t lda,
493  const double *b, size_t ldb,
494  double *x, size_t ldx );
495 
496 
514 ( size_t m, size_t n, const double *A, size_t lda,
515  double *U, size_t ldu,
516  double *S,
517  double *Vt, size_t ldvt );
518 
519 
526 AA_API double aa_la_d_median
527 ( size_t n, const double *x, size_t incx );
528 
537 AA_API double aa_la_d_nmedian
538 ( size_t n, double *x );
539 
540 
543 static inline double aa_la_d_nmedian_pop
544 ( size_t n, double *x )
545 {
546  double u = aa_la_d_nmedian(n, x);
548  return u;
549 }
550 
558 double aa_la_d_mad
559 ( size_t n, const double u, const double *x, size_t incx );
560 
570 double aa_la_d_mad2
571 ( size_t m, size_t n, const double *u, const double *A, size_t lda );
572 
575 ( size_t n, const double *A, size_t lda,
576  double *wr,
577  double *wi,
578  double *Vl, size_t ldvl,
579  double *Vr, size_t ldvr );
580 
593 AA_API void aa_la_d_colfit ( size_t m, size_t n, const double *A, size_t lda, double *x );
594 
595  ;
596 
597 
598 /* Ordering / Sort comparison function */
599 int aa_la_d_compar( const void *a, const void *b );
600 
608 (const double *sigma, const double *theta, double *cm);
609 
610 
611 # 1 "./include/amino/undef.h" 1
612 # 506 "./include/amino/la_impl.h" 2
613 # 49 "./include/amino/la.h" 2
614 
616 
618 # 1 "./include/amino/la_impl.h" 1
619 /* -*- mode: C; c-basic-offset: 4 -*- */
620 /* ex: set shiftwidth=4 tabstop=4 expandtab: */
621 /*
622  * Copyright (c) 2011-2012, Georgia Tech Research Corporation
623  * All rights reserved.
624  *
625  * Author(s): Neil T. Dantam <ntd@gatech.edu>
626  * Georgia Tech Humanoid Robotics Lab
627  * Under Direction of Prof. Mike Stilman <mstilman@cc.gatech.edu>
628  *
629  *
630  * This file is provided under the following "BSD-style" License:
631  *
632  *
633  * Redistribution and use in source and binary forms, with or
634  * without modification, are permitted provided that the following
635  * conditions are met:
636  *
637  * * Redistributions of source code must retain the above copyright
638  * notice, this list of conditions and the following disclaimer.
639  *
640  * * Redistributions in binary form must reproduce the above
641  * copyright notice, this list of conditions and the following
642  * disclaimer in the documentation and/or other materials provided
643  * with the distribution.
644  *
645  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
646  * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
647  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
648  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
649  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
650  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
651  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
652  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
653  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
654  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
655  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
656  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
657  * POSSIBILITY OF SUCH DAMAGE.
658  *
659  */
660 
661 
662 # 1 "./include/amino/def.h" 1
663 # 45 "./include/amino/la_impl.h" 2
664 
675 ( size_t m, size_t n,
676  const float *A, size_t lda,
677  float *B, size_t ldb );
678 
688 AA_API float aa_la_s_ssd ( size_t n, const float *x, size_t incx, const float *y, size_t incy );
689 
690 
691 
692 
703 AA_API void aa_la_s_lerp
704 ( size_t n, float u,
705  const float *v1, size_t inc1,
706  const float *v2, size_t inc2,
707  float *vu, size_t incu );
708 
709 
710 
713 ( size_t n, float tf,
714  const float *x1, size_t incx1,
715  const float *dx1, size_t incdx1,
716  const float *x2, size_t inc2,
717  const float *dx2, size_t incdx2,
718  float *a2, float *a3 );
719 
722 ( size_t n, float tf,
723  const float *x1, size_t incx1,
724  const float *dx1, size_t incdx1,
725  const float *a2, const float *a3,
726  float *x, size_t incx,
727  float *dx, size_t incdx,
728  float *ddx, size_t incddx );
729 
732 ( size_t n, float tf,
733  const float *x1, size_t incx1,
734  const float *dx1, size_t incdx1,
735  const float *ddx1, size_t incddx1,
736  const float *x2, size_t inc2,
737  const float *dx2, size_t incdx2,
738  const float *ddx2, size_t incddx2,
739  float *a3, float *a4, float *a5 );
740 
743 ( size_t n, float tf,
744  const float *x1, size_t incx1,
745  const float *dx1, size_t incdx1,
746  const float *ddx1, size_t incddx1,
747  const float *a3, const float *a4, const float *a5,
748  float *x, size_t incx,
749  float *dx, size_t incdx,
750  float *ddx, size_t incddx );
751 
758 AA_API float aa_la_s_vecstd ( size_t n, const float *x, size_t incx, float mu );
759 
760 
761  ;
762 
772 AA_API void aa_la_s_colmean ( size_t m, size_t n, const float *A, size_t lda, float *x );
773 
774 
775  ;
776 
786 AA_API void aa_la_s_rowmean ( size_t m, size_t n, const float *A, size_t lda, float *x );
787 
788 
789  ;
790 
791 /* AA_API void AA_NAME(la,_cmean) */
792 /* ( size_t m, size_t n, */
793 /* const AA_TYPE *A, size_t lda, */
794 /* AA_TYPE *x ); */
795 
807 AA_API void aa_la_s_colcov ( size_t m, size_t n, const float *A, size_t lda, const float *x, float *E, size_t lde );
808 
809 
810 
811  ;
812 
813 /* AA_API void AA_NAME(la,_ccov) */
814 /* ( size_t m, size_t n, */
815 /* const AA_TYPE *A, size_t lda, */
816 /* const AA_TYPE *x, */
817 /* AA_TYPE *E, size_t lde ); */
818 
819 
820 
821 /* Hungarian algorithm to solve min assignment problem
822  * \param n rows and cols of A
823  * \param A cost matrix, column major, destroyed on exit
824  * \param[out] row_assign array of column assigned to row at index i,
825  * length m. Unmatched elements have the value of -1.
826  * \param col_assign mapping from col to matched row
827  * \param lda leading dimension of A
828  * \param row_assign array of column assigned to row at index i
829  * \param iwork array of size 3*n*n +2*n
830  */
831 /* AA_API void AA_NAME(la,opt_hungarian) */
832 /* ( size_t n, AA_TYPE *A, size_t lda, */
833 /* ssize_t *row_assign, */
834 /* ssize_t *col_assign, */
835 /* ssize_t *iwork); */
836 
837 
838 /* Compute minimum iwork size for hungarian algorithm
839  *
840  * \sa aa_la_d_opt_hungarian
841  */
842 /* static inline size_t AA_NAME(la,opt_hungarian_iworksize) */
843 /* ( size_t n ) { */
844 /* return 3*n*n + 2*n; */
845 /* } */
846 
847 /* Hungarian algorithm for rectangular distance matrix by padding with zeros.
848  *
849  * \param m rows of A
850  * \param n cols of A
851  * \param A distance matrix for minimization problem
852  * \param lda leading dimension of A
853  * \param[out] row_assign array of column assigned to row at index i,
854  * length m. Unmatched elements have the value of -1.
855  * \param[out] col_assign mapping from col to matched row
856  * \param work work array of length max(m,n)**2
857  * \param iwork integer work array of length (3*max(m,n)**2 + 4*max(m,n))
858  */
859 /* AA_API void AA_NAME(la,opt_hungarian_pad) */
860 /* ( size_t m, size_t n, const AA_TYPE *A, size_t lda, */
861 /* ssize_t *row_assign, */
862 /* ssize_t *col_assign, */
863 /* AA_TYPE *work, ssize_t *iwork); */
864 
865 /* Compute minimum iwork size for padded hungarian algorithm
866  *
867  * \sa aa_la_d_opt_hungarian_pad
868  */
869 /* static inline size_t AA_NAME(la,opt_hungarian_pad_iworksize) */
870 /* (size_t m,size_t n) { */
871 /* size_t p = AA_MAX(m,n); */
872 /* return AA_NAME(la,opt_hungarian_iworksize)(p) + 2*p; */
873 /* } */
874 
875 
876 /* Compute minimum work size for padded hungarian algorithm
877  *
878  * \sa aa_la_d_opt_hungarian_pad
879  */
880 /* static inline size_t AA_NAME(la,opt_hungarian_pad_worksize) */
881 /* (size_t m,size_t n) { */
882 /* size_t p = AA_MAX(m,n); */
883 /* return p*p; */
884 /* } */
885 
886 
887 /* Converts max assignment to min assignment for Hungarian algorithm.
888  * \param m rows of A
889  * \param n cols of A
890  * \param A cost matrix for max problem,
891  * converted to matrix for min proble on exit
892  * \param lda leading dimension of A
893  */
894 /* AA_API void AA_NAME(la,opt_hungarian_max2min) */
895 /* ( size_t m, size_t n, AA_TYPE *A, size_t lda ); */
896 
897 
907 AA_API void aa_la_s_assign_hungarian ( size_t m, size_t n, const float *A, size_t lda, ssize_t *row_assign, ssize_t *col_assign );
908 
909 
910  ;
911 
920 AA_API void aa_la_s_assign_hungarian_max2min ( size_t m, size_t n, float *A, size_t lda );
921 
922  ;
923 
924 
926 static inline size_t aa_la_s_minloc
927 ( size_t n, float *x, size_t incx ) {
928  size_t imin = 0;
929  float xmin = *x;
930  for( size_t i = 1; i < n; i ++ ) {
931  if( x[i*incx] < xmin ) {
932  imin = i;
933  xmin = x[i*incx];
934  }
935  }
936  return imin;
937 }
938 
940 static inline float aa_la_s_mat_max
941 ( size_t m, size_t n, float *A, size_t lda,
942  size_t *pi, size_t *pj ) {
943  size_t im = 0;
944  size_t jm = 0;
945  float xm = *A;
946  for( size_t i = 0; i < m; i++) {
947  for( size_t j = 0; j < n; j++) {
948  if( AA_MATREF(A, lda, i, j ) > xm ) {
949  im = i;
950  jm = j;
951  xm = AA_MATREF(A, lda, i, j );
952  }
953  }
954  }
955  if( pi ) *pi = im;
956  if( pj ) *pj = jm;
957  return xm;
958 }
959 
960 
962 static inline size_t aa_la_s_maxloc
963 ( size_t n, float *x, size_t incx ) {
964  size_t imax = 0;
965  float xmax = *x;
966  for( size_t i = 1; i < n; i ++ ) {
967  if( x[i*incx] > xmax ) {
968  imax = i;
969  xmax = x[i*incx];
970  }
971  }
972  return imax;
973 }
974 
985 AA_API float aa_la_s_angle ( size_t n, const float *x, size_t incx, const float *y, size_t incy );
986 
987 
988 
989 
990 
1004 AA_API int aa_la_s_lls
1005 ( size_t m, size_t n, size_t p,
1006  const float *A, size_t lda,
1007  const float *b, size_t ldb,
1008  float *x, size_t ldx );
1009 
1010 
1027 AA_API int aa_la_s_svd
1028 ( size_t m, size_t n, const float *A, size_t lda,
1029  float *U, size_t ldu,
1030  float *S,
1031  float *Vt, size_t ldvt );
1032 
1033 
1040 AA_API float aa_la_s_median
1041 ( size_t n, const float *x, size_t incx );
1042 
1051 AA_API float aa_la_s_nmedian
1052 ( size_t n, float *x );
1053 
1054 
1057 static inline float aa_la_s_nmedian_pop
1058 ( size_t n, float *x )
1059 {
1060  float u = aa_la_s_nmedian(n, x);
1062  return u;
1063 }
1064 
1072 float aa_la_s_mad
1073 ( size_t n, const float u, const float *x, size_t incx );
1074 
1084 float aa_la_s_mad2
1085 ( size_t m, size_t n, const float *u, const float *A, size_t lda );
1086 
1088 AA_API int aa_la_s_eev
1089 ( size_t n, const float *A, size_t lda,
1090  float *wr,
1091  float *wi,
1092  float *Vl, size_t ldvl,
1093  float *Vr, size_t ldvr );
1094 
1107 AA_API void aa_la_s_colfit ( size_t m, size_t n, const float *A, size_t lda, float *x );
1108 
1109  ;
1110 
1111 
1112 /* Ordering / Sort comparison function */
1113 int aa_la_s_compar( const void *a, const void *b );
1114 
1122 (const double *sigma, const double *theta, double *cm);
1123 
1124 
1125 # 1 "./include/amino/undef.h" 1
1126 # 506 "./include/amino/la_impl.h" 2
1127 # 54 "./include/amino/la.h" 2
1128 # 7 "doc/la_doc.c" 2
AA_API void aa_la_s_colcov(size_t m, size_t n, const float *A, size_t lda, const float *x, float *E, size_t lde)
Covariance of columns of A.
AA_API int aa_la_d_svd(size_t m, size_t n, const double *A, size_t lda, double *U, size_t ldu, double *S, double *Vt, size_t ldvt)
Singular Value Decomposition of A.
static float aa_la_s_mat_max(size_t m, size_t n, float *A, size_t lda, size_t *pi, size_t *pj)
Minimum location of vector x.
Definition: la_doc.c:941
AA_API int aa_la_s_eev(size_t n, const float *A, size_t lda, float *wr, float *wi, float *Vl, size_t ldvl, float *Vr, size_t ldvr)
Compute eigen values and vectors.
AA_API float aa_la_s_vecstd(size_t n, const float *x, size_t incx, float mu)
Standard deviation of vector.
AA_API double aa_la_d_ssd(size_t n, const double *x, size_t incx, const double *y, size_t incy)
Sum-square differences of x and y.
AA_API float aa_la_s_median(size_t n, const float *x, size_t incx)
Cmpute median.
AA_API void aa_la_d_3spline(size_t n, double tf, const double *x1, size_t incx1, const double *dx1, size_t incdx1, const double *a2, const double *a3, double *x, size_t incx, double *dx, size_t incdx, double *ddx, size_t incddx)
Compute cubic spline value.
AA_API void aa_la_d_5spline(size_t n, double tf, const double *x1, size_t incx1, const double *dx1, size_t incdx1, const double *ddx1, size_t incddx1, const double *a3, const double *a4, const double *a5, double *x, size_t incx, double *dx, size_t incdx, double *ddx, size_t incddx)
Compute quintic spline value.
#define AA_MATREF(A, lda, row, col)
Reference an element in a column-major matrix.
Definition: math.h:340
AA_API int aa_la_s_lls(size_t m, size_t n, size_t p, const float *A, size_t lda, const float *b, size_t ldb, float *x, size_t ldx)
Linear Least Squares.
AA_API void aa_la_s_5spline_param(size_t n, float tf, const float *x1, size_t incx1, const float *dx1, size_t incdx1, const float *ddx1, size_t incddx1, const float *x2, size_t inc2, const float *dx2, size_t incdx2, const float *ddx2, size_t incddx2, float *a3, float *a4, float *a5)
Compute quintic spline parameters.
AA_API void aa_la_d_transpose(size_t m, size_t n, const double *A, size_t lda, double *B, size_t ldb)
type for operations
static size_t aa_la_d_maxloc(size_t n, double *x, size_t incx)
Maximum location of vector x.
Definition: la_doc.c:449
AA_API void aa_la_d_assign_hungarian(size_t m, size_t n, const double *A, size_t lda, ssize_t *row_assign, ssize_t *col_assign)
Hungarian algorithm to solve min assignment problem.
AA_API float aa_la_s_ssd(size_t n, const float *x, size_t incx, const float *y, size_t incy)
Sum-square differences of x and y.
AA_API void aa_la_s_3spline_param(size_t n, float tf, const float *x1, size_t incx1, const float *dx1, size_t incdx1, const float *x2, size_t inc2, const float *dx2, size_t incdx2, float *a2, float *a3)
Compute cubic spline parameters.
AA_API int aa_la_d_eev(size_t n, const double *A, size_t lda, double *wr, double *wi, double *Vl, size_t ldvl, double *Vr, size_t ldvr)
Compute eigen values and vectors.
AA_API void aa_la_d_colfit(size_t m, size_t n, const double *A, size_t lda, double *x)
Fit a least-squares hyperplane to columns of A.
AA_API float aa_la_s_nmedian(size_t n, float *x)
Destructive median computation.
double aa_la_d_mad(size_t n, const double u, const double *x, size_t incx)
Median Absolute Deviation.
float aa_la_s_mad(size_t n, const float u, const float *x, size_t incx)
Median Absolute Deviation.
AA_API void aa_mem_region_local_pop(void *ptr)
Pop ptr from thread-local memory region.
AA_API void aa_la_s_colmean(size_t m, size_t n, const float *A, size_t lda, float *x)
Mean of columns of A.
static size_t aa_la_s_maxloc(size_t n, float *x, size_t incx)
Maximum location of vector x.
Definition: la_doc.c:963
AA_API void aa_la_s_assign_hungarian(size_t m, size_t n, const float *A, size_t lda, ssize_t *row_assign, ssize_t *col_assign)
Hungarian algorithm to solve min assignment problem.
AA_API int aa_la_s_svd(size_t m, size_t n, const float *A, size_t lda, float *U, size_t ldu, float *S, float *Vt, size_t ldvt)
Singular Value Decomposition of A.
AA_API void aa_la_d_lerp(size_t n, double u, const double *v1, size_t inc1, const double *v2, size_t inc2, double *vu, size_t incu)
Linear interpolation of vectors.
AA_API float aa_la_s_angle(size_t n, const float *x, size_t incx, const float *y, size_t incy)
Angle between vectors.
AA_API void aa_la_s_rowmean(size_t m, size_t n, const float *A, size_t lda, float *x)
Mean of rows of A.
int aa_la_d_ls_duqu_cmat(const double *sigma, const double *theta, double *cm)
Create a companion matrix for the lambda polynomial in se3 least-squares.
AA_API void aa_la_d_3spline_param(size_t n, double tf, const double *x1, size_t incx1, const double *dx1, size_t incdx1, const double *x2, size_t inc2, const double *dx2, size_t incdx2, double *a2, double *a3)
Compute cubic spline parameters.
AA_API void aa_la_s_assign_hungarian_max2min(size_t m, size_t n, float *A, size_t lda)
Converts max assignment to min assignment for Hungarian algorithm.
AA_API void aa_la_d_colcov(size_t m, size_t n, const double *A, size_t lda, const double *x, double *E, size_t lde)
Covariance of columns of A.
AA_API double aa_la_d_angle(size_t n, const double *x, size_t incx, const double *y, size_t incy)
Angle between vectors.
AA_API int aa_la_d_lls(size_t m, size_t n, size_t p, const double *A, size_t lda, const double *b, size_t ldb, double *x, size_t ldx)
Linear Least Squares.
AA_API void aa_la_d_assign_hungarian_max2min(size_t m, size_t n, double *A, size_t lda)
Converts max assignment to min assignment for Hungarian algorithm.
#define AA_API
calling and name mangling convention for functions
Definition: amino.h:86
static double aa_la_d_mat_max(size_t m, size_t n, double *A, size_t lda, size_t *pi, size_t *pj)
Minimum location of vector x.
Definition: la_doc.c:427
static float aa_la_s_nmedian_pop(size_t n, float *x)
Compute median and pop array from local memory region.
Definition: la_doc.c:1058
static double aa_la_d_nmedian_pop(size_t n, double *x)
Compute median and pop array from local memory region.
Definition: la_doc.c:544
AA_API void aa_la_d_5spline_param(size_t n, double tf, const double *x1, size_t incx1, const double *dx1, size_t incdx1, const double *ddx1, size_t incddx1, const double *x2, size_t inc2, const double *dx2, size_t incdx2, const double *ddx2, size_t incddx2, double *a3, double *a4, double *a5)
Compute quintic spline parameters.
AA_API void aa_la_s_lerp(size_t n, float u, const float *v1, size_t inc1, const float *v2, size_t inc2, float *vu, size_t incu)
Linear interpolation of vectors.
AA_API double aa_la_d_vecstd(size_t n, const double *x, size_t incx, double mu)
Standard deviation of vector.
AA_API void aa_la_s_5spline(size_t n, float tf, const float *x1, size_t incx1, const float *dx1, size_t incdx1, const float *ddx1, size_t incddx1, const float *a3, const float *a4, const float *a5, float *x, size_t incx, float *dx, size_t incdx, float *ddx, size_t incddx)
Compute quintic spline value.
AA_API double aa_la_d_nmedian(size_t n, double *x)
Destructive median computation.
static size_t aa_la_d_minloc(size_t n, double *x, size_t incx)
Minimum location of vector x.
Definition: la_doc.c:413
static size_t aa_la_s_minloc(size_t n, float *x, size_t incx)
Minimum location of vector x.
Definition: la_doc.c:927
AA_API void aa_la_d_rowmean(size_t m, size_t n, const double *A, size_t lda, double *x)
Mean of rows of A.
AA_API double aa_la_d_median(size_t n, const double *x, size_t incx)
Cmpute median.
AA_API void aa_la_s_transpose(size_t m, size_t n, const float *A, size_t lda, float *B, size_t ldb)
type for operations
AA_API void aa_la_s_colfit(size_t m, size_t n, const float *A, size_t lda, float *x)
Fit a least-squares hyperplane to columns of A.
int aa_la_s_ls_duqu_cmat(const double *sigma, const double *theta, double *cm)
Create a companion matrix for the lambda polynomial in se3 least-squares.
AA_API void aa_la_s_3spline(size_t n, float tf, const float *x1, size_t incx1, const float *dx1, size_t incdx1, const float *a2, const float *a3, float *x, size_t incx, float *dx, size_t incdx, float *ddx, size_t incddx)
Compute cubic spline value.
AA_API void aa_la_d_colmean(size_t m, size_t n, const double *A, size_t lda, double *x)
Mean of columns of A.
float aa_la_s_mad2(size_t m, size_t n, const float *u, const float *A, size_t lda)
Median Absolute Deviation with Euclidean distance.
double aa_la_d_mad2(size_t m, size_t n, const double *u, const double *A, size_t lda)
Median Absolute Deviation with Euclidean distance.