od_covmat.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*Daala video codec
  2. Copyright (c) 2013 Daala project contributors. All rights reserved.
  3. Redistribution and use in source and binary forms, with or without
  4. modification, are permitted provided that the following conditions are met:
  5. - Redistributions of source code must retain the above copyright notice, this
  6. list of conditions and the following disclaimer.
  7. - Redistributions in binary form must reproduce the above copyright notice,
  8. this list of conditions and the following disclaimer in the documentation
  9. and/or other materials provided with the distribution.
  10. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS”
  11. AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  12. IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  13. DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
  14. FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  15. DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  16. SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  17. CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  18. OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  19. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.*/
  20. #if !defined(_od_covmat_H)
  21. # define _od_covmat_H (0)
  22. #include <stdio.h>
  23. typedef struct od_covmat od_covmat;
  24. struct od_covmat{
  25. int sz;
  26. double w;
  27. double *mean;
  28. double *cov;
  29. double *work;
  30. };
  31. void od_covmat_init(od_covmat *_this,int _sz);
  32. void od_covmat_clear(od_covmat *_this);
  33. void od_covmat_reset(od_covmat *_this);
  34. void od_covmat_add(od_covmat *_this,const double *_data,double _w);
  35. void od_covmat_combine(od_covmat *_a,const od_covmat *_b);
  36. void od_covmat_update(od_covmat *_this,const double *_cov,const double *_mean,
  37. double _w);
  38. void od_covmat_correct(od_covmat *_this);
  39. void od_covmat_normalize(od_covmat *_this);
  40. void od_covmat_collapse(od_covmat *_this,int _n,double *_r);
  41. void od_covmat_expand(od_covmat *_this,int _n,const double *_r);
  42. void od_covmat_print(od_covmat *_this,FILE *_fp);
  43. #endif