Menu

Port to c# language, please...

Miguel G L
2008-09-17
2013-01-19
  • Miguel G L

    Miguel G L - 2008-09-17

    For example, the code in C++ "Columns = new Column ** [OutputsX];" is incomprehensible to me ...
    I program in the language Pascal and C#.

    Thank you, a greeting

     
    • David Green

      David Green - 2008-09-17

      Hello Miguel

      Thanks for the interest.

      I am happy to assist you or anyone else who wishes to port to C#.
      I doubt if Pascal would be suitable but it's not impossible.  Just harder.

      Unfortunately my time is very limited so my assistance would be just to explain what things do as best I can.
      However, C++ and C# are syntactically very similar as far as I can see so a lot of it should be fairly clear.
      You may be interested in the Qt bindings for C#:
      http://freshmeat.net/projects/qtcsharp/

      The following is the sort of level of explanation I can offer.
      In C# you do not have the memory allocation thing 'new' but all that does is create a new object, an array in this case.
      In this case it's a 2 dimensional array (the other dimension being OutputsY).
      Not so hard once you know what it does (you do not need to care much how it does it if you just want to port it to C#). 

      I have to say that I am not convinced that your time would be well spent in porting to C# but it would at least give you a good grounding in how the various parts of this model work. 
      You might be best off just working from the Numenta white papers and this model to develop the ideas further.

      Another negative point is that C# would appear to confine the implementation to the Microsoft platform.

      But also there is also plenty of work to do running the model (and Numenta's) with various parameters and making suggestions for improvements to the algorithms. 
      If you had a C# implementation and changed the algorithms it could, of course, be ported to the C++ version!

      Thanks once again

      David Green
      (Developer)

       
    • Saulius

      Saulius - 2008-10-26

      Hi Miguel,

      believe it or not, my hard drive crashed while composing a reply for you... A month later I am trying again, will see what happens :)

      C++ was chosen primarily for performance, since some of the experiments are very long. However, you could try to convert it to C# and we would help to explain any parts that are incomprehensible to you. But then the C# version would need to be maintained in parallel with the C++ version, which would detract us from further algorithm improvement... Anyway, let me know, if you are interesting in doing the conversion.

      Regarding "Columns = new Column ** [OutputsX];"... Dynamic arrays in C++ are just pointers to the beginning to the allocated space. So:
      Column *  - is a pointer to an object of type Column;
      Column **   - is a one-dimensional array of pointers to an object of type Column;
      Column ***Columns - represents a two-dimensional array of such pointers (i.e. a one-dimensional array where each element is a one-dimensional array of pointers). When we create it, we specify the type of the element in this one-dimensional array (Column **) and the number of elements ([OutputsX]).
      You can visualize how everything works once you know the meaning of each symbol! That's the beauty of C++ :)

      Saulius

       

Log in to post a comment.