Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] View of /tests/trunk/bugs/tests.obsolete/bug301.sml
ViewVC logotype

View of /tests/trunk/bugs/tests.obsolete/bug301.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2460 - (download) (annotate)
Sat Apr 28 20:18:10 2007 UTC (12 years, 1 month ago) by gkuan
File size: 606 byte(s)
(* bug301.sml *)

struct VMat :
sig
    type v4 = real*real*real*real
    type m4 = v4*v4*v4*v4
    val vmul = v4*v4 -> v4
    val vdot = v4*v4 -> real
    val vmmul = v4*m4 -> v4
    val mmul = m4*m4 -> m4
end =
struct

fun vmul((v1x, v1y, v1z, v1w), (v2x, v2y, v2z, v2w)) =
    (v1x * v2x, v1y * v2y, v1z * v2z, v1w * v2w)

fun vdot((v1x, v1y, v1z, v1w), (v2x, v2y, v2z, v2w)) =
    v1x * v2x + v1y * v2y + v1z * v2z + v1w * v2w

fun vmmul(v, (a, b, c, d)) =
    (vdot(v, a), vdot(v, b), vdot(v, c), vdot(v, d))

fun mmul((a, b, c, d), m) =
    (vmmul(a, m), vmmul(b, m), vmmul(c, m), vmmul(d, m))

end;

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