Comments (4)
Isn't the array template fixed size one dimensional [compile time templated]?
Might work for Nd type indices, but not generally usable; secondly the boost array has really nice
multi-dimensional features and subslicing extents. So it would merge multi1d,2d,3d to Nd neatly
and give subslicing. Just annoyed it hasn't made it into a standard and don't like dependency on boost.
Another thought is that in general I'm getting quite annoyed that vector resize loops
over dimension calling default constructor, giving slow resize. Will benchmark this again,
but for a while I tried (incorrectly) to call reserve and prevent the loop.
If I remember right, it is an implementation issue: the loop is implemented by
i) calling the default constructor once on a temporary if not is_pod.
ii) looping over the whole array using the copy constructor for each element
passing it the temporary.
iii) in the case where the default constructor does nothing, is_pod still says not plain old
data, the empty constructor does nothing to the temporary, but then it loops over the whole
volume copying the temporary that contains junk.
This is avoidable with an "is_pod" enable_if in valarray (and possibly vector haven't checked); but
std::complex is forcing it to still use the slow resize were I to use valarray because it triggers and "is_pod" failure.
So, at some point I may be forced to roll my own "simple" array container that suppresses
initialisation of arrays to junk in resize and initial allocate when is_pod==false.
Question is then whether I make it a multi-dim like boost arrays, or fix to vector like 1d.
from grid.
This is the sort of offending loop, that creates a default object and issues a loop
of length the allocation EVEN if the default contstructor is trival and thus filling with random junk.
The implementation should be guarded with enable_if<has_trivial_constructor<value_type> > to
avoid the loop when the constructor is empty.
void
resize(size_type __new_size, value_type __x = value_type())
{
if (__new_size < size())
_M_erase_at_end(this->_M_impl._M_start + __new_size);
else
insert(end(), __new_size - size(), __x);
}
from grid.
sorry for brain dumping Matt -- origin of misunderstanding -- my comments in the
TODO were intended to mean Boost's MultiArray:
http://www.boost.org/doc/libs/1_58_0/libs/multi_array/doc/
which is a very interesting interface.
from grid.
Ah sure, I see what you mean. Yeah std::array won't help for multi-dimensional arrays.
from grid.
Related Issues (20)
- MPI2 romio321 library fails when reading >= 2GB per rank HOT 2
- Cannot compile the gparity and adjoint versions of the CompactWilsonCloverAction
- Compilation errors and warnings build targeting Nvidia GPUs HOT 2
- GPU Benchmark_ITT segfaults with MPI and ranks > 1 HOT 9
- Create a version of Benchmark_ITT including Clover instead of Wilson
- Grid fails to build for Nc != 3
- hipcc on Crusher: function bcopy undefined (compiler does not have openmp enabled?) HOT 1
- Certain operations involving SitePropagator::scalar_object won't compile with CUDA for Nc > 3
- make install doesn't install all headers due to duplicate Config.h and Version.h HOT 3
- Using ILDG checkpointer causes a crash during write HOT 2
- Develop is broken HOT 1
- ARM NEON is broken HOT 2
- Feature request: provenance tracking
- Add hint to shm error message
- Cuda error invalid device ordinal
- Recent commit causing Grid build to fail
- The configure options --enable-setdevice and --diable-setdevice have no effect
- Grid does not compile on Arm with CUDA HOT 9
- invalid configuration argument when running with 1 GPU
- FlightRecorder.cc breaks compilation for --enable-comms=none 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 grid.