Giter Club home page Giter Club logo

multi_array's People

Contributors

beman avatar cromwellenage avatar dabrahams avatar danielae avatar danieljames avatar douggregor avatar eldiener avatar glenfe avatar grafikrobot avatar hkaiser avatar imikejackson avatar jensmaurer avatar jewillco avatar joaquintides avatar jzmaddock avatar marcelraad avatar morinmorin avatar pdimov avatar rxg avatar steveire avatar straszheim avatar vprus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

multi_array's Issues

Warning C4459 when building using MSVC

Using multi_array, MSVC (VS 2019, VS 2022) emits the following warnings (using Boost release 1.82.0, but current code in the repo includes the same global variable and argument name):

`C:\lo\build\workdir\UnpackedTarball\boost\boost/multi_array/multi_array_ref.hpp(615): warning C4459: declaration of 'extents' hides global declaration

C:\lo\build\workdir\UnpackedTarball\boost\boost/multi_array/base.hpp(69): note: see declaration of 'boost::anonymous-namespace'::extents'

This prevents warning-free builds, or requires pollution of the code with pragmas. Would it be possible to rename the constructor argument name?

Performance issue on resize

When I use boost::multi_array with boost::fortran_storage_order(), and I want to .resize by only the latest (rightmost) dimension, the current implementation is a nested N function call (std::copy), one by dimension.
The same functionality can be reached with one std::copy on the storage.

This minimal example shows the problem:
https://godbolt.org/z/GWbxcM14h

Feature request: constructor and resize from values

Hello, this is a copy of my email I sent to the boost-users mailing list, as it might improve visibility.

I'd love to be able to use multi_array with classes that do not have a default constructor. At the moment, this is impossible, as both the constructor and resize functions only take extents as arguments (and possibly some other options), but no value_type, as for example std::vector does. Thus, trying to store objects without a default constructor in a multi_array results in hard compiler errors, with no workaround that I know of.

This happens to me fairly often, as I use multi_array to organize sets of complex objects. If there is a technical reason why this is not possible, I would also be happy to learn it.

provide multi_array::swap

... or at least make its members protected to allow a subclass to do so.

swap would be substantially the same as the current resize method.

Background: I use a subclass of multi_array in order to resize during assignment to get around the most dagnerous multi_array pitfall. This works, but I'd also like to fix another longstanding inefficiency ( #24 ) while I'm at it. Unfortunately the private data members make it impossible to fix in my subclass (barring a type-punning hack).

valgrind warning when allocating large amount of memory

The following program:

#include "boost/multi_array.hpp"
using Emax = boost::multi_array<double, 7>; 

int main() {
    Emax emax(boost::extents[40][30][50][5][5][5][5]);
    return 0;
}

when run under valgrind gives the following warnings:

==20786== Memcheck, a memory error detector
==20786== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==20786== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
==20786== Command: ./test_arr
==20786==
==20786== Warning: set address range perms: large range [0x5171040, 0x16f8b340) (undefined)
==20786== Warning: set address range perms: large range [0x5171028, 0x16f8b358) (noaccess)
==20786==
==20786== HEAP SUMMARY:
==20786==     in use at exit: 0 bytes in 0 blocks
==20786==   total heap usage: 2 allocs, 2 frees, 300,072,704 bytes allocated
==20786==
==20786== All heap blocks were freed -- no leaks are possible
==20786==
==20786== For lists of detected and suppressed errors, rerun with: -s
==20786== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)

versions are:

gcc version 8.3.1 20190223 (Red Hat 8.3.1-2) (GCC)
valgrind-3.15.0

Return of bug#6554 (Compiler error dereferencing multi_array value via an iterator)

The bug described in https://svn.boost.org/trac10/ticket/6554 seems to return. I tried the example from this bug in godbolt: https://godbolt.org/z/4vMf8oo4q and it fails to compile. The code I used is:

#include <boost/multi_array.hpp>

struct data
{
	int	value;
};
typedef boost::multi_array<data, 2> array_type;

int main() {
    array_type	a(boost::extents[4][5]);

    // ERROR: Cannot compile this line
    a.begin()->begin()->value = 7;

    // Compiles successfully
    (*a.begin()->begin()).value = 5;
    return 0;
}

All versions of boost on godbolt (1.64 to 1.79) seem to be affected.

NVCC unable to compile multi_arrays

I am trying to use multi_arrays in a CUDA GPU project and NVCC is unable to compile it.
NVCC version is 12.3 (error also occurs with other versions)
Boost version is 1.84.0 (error also occurs with other versions)

I used the following command to compile:
nvcc -o C:/_repro/output.exe C:/_repro/main.cu -IC:/boost_1_84_0

I am using the following code (main.cu):

#include <boost/multi_array.hpp>

int main()
{
	boost::multi_array<int, 3> my_arr;
	return 0;
}

I get the following errors:

C:/boost_1_84_0\boost/multi_array/base.hpp(408): error C2988: unrecognizable template declaration/definition
C:/boost_1_84_0\boost/multi_array/base.hpp(408): error C2143: syntax error: missing ')' before '<'
C:/boost_1_84_0\boost/multi_array/base.hpp(408): error C2143: syntax error: missing ';' before '<'
C:/boost_1_84_0\boost/multi_array/base.hpp(408): error C2238: unexpected token(s) preceding ';'
C:/boost_1_84_0\boost/multi_array/base.hpp(408): error C2059: syntax error: '<'
C:/boost_1_84_0\boost/multi_array/base.hpp(414): error C2059: syntax error: ')'
C:/boost_1_84_0\boost/multi_array/base.hpp(494): error C2143: syntax error: missing ';' before '}'
C:/boost_1_84_0\boost/multi_array/base.hpp(494): error C2238: unexpected token(s) preceding ';'

Several more errors occur when I attempt to use further multi_array functionality such as extents and indexing, this is just a minimal example. Additionally, the code compiles just fine when you change the file extention to .cpp, but I assume this is just NVCC falling back on the default cl.exe compiler. I specifically need multi_arrays to compile within a .cu file along with CUDA device code.

Any help is much appreciated, thank you.

List of non BOOST-prefixed macros

The following macros are missing a BOOST_ prefix, which is against Boost library guidelines:

./libs/multi_array/test/generative_tests.hpp:#ifndef GENERATIVE_TESTS_RG072001_HPP
./libs/multi_array/test/generative_tests.hpp:#define GENERATIVE_TESTS_RG072001_HPP
./libs/multi_array/test/generative_tests.hpp:#endif // GENERATIVE_TESTS_RG072001_HPP
./boost/multi_array/base.hpp:#ifndef BASE_RG071801_HPP
./boost/multi_array/base.hpp:#define BASE_RG071801_HPP
./boost/multi_array/base.hpp:#endif // BASE_RG071801_HPP
./boost/multi_array/collection_concept.hpp:#ifndef COLLECTION_CONCEPT_RG103101_HPP
./boost/multi_array/collection_concept.hpp:#define COLLECTION_CONCEPT_RG103101_HPP
./boost/multi_array/collection_concept.hpp:#endif // COLLECTION_CONCEPT_RG103101_HPP
./boost/multi_array/range_list.hpp:#ifndef RANGE_LIST_RG072501_HPP
./boost/multi_array/range_list.hpp:#define RANGE_LIST_RG072501_HPP
./boost/multi_array/range_list.hpp:#endif // RANGE_LIST_RG072501_HPP
./boost/multi_array/iterator.hpp:#ifndef ITERATOR_RG071801_HPP
./boost/multi_array/iterator.hpp:#define ITERATOR_RG071801_HPP
./boost/multi_array/iterator.hpp:#endif // ITERATOR_RG071801_HPP
./boost/multi_array/copy_array.hpp:#ifndef COPY_ARRAY_RG092101_HPP
./boost/multi_array/copy_array.hpp:#define COPY_ARRAY_RG092101_HPP
./boost/multi_array/copy_array.hpp:#endif // COPY_ARRAY_RG092101_HPP
./boost/multi_array/subarray.hpp:#ifndef SUBARRAY_RG071801_HPP
./boost/multi_array/subarray.hpp:#define SUBARRAY_RG071801_HPP
./boost/multi_array/subarray.hpp:#endif // SUBARRAY_RG071801_HPP

DOC: Suggest referencing NumPy

While not a C++ N-D array, NumPy provides an N-D array for Python. Might be nice to include this in the related work section of the docs.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.