@jasper Thanks a lot. The following worked (I had to add the `auto` return type 
as you mentioned):
    
    
    template `+`[L, R](lhs: L, rhs: R): auto =
      DualBinaryExpr[AddOp, L, R](l: lhs, r: rhs)
    
    
    Run

@mratsim Your tensor lib Lux seems quite impressive. My idea is to have an 
autodiff library in Nim similar to this one I developed in C++: 
[autodiff.github.io](https://forum.nim-lang.org/autodiff.github.io) . It relies 
heavily on template metaprogramming, `if constexpr`, SFINAE, etc., to optimize 
the expression tree (whenever possible) and avoid temporaries.

There are forward and reverse mode automatic differentiation algorithms in 
there. My research needs, however, relies mainly (if not only) in forward mode; 
so, forward mode in autodiff lib is what I have spent most of my available time 
for this dev.

I'm quite new to Nim; just started exploring it yesterday and I found it quite 
neat. Right now, just want to experiment with it and check if it could be used 
for advanced scientific computing (for problems that involve numerical 
optimization, solving ODEs, PDEs, etc.). 

Reply via email to