Home My Page Projects Code Snippets Project Openings diderot

# SCM Repository

[diderot] Diff of /branches/staging/src/include/Diderot/inline-tensor3.h
 [diderot] / branches / staging / src / include / Diderot / inline-tensor3.h

# Diff of /branches/staging/src/include/Diderot/inline-tensor3.h

revision 1941, Tue Jul 3 15:22:31 2012 UTC revision 1942, Tue Jul 3 15:22:53 2012 UTC
# Line 54  Line 54
54      dst[1].v = vec2(dot2(T[1][0].v, v), dot2(T[1][1].v, v));      dst[1].v = vec2(dot2(T[1][0].v, v), dot2(T[1][1].v, v));
55  }  }
56
57    // The Frobenius norm of a tensor
58    STATIC_INLINE Diderot_real_t normTen2x2x2 (Diderot_Ten2x2x2_t T)
59    {
60        Diderot_real_t sumSq =
61            dot2(T[0][0].v,T[0][0].v) + dot2(T[0][1].v,T[0][1].v) +
62            dot2(T[1][0].v,T[1][0].v) + dot2(T[1][1].v,T[1][1].v);
63        return SQRT(sumSq);
64    }
65
66  /********** 3x3x3 tensor functions **********/  /********** 3x3x3 tensor functions **********/
67
# Line 94  Line 102
102      dst[2].v = vec3(dot3(T[2][0].v, v), dot3(T[2][1].v, v), dot3(T[2][2].v, v));      dst[2].v = vec3(dot3(T[2][0].v, v), dot3(T[2][1].v, v), dot3(T[2][2].v, v));
103  }  }
104
105    // The Frobenius norm of a tensor
106    STATIC_INLINE Diderot_real_t normTen3x3x3 (Diderot_Ten3x3x3_t T)
107    {
108        Diderot_real_t sumSq =
109            dot3(T[0][0].v,T[0][0].v) + dot3(T[0][1].v,T[0][1].v) + dot3(T[0][2].v,T[0][2].v) +
110            dot3(T[1][0].v,T[1][0].v) + dot3(T[1][1].v,T[1][1].v) + dot3(T[1][2].v,T[1][2].v) +
111            dot3(T[2][0].v,T[2][0].v) + dot3(T[2][1].v,T[2][1].v) + dot3(T[2][2].v,T[2][2].v);
112        return SQRT(sumSq);
113    }
114
115
116  /********** 4x4x4 tensor functions **********/  /********** 4x4x4 tensor functions **********/
117
# Line 139  Line 157
157      dst[3].v = vec4(dot4(T[3][0].v, v), dot4(T[3][1].v, v), dot4(T[3][2].v, v), dot4(T[3][3].v, v));      dst[3].v = vec4(dot4(T[3][0].v, v), dot4(T[3][1].v, v), dot4(T[3][2].v, v), dot4(T[3][3].v, v));
158  }  }
159
160    // The Frobenius norm of a tensor
161    STATIC_INLINE Diderot_real_t normTen4x4x4 (Diderot_Ten4x4x4_t T)
162    {
163        Diderot_real_t sumSq =
164            dot4(T[0][0].v,T[0][0].v) + dot4(T[0][1].v,T[0][1].v) + dot4(T[0][2].v,T[0][2].v) + dot4(T[0][3].v,T[0][3].v) +
165            dot4(T[1][0].v,T[1][0].v) + dot4(T[1][1].v,T[1][1].v) + dot4(T[1][2].v,T[1][2].v) + dot4(T[1][3].v,T[1][3].v) +
166            dot4(T[2][0].v,T[2][0].v) + dot4(T[2][1].v,T[2][1].v) + dot4(T[2][2].v,T[2][2].v) + dot4(T[2][3].v,T[2][3].v) +
167            dot4(T[2][0].v,T[2][0].v) + dot4(T[2][1].v,T[2][1].v) + dot4(T[2][2].v,T[2][2].v) + dot4(T[3][3].v,T[3][3].v);
168        return SQRT(sumSq);
169    }
170
171  #endif /*! _DIDEROT_INLINE_TENSOR_H_ */  #endif /*! _DIDEROT_INLINE_TENSOR_H_ */

Legend:
 Removed from v.1941 changed lines Added in v.1942