You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
876 B

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. #include "GMath.h"
  2. #include "CArrayBuffer.h"
  3. #include "CDataView.h"
  4. #include "CFloat32Array.h"
  5. int main() {
  6. /*
  7. matrix P = p1, p2, p3, ......, pn
  8. matrix A;
  9. A * P = (A*p1, A*p2, A*p3, ......, A*pn)
  10. */
  11. float a[] = {
  12. 3, -1, 0,
  13. 4, -1, 0,
  14. -1, 0, 0
  15. };
  16. GMatrix A(3, 3, a);
  17. float p[] = {
  18. 1, 2, 3,
  19. 1, 2, 3,
  20. 1, 2, 3
  21. };
  22. GMatrix P(3, 3, p);
  23. //ģ��P�����ĵڶ���
  24. float x[] = {
  25. 2,
  26. 2,
  27. 2
  28. };
  29. GMatrix X(3, 1, x);
  30. cout << A * P << endl;
  31. cout << A * X << endl;
  32. /*
  33. matrix P = p1, p2, p3, ......, pn
  34. vector v = v1, v2, v3, ......, vn
  35. P * V = (p1 * v1) + (p2 * v2) + (p3 * v3) + ...... + (pn * vn)
  36. */
  37. GVector c1 = A.GetColVec(0);
  38. GVector c2 = A.GetColVec(1);
  39. GVector c3 = A.GetColVec(2);
  40. GVector ret = c1 * X[0][0] + c2 * X[1][0] + c3 * X[2][0];
  41. cout << ret << endl;
  42. return 0;
  43. }