#include <filesystem>
#include <iostream>
int main()
{
auto a2 = a1.
astype<
double>();
auto a3 = nc::linspace<int>(1, 10, 5);
auto a4 = nc::arange<int>(3, 7);
auto a5 = nc::eye<int>(4);
auto a6 = nc::zeros<int>(3, 4);
auto a8 = nc::ones<int>(3, 4);
auto a12 = nc::empty<int>(3, 4);
auto a14 = nc::random::randInt<int>({ 10, 10 }, 0, 100);
[[maybe_unused]] auto value = a14(2, 3);
auto slice = a14({ 2, 5 }, { 2, 5 });
auto rowSlice = a14(a14.rSlice(), 7);
auto values = a14[a14 > 50];
a14.putMask(a14 > 50, 666);
auto a15 = nc::random::randN<double>({ 3, 4 });
auto a16 = nc::random::randInt<int>({ 3, 4 }, 0, 10);
auto a17 = nc::random::rand<double>({ 3, 4 });
auto a = nc::random::randInt<int>({ 3, 4 }, 0, 10);
auto b = nc::random::randInt<int>({ 3, 4 }, 0, 10);
auto c = nc::random::randInt<int>({ 3, 4 }, 0, 10);
auto d = nc::random::randInt<int>({ 5, 5 }, 0, 10);
for (auto it = a.begin(); it < a.end(); ++it)
{
std::cout << *it << " ";
}
std::cout << std::endl;
for (auto& arrayValue : a)
{
std::cout << arrayValue << " ";
}
std::cout << std::endl;
auto a37 = a == b;
auto a39 = a != b;
#ifdef __cpp_structured_bindings
#else
auto& rows = rowsCols.first;
auto& cols = rowsCols.second;
#endif
auto value5 = nc::sum<int>(a);
auto value6 = nc::prod<int>(a);
a.print();
std::cout << a << std::endl;
auto tempDir = std::filesystem::temp_directory_path();
auto tempTxt = (tempDir / "temp.txt").string();
a.tofile(tempTxt, '\n');
auto a50 = nc::fromfile<int>(tempTxt, '\n');
auto tempBin = (tempDir / "temp.bin").string();
auto a51 = nc::load<int>(tempBin);
auto a60 = nc::power<int>(a, 4);
auto a71 = nc::norm<int>(a);
auto a72 = nc::dot<int>(a, b.transpose());
auto a73 = nc::random::randInt<int>({ 3, 3 }, 0, 10);
auto a74 = nc::random::randInt<int>({ 4, 3 }, 0, 10);
auto a75 = nc::random::randInt<int>({ 1, 4 }, 0, 10);
auto a78 = nc::linalg::matrix_power<int>(a73, 3);
auto a79 = nc::linalg::multi_dot<int>({ a, b.transpose(),
c });
return 0;
}
Holds 1D and 2D arrays, the main work horse of the NumCpp library.
Definition: NdArrayCore.hpp:139
self_type & reshape(size_type inSize)
Definition: NdArrayCore.hpp:4271
NdArray< dtypeOut > astype() const
Definition: NdArrayCore.hpp:2181
constexpr double pi
Pi.
Definition: Core/Constants.hpp:39
constexpr double c
speed of light
Definition: Core/Constants.hpp:36
const double nan
NaN.
Definition: Core/Constants.hpp:41
NdArray< double > inv(const NdArray< dtype > &inArray)
Definition: inv.hpp:54
auto det(const NdArray< dtype > &inArray)
Definition: det.hpp:131
NdArray< double > lstsq(const NdArray< dtype > &inA, const NdArray< dtype > &inB, double inTolerance=1e-12)
Definition: lstsq.hpp:57
void svd(const NdArray< dtype > &inArray, NdArray< double > &outU, NdArray< double > &outS, NdArray< double > &outVt)
Definition: svd.hpp:51
dtype f(GeneratorType &generator, dtype inDofN, dtype inDofD)
Definition: f.hpp:56
void seed(int inSeed)
Definition: generator.hpp:46
dtype choice(const NdArray< dtype > &inArray)
Definition: choice.hpp:102
NdArray< dtype > triu(uint32 inN, uint32 inM, int32 inOffset=0)
Definition: tri.hpp:175
NdArray< bool > not_equal(const NdArray< dtype > &inArray1, const NdArray< dtype > &inArray2)
Definition: not_equal.hpp:46
NdArray< dtype > min(const NdArray< dtype > &inArray, Axis inAxis=Axis::NONE)
Definition: min.hpp:44
double remainder(dtype inValue1, dtype inValue2) noexcept
Definition: remainder.hpp:53
NdArray< dtype > tril(uint32 inN, int32 inOffset=0)
Definition: tri.hpp:50
auto expm1(dtype inValue) noexcept
Definition: expm1.hpp:48
double cbrt(dtype inValue) noexcept
Definition: cbrt.hpp:48
NdArray< double > mean(const NdArray< dtype > &inArray, Axis inAxis=Axis::NONE)
Definition: mean.hpp:52
constexpr dtype square(dtype inValue) noexcept
Definition: square.hpp:47
std::pair< NdArray< uint32 >, NdArray< uint32 > > nonzero(const NdArray< dtype > &inArray)
Definition: nonzero.hpp:48
NdArray< dtype > diagonal(const NdArray< dtype > &inArray, int32 inOffset=0, Axis inAxis=Axis::ROW)
Definition: diagonal.hpp:47
NdArray< uint32 > argsort(const NdArray< dtype > &inArray, Axis inAxis=Axis::NONE)
Definition: argsort.hpp:46
NdArray< dtype > sort(const NdArray< dtype > &inArray, Axis inAxis=Axis::NONE)
Definition: sort.hpp:46
auto tanh(dtype inValue) noexcept
Definition: tanh.hpp:49
auto log(dtype inValue) noexcept
Definition: log.hpp:50
auto sin(dtype inValue) noexcept
Definition: sin.hpp:49
NdArray< bool > logical_and(const NdArray< dtype > &inArray1, const NdArray< dtype > &inArray2)
Definition: logical_and.hpp:50
int8 sign(dtype inValue) noexcept
Definition: sign.hpp:52
auto tan(dtype inValue) noexcept
Definition: tan.hpp:49
dtype clip(dtype inValue, dtype inMinValue, dtype inMaxValue)
Definition: clip.hpp:50
auto log1p(dtype inValue) noexcept
Definition: log1p.hpp:51
constexpr double interp(dtype inValue1, dtype inValue2, double inPercent) noexcept
Definition: Functions/interp.hpp:48
NdArray< bool > logical_or(const NdArray< dtype > &inArray1, const NdArray< dtype > &inArray2)
Definition: logical_or.hpp:50
NdArray< bool > any(const NdArray< dtype > &inArray, Axis inAxis=Axis::NONE)
Definition: any.hpp:46
NdArray< bool > equal(const NdArray< dtype > &inArray1, const NdArray< dtype > &inArray2)
Definition: equal.hpp:45
auto abs(dtype inValue) noexcept
Definition: abs.hpp:49
auto cos(dtype inValue) noexcept
Definition: cos.hpp:49
auto sinh(dtype inValue) noexcept
Definition: sinh.hpp:49
NdArray< dtype > where(const NdArray< bool > &inMask, const NdArray< dtype > &inA, const NdArray< dtype > &inB)
Definition: where.hpp:52
NdArray< double > nans(uint32 inSquareSize)
Definition: nans.hpp:45
NdArray< dtype > flipud(const NdArray< dtype > &inArray)
Definition: flipud.hpp:46
NdArray< bool > isclose(const NdArray< dtype > &inArray1, const NdArray< dtype > &inArray2, double inRtol=1e-05, double inAtol=1e-08)
Definition: isclose.hpp:58
NdArray< dtype > unique(const NdArray< dtype > &inArray)
Definition: unique.hpp:53
auto sqrt(dtype inValue) noexcept
Definition: sqrt.hpp:48
NdArray< dtype > diff(const NdArray< dtype > &inArray, Axis inAxis=Axis::NONE)
Definition: diff.hpp:52
NdArray< uint32 > argmax(const NdArray< dtype > &inArray, Axis inAxis=Axis::NONE)
Definition: argmax.hpp:46
NdArray< dtype > hstack(std::initializer_list< NdArray< dtype > > inArrayList)
Definition: hstack.hpp:50
NdArray< bool > all(const NdArray< dtype > &inArray, Axis inAxis=Axis::NONE)
Definition: all.hpp:46
NdArray< uint32 > count_nonzero(const NdArray< dtype > &inArray, Axis inAxis=Axis::NONE)
Definition: count_nonzero.hpp:49
NdArray< dtype > append(const NdArray< dtype > &inArray, const NdArray< dtype > &inAppendValues, Axis inAxis=Axis::NONE)
Definition: append.hpp:53
auto cosh(dtype inValue) noexcept
Definition: cosh.hpp:49
NdArray< dtype > stack(std::initializer_list< NdArray< dtype > > inArrayList, Axis inAxis=Axis::NONE)
Definition: stack.hpp:88
NdArray< dtype > setdiff1d(const NdArray< dtype > &inArray1, const NdArray< dtype > &inArray2)
Definition: setdiff1d.hpp:54
bool isnan(dtype inValue) noexcept
Definition: isnan.hpp:49
bool allclose(const NdArray< dtype > &inArray1, const NdArray< dtype > &inArray2, double inTolerance=1e-5)
Definition: allclose.hpp:54
NdArray< dtype > flip(const NdArray< dtype > &inArray, Axis inAxis=Axis::NONE)
Definition: flip.hpp:47
NdArray< uint32 > argmin(const NdArray< dtype > &inArray, Axis inAxis=Axis::NONE)
Definition: argmin.hpp:46
auto exp(dtype inValue) noexcept
Definition: exp.hpp:49
NdArray< dtype > fliplr(const NdArray< dtype > &inArray)
Definition: fliplr.hpp:46
NdArray< dtype > max(const NdArray< dtype > &inArray, Axis inAxis=Axis::NONE)
Definition: max.hpp:44
void dump(const NdArray< dtype > &inArray, const std::string &inFilename)
Definition: dump.hpp:45
NdArray< dtype > vstack(std::initializer_list< NdArray< dtype > > inArrayList)
Definition: vstack.hpp:49