1

I have the following code:

    using DiffSharp.Interop.Float64;

public class Layer
{
       public DM W { get; set; }
       public DV b { get; set; }
       public Func<DV,DV> a { get; set; }

       public DV Compute(DV v)
       {
          return a(W * v); // This Line
       }
}

The problem is i the statement W * v and it says "Operator * cannot be applied to operands of type DM and DV". In F# they are multiplied in this manner. How can we multiply this matrix and vector in C#?

Reed Copsey
  • 554,122
  • 78
  • 1,158
  • 1,373
ozgur
  • 2,549
  • 4
  • 25
  • 40
  • Not sure how vector is done in f#,but in c#,you need to load System.Windows.Vector assembly-you can check :https://msdn.microsoft.com/en-us/library/ms599648(v=vs.110).aspx – Vicky Jun 20 '16 at 12:59
  • 1
    Take a look at the source code: https://github.com/DiffSharp/DiffSharp/blob/master/src/DiffSharp/Interop.Float64.fs Notice that it defines a lot of mulitplication operators, but none of them are `DM * DV`. Perhaps the authors of the library accidentally omitted the operator you want from the interop library? – Eric Lippert Jun 20 '16 at 13:02
  • `DM` and `DV` are 2 different types. Your `Compute` method either need to do something special or call special method of `DV` (to do something with `DM` type inside disregards what is it doing). – Sinatr Jun 20 '16 at 13:02
  • 1
    @EricLippert You are absolutely right. DV * DV exists. DM * DM exists but DM * DV doesn't. Thank you very much. I guess I should open an issue? – ozgur Jun 20 '16 at 13:07

0 Answers0