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/inline-matrix.h
ViewVC logotype

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

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

revision 990, Tue Apr 26 23:15:12 2011 UTC revision 991, Wed Apr 27 04:53:08 2011 UTC
# Line 39  Line 39 
39      dst[1].v = vec2f(0.0, 1.0);      dst[1].v = vec2f(0.0, 1.0);
40  }  }
41    
42    STATIC_INLINE vec2f_t column2x2f (Diderot_Mat2x2_t m, int i)
43    {
44        return vec2f(m[0].r[i], m[1].r[i]);
45    }
46    
47  STATIC_INLINE void copy2x2f (Diderot_Mat2x2_t dst, Diderot_Mat2x2_t src)  STATIC_INLINE void copy2x2f (Diderot_Mat2x2_t dst, Diderot_Mat2x2_t src)
48  {  {
49      dst[0].v = src[0].v;      dst[0].v = src[0].v;
# Line 64  Line 69 
69      dst[1].v = a[1].v - b[1].v;      dst[1].v = a[1].v - b[1].v;
70  }  }
71    
72    STATIC_INLINE vec2f_t mulVec3Mat2x2f (vec2f_t v, Diderot_Mat2x2_t m)
73    {
74        return vec2f(
75            dot2f(v, column2x2f(m, 0)),
76            dot2f(v, column2x2f(m, 1)));
77    }
78    
79    STATIC_INLINE vec2f_t mulMat2x2Vec2f (Diderot_Mat2x2_t m, vec2f_t v)
80    {
81        return vec2f(dot2f(m[0].v, v), dot2f(m[1].v, v));
82    }
83    
84    STATIC_INLINE void mulMat2x2Mat2x2f (Diderot_Mat2x2_t dst, Diderot_Mat2x2_t m1, Diderot_Mat2x2_t m2)
85    {
86        dst[0].v = vec2f(
87            dot2f(m1[0].v, column2x2f(m2, 0)),
88            dot2f(m1[0].v, column2x2f(m2, 1)));
89        dst[1].v = vec2f(
90            dot2f(m1[1].v, column2x2f(m2, 0)),
91            dot2f(m1[1].v, column2x2f(m2, 1)));
92    }
93    
94    STATIC_INLINE void transpose2x2f (Diderot_Mat2x2_t dst, Diderot_Mat2x2_t src)
95    {
96        dst[0].v = column2x2f(src, 0);
97        dst[1].v = column2x2f(src, 1);
98    }
99    
100  STATIC_INLINE float trace2x2f (Diderot_Mat2x2_t m)  STATIC_INLINE float trace2x2f (Diderot_Mat2x2_t m)
101  {  {
102      return m[0].r[0] + m[1].r[1];      return m[0].r[0] + m[1].r[1];
# Line 97  Line 130 
130      return vec3f(m[0].r[i], m[1].r[i], m[2].r[i]);      return vec3f(m[0].r[i], m[1].r[i], m[2].r[i]);
131  }  }
132    
 STATIC_INLINE float trace3x3f (Diderot_Mat3x3_t m)  
 {  
     return m[0].r[0] + m[1].r[1] + m[2].r[2];  
 }  
   
133  STATIC_INLINE void copy3x3f (Diderot_Mat3x3_t dst, Diderot_Mat3x3_t src)  STATIC_INLINE void copy3x3f (Diderot_Mat3x3_t dst, Diderot_Mat3x3_t src)
134  {  {
135      dst[0].v = src[0].v;      dst[0].v = src[0].v;
# Line 160  Line 188 
188          dot3f(m1[2].v, column3x3f(m2, 2)));          dot3f(m1[2].v, column3x3f(m2, 2)));
189  }  }
190    
191    STATIC_INLINE void transpose3x3f (Diderot_Mat3x3_t dst, Diderot_Mat3x3_t src)
192    {
193        dst[0].v = column3x3f(src, 0);
194        dst[1].v = column3x3f(src, 1);
195        dst[2].v = column3x3f(src, 2);
196    }
197    
198    STATIC_INLINE float trace3x3f (Diderot_Mat3x3_t m)
199    {
200        return m[0].r[0] + m[1].r[1] + m[2].r[2];
201    }
202    
203  // 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
204  STATIC_INLINE float norm3x3f (Diderot_Mat3x3_t m)  STATIC_INLINE float norm3x3f (Diderot_Mat3x3_t m)
205  {  {
# Line 177  Line 217 
217      dst[3].v = src[3].v;      dst[3].v = src[3].v;
218  }  }
219    
220    STATIC_INLINE vec4f_t column4x4f (Diderot_Mat4x4_t m, int i)
221    {
222        return vec4f(m[0].r[i], m[1].r[i], m[2].r[i], m[3].r[i]);
223    }
224    
225    STATIC_INLINE void transpose4x4f (Diderot_Mat4x4_t dst, Diderot_Mat4x4_t src)
226    {
227        dst[0].v = column4x4f(src, 0);
228        dst[1].v = column4x4f(src, 1);
229        dst[2].v = column4x4f(src, 2);
230        dst[3].v = column4x4f(src, 3);
231    }
232    
233  STATIC_INLINE float trace4x4f (Diderot_Mat4x4_t m)  STATIC_INLINE float trace4x4f (Diderot_Mat4x4_t m)
234  {  {
235      return m[0].r[0] + m[1].r[1] + m[2].r[2] + m[3].r[3];      return m[0].r[0] + m[1].r[1] + m[2].r[2] + m[3].r[3];

Legend:
Removed from v.990  
changed lines
  Added in v.991

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