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.

78 lines
1.3 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
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. printf("arr0 �ڲ�����CArrayBuffer\n");
  7. CFloat32Array arr0(8);
  8. for (int i = 0; i < arr0.length(); i++) {
  9. arr0[i] = i * 100.0;
  10. }
  11. for (int i = 0; i < arr0.length(); i++) {
  12. printf("%f\n", arr0[i]);
  13. }
  14. printf("arr1 ���� arr0 �� CArrayBuffer �IJ�������\n");
  15. CFloat32Array arr1(arr0.buffer, 4 * sizeof(float32), 4);
  16. for (int i = 0; i < arr1.length(); i++) {
  17. printf("%f\n", arr1[i]);
  18. }
  19. printf("����arr1�ĸ���Ԫ��Ϊ10.0�ı���\n");
  20. for (int i = 0; i < arr1.length(); i++) {
  21. arr1[i] = i * 10.0;
  22. }
  23. for (int i = 0; i < arr1.length(); i++) {
  24. printf("%f\n", arr1[i]);
  25. }
  26. /*GVector l(3);
  27. l += 2;
  28. cout << l*3 << endl;
  29. float a[] = {
  30. 2, -1, 3,
  31. 4, -2, 5,
  32. 6, -3, 8
  33. };
  34. GMatrix A(3, 3, a);
  35. float b[] = {
  36. 2, -1, 9,
  37. 2, -2, 5,
  38. 3, 1, 2
  39. };
  40. GMatrix B(3, 3, b);
  41. GMatrix C = A*B;
  42. cout << A << endl;
  43. cout << B << endl;
  44. cout << C << endl;
  45. GVector ret(3);
  46. GVector rv = B.GetColVec(1);
  47. for (int i = 0; i < A.GetColNum(); i++) {
  48. GVector l = A.GetColVec(i);
  49. ret += rv[i]*l;
  50. }
  51. cout << ret << endl;
  52. */
  53. /*float a[] = {
  54. 1,0,
  55. 1,4
  56. };
  57. GMatrix A(2, 2, a);
  58. float c[] = {
  59. 0,1,
  60. 1,0
  61. };
  62. GMatrix C(2, 2, c);
  63. cout << A*A << endl;*/
  64. return 0;
  65. }