algebra.h 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /***************************************************************************
  2. * Copyright (C) 2005 by TAKEUCHI Eijiro,,, *
  3. * etake@bird5 *
  4. * *
  5. * This program is free software; you can redistribute it and/or modify *
  6. * it under the terms of the GNU General Public License as published by *
  7. * the Free Software Foundation; either version 2 of the License, or *
  8. * (at your option) any later version. *
  9. * *
  10. * This program is distributed in the hope that it will be useful, *
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of *
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
  13. * GNU General Public License for more details. *
  14. * *
  15. * You should have received a copy of the GNU General Public License *
  16. * along with this program; if not, write to the *
  17. * Free Software Foundation, Inc., *
  18. * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
  19. ***************************************************************************/
  20. #ifndef __ALGEBRA__
  21. #define __ALGEBRA__
  22. #define E_ERROR 0.001
  23. int mux_matrix2d(double s1[2][2], double s2[2][2],double dst[2][2]);
  24. int mux_matrix3d(double s1[3][3], double s2[3][3],double dst[3][3]);
  25. int mux_matrix(double *s1,double *s2,double *dst,int in, int kn, int
  26. jn);
  27. int add_matrix2d(double s1[2][2], double s2[2][2],double dst[2][2]);
  28. int add_matrix3d(double s1[3][3], double s2[3][3],double dst[3][3]);
  29. int add_matrix6d(double s1[6][6], double s2[6][6],double dst[6][6]);
  30. int sub_matrix2d(double s1[2][2], double s2[2][2],double dst[2][2]);
  31. int sub_matrix3d(double s1[3][3], double s2[3][3],double dst[3][3]);
  32. int identity_matrix2d(double dst[2][2]);
  33. int identity_matrix3d(double dst[3][3]);
  34. int identity_matrix6d(double dst[6][6]);
  35. int zero_matrix2d(double dst[2][2]);
  36. int zero_matrix3d(double dst[3][3]);
  37. int zero_matrix6d(double dst[6][6]);
  38. int transpose_matrix2d(double s1[2][2],double dst[2][2]);
  39. int transpose_matrix3d(double s1[3][3],double dst[3][3]);
  40. double determinant_matrix2d(double mat[2][2]);
  41. double determinant_matrix3d(double mat[3][3]);
  42. int inverse_matrix2d(double mat[2][2],double dst[2][2]);
  43. int inverse_matrix3d(double mat[3][3], double dst[3][3]);
  44. int eigenvalue_matrix2d(double mat[2][2],double *l1, double *l2);
  45. int eigenvalue_matrix3d(double mat[3][3],double l1[2], double l2[2],double l3[2]);
  46. int eigenvecter_matrix2d(double mat[2][2],double *v1,double *v2,double *l1,double *l2);
  47. int eigenvecter_matrix3d(double mat[3][3],double v[3][3],double *l);
  48. int matrix2d_eigen(double *v1,double *v2,double l1,double l2,double dst[2][2]);
  49. int matrix3d_eigen(double v[3][3],double l1,double l2,double l3,double dst[3][3]);
  50. int round_matrix3d(double mat[3][3],double dst[3][3] );
  51. int ginverse_matrix3d(double mat[3][3], double dst[3][3]);
  52. int ginverse_matrix6d(double mat[6][6], double dst[6][6]);
  53. #endif