Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Diff of /branches/pure-cfg/src/include/Diderot/cl-inline-matrix.h
ViewVC logotype

Diff of /branches/pure-cfg/src/include/Diderot/cl-inline-matrix.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1289, Tue Jun 7 14:58:48 2011 UTC revision 1290, Tue Jun 7 16:22:05 2011 UTC
# Line 8  Line 8 
8   * All rights reserved.   * All rights reserved.
9   */   */
10    
11  #ifndef _DIDEROT_INLINE_MATRIX_H_  #ifndef _DIDEROT_CL_INLINE_MATRIX_H_
12  #define _DIDEROT_INLINE_MATRIX_H_  #define _DIDEROT_CL_INLINE_MATRIX_H_
13    
14  #ifndef _DIDEROT_TYPES_H_  #ifndef _DIDEROT_CL_TYPES_H_
15  #include "cl-types.h"  #include "cl-types.h"
16  #endif  #endif
17    
   
   
18  /********** 2x2 matrix functions **********/  /********** 2x2 matrix functions **********/
19    
20  STATIC_INLINE void zero2x2f (Diderot_Mat2x2_t dst)  STATIC_INLINE void zero2x2f (Diderot_Mat2x2_t dst)
# Line 76  Line 74 
74  STATIC_INLINE void mulMat2x2Mat2x2f (Diderot_Mat2x2_t dst, Diderot_Mat2x2_t m1, Diderot_Mat2x2_t m2)  STATIC_INLINE void mulMat2x2Mat2x2f (Diderot_Mat2x2_t dst, Diderot_Mat2x2_t m1, Diderot_Mat2x2_t m2)
75  {  {
76      dst[0] = vec2f(      dst[0] = vec2f(
77          dot2f(m1[0].v, column2x2f(m2, 0)),          dot(m1[0].v, column2x2f(m2, 0)),
78          dot2f(m1[0].v, column2x2f(m2, 1)));          dot(m1[0].v, column2x2f(m2, 1)));
79      dst[1] = vec2f(      dst[1] = vec2f(
80          dot2f(m1[1].v, column2x2f(m2, 0)),          dot(m1[1].v, column2x2f(m2, 0)),
81          dot2f(m1[1].v, column2x2f(m2, 1)));          dot(m1[1].v, column2x2f(m2, 1)));
82  }  }
83    
84  STATIC_INLINE void transpose2x2f (Diderot_Mat2x2_t dst, Diderot_Mat2x2_t src)  STATIC_INLINE void transpose2x2f (Diderot_Mat2x2_t dst, Diderot_Mat2x2_t src)
# Line 97  Line 95 
95  // The Frobenius norm of a matrix is the sqrt of the sum of the squares of the elements  // The Frobenius norm of a matrix is the sqrt of the sum of the squares of the elements
96  STATIC_INLINE float norm2x2f (Diderot_Mat2x2_t m)  STATIC_INLINE float norm2x2f (Diderot_Mat2x2_t m)
97  {  {
98      return sqrtf(dot2f(m[0],m[0]) + dot2f(m[1],m[1]));      return sqrtf(dot(m[0],m[0]) + dot(m[1],m[1]));
99  }  }
100    
101    
# Line 154  Line 152 
152  STATIC_INLINE float3 mulVec3Mat3x3f (float3 v, Diderot_Mat3x3_t m)  STATIC_INLINE float3 mulVec3Mat3x3f (float3 v, Diderot_Mat3x3_t m)
153  {  {
154      return (float3)(      return (float3)(
155          dot3f(v, column3x3f(m, 0)),          dot(v, column3x3f(m, 0)),
156          dot3f(v, column3x3f(m, 1)),          dot(v, column3x3f(m, 1)),
157          dot3f(v, column3x3f(m, 2)));          dot(v, column3x3f(m, 2)));
158  }  }
159    
160  STATIC_INLINE float3 mulMat3x3Vec3f (Diderot_Mat3x3_t m, float3 v)  STATIC_INLINE float3 mulMat3x3Vec3f (Diderot_Mat3x3_t m, float3 v)
161  {  {
162      return (float3)(dot3f(m[0], v), dot3f(m[1], v), dot3f(m[2], v));      return (float3)(dot(m[0], v), dof(m[1], v), dot(m[2], v));
163  }  }
164    
165  STATIC_INLINE void mulMat3x3Mat3x3f (Diderot_Mat3x3_t dst, Diderot_Mat3x3_t m1, Diderot_Mat3x3_t m2)  STATIC_INLINE void mulMat3x3Mat3x3f (Diderot_Mat3x3_t dst, Diderot_Mat3x3_t m1, Diderot_Mat3x3_t m2)
# Line 211  Line 209 
209    
210  STATIC_INLINE float4 column4x4f (Diderot_Mat4x4_t m, int i)  STATIC_INLINE float4 column4x4f (Diderot_Mat4x4_t m, int i)
211  {  {
212      return (float4)(m[0].r[i], m[1].r[i], m[2].r[i], m[3].r[i]);      return (float4)(((union4f_t)m[0]).r[i], ((union4f_t)m[1]).r[i], ((union4f_t)m[2]).r[i], ((union4f_t)m[3]).r[i]);
213  }  }
214    
215  STATIC_INLINE void transpose4x4f (Diderot_Mat4x4_t dst, Diderot_Mat4x4_t src)  STATIC_INLINE void transpose4x4f (Diderot_Mat4x4_t dst, Diderot_Mat4x4_t src)
# Line 230  Line 228 
228  // The Frobenius norm of a matrix is the sqrt of the sum of the squares of the elements  // The Frobenius norm of a matrix is the sqrt of the sum of the squares of the elements
229  STATIC_INLINE float norm4x4f (Diderot_Mat4x4_t m)  STATIC_INLINE float norm4x4f (Diderot_Mat4x4_t m)
230  {  {
231      return sqrt(dot4f(m[0],m[0]) + dot4f(m[1],m[1]) + dot4f(m[2],m[2]) + dot4f(m[3],m[3]));      return sqrt(dot(m[0],m[0]) + dot(m[1],m[1]) + dot(m[2],m[2]) + dot(m[3],m[3]));
232  }  }
233    
234  #endif /* !_DIDEROT_INLINE_MATRIX_H_ */  #endif /* !_DIDEROT_CL_INLINE_MATRIX_H_ */

Legend:
Removed from v.1289  
changed lines
  Added in v.1290

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0