vectors

dimension independent vector and matrix operations, including predicates to synamically test the type of values. It may be interesting to notice that both vectors of number  or vectors of functions are allowed

  • Convexcoords returns the convex coords of a point x w.r.t. a simplex p
    Pre/Post conds (p::issimplex)(x::ispoint) => (ispoint)
    Example convexcoords:(simplex:3):< 1/3,1/3,1/3> == < 0.3,0.3,0.3,0.0>

  • Dirproject directional projection of v vector in e direction
    Pre/Post conds (e::isvect)(v::isvect) => (isvect)
    Example dirproject:< 1,1,0,0>:< 10,15,20,25> == < 12.5,12.5,0,0>

  • Idnt identity matrix constructor
    Pre/Post conds (n::isintpos) => (ismat)
    Example idnt:4 == < < 1,0,0,0>,< 0,1,0,0>,< 0,0,1,0>,< 0,0,0,1>

  • Innerprod inner product of vectors in IRn
    Pre/Post conds (v,w::isvect) => (isnum)
    Example innerprod:< < 11,12,13>,< 4,5,6>> == 182

  • Isfunvect predicate to test if arg is a sequence of functions or not
    Pre/Post conds (arg::tt) => (isbool)
    Example isfunvect:< id,k,sin> == true

  • Ismat predicate to test if arg is a matrix (of either numbers or functions) or not
    Pre/Post conds (arg:tt) => (isbool)
    Example ismat:< < 1.0,2.0,3.0>,< 4.0,5.0,6.0>,< 7.0,8.0,9.0>> == true

  • Ismatof to test if arg is a matrix of elements satisfying the istype predicate
    Pre/Post conds (istype::isfun)(arg:tt) => (isbool)
    Example ismatof:ispoint:< < < 0,0,0>,< 2,0,1>>,< < 1,3,-1>,< 3,2,0>>> == true

  • Ispointseq predicate to test if arg is a sequence of points in some IEd
    Pre/Post conds (arg:tt) => (isbool)
    Example isPointSeq:< < 0,0,0>,< 2,0,1>,< 1,3,-1.5>,< 3,2,0>> == true

  • Ispoint predicate to test if arg is a point in some IEd
    Pre/Post conds (arg:tt) => (isbool)
    Example ispoint:< 0,0,0,1> == true

  • Isrealvect predicate to test if arg is a vector in some IRd
    Pre/Post conds (arg:tt) => (isbool)
    Example isrealvect:< 0,0,0,1> == true

  • Issqrmat predicate to test if arg is a square matrix in some Mdd
    Pre/Post conds (arg:tt) => (isbool)
    Example issqrmat:< < < 0,0,0>,< 2,0,1>>,< < 1,3,-1>,< 3,2,0>>> == true

  • Isvect predicate to test if arg is a vector in some Vd (of either numbers or functions)
    Pre/Post conds (arg:tt) => (isbool)
    Example isvect:< 0,0,0,1> == true

  • isvect:(beziercurve:< < 0,0,0>,< 1,0,0>,< 1,1,1>,< 0,1,0>>) == true
    Iszero predicate to test if arg is the 0 element in some IRd
    Pre/Post conds (arg:tt) => (isbool)
    Example iszero:< 0,0,0,0> == true

  • Matdotprod binary inner product of matrix pair == ¡a,b¿ in some IRmn Pre/Post conds (pair::ismatof:isvect ~ trans) => (isnum)
    Example < < 1,2>,< 3,4>,< 5,6>> matdotprod < < 10,20>,< 30,40>,< 50,60>> == 910

  • Mathom matrix homogenization, i.e. adding of a unit first row and column
    Pre/Post conds (m::issqrmat) => (issqrmat)
    Example mathom:< < 10,20>,< 30,40>> == < < 1,0,0>,< 0,10,20>,< 0,30,40>>

  • Meanpoint returns the point with middle coordinates from a points sequence
    Pre/Post conds (points::ispointseq) => (ispoint)
    Example Meanpoint:< < 0,2,0>,< 3,0,10>,< 10,4,0>,< 1,10,2>> == < 7/2,4,3>

  • Mixedprod returns the mixed product a × b · c of three vectors in IR3
    Pre/Post conds (a,b,c::and ~ [isvect, c:eq:3 ~ len]) => (isnum)
    Example mixedprod:< < 1,1,1>,< 2,0,2>,< 0,3,0>> == 0

  • Orthoproject orthogonal projection of v vector in e direction
    Pre/Post conds (e::isvect)(v::isvect) => (isvect)
    Example orthoproject:< 1,1,0,0>:< 10,15,20,25> == < -2.5,2.5,20,25>

  • Ortho orthogonal component of a square matrix
    Pre/Post conds (matrix::issqrmat) => (issqrmat)
    Example Ortho:< < 0,1,0>,< 0,0,2>,< 1,1,1>> ==
    << 0,1/2,1/2>,< 1/2,0,3/2>,< 1/2,3/2,1>>

  • Pivotop pivoting operation on the (i, j) element of mat in some IRmn
    Pre/Post conds (i,j::isintpos)(mat::ismat) => (ismat)
    Example (PivotOp:< 2,2> * ID):< < 1,2,0>,< 0,-1,2>,< 1,1,1>> ==
    < < 1,0,4>,< 0,1,-2>,< 1,0,3>>

  • Rotn rotation in IE3 of α angle about an arbitrary axis n for the origin
    Pre/Post conds (alpha::isreal; n::isvect) => (isfun)
    Example rotn:< pi/4, < 1,1,1>>:(cuboid:< 1,1,1>)

  • Scalarmatprod product of a scalar a times a matrix mat
    Pre/Post conds (a::isnum; mat::ismat) => (ismat)
    Example 9 ScalarMatProd IDNT:3 == < < 9,0,0>,< 0,9,0>,< 0,0,9>>

  • Scalarvectprod product of a scalar a times a vector v
    Pre/Post conds (arg::ispair) => (isvect)
    Example 10 ScalarVectProd < 1,2> == < 1,2> ScalarVectProd 10 == < 10,20>

  • Skew skew component of a square matrix
    Pre/Post conds (matrix::issqrmat) => (issqrmat)
    Example skew:< < 0,1,0>,< 0,0,2>,< 1,1,1>> ==
    < < 0,1/2,-1/2>,< -1/2,0,1/2>,< 1/2,-1/2,0>>

  • Trace returns the trace of the input matrix
    Pre/Post conds (matrix::issqrmat) => (isnum)
    Example trace:< < 1,2,3>,< 4,5,6>,< 7,8,9>> == 15

  • Unitvect returns the unit vector of IRn parallel to v ∈ IRn
    Pre/Post conds (v::isvect) => (isvect)
    Example unitvect:< 10,20,30> == < 0.2672612419, 0.534522483, 0.801783725>

  • Vectdiff difference of vectors v,w in a vector space Vd (of numbers or functions)
    Pre/Post conds (v,w::isvect) => (isvect)
    Example vectdiff:< < 11,12,13>,< 4,5,6>> == < 7,7,7>

  • beziercurve:< < 0,0>,< 1,0>,< 1,1>,< 0,1>> vectdiff < k:1,k:1>
    Vectnorm Euclidean norm of the vector v
    Pre/Post conds (v::isvect) => (isnum)
    Example (vectnorm ~ unitvect):< 10,20,30> == 0.9999999999999999

  • Vectprod vector product of vectors u, v ∈ IR3
    Pre/Post conds (u,v::isvect) => (isvect)
    Example vectProd:< < 1,0,0>,< 1,1,0>> == < 0,0,1>

  • Vectsum addition of vectors v,w in a vector space Vd (of numbers or functions)
    Pre/Post conds (v,w::isvect) => (isvect)
    Example vectsum:< < 11,12,13>,< 4,5,6>> == < 15,17,19> beziercurve:< < 0,0>,< 1,0>,< 1,1>,< 0,1>> vectsum < k:1,k:1>

  • Vect2dtoangle maps a vector v ∈ IE2 to its signed angle with the x-axis
    Pre/Post conds (v::isvect) => (isnum)
    Example vect2dtoangle:< 1,1> == vect2dtoangle:< 2,2> == 0.78539816339745

PLaSM is Free Software and may be distributed under GNU LGPL