Comments (6)
Dealing with ADL is always fun. Not sure what the best approach is without looking into this deeper. However, the suggested approach (essentially an abstraction layer) sounds pragmatic and doable.
(PS. Based on experience, ADL in its current state is a net negative in my view. In retrospect, its inclusion into the C++ standard was a mistake. A better solution would be to have an explicit using
statement for every function/object that would be allowed to be pulled in during lookups and argument matching.)
from ensmallen.
I guess another solution would be to make conv_to
a member function of X,
instead of a standalone function. But maybe there is a reason why you opted out for this? So similar to X.max()
I can also do X.conv_to<type>()
.
from ensmallen.
Armadillo aims to follow both the letter and spirit of Matlab syntax, where stand-alone functions take inputs and provide outputs, ie. Y = f(X)
. Member functions mainly aim to modify the underlying objects, eg. X.load()
.
There are targeted exceptions for pragmatic reasons, such as Y = X.t()
, which aims to mimic the transpose operation in Matlab (ie. Y = X'
). The X.max()
member function is available so the maximum scalar value can be obtained regardless whether X
is a vector or matrix, which is not possible in normal Matlab syntax without ugly workarounds that may have performance penalties (eg. val = max(max(X))
, or val = max(vectorise(X))
). It's of course possible to have dedicated internal code that ameliorates the performance penalties, but this adds to the maintenance burden and doesn't address the ugliness aspect.
For the conv_to
family of functions, I'd rather not modify/extend the Armadillo API for a central function such as this. Adding the X.conv_to()
member function would be inconsistent with the Y = f(X)
pattern, and does not have a widely-applicable use case to warrant an exception. Furthermore, it takes ages for the Armadillo packages to be updated in various Linux distros, meaning it would take a long time for any new functionality to be sufficiently available. Case in point: ensmallen currently can only use Armadillo API up to version 9.800 due to Ubuntu 20.04 LTS.
from ensmallen.
Thanks for the clarification; I also don't want to backport specific armadillo functions because we like to support older versions. That said, I think the extra type-dependent conversion utility is good enough.
from ensmallen.
The workaround solution you proposed is a bit tedious, but unfortunately I don't think we can do much better than that. 👍
from ensmallen.
This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions! 👍
from ensmallen.
Related Issues (20)
- Compiling errors ensmallen 02.18.02 using VS2019 armadillo.lib 10.08.02 and mlpack.lib 03.04.02 HOT 6
- The example to use the constrained function HOT 4
- AugLagrangian with constraints validation HOT 8
- Multi-objective functions both MOEA/D-DE and NSGA2 - Examples using SchafferFunctionN1 HOT 1
- Implementing Function Type for Partial Derivatives HOT 3
- Does ensmallen work with armadillo >=10.0? HOT 5
- Enable HTTPS on ensmallen.org HOT 1
- Debian build (test) failure on i386 HOT 7
- ProgressBar() does not work with L_BFGS HOT 3
- Bounds for search space HOT 5
- During AugLagrangian's optimization, L_BFGS sets coordinates to nan HOT 6
- Migrate from Catch v2 to v3 HOT 3
- Using optimizer with integers HOT 6
- Custom early stop callback HOT 12
- SCD isn't stochastic and perhaps should be called CD? HOT 2
- 2.20 documentation + link issues
- Which optimizer should I use? HOT 2
- [PowerPC] Bus error during running tests: `KERN_PROTECTION_FAILURE at address: 0x00000000` HOT 7
- [aarch64] One test failure in Johnson844LovaszThetaFMatSDP HOT 8
- benchmarking framework for single-objective evolutionary optimization algorithms HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ensmallen.