amino
Lightweight Robot Utility Library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
/home/ntd/git/amino/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 
106 
109 # 1 "./include/amino/la_impl.h" 1
110 /* -*- mode: C; c-basic-offset: 4 -*- */
111 /* ex: set shiftwidth=4 tabstop=4 expandtab: */
112 /*
113  * Copyright (c) 2011-2012, Georgia Tech Research Corporation
114  * All rights reserved.
115  *
116  * Author(s): Neil T. Dantam <ntd@gatech.edu>
117  * Georgia Tech Humanoid Robotics Lab
118  * Under Direction of Prof. Mike Stilman <mstilman@cc.gatech.edu>
119  *
120  *
121  * This file is provided under the following "BSD-style" License:
122  *
123  *
124  * Redistribution and use in source and binary forms, with or
125  * without modification, are permitted provided that the following
126  * conditions are met:
127  *
128  * * Redistributions of source code must retain the above copyright
129  * notice, this list of conditions and the following disclaimer.
130  *
131  * * Redistributions in binary form must reproduce the above
132  * copyright notice, this list of conditions and the following
133  * disclaimer in the documentation and/or other materials provided
134  * with the distribution.
135  *
136  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
137  * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
138  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
139  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
140  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
141  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
142  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
143  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
144  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
145  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
146  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
147  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
148  * POSSIBILITY OF SUCH DAMAGE.
149  *
150  */
151 
152 
153 # 1 "./include/amino/def.h" 1
154 # 42 "./include/amino/def.h"
155 # 1 "./include/amino/mangle.h" 1
156 # 43 "./include/amino/def.h" 2
157 # 45 "./include/amino/la_impl.h" 2
158 
169 ( size_t m, size_t n,
170  const double *A, size_t lda,
171  double *B, size_t ldb );
172 
182 AA_API double aa_la_d_ssd ( size_t n, const double *x, size_t incx, const double *y, size_t incy );
183 
184 
185 
186 
197 AA_API void aa_la_d_lerp
198 ( size_t n, double u,
199  const double *v1, size_t inc1,
200  const double *v2, size_t inc2,
201  double *vu, size_t incu );
202 
203 
204 
207 ( size_t n, double tf,
208  const double *x1, size_t incx1,
209  const double *dx1, size_t incdx1,
210  const double *x2, size_t inc2,
211  const double *dx2, size_t incdx2,
212  double *a2, double *a3 );
213 
216 ( size_t n, double tf,
217  const double *x1, size_t incx1,
218  const double *dx1, size_t incdx1,
219  const double *a2, const double *a3,
220  double *x, size_t incx,
221  double *dx, size_t incdx,
222  double *ddx, size_t incddx );
223 
226 ( size_t n, double tf,
227  const double *x1, size_t incx1,
228  const double *dx1, size_t incdx1,
229  const double *ddx1, size_t incddx1,
230  const double *x2, size_t inc2,
231  const double *dx2, size_t incdx2,
232  const double *ddx2, size_t incddx2,
233  double *a3, double *a4, double *a5 );
234 
237 ( size_t n, double tf,
238  const double *x1, size_t incx1,
239  const double *dx1, size_t incdx1,
240  const double *ddx1, size_t incddx1,
241  const double *a3, const double *a4, const double *a5,
242  double *x, size_t incx,
243  double *dx, size_t incdx,
244  double *ddx, size_t incddx );
245 
252 AA_API double aa_la_d_vecstd ( size_t n, const double *x, size_t incx, double mu );
253 
254 
255  ;
256 
266 AA_API void aa_la_d_colmean ( size_t m, size_t n, const double *A, size_t lda, double *x );
267 
268 
269  ;
270 
280 AA_API void aa_la_d_rowmean ( size_t m, size_t n, const double *A, size_t lda, double *x );
281 
282 
283  ;
284 
285 /* AA_API void AA_NAME(la,_cmean) */
286 /* ( size_t m, size_t n, */
287 /* const AA_TYPE *A, size_t lda, */
288 /* AA_TYPE *x ); */
289 
301 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 );
302 
303 
304 
305  ;
306 
307 /* AA_API void AA_NAME(la,_ccov) */
308 /* ( size_t m, size_t n, */
309 /* const AA_TYPE *A, size_t lda, */
310 /* const AA_TYPE *x, */
311 /* AA_TYPE *E, size_t lde ); */
312 
313 
314 
315 /* Hungarian algorithm to solve min assignment problem
316  * \param n rows and cols of A
317  * \param A cost matrix, column major, destroyed on exit
318  * \param[out] row_assign array of column assigned to row at index i,
319  * length m. Unmatched elements have the value of -1.
320  * \param col_assign mapping from col to matched row
321  * \param lda leading dimension of A
322  * \param row_assign array of column assigned to row at index i
323  * \param iwork array of size 3*n*n +2*n
324  */
325 /* AA_API void AA_NAME(la,opt_hungarian) */
326 /* ( size_t n, AA_TYPE *A, size_t lda, */
327 /* ssize_t *row_assign, */
328 /* ssize_t *col_assign, */
329 /* ssize_t *iwork); */
330 
331 
332 /* Compute minimum iwork size for hungarian algorithm
333  *
334  * \sa aa_la_d_opt_hungarian
335  */
336 /* static inline size_t AA_NAME(la,opt_hungarian_iworksize) */
337 /* ( size_t n ) { */
338 /* return 3*n*n + 2*n; */
339 /* } */
340 
341 /* Hungarian algorithm for rectangular distance matrix by padding with zeros.
342  *
343  * \param m rows of A
344  * \param n cols of A
345  * \param A distance matrix for minimization problem
346  * \param lda leading dimension of A
347  * \param[out] row_assign array of column assigned to row at index i,
348  * length m. Unmatched elements have the value of -1.
349  * \param[out] col_assign mapping from col to matched row
350  * \param work work array of length max(m,n)**2
351  * \param iwork integer work array of length (3*max(m,n)**2 + 4*max(m,n))
352  */
353 /* AA_API void AA_NAME(la,opt_hungarian_pad) */
354 /* ( size_t m, size_t n, const AA_TYPE *A, size_t lda, */
355 /* ssize_t *row_assign, */
356 /* ssize_t *col_assign, */
357 /* AA_TYPE *work, ssize_t *iwork); */
358 
359 /* Compute minimum iwork size for padded hungarian algorithm
360  *
361  * \sa aa_la_d_opt_hungarian_pad
362  */
363 /* static inline size_t AA_NAME(la,opt_hungarian_pad_iworksize) */
364 /* (size_t m,size_t n) { */
365 /* size_t p = AA_MAX(m,n); */
366 /* return AA_NAME(la,opt_hungarian_iworksize)(p) + 2*p; */
367 /* } */
368 
369 
370 /* Compute minimum work size for padded hungarian algorithm
371  *
372  * \sa aa_la_d_opt_hungarian_pad
373  */
374 /* static inline size_t AA_NAME(la,opt_hungarian_pad_worksize) */
375 /* (size_t m,size_t n) { */
376 /* size_t p = AA_MAX(m,n); */
377 /* return p*p; */
378 /* } */
379 
380 
381 /* Converts max assignment to min assignment for Hungarian algorithm.
382  * \param m rows of A
383  * \param n cols of A
384  * \param A cost matrix for max problem,
385  * converted to matrix for min proble on exit
386  * \param lda leading dimension of A
387  */
388 /* AA_API void AA_NAME(la,opt_hungarian_max2min) */
389 /* ( size_t m, size_t n, AA_TYPE *A, size_t lda ); */
390 
391 
401 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 );
402 
403 
404  ;
405 
414 AA_API void aa_la_d_assign_hungarian_max2min ( size_t m, size_t n, double *A, size_t lda );
415 
416  ;
417 
418 
420 static inline size_t aa_la_d_minloc
421 ( size_t n, double *x, size_t incx ) {
422  size_t imin = 0;
423  double xmin = *x;
424  for( size_t i = 1; i < n; i ++ ) {
425  if( x[i*incx] < xmin ) {
426  imin = i;
427  xmin = x[i*incx];
428  }
429  }
430  return imin;
431 }
432 
434 static inline double aa_la_d_mat_max
435 ( size_t m, size_t n, double *A, size_t lda,
436  size_t *pi, size_t *pj ) {
437  size_t im = 0;
438  size_t jm = 0;
439  double xm = *A;
440  for( size_t i = 0; i < m; i++) {
441  for( size_t j = 0; j < n; j++) {
442  if( AA_MATREF(A, lda, i, j ) > xm ) {
443  im = i;
444  jm = j;
445  xm = AA_MATREF(A, lda, i, j );
446  }
447  }
448  }
449  if( pi ) *pi = im;
450  if( pj ) *pj = jm;
451  return xm;
452 }
453 
454 
456 static inline size_t aa_la_d_maxloc
457 ( size_t n, double *x, size_t incx ) {
458  size_t imax = 0;
459  double xmax = *x;
460  for( size_t i = 1; i < n; i ++ ) {
461  if( x[i*incx] > xmax ) {
462  imax = i;
463  xmax = x[i*incx];
464  }
465  }
466  return imax;
467 }
468 
479 AA_API double aa_la_d_angle ( size_t n, const double *x, size_t incx, const double *y, size_t incy );
480 
481 
482 
483 
484 
499 ( size_t m, size_t n, size_t p,
500  const double *A, size_t lda,
501  const double *b, size_t ldb,
502  double *x, size_t ldx );
503 
504 
522 ( size_t m, size_t n, const double *A, size_t lda,
523  double *U, size_t ldu,
524  double *S,
525  double *Vt, size_t ldvt );
526 
527 
534 AA_API double aa_la_d_median
535 ( size_t n, const double *x, size_t incx );
536 
545 AA_API double aa_la_d_nmedian
546 ( size_t n, double *x );
547 
548 
551 static inline double aa_la_d_nmedian_pop
552 ( size_t n, double *x )
553 {
554  double u = aa_la_d_nmedian(n, x);
556  return u;
557 }
558 
566 double aa_la_d_mad
567 ( size_t n, const double u, const double *x, size_t incx );
568 
578 double aa_la_d_mad2
579 ( size_t m, size_t n, const double *u, const double *A, size_t lda );
580 
583 ( size_t n, const double *A, size_t lda,
584  double *wr,
585  double *wi,
586  double *Vl, size_t ldvl,
587  double *Vr, size_t ldvr );
588 
601 AA_API void aa_la_d_colfit ( size_t m, size_t n, const double *A, size_t lda, double *x );
602 
603  ;
604 
605 
606 /* Ordering / Sort comparison function */
607 int aa_la_d_compar( const void *a, const void *b );
608 
616 (const double *sigma, const double *theta, double *cm);
617 
618 
619 # 1 "./include/amino/undef.h" 1
620 # 506 "./include/amino/la_impl.h" 2
621 # 57 "./include/amino/la.h" 2
622 
624 
626 # 1 "./include/amino/la_impl.h" 1
627 /* -*- mode: C; c-basic-offset: 4 -*- */
628 /* ex: set shiftwidth=4 tabstop=4 expandtab: */
629 /*
630  * Copyright (c) 2011-2012, Georgia Tech Research Corporation
631  * All rights reserved.
632  *
633  * Author(s): Neil T. Dantam <ntd@gatech.edu>
634  * Georgia Tech Humanoid Robotics Lab
635  * Under Direction of Prof. Mike Stilman <mstilman@cc.gatech.edu>
636  *
637  *
638  * This file is provided under the following "BSD-style" License:
639  *
640  *
641  * Redistribution and use in source and binary forms, with or
642  * without modification, are permitted provided that the following
643  * conditions are met:
644  *
645  * * Redistributions of source code must retain the above copyright
646  * notice, this list of conditions and the following disclaimer.
647  *
648  * * Redistributions in binary form must reproduce the above
649  * copyright notice, this list of conditions and the following
650  * disclaimer in the documentation and/or other materials provided
651  * with the distribution.
652  *
653  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
654  * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
655  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
656  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
657  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
658  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
659  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
660  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
661  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
662  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
663  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
664  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
665  * POSSIBILITY OF SUCH DAMAGE.
666  *
667  */
668 
669 
670 # 1 "./include/amino/def.h" 1
671 # 45 "./include/amino/la_impl.h" 2
672 
683 ( size_t m, size_t n,
684  const float *A, size_t lda,
685  float *B, size_t ldb );
686 
696 AA_API float aa_la_s_ssd ( size_t n, const float *x, size_t incx, const float *y, size_t incy );
697 
698 
699 
700 
711 AA_API void aa_la_s_lerp
712 ( size_t n, float u,
713  const float *v1, size_t inc1,
714  const float *v2, size_t inc2,
715  float *vu, size_t incu );
716 
717 
718 
721 ( size_t n, float tf,
722  const float *x1, size_t incx1,
723  const float *dx1, size_t incdx1,
724  const float *x2, size_t inc2,
725  const float *dx2, size_t incdx2,
726  float *a2, float *a3 );
727 
730 ( size_t n, float tf,
731  const float *x1, size_t incx1,
732  const float *dx1, size_t incdx1,
733  const float *a2, const float *a3,
734  float *x, size_t incx,
735  float *dx, size_t incdx,
736  float *ddx, size_t incddx );
737 
740 ( size_t n, float tf,
741  const float *x1, size_t incx1,
742  const float *dx1, size_t incdx1,
743  const float *ddx1, size_t incddx1,
744  const float *x2, size_t inc2,
745  const float *dx2, size_t incdx2,
746  const float *ddx2, size_t incddx2,
747  float *a3, float *a4, float *a5 );
748 
751 ( size_t n, float tf,
752  const float *x1, size_t incx1,
753  const float *dx1, size_t incdx1,
754  const float *ddx1, size_t incddx1,
755  const float *a3, const float *a4, const float *a5,
756  float *x, size_t incx,
757  float *dx, size_t incdx,
758  float *ddx, size_t incddx );
759 
766 AA_API float aa_la_s_vecstd ( size_t n, const float *x, size_t incx, float mu );
767 
768 
769  ;
770 
780 AA_API void aa_la_s_colmean ( size_t m, size_t n, const float *A, size_t lda, float *x );
781 
782 
783  ;
784 
794 AA_API void aa_la_s_rowmean ( size_t m, size_t n, const float *A, size_t lda, float *x );
795 
796 
797  ;
798 
799 /* AA_API void AA_NAME(la,_cmean) */
800 /* ( size_t m, size_t n, */
801 /* const AA_TYPE *A, size_t lda, */
802 /* AA_TYPE *x ); */
803 
815 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 );
816 
817 
818 
819  ;
820 
821 /* AA_API void AA_NAME(la,_ccov) */
822 /* ( size_t m, size_t n, */
823 /* const AA_TYPE *A, size_t lda, */
824 /* const AA_TYPE *x, */
825 /* AA_TYPE *E, size_t lde ); */
826 
827 
828 
829 /* Hungarian algorithm to solve min assignment problem
830  * \param n rows and cols of A
831  * \param A cost matrix, column major, destroyed on exit
832  * \param[out] row_assign array of column assigned to row at index i,
833  * length m. Unmatched elements have the value of -1.
834  * \param col_assign mapping from col to matched row
835  * \param lda leading dimension of A
836  * \param row_assign array of column assigned to row at index i
837  * \param iwork array of size 3*n*n +2*n
838  */
839 /* AA_API void AA_NAME(la,opt_hungarian) */
840 /* ( size_t n, AA_TYPE *A, size_t lda, */
841 /* ssize_t *row_assign, */
842 /* ssize_t *col_assign, */
843 /* ssize_t *iwork); */
844 
845 
846 /* Compute minimum iwork size for hungarian algorithm
847  *
848  * \sa aa_la_d_opt_hungarian
849  */
850 /* static inline size_t AA_NAME(la,opt_hungarian_iworksize) */
851 /* ( size_t n ) { */
852 /* return 3*n*n + 2*n; */
853 /* } */
854 
855 /* Hungarian algorithm for rectangular distance matrix by padding with zeros.
856  *
857  * \param m rows of A
858  * \param n cols of A
859  * \param A distance matrix for minimization problem
860  * \param lda leading dimension of A
861  * \param[out] row_assign array of column assigned to row at index i,
862  * length m. Unmatched elements have the value of -1.
863  * \param[out] col_assign mapping from col to matched row
864  * \param work work array of length max(m,n)**2
865  * \param iwork integer work array of length (3*max(m,n)**2 + 4*max(m,n))
866  */
867 /* AA_API void AA_NAME(la,opt_hungarian_pad) */
868 /* ( size_t m, size_t n, const AA_TYPE *A, size_t lda, */
869 /* ssize_t *row_assign, */
870 /* ssize_t *col_assign, */
871 /* AA_TYPE *work, ssize_t *iwork); */
872 
873 /* Compute minimum iwork size for padded hungarian algorithm
874  *
875  * \sa aa_la_d_opt_hungarian_pad
876  */
877 /* static inline size_t AA_NAME(la,opt_hungarian_pad_iworksize) */
878 /* (size_t m,size_t n) { */
879 /* size_t p = AA_MAX(m,n); */
880 /* return AA_NAME(la,opt_hungarian_iworksize)(p) + 2*p; */
881 /* } */
882 
883 
884 /* Compute minimum work size for padded hungarian algorithm
885  *
886  * \sa aa_la_d_opt_hungarian_pad
887  */
888 /* static inline size_t AA_NAME(la,opt_hungarian_pad_worksize) */
889 /* (size_t m,size_t n) { */
890 /* size_t p = AA_MAX(m,n); */
891 /* return p*p; */
892 /* } */
893 
894 
895 /* Converts max assignment to min assignment for Hungarian algorithm.
896  * \param m rows of A
897  * \param n cols of A
898  * \param A cost matrix for max problem,
899  * converted to matrix for min proble on exit
900  * \param lda leading dimension of A
901  */
902 /* AA_API void AA_NAME(la,opt_hungarian_max2min) */
903 /* ( size_t m, size_t n, AA_TYPE *A, size_t lda ); */
904 
905 
915 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 );
916 
917 
918  ;
919 
928 AA_API void aa_la_s_assign_hungarian_max2min ( size_t m, size_t n, float *A, size_t lda );
929 
930  ;
931 
932 
934 static inline size_t aa_la_s_minloc
935 ( size_t n, float *x, size_t incx ) {
936  size_t imin = 0;
937  float xmin = *x;
938  for( size_t i = 1; i < n; i ++ ) {
939  if( x[i*incx] < xmin ) {
940  imin = i;
941  xmin = x[i*incx];
942  }
943  }
944  return imin;
945 }
946 
948 static inline float aa_la_s_mat_max
949 ( size_t m, size_t n, float *A, size_t lda,
950  size_t *pi, size_t *pj ) {
951  size_t im = 0;
952  size_t jm = 0;
953  float xm = *A;
954  for( size_t i = 0; i < m; i++) {
955  for( size_t j = 0; j < n; j++) {
956  if( AA_MATREF(A, lda, i, j ) > xm ) {
957  im = i;
958  jm = j;
959  xm = AA_MATREF(A, lda, i, j );
960  }
961  }
962  }
963  if( pi ) *pi = im;
964  if( pj ) *pj = jm;
965  return xm;
966 }
967 
968 
970 static inline size_t aa_la_s_maxloc
971 ( size_t n, float *x, size_t incx ) {
972  size_t imax = 0;
973  float xmax = *x;
974  for( size_t i = 1; i < n; i ++ ) {
975  if( x[i*incx] > xmax ) {
976  imax = i;
977  xmax = x[i*incx];
978  }
979  }
980  return imax;
981 }
982 
993 AA_API float aa_la_s_angle ( size_t n, const float *x, size_t incx, const float *y, size_t incy );
994 
995 
996 
997 
998 
1012 AA_API int aa_la_s_lls
1013 ( size_t m, size_t n, size_t p,
1014  const float *A, size_t lda,
1015  const float *b, size_t ldb,
1016  float *x, size_t ldx );
1017 
1018 
1035 AA_API int aa_la_s_svd
1036 ( size_t m, size_t n, const float *A, size_t lda,
1037  float *U, size_t ldu,
1038  float *S,
1039  float *Vt, size_t ldvt );
1040 
1041 
1048 AA_API float aa_la_s_median
1049 ( size_t n, const float *x, size_t incx );
1050 
1059 AA_API float aa_la_s_nmedian
1060 ( size_t n, float *x );
1061 
1062 
1065 static inline float aa_la_s_nmedian_pop
1066 ( size_t n, float *x )
1067 {
1068  float u = aa_la_s_nmedian(n, x);
1070  return u;
1071 }
1072 
1080 float aa_la_s_mad
1081 ( size_t n, const float u, const float *x, size_t incx );
1082 
1092 float aa_la_s_mad2
1093 ( size_t m, size_t n, const float *u, const float *A, size_t lda );
1094 
1096 AA_API int aa_la_s_eev
1097 ( size_t n, const float *A, size_t lda,
1098  float *wr,
1099  float *wi,
1100  float *Vl, size_t ldvl,
1101  float *Vr, size_t ldvr );
1102 
1115 AA_API void aa_la_s_colfit ( size_t m, size_t n, const float *A, size_t lda, float *x );
1116 
1117  ;
1118 
1119 
1120 /* Ordering / Sort comparison function */
1121 int aa_la_s_compar( const void *a, const void *b );
1122 
1130 (const double *sigma, const double *theta, double *cm);
1131 
1132 
1133 # 1 "./include/amino/undef.h" 1
1134 # 506 "./include/amino/la_impl.h" 2
1135 # 62 "./include/amino/la.h" 2
1136 # 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:949
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:347
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:457
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:971
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:96
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:435
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:1066
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:552
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:421
static size_t aa_la_s_minloc(size_t n, float *x, size_t incx)
Minimum location of vector x.
Definition: la_doc.c:935
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.