/// @file
/// @author David Pilger <dpilger26@gmail.com>
/// [GitHub Repository](https://github.com/dpilger26/NumCpp)
///
/// License
/// Copyright 2018-2023 David Pilger
///
/// Permission is hereby granted, free of charge, to any person obtaining a copy of this
/// software and associated documentation files(the "Software"), to deal in the Software
/// without restriction, including without limitation the rights to use, copy, modify,
/// merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
/// permit persons to whom the Software is furnished to do so, subject to the following
/// conditions :
///
/// The above copyright notice and this permission notice shall be included in all copies
/// or substantial portions of the Software.
///
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
/// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
/// PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
/// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
/// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
/// DEALINGS IN THE SOFTWARE.
///
/// Description
/// Holds 1D and 2D arrays, the main work horse of the NumCpp library
///
#pragma once
#include <array>
#include <cmath>
#include <deque>
#include <filesystem>
#include <forward_list>
#include <fstream>
#include <initializer_list>
#include <iostream>
#include <iterator>
#include <list>
#include <memory>
#include <numeric>
#include <set>
#include <string>
#include <type_traits>
#include <utility>
#include <vector>
#include "NumCpp/Core/Constants.hpp"
#include "NumCpp/Core/DtypeInfo.hpp"
#include "NumCpp/Core/Enums.hpp"
#include "NumCpp/Core/Internal/Endian.hpp"
#include "NumCpp/Core/Internal/Error.hpp"
#include "NumCpp/Core/Internal/StaticAsserts.hpp"
#include "NumCpp/Core/Internal/StdComplexOperators.hpp"
#include "NumCpp/Core/Internal/StlAlgorithms.hpp"
#include "NumCpp/Core/Internal/TypeTraits.hpp"
#include "NumCpp/Core/Shape.hpp"
#include "NumCpp/Core/Slice.hpp"
#include "NumCpp/Core/Types.hpp"
#include "NumCpp/NdArray/NdArrayIterators.hpp"
#include "NumCpp/Utils/essentiallyEqual.hpp"
#include "NumCpp/Utils/essentiallyEqualComplex.hpp"
#include "NumCpp/Utils/num2str.hpp"
#include "NumCpp/Utils/power.hpp"
#include "NumCpp/Utils/sqr.hpp"
#include "NumCpp/Utils/value2str.hpp"
namespace nc
{
namespace type_traits
{
//============================================================================
// Class Description:
/// Template class for determining if dtype is a valid index type for NdArray
///
template<typename>
struct is_ndarray_int : std::false_type
{
};
//============================================================================
// Class Description:
/// Template class for determining if dtype is a valid index typefor NdArray
///
template<typename dtype, typename Allocator>
struct is_ndarray_int<NdArray<dtype, Allocator>>
{
static constexpr bool value = std::is_integral_v<dtype>;
};
//============================================================================
// Class Description:
/// is_ndarray_int helper
///
template<typename T>
constexpr bool is_ndarray_int_v = is_ndarray_int<T>::value;
//============================================================================
// Class Description:
/// Template class for determining if dtype is an unsigned integer type
///
template<typename>
struct is_ndarray_signed_int : std::false_type
{
};
//============================================================================
// Class Description:
/// Template class for determining if dtype is an unsigned integer type
///
template<typename dtype, typename Allocator>
struct is_ndarray_signed_int<NdArray<dtype, Allocator>>
{
static constexpr bool value = std::is_signed_v<dtype>;
};
//============================================================================
// Class Description:
/// is_ndarray_int helper
///
template<typename T>
constexpr bool is_ndarray_signed_int_v = is_ndarray_signed_int<T>::value;
//============================================================================
// Class Description:
/// is_ndarray_int
///
template<typename T>
using ndarray_int_concept = std::enable_if_t<is_ndarray_int_v<T>, int>;
} // namespace type_traits
//================================================================================
// Class Description:
/// Holds 1D and 2D arrays, the main work horse of the NumCpp library
template<typename dtype, class Allocator = std::allocator<dtype>>
class NdArray
{
private:
STATIC_ASSERT_VALID_DTYPE(dtype);
static_assert(std::is_same_v<dtype, typename Allocator::value_type>,
"value_type and Allocator::value_type must match");
using AllocType = typename std::allocator_traits<Allocator>::template rebind_alloc<dtype>;
using AllocTraits = std::allocator_traits<AllocType>;
public:
using self_type = NdArray<dtype, Allocator>;
using value_type = dtype;
using allocator_type = Allocator;
using pointer = typename AllocTraits::pointer;
using const_pointer = typename AllocTraits::const_pointer;
using reference = dtype&;
using const_reference = const dtype&;
using size_type = uint32;
using index_type = int32;
using difference_type = typename AllocTraits::difference_type;
using iterator = NdArrayIterator<dtype, pointer, difference_type>;
using const_iterator = NdArrayConstIterator<dtype, const_pointer, difference_type>;
using reverse_iterator = std::reverse_iterator<iterator>;
using const_reverse_iterator = std::reverse_iterator<const_iterator>;
using column_iterator = NdArrayColumnIterator<dtype, size_type, pointer, difference_type>;
using const_column_iterator = NdArrayConstColumnIterator<dtype, size_type, const_pointer, difference_type>;
using reverse_column_iterator = std::reverse_iterator<column_iterator>;
using const_reverse_column_iterator = std::reverse_iterator<const_column_iterator>;
//============================================================================
// Method Description:
/// Defualt Constructor, not very usefull...
///
NdArray() = default;
//============================================================================
// Method Description:
/// Constructor
///
/// @param inSquareSize: square number of rows and columns
///
explicit NdArray(size_type inSquareSize) :
shape_{ inSquareSize, inSquareSize },
size_{ inSquareSize * inSquareSize }
{
newArray();
}
//============================================================================
// Method Description:
/// Constructor
///
/// @param inNumRows
/// @param inNumCols
///
NdArray(size_type inNumRows, size_type inNumCols) :
shape_{ inNumRows, inNumCols },
size_{ inNumRows * inNumCols }
{
newArray();
}
//======
没有合适的资源?快使用搜索试试~ 我知道了~
C++ implementation of the Python Numpy library.zip
共2000个文件
html:931个
hpp:529个
js:510个
需积分: 5 0 下载量 5 浏览量
2023-12-31
10:04:57
上传
评论
收藏 7.23MB ZIP 举报
温馨提示
C++ implementation of the Python Numpy library.zip
资源推荐
资源详情
资源评论
收起资源包目录
C++ implementation of the Python Numpy library.zip (2000个子文件)
GaussNewtonNlls.cpp 14KB
ReadMe.cpp 6KB
InterfaceWithOpenCV.cpp 2KB
InterfaceWithEigen.cpp 2KB
main.cpp 1KB
doxygen-awesome.css 66KB
doxygen-awesome.css 66KB
doxygen.css 33KB
delete_me.css 32KB
new_stylesheet.css 32KB
doxygen-awesome-sidebar-only.css 3KB
navtree.css 2KB
doxygen-awesome-sidebar-only-darkmode-toggle.css 1KB
doxygen-awesome-sidebar-only-darkmode-toggle.css 1KB
NdArrayCore.hpp 186KB
NdArrayOperators.hpp 63KB
RNG.hpp 44KB
Quaternion.hpp 37KB
NdArrayIterators.hpp 32KB
StlAlgorithms.hpp 29KB
DataCube.hpp 28KB
NdArrayCore.hpp 27KB
insert.hpp 25KB
Celestial.hpp 23KB
Poly1d.hpp 23KB
SVDClass.hpp 20KB
DateTime.hpp 20KB
Vec3.hpp 19KB
Vec2.hpp 17KB
put.hpp 17KB
hammingEncode.hpp 16KB
NdArrayIterators.hpp 15KB
ClusterMaker.hpp 14KB
Cluster.hpp 13KB
BoostNumpyNdarrayHelper.hpp 13KB
asarray.hpp 13KB
NdArrayBroadcast.hpp 12KB
Centroid.hpp 12KB
Functions.hpp 12KB
deleteIndices.hpp 12KB
BinaryLogger.hpp 12KB
Brent.hpp 11KB
gradient.hpp 10KB
Cartesian.hpp 9KB
Logger.hpp 9KB
average.hpp 9KB
percentile.hpp 8KB
tri.hpp 8KB
PybindInterface.hpp 8KB
Slice.hpp 8KB
TypeTraits.hpp 8KB
packbits.hpp 8KB
DCM.hpp 7KB
gauss_legendre.hpp 7KB
Dekker.hpp 7KB
triangle.hpp 7KB
DtypeInfo.hpp 7KB
gaussNewtonNlls.hpp 7KB
cross.hpp 7KB
select.hpp 6KB
dot.hpp 6KB
nonCentralChiSquared.hpp 6KB
stdev.hpp 6KB
unpackbits.hpp 6KB
where.hpp 6KB
randFloat.hpp 6KB
BoostInterface.hpp 6KB
lognormal.hpp 6KB
legendre_p.hpp 6KB
trapz.hpp 6KB
randInt.hpp 6KB
negativeBinomial.hpp 6KB
f.hpp 6KB
normal.hpp 6KB
multiply.hpp 6KB
subtract.hpp 6KB
beta.hpp 6KB
divide.hpp 6KB
binomial.hpp 6KB
add.hpp 6KB
laplace.hpp 6KB
gamma.hpp 6KB
Pixel.hpp 6KB
bincount.hpp 6KB
det.hpp 6KB
Timer.hpp 6KB
weibull.hpp 5KB
cauchy.hpp 5KB
arange.hpp 5KB
mean.hpp 5KB
Shape.hpp 5KB
Bisection.hpp 5KB
chiSquare.hpp 5KB
geometric.hpp 5KB
TypeTraits.hpp 5KB
wahbasProblem.hpp 5KB
hypot.hpp 5KB
rms.hpp 5KB
poisson.hpp 5KB
studentT.hpp 5KB
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
暮苍梧~
- 粉丝: 41
- 资源: 258
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 学生信息管理系统-java
- 基于目标检测的刀具检测数据集(VOC格式进行标注,包含858张标注图像数据)
- 【unity开发】资源godot-v3.5.3.zip
- 【PHP+mysql】社区交流系统【源码+lw+部署文档+讲解】
- WSN覆盖优化MATLAB代码合集.zip
- 基于ASP的企业人事管理系统的设计与实现(源代码+lw).rar
- 基于ASP的网络聊天室的设计和实现(源代码+lw).rar
- pycocotools-windows-2.0.0.1-cp37-cp37m-win-amd64.whl
- 汉诺塔python.docx
- 讯飞星火大模型的Java SDK 易使用、开箱即用、支持异常、输出、会话结束、会话结束Token信息返回等多种自定义回调处理
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功