Skip to content

Instantly share code, notes, and snippets.

@Jutho
Last active August 22, 2016 23:17
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Jutho/a31036f74305d0248fdf842d2c2d13d9 to your computer and use it in GitHub Desktop.
Save Jutho/a31036f74305d0248fdf842d2c2d13d9 to your computer and use it in GitHub Desktop.

Preliminary notes:

  • Abstract is left out of the type names for conciseness
  • We need a Covector (or alternative name) type for theoretical reasons, i.e. to make dispatch able to distinguish between all of the following operations and to have methods with a different return type for these different operations.
  • We need a LazyTranspose type (and Covector) for computational efficiency, i.e. to link with BLAS, to replace the current Ac_mul_Bt etc family.
  • Alternatives with ? ... ? are not very likely, just to point out the possibility.

Given vectors v and w, linear maps with matrix representation A and B, and a covector z

abstract operation julia ascii julia method possible alternative or unicode equivalent
Inner product dot(v, w) dot(::Vector, ::Vector) -> Number v ∙ w
Mapping vector to covector z = v' transpose(::Vector) -> Covector Covector(v), ? dot(v) (incomplete inner product) ?
Mapping covector to vector v = z' transpose(::Covector) -> Vector
Applying a covector z * w *(::Covector, ::Vector) -> Number ? z(w) ?
Combined operation v'w = v' * w = dot(v,w) no special method required
Applying linear map A * v *(::Matrix, ::Vector) -> Vector ? A(v) ?
Transpose of a map B = A.' transpose(::Matrix) -> LazyTranpose
Adjoint of a map B = A' ctranspose(::Matrix) -> LazyTranpose
Composing linear maps A * B *(::Matrix, ::Matrix) -> Matrix ? A ◦ B ?
Composing linear form and linear map z * A *(::Covector,::Matrix) -> Covector ? z ◦ A ?
Combined operation A.' * v no special method required
Combined operation A' * v no special method required
Combined operation v'A = v' * A no special method required ? dot(v,A) = v ∙ A ?
Tensor product between vectors kron(v, w) kron(::Vector, ::Vector) -> Vector v ⊗ w ?
Outer product = tensor product between vector and covector w * z = w * v' *(::Vector, ::Covector) -> Matrix w ⊗ z ?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment