anchor.diff:                                  | _ -> failwithf "cannot subtract types: %A and %A" a.Type b.Type
   
                           | Mul ->
  -                            match a.Type with
  -                                | Integral | VectorOf(_,Integral) -> yield OpIMul(tid, id, ia, ib)
  -                                | Fractional | VectorOf(_,Fractional) -> yield OpFMul(tid, id, ia, ib)
  -                                | _ -> failwithf "cannot multiply types: %A and %A" a.Type b.Type
  -
  +                            if a.Type = b.Type then
  +                                match a.Type with
  +                                    | Integral | VectorOf(_,Integral) -> yield OpIMul(tid, id, ia, ib)
  +                                    | Fractional | VectorOf(_,Fractional) -> yield OpFMul(tid, id, ia, ib)
  +                                    | MatrixOf(size,bt) when size.X = size.Y -> yield OpMatrixTimesMatrix(tid, id, ia, ib)
  +
  +                                    | _ -> failwithf "cannot multiply types: %A and %A" a.Type b.Type
  +                            else
  +                                match a.Type, b.Type with
  +                                    | MatrixOf(ms, mt), VectorOf(vd, vt) when vt = mt && ms.X = vd ->
  +                                        let! resType = compileType (a.Type.GetProperty("C0").PropertyType)
  +                                        yield OpMatrixTimesVector(resType, id, ia, ib)
  +                                    | _ ->
  +                                        failwithf "cannot multiply types: %A and %A" a.Type b.Type 
                           | Div ->
                               match a.Type with
                                   | SignedIntegral | VectorOf(_,SignedIntegral) -> yield OpSDiv(tid, id, ia, ib)
  
positive.code: 
                  | VarSet(v,e) ->
                      let! vid = getVarId v
                      let! eid = compileExpression false e
  
                      yield OpStore(vid, eid, None)
  
                      return! ret 0u
  
  
  
  
negative.code:                             // variable we skip its initialization
                              | FixedArrayType(et,d), NewObject(_) ->
                                  let! tid = compileType (makePtrType v.Type)
                                  let! vid = newMutableVarId v
                                  yield OpVariable(tid, vid, StorageClass.Function, None)
  
                              | _ ->
                                  if v.IsMutable then
                                      let! tid = compileType (makePtrType v.Type)
                                      let! vid = newMutableVarId v
                                      let! e = compileExpression false e
                                      yield OpVariable(tid, vid, StorageClass.Function, Some e)
                                  else
  