Counter Strike : Global Offensive Source Code
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.

49 lines
1.5 KiB

  1. //========= Copyright c 1996-2009, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //
  7. //=============================================================================//
  8. #ifndef SSE_CHOLESKY_HDR
  9. #define SSE_CHOLESKY_HDR
  10. #include "mathlib/vector.h"
  11. #include "mathlib/mathlib.h"
  12. #include "mathlib/ssemath.h"
  13. // This class holds cholesky decomposition of Four 3x3 matrices
  14. struct SimdCholesky3x3_t
  15. {
  16. /// lower diagonal matrix L such that LL' = input matrix
  17. fltx4 m_10, m_20, m_21; // These are off-diagonals used in compuations
  18. fltx4 m_inv00, m_inv11, m_inv22; // These are reciprocals of diagonals used in all computations
  19. public:
  20. /// @group Construction and initialization {
  21. SimdCholesky3x3_t( const fltx4 &a00, const fltx4 & a10, const fltx4 & a11, const fltx4 & a20, const fltx4 & a21, const fltx4 & a22 )
  22. {
  23. Init( a00, a10, a11, a20, a21, a22 );
  24. }
  25. void Init( const fltx4 & a00, const fltx4 & a10, const fltx4 & a11, const fltx4 & a20, const fltx4 & a21, const fltx4 & a22 );
  26. //@}
  27. bool IsValid( )const ;
  28. fltx4 GetValidMask( )const;
  29. const FourVectors SolveRight( const FourVectors &b );
  30. const FourVectors SolveLeft( const FourVectors &b );
  31. /// Using this decomposition LL', solve the following equation and return the result: LL' x = rhs
  32. const FourVectors Solve( const FourVectors &rhs )
  33. {
  34. // L R x = b
  35. // R x = L^-1 b
  36. // x = R^-1 L^-1 b
  37. return SolveRight( SolveLeft( rhs ) );
  38. }
  39. };
  40. #endif