mirror of
https://github.com/slsdetectorgroup/aare.git
synced 2025-06-08 05:30:41 +02:00
391 lines
50 KiB
TeX
391 lines
50 KiB
TeX
\doxysection{NDArray.\+hpp}
|
|
\hypertarget{NDArray_8hpp_source}{}\label{NDArray_8hpp_source}\index{core/include/aare/core/NDArray.hpp@{core/include/aare/core/NDArray.hpp}}
|
|
\mbox{\hyperlink{NDArray_8hpp}{Go to the documentation of this file.}}
|
|
\begin{DoxyCode}{0}
|
|
\DoxyCodeLine{00001\ \textcolor{preprocessor}{\#pragma\ once}}
|
|
\DoxyCodeLine{00002\ \textcolor{comment}{/*}}
|
|
\DoxyCodeLine{00003\ \textcolor{comment}{Container\ holding\ image\ data,\ or\ a\ time\ series\ of\ image\ data\ in\ contigious}}
|
|
\DoxyCodeLine{00004\ \textcolor{comment}{memory.}}
|
|
\DoxyCodeLine{00005\ \textcolor{comment}{}}
|
|
\DoxyCodeLine{00006\ \textcolor{comment}{}}
|
|
\DoxyCodeLine{00007\ \textcolor{comment}{TODO!\ Add\ expression\ templates\ for\ operators}}
|
|
\DoxyCodeLine{00008\ \textcolor{comment}{}}
|
|
\DoxyCodeLine{00009\ \textcolor{comment}{*/}}
|
|
\DoxyCodeLine{00010\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{NDView_8hpp}{aare/core/NDView.hpp}}"{}}}
|
|
\DoxyCodeLine{00011\ }
|
|
\DoxyCodeLine{00012\ \textcolor{preprocessor}{\#include\ <algorithm>}}
|
|
\DoxyCodeLine{00013\ \textcolor{preprocessor}{\#include\ <array>}}
|
|
\DoxyCodeLine{00014\ \textcolor{preprocessor}{\#include\ <cmath>}}
|
|
\DoxyCodeLine{00015\ \textcolor{preprocessor}{\#include\ <fmt/format.h>}}
|
|
\DoxyCodeLine{00016\ \textcolor{preprocessor}{\#include\ <fstream>}}
|
|
\DoxyCodeLine{00017\ \textcolor{preprocessor}{\#include\ <iomanip>}}
|
|
\DoxyCodeLine{00018\ \textcolor{preprocessor}{\#include\ <iostream>}}
|
|
\DoxyCodeLine{00019\ \textcolor{preprocessor}{\#include\ <numeric>}}
|
|
\DoxyCodeLine{00020\ }
|
|
\DoxyCodeLine{00021\ \textcolor{keyword}{namespace\ }\mbox{\hyperlink{namespaceaare}{aare}}\ \{}
|
|
\DoxyCodeLine{00022\ }
|
|
\DoxyCodeLine{00023\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ s\textcolor{keywordtype}{size\_t}\ Ndim\ =\ 2>\ \textcolor{keyword}{class\ }\mbox{\hyperlink{classaare_1_1NDArray}{NDArray}}\ \{}
|
|
\DoxyCodeLine{00024\ \ \ \textcolor{keyword}{public}:}
|
|
\DoxyCodeLine{00025\ \ \ \ \ \mbox{\hyperlink{classaare_1_1NDArray_a41d9f4d28c02f18b60a1fa297249559d}{NDArray}}()\ :\ \mbox{\hyperlink{classaare_1_1NDArray_af00f150a2867b13b37a3f711ba5f7c3b}{shape\_}}(),\ \mbox{\hyperlink{classaare_1_1NDArray_a5275d4999e7422458d472620f792573a}{strides\_}}(\mbox{\hyperlink{namespaceaare_a737039de5f8de78a691a40b9ceb47b64}{c\_strides}}<Ndim>(\mbox{\hyperlink{classaare_1_1NDArray_af00f150a2867b13b37a3f711ba5f7c3b}{shape\_}})),\ \mbox{\hyperlink{classaare_1_1NDArray_ac64b3e00ad3b69f6bc46def403614ccd}{size\_}}(0),\ \mbox{\hyperlink{classaare_1_1NDArray_ad2357b3a2dca6ff0ef6705d9913227ca}{data\_}}(nullptr)\{\};}
|
|
\DoxyCodeLine{00026\ }
|
|
\DoxyCodeLine{00027\ \ \ \ \ \textcolor{keyword}{explicit}\ \mbox{\hyperlink{classaare_1_1NDArray_a2e965c4b7501e355b3cbd2bd3b33f32f}{NDArray}}(std::array<ssize\_t,\ Ndim>\ \mbox{\hyperlink{classaare_1_1NDArray_a6dfa3b12cb66147effe2a42435dd346d}{shape}})}
|
|
\DoxyCodeLine{00028\ \ \ \ \ \ \ \ \ :\ \mbox{\hyperlink{classaare_1_1NDArray_af00f150a2867b13b37a3f711ba5f7c3b}{shape\_}}(\mbox{\hyperlink{classaare_1_1NDArray_a6dfa3b12cb66147effe2a42435dd346d}{shape}}),\ \mbox{\hyperlink{classaare_1_1NDArray_a5275d4999e7422458d472620f792573a}{strides\_}}(\mbox{\hyperlink{namespaceaare_a737039de5f8de78a691a40b9ceb47b64}{c\_strides}}<Ndim>(\mbox{\hyperlink{classaare_1_1NDArray_af00f150a2867b13b37a3f711ba5f7c3b}{shape\_}})),}
|
|
\DoxyCodeLine{00029\ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{classaare_1_1NDArray_ac64b3e00ad3b69f6bc46def403614ccd}{size\_}}(std::accumulate(\mbox{\hyperlink{classaare_1_1NDArray_af00f150a2867b13b37a3f711ba5f7c3b}{shape\_}}.\mbox{\hyperlink{classaare_1_1NDArray_a3241eee2a316d350390c3b9a2e3ba091}{begin}}(),\ \mbox{\hyperlink{classaare_1_1NDArray_af00f150a2867b13b37a3f711ba5f7c3b}{shape\_}}.\mbox{\hyperlink{classaare_1_1NDArray_aeac1405793b07e8433b53f1e04740ec8}{end}}(),\ 1,\ std::multiplies<ssize\_t>())),\ \mbox{\hyperlink{classaare_1_1NDArray_ad2357b3a2dca6ff0ef6705d9913227ca}{data\_}}(new\ T[\mbox{\hyperlink{classaare_1_1NDArray_ac64b3e00ad3b69f6bc46def403614ccd}{size\_}}])\{\};}
|
|
\DoxyCodeLine{00030\ }
|
|
\DoxyCodeLine{00031\ \ \ \ \ \mbox{\hyperlink{classaare_1_1NDArray_a5f2e568908401ef19e82f63379e80d97}{NDArray}}(std::array<ssize\_t,\ Ndim>\ \mbox{\hyperlink{classaare_1_1NDArray_a6dfa3b12cb66147effe2a42435dd346d}{shape}},\ T\ \mbox{\hyperlink{classaare_1_1NDArray_ad8f804893325ae1553d33accec070e92}{value}})\ :\ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray}}(\mbox{\hyperlink{classaare_1_1NDArray_a6dfa3b12cb66147effe2a42435dd346d}{shape}})\ \{\ this-\/>\mbox{\hyperlink{classaare_1_1NDArray_a06c658e8a6490c74fb9878b14a4faf1d}{operator=}}(value);\ \}}
|
|
\DoxyCodeLine{00032\ }
|
|
\DoxyCodeLine{00033\ \ \ \ \ \textcolor{comment}{/*\ When\ constructing\ from\ a\ NDView\ we\ need\ to\ copy\ the\ data\ since}}
|
|
\DoxyCodeLine{00034\ \textcolor{comment}{\ \ \ \ NDArray\ expect\ to\ own\ its\ data,\ and\ span\ is\ just\ a\ view*/}}
|
|
\DoxyCodeLine{00035\ \ \ \ \ \mbox{\hyperlink{classaare_1_1NDArray_a04cbc1cc0ba2aaac434b43674b0f820e}{NDArray}}(\mbox{\hyperlink{classaare_1_1NDView}{NDView<T,\ Ndim>}}\ \mbox{\hyperlink{classaare_1_1NDArray_ac5ffe1a4b9dde8f2ec6dba021951c922}{span}})\ :\ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray}}(\mbox{\hyperlink{classaare_1_1NDArray_ac5ffe1a4b9dde8f2ec6dba021951c922}{span}}.\mbox{\hyperlink{classaare_1_1NDArray_a6dfa3b12cb66147effe2a42435dd346d}{shape}}())\ \{}
|
|
\DoxyCodeLine{00036\ \ \ \ \ \ \ \ \ std::copy(\mbox{\hyperlink{classaare_1_1NDArray_ac5ffe1a4b9dde8f2ec6dba021951c922}{span}}.begin(),\ \mbox{\hyperlink{classaare_1_1NDArray_ac5ffe1a4b9dde8f2ec6dba021951c922}{span}}.end(),\ \mbox{\hyperlink{classaare_1_1NDArray_a3241eee2a316d350390c3b9a2e3ba091}{begin}}());}
|
|
\DoxyCodeLine{00037\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ fmt::print("{}NDArray(NDView<T,\ Ndim>\ span)\(\backslash\)n"{});}}
|
|
\DoxyCodeLine{00038\ \ \ \ \ \}}
|
|
\DoxyCodeLine{00039\ }
|
|
\DoxyCodeLine{00040\ \ \ \ \ \textcolor{comment}{//\ Move\ constructor}}
|
|
\DoxyCodeLine{00041\ \ \ \ \ \mbox{\hyperlink{classaare_1_1NDArray_a804d1971ae1fc08375ec4bad36a42fe7}{NDArray}}(\mbox{\hyperlink{classaare_1_1NDArray}{NDArray}}\ \&\&other)}
|
|
\DoxyCodeLine{00042\ \ \ \ \ \ \ \ \ :\ \mbox{\hyperlink{classaare_1_1NDArray_af00f150a2867b13b37a3f711ba5f7c3b}{shape\_}}(other.\mbox{\hyperlink{classaare_1_1NDArray_af00f150a2867b13b37a3f711ba5f7c3b}{shape\_}}),\ \mbox{\hyperlink{classaare_1_1NDArray_a5275d4999e7422458d472620f792573a}{strides\_}}(\mbox{\hyperlink{namespaceaare_a737039de5f8de78a691a40b9ceb47b64}{c\_strides}}<Ndim>(\mbox{\hyperlink{classaare_1_1NDArray_af00f150a2867b13b37a3f711ba5f7c3b}{shape\_}})),\ \mbox{\hyperlink{classaare_1_1NDArray_ac64b3e00ad3b69f6bc46def403614ccd}{size\_}}(other.\mbox{\hyperlink{classaare_1_1NDArray_ac64b3e00ad3b69f6bc46def403614ccd}{size\_}}),\ \mbox{\hyperlink{classaare_1_1NDArray_ad2357b3a2dca6ff0ef6705d9913227ca}{data\_}}(nullptr)\ \{}
|
|
\DoxyCodeLine{00043\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{classaare_1_1NDArray_ad2357b3a2dca6ff0ef6705d9913227ca}{data\_}}\ =\ other.data\_;}
|
|
\DoxyCodeLine{00044\ \ \ \ \ \ \ \ \ other.reset();}
|
|
\DoxyCodeLine{00045\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ fmt::print("{}NDArray(NDArray\ \&\&other)\(\backslash\)n"{});}}
|
|
\DoxyCodeLine{00046\ \ \ \ \ \}}
|
|
\DoxyCodeLine{00047\ }
|
|
\DoxyCodeLine{00048\ \ \ \ \ \textcolor{comment}{//\ Copy\ constructor}}
|
|
\DoxyCodeLine{00049\ \ \ \ \ \mbox{\hyperlink{classaare_1_1NDArray_a1485287520ba5919ebb4fa2bc84b3a67}{NDArray}}(\textcolor{keyword}{const}\ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray}}\ \&other)}
|
|
\DoxyCodeLine{00050\ \ \ \ \ \ \ \ \ :\ \mbox{\hyperlink{classaare_1_1NDArray_af00f150a2867b13b37a3f711ba5f7c3b}{shape\_}}(other.\mbox{\hyperlink{classaare_1_1NDArray_af00f150a2867b13b37a3f711ba5f7c3b}{shape\_}}),\ \mbox{\hyperlink{classaare_1_1NDArray_a5275d4999e7422458d472620f792573a}{strides\_}}(\mbox{\hyperlink{namespaceaare_a737039de5f8de78a691a40b9ceb47b64}{c\_strides}}<Ndim>(\mbox{\hyperlink{classaare_1_1NDArray_af00f150a2867b13b37a3f711ba5f7c3b}{shape\_}})),\ \mbox{\hyperlink{classaare_1_1NDArray_ac64b3e00ad3b69f6bc46def403614ccd}{size\_}}(other.\mbox{\hyperlink{classaare_1_1NDArray_ac64b3e00ad3b69f6bc46def403614ccd}{size\_}}),\ \mbox{\hyperlink{classaare_1_1NDArray_ad2357b3a2dca6ff0ef6705d9913227ca}{data\_}}(new\ T[\mbox{\hyperlink{classaare_1_1NDArray_ac64b3e00ad3b69f6bc46def403614ccd}{size\_}}])\ \{}
|
|
\DoxyCodeLine{00051\ \ \ \ \ \ \ \ \ std::copy(other.\mbox{\hyperlink{classaare_1_1NDArray_ad2357b3a2dca6ff0ef6705d9913227ca}{data\_}},\ other.\mbox{\hyperlink{classaare_1_1NDArray_ad2357b3a2dca6ff0ef6705d9913227ca}{data\_}}\ +\ \mbox{\hyperlink{classaare_1_1NDArray_ac64b3e00ad3b69f6bc46def403614ccd}{size\_}},\ \mbox{\hyperlink{classaare_1_1NDArray_ad2357b3a2dca6ff0ef6705d9913227ca}{data\_}});}
|
|
\DoxyCodeLine{00052\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ fmt::print("{}NDArray(const\ NDArray\ \&other)\(\backslash\)n"{});}}
|
|
\DoxyCodeLine{00053\ \ \ \ \ \}}
|
|
\DoxyCodeLine{00054\ }
|
|
\DoxyCodeLine{00055\ \ \ \ \ \mbox{\hyperlink{classaare_1_1NDArray_a702d2a7566dd9796eb891d043159fd41}{\string~NDArray}}()\ \{\ \textcolor{keyword}{delete}[]\ \mbox{\hyperlink{classaare_1_1NDArray_ad2357b3a2dca6ff0ef6705d9913227ca}{data\_}};\ \}}
|
|
\DoxyCodeLine{00056\ }
|
|
\DoxyCodeLine{00057\ \ \ \ \ \textcolor{keyword}{auto}\ \mbox{\hyperlink{classaare_1_1NDArray_a3241eee2a316d350390c3b9a2e3ba091}{begin}}()\ \{\ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{classaare_1_1NDArray_ad2357b3a2dca6ff0ef6705d9913227ca}{data\_}};\ \}}
|
|
\DoxyCodeLine{00058\ \ \ \ \ \textcolor{keyword}{auto}\ \mbox{\hyperlink{classaare_1_1NDArray_aeac1405793b07e8433b53f1e04740ec8}{end}}()\ \{\ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{classaare_1_1NDArray_ad2357b3a2dca6ff0ef6705d9913227ca}{data\_}}\ +\ \mbox{\hyperlink{classaare_1_1NDArray_ac64b3e00ad3b69f6bc46def403614ccd}{size\_}};\ \}}
|
|
\DoxyCodeLine{00059\ }
|
|
\DoxyCodeLine{00060\ \ \ \ \ \textcolor{keyword}{using\ }\mbox{\hyperlink{classaare_1_1NDArray_a0574380e6b0f3d77a8364c942123c24a}{value\_type}}\ =\ T;}
|
|
\DoxyCodeLine{00061\ }
|
|
\DoxyCodeLine{00062\ \ \ \ \ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray}}\ \&\mbox{\hyperlink{classaare_1_1NDArray_a06c658e8a6490c74fb9878b14a4faf1d}{operator=}}(\mbox{\hyperlink{classaare_1_1NDArray}{NDArray}}\ \&\&other);\ \ \ \ \ \ \textcolor{comment}{//\ Move\ assign}}
|
|
\DoxyCodeLine{00063\ \ \ \ \ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray}}\ \&\mbox{\hyperlink{classaare_1_1NDArray_a713fff54cdec54f27ec92c1f317a46c7}{operator=}}(\textcolor{keyword}{const}\ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray}}\ \&other);\ \textcolor{comment}{//\ Copy\ assign}}
|
|
\DoxyCodeLine{00064\ }
|
|
\DoxyCodeLine{00065\ \ \ \ \ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray}}\ \mbox{\hyperlink{classaare_1_1NDArray_afcc5f259b1bd0cadcadbf2b52795babc}{operator+}}(\textcolor{keyword}{const}\ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray}}\ \&other);}
|
|
\DoxyCodeLine{00066\ \ \ \ \ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray}}\ \&\mbox{\hyperlink{classaare_1_1NDArray_a27eb7b3599cb62297832d4a3d8022f32}{operator+=}}(\textcolor{keyword}{const}\ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray}}\ \&other);}
|
|
\DoxyCodeLine{00067\ \ \ \ \ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray}}\ \mbox{\hyperlink{classaare_1_1NDArray_aac96eb2ce76cd90d44eb3b19408d2434}{operator-\/}}(\textcolor{keyword}{const}\ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray}}\ \&other);}
|
|
\DoxyCodeLine{00068\ \ \ \ \ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray}}\ \&\mbox{\hyperlink{classaare_1_1NDArray_aad602fc6734cb85112f2a8edf91d1c70}{operator-\/=}}(\textcolor{keyword}{const}\ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray}}\ \&other);}
|
|
\DoxyCodeLine{00069\ \ \ \ \ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray}}\ \mbox{\hyperlink{classaare_1_1NDArray_ae67f899470bc9f8c8df8b54d544f9171}{operator*}}(\textcolor{keyword}{const}\ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray}}\ \&other);}
|
|
\DoxyCodeLine{00070\ \ \ \ \ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray}}\ \&\mbox{\hyperlink{classaare_1_1NDArray_a54edf15f9669a1e4601fa4aa936a2d92}{operator*=}}(\textcolor{keyword}{const}\ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray}}\ \&other);}
|
|
\DoxyCodeLine{00071\ \ \ \ \ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray}}\ \mbox{\hyperlink{classaare_1_1NDArray_a59dc47216852c36191e0cecc869131e1}{operator/}}(\textcolor{keyword}{const}\ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray}}\ \&other);}
|
|
\DoxyCodeLine{00072\ \ \ \ \ \textcolor{comment}{//\ NDArray\&\ operator/=(const\ NDArray\&\ other);}}
|
|
\DoxyCodeLine{00073\ \ \ \ \ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ V>\ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray}}\ \&\mbox{\hyperlink{classaare_1_1NDArray_a2a6260113ca73c86d37d0444b5148c49}{operator/=}}(\textcolor{keyword}{const}\ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray<V,\ Ndim>}}\ \&other)\ \{}
|
|
\DoxyCodeLine{00074\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ check\ shape}}
|
|
\DoxyCodeLine{00075\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (\mbox{\hyperlink{classaare_1_1NDArray_af00f150a2867b13b37a3f711ba5f7c3b}{shape\_}}\ ==\ other.\mbox{\hyperlink{classaare_1_1NDArray_a6dfa3b12cb66147effe2a42435dd346d}{shape}}())\ \{}
|
|
\DoxyCodeLine{00076\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keywordtype}{int}\ i\ =\ 0;\ i\ <\ \mbox{\hyperlink{classaare_1_1NDArray_ac64b3e00ad3b69f6bc46def403614ccd}{size\_}};\ ++i)\ \{}
|
|
\DoxyCodeLine{00077\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{classaare_1_1NDArray_ad2357b3a2dca6ff0ef6705d9913227ca}{data\_}}[i]\ /=\ other(i);}
|
|
\DoxyCodeLine{00078\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
|
|
\DoxyCodeLine{00079\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ *\textcolor{keyword}{this};}
|
|
\DoxyCodeLine{00080\ \ \ \ \ \ \ \ \ \}\ \textcolor{keywordflow}{else}\ \{}
|
|
\DoxyCodeLine{00081\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{throw}(std::runtime\_error(\textcolor{stringliteral}{"{}Shape\ of\ NDArray\ must\ match"{}}));}
|
|
\DoxyCodeLine{00082\ \ \ \ \ \ \ \ \ \}}
|
|
\DoxyCodeLine{00083\ \ \ \ \ \}}
|
|
\DoxyCodeLine{00084\ }
|
|
\DoxyCodeLine{00085\ \ \ \ \ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray<bool,\ Ndim>}}\ \mbox{\hyperlink{classaare_1_1NDArray_a569e8de85121a4a6315c556870b48931}{operator>}}(\textcolor{keyword}{const}\ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray}}\ \&other);}
|
|
\DoxyCodeLine{00086\ }
|
|
\DoxyCodeLine{00087\ \ \ \ \ \textcolor{keywordtype}{bool}\ \mbox{\hyperlink{classaare_1_1NDArray_ad20b30f1abea56b82196f030b1492027}{operator==}}(\textcolor{keyword}{const}\ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray}}\ \&other)\ \textcolor{keyword}{const};}
|
|
\DoxyCodeLine{00088\ \ \ \ \ \textcolor{keywordtype}{bool}\ \mbox{\hyperlink{classaare_1_1NDArray_a90408ebad72f63d0288b869b3e32e50b}{operator!=}}(\textcolor{keyword}{const}\ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray}}\ \&other)\ \textcolor{keyword}{const};}
|
|
\DoxyCodeLine{00089\ }
|
|
\DoxyCodeLine{00090\ \ \ \ \ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray}}\ \&\mbox{\hyperlink{classaare_1_1NDArray_a5f249dd42235efcf858caca096300d02}{operator=}}(\textcolor{keyword}{const}\ T\ \&);}
|
|
\DoxyCodeLine{00091\ \ \ \ \ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray}}\ \&\mbox{\hyperlink{classaare_1_1NDArray_aa15fe27ef06f8a230345161990ce8381}{operator+=}}(\textcolor{keyword}{const}\ T\ \&);}
|
|
\DoxyCodeLine{00092\ \ \ \ \ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray}}\ \mbox{\hyperlink{classaare_1_1NDArray_a86042f9185412e1d68422765d56ce769}{operator+}}(\textcolor{keyword}{const}\ T\ \&);}
|
|
\DoxyCodeLine{00093\ \ \ \ \ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray}}\ \&\mbox{\hyperlink{classaare_1_1NDArray_ad65261a50424d112852f046426c66267}{operator-\/=}}(\textcolor{keyword}{const}\ T\ \&);}
|
|
\DoxyCodeLine{00094\ \ \ \ \ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray}}\ \mbox{\hyperlink{classaare_1_1NDArray_ae8fcc0b6cb14d353286ffdf2c914200f}{operator-\/}}(\textcolor{keyword}{const}\ T\ \&);}
|
|
\DoxyCodeLine{00095\ \ \ \ \ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray}}\ \&\mbox{\hyperlink{classaare_1_1NDArray_afe950d8cf1bdc97d450f912d1d903c09}{operator*=}}(\textcolor{keyword}{const}\ T\ \&);}
|
|
\DoxyCodeLine{00096\ \ \ \ \ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray}}\ \mbox{\hyperlink{classaare_1_1NDArray_a2d6d56700f622c3175b9b82f043c3b94}{operator*}}(\textcolor{keyword}{const}\ T\ \&);}
|
|
\DoxyCodeLine{00097\ \ \ \ \ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray}}\ \&\mbox{\hyperlink{classaare_1_1NDArray_a8658f5217fcd0ac6f6900b4f013aed16}{operator/=}}(\textcolor{keyword}{const}\ T\ \&);}
|
|
\DoxyCodeLine{00098\ \ \ \ \ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray}}\ \mbox{\hyperlink{classaare_1_1NDArray_a6a69a2fce0631e9ef9b1587e75cf1568}{operator/}}(\textcolor{keyword}{const}\ T\ \&);}
|
|
\DoxyCodeLine{00099\ }
|
|
\DoxyCodeLine{00100\ \ \ \ \ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray}}\ \&\mbox{\hyperlink{classaare_1_1NDArray_ab01fdad1a92b1629996f15ff0cf79ac3}{operator\&=}}(\textcolor{keyword}{const}\ T\ \&);}
|
|
\DoxyCodeLine{00101\ }
|
|
\DoxyCodeLine{00102\ \ \ \ \ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{classaare_1_1NDArray_af36c03e7a91fe932d60739d5ea30f1f2}{sqrt}}()\ \{}
|
|
\DoxyCodeLine{00103\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keywordtype}{int}\ i\ =\ 0;\ i\ <\ \mbox{\hyperlink{classaare_1_1NDArray_ac64b3e00ad3b69f6bc46def403614ccd}{size\_}};\ ++i)\ \{}
|
|
\DoxyCodeLine{00104\ \ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{classaare_1_1NDArray_ad2357b3a2dca6ff0ef6705d9913227ca}{data\_}}[i]\ =\ std::sqrt(\mbox{\hyperlink{classaare_1_1NDArray_ad2357b3a2dca6ff0ef6705d9913227ca}{data\_}}[i]);}
|
|
\DoxyCodeLine{00105\ \ \ \ \ \ \ \ \ \}}
|
|
\DoxyCodeLine{00106\ \ \ \ \ \}}
|
|
\DoxyCodeLine{00107\ }
|
|
\DoxyCodeLine{00108\ \ \ \ \ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray}}\ \&\mbox{\hyperlink{classaare_1_1NDArray_a040dd143e6dc040703b33d91ba929271}{operator++}}();\ \textcolor{comment}{//\ pre\ inc}}
|
|
\DoxyCodeLine{00109\ }
|
|
\DoxyCodeLine{00110\ \ \ \ \ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}...\ Ix>\ \textcolor{keyword}{typename}\ std::enable\_if<\textcolor{keyword}{sizeof}...(Ix)\ ==\ Ndim,\ T\ \&>::type\ \textcolor{keyword}{operator}()(Ix...\ index)\ \{}
|
|
\DoxyCodeLine{00111\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{classaare_1_1NDArray_ad2357b3a2dca6ff0ef6705d9913227ca}{data\_}}[\mbox{\hyperlink{namespaceaare_a45ca88f1c8c15d6e4d08b14e21a3e579}{element\_offset}}(\mbox{\hyperlink{classaare_1_1NDArray_a5275d4999e7422458d472620f792573a}{strides\_}},\ index...)];}
|
|
\DoxyCodeLine{00112\ \ \ \ \ \}}
|
|
\DoxyCodeLine{00113\ }
|
|
\DoxyCodeLine{00114\ \ \ \ \ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}...\ Ix>\ \textcolor{keyword}{typename}\ std::enable\_if<\textcolor{keyword}{sizeof}...(Ix)\ ==\ Ndim,\ T\ \&>::type\ \textcolor{keyword}{operator}()(Ix...\ index)\ \textcolor{keyword}{const}\ \{}
|
|
\DoxyCodeLine{00115\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{classaare_1_1NDArray_ad2357b3a2dca6ff0ef6705d9913227ca}{data\_}}[\mbox{\hyperlink{namespaceaare_a45ca88f1c8c15d6e4d08b14e21a3e579}{element\_offset}}(\mbox{\hyperlink{classaare_1_1NDArray_a5275d4999e7422458d472620f792573a}{strides\_}},\ index...)];}
|
|
\DoxyCodeLine{00116\ \ \ \ \ \}}
|
|
\DoxyCodeLine{00117\ }
|
|
\DoxyCodeLine{00118\ \ \ \ \ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}...\ Ix>\ \textcolor{keyword}{typename}\ std::enable\_if<\textcolor{keyword}{sizeof}...(Ix)\ ==\ Ndim,\ T>::type\ \mbox{\hyperlink{classaare_1_1NDArray_ad8f804893325ae1553d33accec070e92}{value}}(Ix...\ index)\ \{}
|
|
\DoxyCodeLine{00119\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{classaare_1_1NDArray_ad2357b3a2dca6ff0ef6705d9913227ca}{data\_}}[\mbox{\hyperlink{namespaceaare_a45ca88f1c8c15d6e4d08b14e21a3e579}{element\_offset}}(\mbox{\hyperlink{classaare_1_1NDArray_a5275d4999e7422458d472620f792573a}{strides\_}},\ index...)];}
|
|
\DoxyCodeLine{00120\ \ \ \ \ \}}
|
|
\DoxyCodeLine{00121\ }
|
|
\DoxyCodeLine{00122\ \ \ \ \ T\ \&\mbox{\hyperlink{classaare_1_1NDArray_a8d75984e7f384c4c9d25bc04c6c14983}{operator()}}(\textcolor{keywordtype}{int}\ i)\ \{\ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{classaare_1_1NDArray_ad2357b3a2dca6ff0ef6705d9913227ca}{data\_}}[i];\ \}}
|
|
\DoxyCodeLine{00123\ \ \ \ \ \textcolor{keyword}{const}\ T\ \&\mbox{\hyperlink{classaare_1_1NDArray_adf800cbb478a4f24ae24026034bafd43}{operator()}}(\textcolor{keywordtype}{int}\ i)\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{classaare_1_1NDArray_ad2357b3a2dca6ff0ef6705d9913227ca}{data\_}}[i];\ \}}
|
|
\DoxyCodeLine{00124\ }
|
|
\DoxyCodeLine{00125\ \ \ \ \ T\ *\mbox{\hyperlink{classaare_1_1NDArray_a77b3ca3e85d5a3e394248fdaab01c5a5}{data}}()\ \{\ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{classaare_1_1NDArray_ad2357b3a2dca6ff0ef6705d9913227ca}{data\_}};\ \}}
|
|
\DoxyCodeLine{00126\ \ \ \ \ std::byte\ *\mbox{\hyperlink{classaare_1_1NDArray_af289b6a162612ed74ad2fd0606a479a9}{buffer}}()\ \{\ \textcolor{keywordflow}{return}\ \textcolor{keyword}{reinterpret\_cast<}std::byte\ *\textcolor{keyword}{>}(\mbox{\hyperlink{classaare_1_1NDArray_ad2357b3a2dca6ff0ef6705d9913227ca}{data\_}});\ \}}
|
|
\DoxyCodeLine{00127\ \ \ \ \ ssize\_t\ \mbox{\hyperlink{classaare_1_1NDArray_a86632c60ddbdf7af8cfd3939df472127}{size}}()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{classaare_1_1NDArray_ac64b3e00ad3b69f6bc46def403614ccd}{size\_}};\ \}}
|
|
\DoxyCodeLine{00128\ \ \ \ \ \textcolor{keywordtype}{size\_t}\ \mbox{\hyperlink{classaare_1_1NDArray_ab1f9c68ddce8440f1fc220cbc1d865fc}{total\_bytes}}()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{classaare_1_1NDArray_ac64b3e00ad3b69f6bc46def403614ccd}{size\_}}\ *\ \textcolor{keyword}{sizeof}(T);\ \}}
|
|
\DoxyCodeLine{00129\ \ \ \ \ std::array<ssize\_t,\ Ndim>\ \mbox{\hyperlink{classaare_1_1NDArray_a6dfa3b12cb66147effe2a42435dd346d}{shape}}()\ const\ noexcept\ \{\ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{classaare_1_1NDArray_af00f150a2867b13b37a3f711ba5f7c3b}{shape\_}};\ \}}
|
|
\DoxyCodeLine{00130\ \ \ \ \ ssize\_t\ \mbox{\hyperlink{classaare_1_1NDArray_af765f5cb619ed79d44a000572b265589}{shape}}(ssize\_t\ i)\ \textcolor{keyword}{const}\ \textcolor{keyword}{noexcept}\ \{\ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{classaare_1_1NDArray_af00f150a2867b13b37a3f711ba5f7c3b}{shape\_}}[i];\ \}}
|
|
\DoxyCodeLine{00131\ \ \ \ \ std::array<ssize\_t,\ Ndim>\ \mbox{\hyperlink{classaare_1_1NDArray_a07369722ffea061203bfbfd4479c05e9}{strides}}()\ const\ noexcept\ \{\ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{classaare_1_1NDArray_a5275d4999e7422458d472620f792573a}{strides\_}};\ \}}
|
|
\DoxyCodeLine{00132\ \ \ \ \ std::array<ssize\_t,\ Ndim>\ \mbox{\hyperlink{classaare_1_1NDArray_a2ab19fc488009d3fce95fcf5bff6b10a}{byte\_strides}}()\ const\ noexcept\ \{}
|
|
\DoxyCodeLine{00133\ \ \ \ \ \ \ \ \ \textcolor{keyword}{auto}\ \mbox{\hyperlink{classaare_1_1NDArray_a2ab19fc488009d3fce95fcf5bff6b10a}{byte\_strides}}\ =\ \mbox{\hyperlink{classaare_1_1NDArray_a5275d4999e7422458d472620f792573a}{strides\_}};}
|
|
\DoxyCodeLine{00134\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keyword}{auto}\ \&val\ :\ \mbox{\hyperlink{classaare_1_1NDArray_a2ab19fc488009d3fce95fcf5bff6b10a}{byte\_strides}})}
|
|
\DoxyCodeLine{00135\ \ \ \ \ \ \ \ \ \ \ \ \ val\ *=\ \textcolor{keyword}{sizeof}(T);}
|
|
\DoxyCodeLine{00136\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{classaare_1_1NDArray_a2ab19fc488009d3fce95fcf5bff6b10a}{byte\_strides}};}
|
|
\DoxyCodeLine{00137\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ return\ strides\_;}}
|
|
\DoxyCodeLine{00138\ \ \ \ \ \}}
|
|
\DoxyCodeLine{00139\ }
|
|
\DoxyCodeLine{00140\ \ \ \ \ \mbox{\hyperlink{classaare_1_1NDView}{NDView<T,\ Ndim>}}\ \mbox{\hyperlink{classaare_1_1NDArray_ac5ffe1a4b9dde8f2ec6dba021951c922}{span}}()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{classaare_1_1NDView}{NDView<T,\ Ndim>}}\{\mbox{\hyperlink{classaare_1_1NDArray_ad2357b3a2dca6ff0ef6705d9913227ca}{data\_}},\ \mbox{\hyperlink{classaare_1_1NDArray_af00f150a2867b13b37a3f711ba5f7c3b}{shape\_}}\};\ \}}
|
|
\DoxyCodeLine{00141\ }
|
|
\DoxyCodeLine{00142\ \ \ \ \ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{classaare_1_1NDArray_ad49628442cc054b7c0b56b3104d9ef20}{Print}}();}
|
|
\DoxyCodeLine{00143\ \ \ \ \ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{classaare_1_1NDArray_a6084445eed769b89387b4aca53306513}{Print\_all}}();}
|
|
\DoxyCodeLine{00144\ \ \ \ \ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{classaare_1_1NDArray_a5dec49e82ec3abfa28bddfc328b1c4e9}{Print\_some}}();}
|
|
\DoxyCodeLine{00145\ }
|
|
\DoxyCodeLine{00146\ \ \ \ \ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{classaare_1_1NDArray_a98d5740082a649135587590dbbaa42e2}{reset}}()\ \{}
|
|
\DoxyCodeLine{00147\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{classaare_1_1NDArray_ad2357b3a2dca6ff0ef6705d9913227ca}{data\_}}\ =\ \textcolor{keyword}{nullptr};}
|
|
\DoxyCodeLine{00148\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{classaare_1_1NDArray_ac64b3e00ad3b69f6bc46def403614ccd}{size\_}}\ =\ 0;}
|
|
\DoxyCodeLine{00149\ \ \ \ \ \ \ \ \ std::fill(\mbox{\hyperlink{classaare_1_1NDArray_af00f150a2867b13b37a3f711ba5f7c3b}{shape\_}}.begin(),\ \mbox{\hyperlink{classaare_1_1NDArray_af00f150a2867b13b37a3f711ba5f7c3b}{shape\_}}.end(),\ 0);}
|
|
\DoxyCodeLine{00150\ \ \ \ \ \ \ \ \ std::fill(\mbox{\hyperlink{classaare_1_1NDArray_a5275d4999e7422458d472620f792573a}{strides\_}}.begin(),\ \mbox{\hyperlink{classaare_1_1NDArray_a5275d4999e7422458d472620f792573a}{strides\_}}.end(),\ 0);}
|
|
\DoxyCodeLine{00151\ \ \ \ \ \}}
|
|
\DoxyCodeLine{00152\ }
|
|
\DoxyCodeLine{00153\ \ \ \textcolor{keyword}{private}:}
|
|
\DoxyCodeLine{00154\ \ \ \ \ std::array<ssize\_t,\ Ndim>\ \mbox{\hyperlink{classaare_1_1NDArray_af00f150a2867b13b37a3f711ba5f7c3b}{shape\_}};}
|
|
\DoxyCodeLine{00155\ \ \ \ \ std::array<ssize\_t,\ Ndim>\ \mbox{\hyperlink{classaare_1_1NDArray_a5275d4999e7422458d472620f792573a}{strides\_}};}
|
|
\DoxyCodeLine{00156\ \ \ \ \ ssize\_t\ \mbox{\hyperlink{classaare_1_1NDArray_ac64b3e00ad3b69f6bc46def403614ccd}{size\_}};}
|
|
\DoxyCodeLine{00157\ \ \ \ \ T\ *\mbox{\hyperlink{classaare_1_1NDArray_ad2357b3a2dca6ff0ef6705d9913227ca}{data\_}};}
|
|
\DoxyCodeLine{00158\ \};}
|
|
\DoxyCodeLine{00159\ }
|
|
\DoxyCodeLine{00160\ \textcolor{comment}{//\ Move\ assign}}
|
|
\DoxyCodeLine{00161\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ s\textcolor{keywordtype}{size\_t}\ Ndim>\ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray<T,\ Ndim>}}\ \&\mbox{\hyperlink{classaare_1_1NDArray_a06c658e8a6490c74fb9878b14a4faf1d}{NDArray<T,\ Ndim>::operator=}}(\mbox{\hyperlink{classaare_1_1NDArray}{NDArray<T,\ Ndim>}}\ \&\&other)\ \{}
|
|
\DoxyCodeLine{00162\ \ \ \ \ \textcolor{keywordflow}{if}\ (\textcolor{keyword}{this}\ !=\ \&other)\ \{}
|
|
\DoxyCodeLine{00163\ \ \ \ \ \ \ \ \ \textcolor{keyword}{delete}[]\ data\_;}
|
|
\DoxyCodeLine{00164\ \ \ \ \ \ \ \ \ data\_\ =\ other.\mbox{\hyperlink{classaare_1_1NDArray_ad2357b3a2dca6ff0ef6705d9913227ca}{data\_}};}
|
|
\DoxyCodeLine{00165\ \ \ \ \ \ \ \ \ shape\_\ =\ other.shape\_;}
|
|
\DoxyCodeLine{00166\ \ \ \ \ \ \ \ \ size\_\ =\ other.size\_;}
|
|
\DoxyCodeLine{00167\ \ \ \ \ \ \ \ \ strides\_\ =\ other.strides\_;}
|
|
\DoxyCodeLine{00168\ \ \ \ \ \ \ \ \ other.reset();}
|
|
\DoxyCodeLine{00169\ \ \ \ \ \}}
|
|
\DoxyCodeLine{00170\ \ \ \ \ \textcolor{keywordflow}{return}\ *\textcolor{keyword}{this};}
|
|
\DoxyCodeLine{00171\ \}}
|
|
\DoxyCodeLine{00172\ }
|
|
\DoxyCodeLine{00173\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ s\textcolor{keywordtype}{size\_t}\ Ndim>\ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray<T,\ Ndim>}}\ \mbox{\hyperlink{classaare_1_1NDArray_afcc5f259b1bd0cadcadbf2b52795babc}{NDArray<T,\ Ndim>::operator+}}(\textcolor{keyword}{const}\ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray}}\ \&other)\ \{}
|
|
\DoxyCodeLine{00174\ \ \ \ \ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray}}\ result(*\textcolor{keyword}{this});}
|
|
\DoxyCodeLine{00175\ \ \ \ \ result\ +=\ other;}
|
|
\DoxyCodeLine{00176\ \ \ \ \ \textcolor{keywordflow}{return}\ result;}
|
|
\DoxyCodeLine{00177\ \}}
|
|
\DoxyCodeLine{00178\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ s\textcolor{keywordtype}{size\_t}\ Ndim>\ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray<T,\ Ndim>}}\ \&\mbox{\hyperlink{classaare_1_1NDArray_a27eb7b3599cb62297832d4a3d8022f32}{NDArray<T,\ Ndim>::operator+=}}(\textcolor{keyword}{const}\ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray<T,\ Ndim>}}\ \&other)\ \{}
|
|
\DoxyCodeLine{00179\ \ \ \ \ \textcolor{comment}{//\ check\ shape}}
|
|
\DoxyCodeLine{00180\ \ \ \ \ \textcolor{keywordflow}{if}\ (shape\_\ ==\ other.\mbox{\hyperlink{classaare_1_1NDArray_af00f150a2867b13b37a3f711ba5f7c3b}{shape\_}})\ \{}
|
|
\DoxyCodeLine{00181\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keywordtype}{int}\ i\ =\ 0;\ i\ <\ size\_;\ ++i)\ \{}
|
|
\DoxyCodeLine{00182\ \ \ \ \ \ \ \ \ \ \ \ \ data\_[i]\ +=\ other.\mbox{\hyperlink{classaare_1_1NDArray_ad2357b3a2dca6ff0ef6705d9913227ca}{data\_}}[i];}
|
|
\DoxyCodeLine{00183\ \ \ \ \ \ \ \ \ \}}
|
|
\DoxyCodeLine{00184\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ *\textcolor{keyword}{this};}
|
|
\DoxyCodeLine{00185\ \ \ \ \ \}\ \textcolor{keywordflow}{else}\ \{}
|
|
\DoxyCodeLine{00186\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{throw}(std::runtime\_error(\textcolor{stringliteral}{"{}Shape\ of\ ImageDatas\ must\ match"{}}));}
|
|
\DoxyCodeLine{00187\ \ \ \ \ \}}
|
|
\DoxyCodeLine{00188\ \}}
|
|
\DoxyCodeLine{00189\ }
|
|
\DoxyCodeLine{00190\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ s\textcolor{keywordtype}{size\_t}\ Ndim>\ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray<T,\ Ndim>}}\ \mbox{\hyperlink{classaare_1_1NDArray_aac96eb2ce76cd90d44eb3b19408d2434}{NDArray<T,\ Ndim>::operator-\/}}(\textcolor{keyword}{const}\ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray}}\ \&other)\ \{}
|
|
\DoxyCodeLine{00191\ \ \ \ \ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray}}\ result\{*\textcolor{keyword}{this}\};}
|
|
\DoxyCodeLine{00192\ \ \ \ \ result\ -\/=\ other;}
|
|
\DoxyCodeLine{00193\ \ \ \ \ \textcolor{keywordflow}{return}\ result;}
|
|
\DoxyCodeLine{00194\ \}}
|
|
\DoxyCodeLine{00195\ }
|
|
\DoxyCodeLine{00196\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ s\textcolor{keywordtype}{size\_t}\ Ndim>\ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray<T,\ Ndim>}}\ \&\mbox{\hyperlink{classaare_1_1NDArray_aad602fc6734cb85112f2a8edf91d1c70}{NDArray<T,\ Ndim>::operator-\/=}}(\textcolor{keyword}{const}\ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray<T,\ Ndim>}}\ \&other)\ \{}
|
|
\DoxyCodeLine{00197\ \ \ \ \ \textcolor{comment}{//\ check\ shape}}
|
|
\DoxyCodeLine{00198\ \ \ \ \ \textcolor{keywordflow}{if}\ (shape\_\ ==\ other.\mbox{\hyperlink{classaare_1_1NDArray_af00f150a2867b13b37a3f711ba5f7c3b}{shape\_}})\ \{}
|
|
\DoxyCodeLine{00199\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keywordtype}{int}\ i\ =\ 0;\ i\ <\ size\_;\ ++i)\ \{}
|
|
\DoxyCodeLine{00200\ \ \ \ \ \ \ \ \ \ \ \ \ data\_[i]\ -\/=\ other.\mbox{\hyperlink{classaare_1_1NDArray_ad2357b3a2dca6ff0ef6705d9913227ca}{data\_}}[i];}
|
|
\DoxyCodeLine{00201\ \ \ \ \ \ \ \ \ \}}
|
|
\DoxyCodeLine{00202\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ *\textcolor{keyword}{this};}
|
|
\DoxyCodeLine{00203\ \ \ \ \ \}\ \textcolor{keywordflow}{else}\ \{}
|
|
\DoxyCodeLine{00204\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{throw}(std::runtime\_error(\textcolor{stringliteral}{"{}Shape\ of\ ImageDatas\ must\ match"{}}));}
|
|
\DoxyCodeLine{00205\ \ \ \ \ \}}
|
|
\DoxyCodeLine{00206\ \}}
|
|
\DoxyCodeLine{00207\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ s\textcolor{keywordtype}{size\_t}\ Ndim>\ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray<T,\ Ndim>}}\ \mbox{\hyperlink{classaare_1_1NDArray_ae67f899470bc9f8c8df8b54d544f9171}{NDArray<T,\ Ndim>::operator*}}(\textcolor{keyword}{const}\ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray}}\ \&other)\ \{}
|
|
\DoxyCodeLine{00208\ \ \ \ \ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray}}\ result\ =\ *\textcolor{keyword}{this};}
|
|
\DoxyCodeLine{00209\ \ \ \ \ result\ *=\ other;}
|
|
\DoxyCodeLine{00210\ \ \ \ \ \textcolor{keywordflow}{return}\ result;}
|
|
\DoxyCodeLine{00211\ \}}
|
|
\DoxyCodeLine{00212\ }
|
|
\DoxyCodeLine{00213\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ s\textcolor{keywordtype}{size\_t}\ Ndim>\ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray<T,\ Ndim>}}\ \&\mbox{\hyperlink{classaare_1_1NDArray_a54edf15f9669a1e4601fa4aa936a2d92}{NDArray<T,\ Ndim>::operator*=}}(\textcolor{keyword}{const}\ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray<T,\ Ndim>}}\ \&other)\ \{}
|
|
\DoxyCodeLine{00214\ \ \ \ \ \textcolor{comment}{//\ check\ shape}}
|
|
\DoxyCodeLine{00215\ \ \ \ \ \textcolor{keywordflow}{if}\ (shape\_\ ==\ other.\mbox{\hyperlink{classaare_1_1NDArray_af00f150a2867b13b37a3f711ba5f7c3b}{shape\_}})\ \{}
|
|
\DoxyCodeLine{00216\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keywordtype}{int}\ i\ =\ 0;\ i\ <\ size\_;\ ++i)\ \{}
|
|
\DoxyCodeLine{00217\ \ \ \ \ \ \ \ \ \ \ \ \ data\_[i]\ *=\ other.\mbox{\hyperlink{classaare_1_1NDArray_ad2357b3a2dca6ff0ef6705d9913227ca}{data\_}}[i];}
|
|
\DoxyCodeLine{00218\ \ \ \ \ \ \ \ \ \}}
|
|
\DoxyCodeLine{00219\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ *\textcolor{keyword}{this};}
|
|
\DoxyCodeLine{00220\ \ \ \ \ \}\ \textcolor{keywordflow}{else}\ \{}
|
|
\DoxyCodeLine{00221\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{throw}(std::runtime\_error(\textcolor{stringliteral}{"{}Shape\ of\ ImageDatas\ must\ match"{}}));}
|
|
\DoxyCodeLine{00222\ \ \ \ \ \}}
|
|
\DoxyCodeLine{00223\ \}}
|
|
\DoxyCodeLine{00224\ }
|
|
\DoxyCodeLine{00225\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ s\textcolor{keywordtype}{size\_t}\ Ndim>\ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray<T,\ Ndim>}}\ \mbox{\hyperlink{classaare_1_1NDArray_a59dc47216852c36191e0cecc869131e1}{NDArray<T,\ Ndim>::operator/}}(\textcolor{keyword}{const}\ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray}}\ \&other)\ \{}
|
|
\DoxyCodeLine{00226\ \ \ \ \ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray}}\ result\ =\ *\textcolor{keyword}{this};}
|
|
\DoxyCodeLine{00227\ \ \ \ \ result\ /=\ other;}
|
|
\DoxyCodeLine{00228\ \ \ \ \ \textcolor{keywordflow}{return}\ result;}
|
|
\DoxyCodeLine{00229\ \}}
|
|
\DoxyCodeLine{00230\ }
|
|
\DoxyCodeLine{00231\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ s\textcolor{keywordtype}{size\_t}\ Ndim>\ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray<T,\ Ndim>}}\ \&\mbox{\hyperlink{classaare_1_1NDArray_ab01fdad1a92b1629996f15ff0cf79ac3}{NDArray<T,\ Ndim>::operator\&=}}(\textcolor{keyword}{const}\ T\ \&mask)\ \{}
|
|
\DoxyCodeLine{00232\ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keyword}{auto}\ it\ =\ begin();\ it\ !=\ end();\ ++it)}
|
|
\DoxyCodeLine{00233\ \ \ \ \ \ \ \ \ *it\ \&=\ mask;}
|
|
\DoxyCodeLine{00234\ \ \ \ \ \textcolor{keywordflow}{return}\ *\textcolor{keyword}{this};}
|
|
\DoxyCodeLine{00235\ \}}
|
|
\DoxyCodeLine{00236\ }
|
|
\DoxyCodeLine{00237\ \textcolor{comment}{//\ template\ <typename\ T,\ ssize\_t\ Ndim>}}
|
|
\DoxyCodeLine{00238\ \textcolor{comment}{//\ NDArray<T,\ Ndim>\&\ NDArray<T,\ Ndim>::operator/=(const\ NDArray<T,\ Ndim>\&}}
|
|
\DoxyCodeLine{00239\ \textcolor{comment}{//\ other)}}
|
|
\DoxyCodeLine{00240\ \textcolor{comment}{//\ \{}}
|
|
\DoxyCodeLine{00241\ \textcolor{comment}{//\ \ \ \ \ //check\ shape}}
|
|
\DoxyCodeLine{00242\ \textcolor{comment}{//\ \ \ \ \ if\ (shape\_\ ==\ other.shape\_)\ \{}}
|
|
\DoxyCodeLine{00243\ \textcolor{comment}{//\ \ \ \ \ \ \ \ \ for\ (int\ i\ =\ 0;\ i\ <\ size\_;\ ++i)\ \{}}
|
|
\DoxyCodeLine{00244\ \textcolor{comment}{//\ \ \ \ \ \ \ \ \ \ \ \ \ data\_[i]\ /=\ other.data\_[i];}}
|
|
\DoxyCodeLine{00245\ \textcolor{comment}{//\ \ \ \ \ \ \ \ \ \}}}
|
|
\DoxyCodeLine{00246\ \textcolor{comment}{//\ \ \ \ \ \ \ \ \ return\ *this;}}
|
|
\DoxyCodeLine{00247\ \textcolor{comment}{//\ \ \ \ \ \}\ else\ \{}}
|
|
\DoxyCodeLine{00248\ \textcolor{comment}{//\ \ \ \ \ \ \ \ \ throw(std::runtime\_error("{}Shape\ of\ ImageDatas\ must\ match"{}));}}
|
|
\DoxyCodeLine{00249\ \textcolor{comment}{//\ \ \ \ \ \}}}
|
|
\DoxyCodeLine{00250\ \textcolor{comment}{//\ \}}}
|
|
\DoxyCodeLine{00251\ }
|
|
\DoxyCodeLine{00252\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ s\textcolor{keywordtype}{size\_t}\ Ndim>\ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray<bool,\ Ndim>}}\ \mbox{\hyperlink{classaare_1_1NDArray_a569e8de85121a4a6315c556870b48931}{NDArray<T,\ Ndim>::operator>}}(\textcolor{keyword}{const}\ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray}}\ \&other)\ \{}
|
|
\DoxyCodeLine{00253\ \ \ \ \ \textcolor{keywordflow}{if}\ (shape\_\ ==\ other.\mbox{\hyperlink{classaare_1_1NDArray_af00f150a2867b13b37a3f711ba5f7c3b}{shape\_}})\ \{}
|
|
\DoxyCodeLine{00254\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray<bool>}}\ result\{shape\_\};}
|
|
\DoxyCodeLine{00255\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keywordtype}{int}\ i\ =\ 0;\ i\ <\ size\_;\ ++i)\ \{}
|
|
\DoxyCodeLine{00256\ \ \ \ \ \ \ \ \ \ \ \ \ result(i)\ =\ (data\_[i]\ >\ other.\mbox{\hyperlink{classaare_1_1NDArray_ad2357b3a2dca6ff0ef6705d9913227ca}{data\_}}[i]);}
|
|
\DoxyCodeLine{00257\ \ \ \ \ \ \ \ \ \}}
|
|
\DoxyCodeLine{00258\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ result;}
|
|
\DoxyCodeLine{00259\ \ \ \ \ \}\ \textcolor{keywordflow}{else}\ \{}
|
|
\DoxyCodeLine{00260\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{throw}(std::runtime\_error(\textcolor{stringliteral}{"{}Shape\ of\ ImageDatas\ must\ match"{}}));}
|
|
\DoxyCodeLine{00261\ \ \ \ \ \}}
|
|
\DoxyCodeLine{00262\ \}}
|
|
\DoxyCodeLine{00263\ }
|
|
\DoxyCodeLine{00264\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ s\textcolor{keywordtype}{size\_t}\ Ndim>\ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray<T,\ Ndim>}}\ \&\mbox{\hyperlink{classaare_1_1NDArray_a06c658e8a6490c74fb9878b14a4faf1d}{NDArray<T,\ Ndim>::operator=}}(\textcolor{keyword}{const}\ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray<T,\ Ndim>}}\ \&other)\ \{}
|
|
\DoxyCodeLine{00265\ \ \ \ \ \textcolor{keywordflow}{if}\ (\textcolor{keyword}{this}\ !=\ \&other)\ \{}
|
|
\DoxyCodeLine{00266\ \ \ \ \ \ \ \ \ \textcolor{keyword}{delete}[]\ data\_;}
|
|
\DoxyCodeLine{00267\ \ \ \ \ \ \ \ \ shape\_\ =\ other.\mbox{\hyperlink{classaare_1_1NDArray_af00f150a2867b13b37a3f711ba5f7c3b}{shape\_}};}
|
|
\DoxyCodeLine{00268\ \ \ \ \ \ \ \ \ strides\_\ =\ other.\mbox{\hyperlink{classaare_1_1NDArray_a5275d4999e7422458d472620f792573a}{strides\_}};}
|
|
\DoxyCodeLine{00269\ \ \ \ \ \ \ \ \ size\_\ =\ other.\mbox{\hyperlink{classaare_1_1NDArray_ac64b3e00ad3b69f6bc46def403614ccd}{size\_}};}
|
|
\DoxyCodeLine{00270\ \ \ \ \ \ \ \ \ data\_\ =\ \textcolor{keyword}{new}\ T[size\_];}
|
|
\DoxyCodeLine{00271\ \ \ \ \ \ \ \ \ std::copy(other.\mbox{\hyperlink{classaare_1_1NDArray_ad2357b3a2dca6ff0ef6705d9913227ca}{data\_}},\ other.\mbox{\hyperlink{classaare_1_1NDArray_ad2357b3a2dca6ff0ef6705d9913227ca}{data\_}}\ +\ size\_,\ data\_);}
|
|
\DoxyCodeLine{00272\ \ \ \ \ \}}
|
|
\DoxyCodeLine{00273\ \ \ \ \ \textcolor{keywordflow}{return}\ *\textcolor{keyword}{this};}
|
|
\DoxyCodeLine{00274\ \}}
|
|
\DoxyCodeLine{00275\ }
|
|
\DoxyCodeLine{00276\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ s\textcolor{keywordtype}{size\_t}\ Ndim>\ \textcolor{keywordtype}{bool}\ \mbox{\hyperlink{classaare_1_1NDArray_ad20b30f1abea56b82196f030b1492027}{NDArray<T,\ Ndim>::operator==}}(\textcolor{keyword}{const}\ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray<T,\ Ndim>}}\ \&other)\textcolor{keyword}{\ const\ }\{}
|
|
\DoxyCodeLine{00277\ \ \ \ \ \textcolor{keywordflow}{if}\ (shape\_\ !=\ other.\mbox{\hyperlink{classaare_1_1NDArray_af00f150a2867b13b37a3f711ba5f7c3b}{shape\_}})}
|
|
\DoxyCodeLine{00278\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
|
|
\DoxyCodeLine{00279\ }
|
|
\DoxyCodeLine{00280\ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keywordtype}{int}\ i\ =\ 0;\ i\ !=\ size\_;\ ++i)}
|
|
\DoxyCodeLine{00281\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (data\_[i]\ !=\ other.\mbox{\hyperlink{classaare_1_1NDArray_ad2357b3a2dca6ff0ef6705d9913227ca}{data\_}}[i])}
|
|
\DoxyCodeLine{00282\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
|
|
\DoxyCodeLine{00283\ }
|
|
\DoxyCodeLine{00284\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
|
|
\DoxyCodeLine{00285\ \}}
|
|
\DoxyCodeLine{00286\ }
|
|
\DoxyCodeLine{00287\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ s\textcolor{keywordtype}{size\_t}\ Ndim>\ \textcolor{keywordtype}{bool}\ \mbox{\hyperlink{classaare_1_1NDArray_a90408ebad72f63d0288b869b3e32e50b}{NDArray<T,\ Ndim>::operator!=}}(\textcolor{keyword}{const}\ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray<T,\ Ndim>}}\ \&other)\textcolor{keyword}{\ const\ }\{}
|
|
\DoxyCodeLine{00288\ \ \ \ \ \textcolor{keywordflow}{return}\ !((*this)\ ==\ other);}
|
|
\DoxyCodeLine{00289\ \}}
|
|
\DoxyCodeLine{00290\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ s\textcolor{keywordtype}{size\_t}\ Ndim>\ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray<T,\ Ndim>}}\ \&\mbox{\hyperlink{classaare_1_1NDArray_a040dd143e6dc040703b33d91ba929271}{NDArray<T,\ Ndim>::operator++}}()\ \{}
|
|
\DoxyCodeLine{00291\ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keywordtype}{int}\ i\ =\ 0;\ i\ <\ size\_;\ ++i)}
|
|
\DoxyCodeLine{00292\ \ \ \ \ \ \ \ \ data\_[i]\ +=\ 1;}
|
|
\DoxyCodeLine{00293\ \ \ \ \ \textcolor{keywordflow}{return}\ *\textcolor{keyword}{this};}
|
|
\DoxyCodeLine{00294\ \}}
|
|
\DoxyCodeLine{00295\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ s\textcolor{keywordtype}{size\_t}\ Ndim>\ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray<T,\ Ndim>}}\ \&\mbox{\hyperlink{classaare_1_1NDArray_a06c658e8a6490c74fb9878b14a4faf1d}{NDArray<T,\ Ndim>::operator=}}(\textcolor{keyword}{const}\ T\ \&value)\ \{}
|
|
\DoxyCodeLine{00296\ \ \ \ \ std::fill\_n(data\_,\ size\_,\ value);}
|
|
\DoxyCodeLine{00297\ \ \ \ \ \textcolor{keywordflow}{return}\ *\textcolor{keyword}{this};}
|
|
\DoxyCodeLine{00298\ \}}
|
|
\DoxyCodeLine{00299\ }
|
|
\DoxyCodeLine{00300\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ s\textcolor{keywordtype}{size\_t}\ Ndim>\ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray<T,\ Ndim>}}\ \&\mbox{\hyperlink{classaare_1_1NDArray_a27eb7b3599cb62297832d4a3d8022f32}{NDArray<T,\ Ndim>::operator+=}}(\textcolor{keyword}{const}\ T\ \&value)\ \{}
|
|
\DoxyCodeLine{00301\ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keywordtype}{int}\ i\ =\ 0;\ i\ <\ size\_;\ ++i)}
|
|
\DoxyCodeLine{00302\ \ \ \ \ \ \ \ \ data\_[i]\ +=\ value;}
|
|
\DoxyCodeLine{00303\ \ \ \ \ \textcolor{keywordflow}{return}\ *\textcolor{keyword}{this};}
|
|
\DoxyCodeLine{00304\ \}}
|
|
\DoxyCodeLine{00305\ }
|
|
\DoxyCodeLine{00306\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ s\textcolor{keywordtype}{size\_t}\ Ndim>\ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray<T,\ Ndim>}}\ \mbox{\hyperlink{classaare_1_1NDArray_afcc5f259b1bd0cadcadbf2b52795babc}{NDArray<T,\ Ndim>::operator+}}(\textcolor{keyword}{const}\ T\ \&value)\ \{}
|
|
\DoxyCodeLine{00307\ \ \ \ \ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray}}\ result\ =\ *\textcolor{keyword}{this};}
|
|
\DoxyCodeLine{00308\ \ \ \ \ result\ +=\ value;}
|
|
\DoxyCodeLine{00309\ \ \ \ \ \textcolor{keywordflow}{return}\ result;}
|
|
\DoxyCodeLine{00310\ \}}
|
|
\DoxyCodeLine{00311\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ s\textcolor{keywordtype}{size\_t}\ Ndim>\ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray<T,\ Ndim>}}\ \&\mbox{\hyperlink{classaare_1_1NDArray_aad602fc6734cb85112f2a8edf91d1c70}{NDArray<T,\ Ndim>::operator-\/=}}(\textcolor{keyword}{const}\ T\ \&value)\ \{}
|
|
\DoxyCodeLine{00312\ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keywordtype}{int}\ i\ =\ 0;\ i\ <\ size\_;\ ++i)}
|
|
\DoxyCodeLine{00313\ \ \ \ \ \ \ \ \ data\_[i]\ -\/=\ value;}
|
|
\DoxyCodeLine{00314\ \ \ \ \ \textcolor{keywordflow}{return}\ *\textcolor{keyword}{this};}
|
|
\DoxyCodeLine{00315\ \}}
|
|
\DoxyCodeLine{00316\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ s\textcolor{keywordtype}{size\_t}\ Ndim>\ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray<T,\ Ndim>}}\ \mbox{\hyperlink{classaare_1_1NDArray_aac96eb2ce76cd90d44eb3b19408d2434}{NDArray<T,\ Ndim>::operator-\/}}(\textcolor{keyword}{const}\ T\ \&value)\ \{}
|
|
\DoxyCodeLine{00317\ \ \ \ \ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray}}\ result\ =\ *\textcolor{keyword}{this};}
|
|
\DoxyCodeLine{00318\ \ \ \ \ result\ -\/=\ value;}
|
|
\DoxyCodeLine{00319\ \ \ \ \ \textcolor{keywordflow}{return}\ result;}
|
|
\DoxyCodeLine{00320\ \}}
|
|
\DoxyCodeLine{00321\ }
|
|
\DoxyCodeLine{00322\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ s\textcolor{keywordtype}{size\_t}\ Ndim>\ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray<T,\ Ndim>}}\ \&\mbox{\hyperlink{classaare_1_1NDArray_a2a6260113ca73c86d37d0444b5148c49}{NDArray<T,\ Ndim>::operator/=}}(\textcolor{keyword}{const}\ T\ \&value)\ \{}
|
|
\DoxyCodeLine{00323\ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keywordtype}{int}\ i\ =\ 0;\ i\ <\ size\_;\ ++i)}
|
|
\DoxyCodeLine{00324\ \ \ \ \ \ \ \ \ data\_[i]\ /=\ value;}
|
|
\DoxyCodeLine{00325\ \ \ \ \ \textcolor{keywordflow}{return}\ *\textcolor{keyword}{this};}
|
|
\DoxyCodeLine{00326\ \}}
|
|
\DoxyCodeLine{00327\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ s\textcolor{keywordtype}{size\_t}\ Ndim>\ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray<T,\ Ndim>}}\ \mbox{\hyperlink{classaare_1_1NDArray_a59dc47216852c36191e0cecc869131e1}{NDArray<T,\ Ndim>::operator/}}(\textcolor{keyword}{const}\ T\ \&value)\ \{}
|
|
\DoxyCodeLine{00328\ \ \ \ \ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray}}\ result\ =\ *\textcolor{keyword}{this};}
|
|
\DoxyCodeLine{00329\ \ \ \ \ result\ /=\ value;}
|
|
\DoxyCodeLine{00330\ \ \ \ \ \textcolor{keywordflow}{return}\ result;}
|
|
\DoxyCodeLine{00331\ \}}
|
|
\DoxyCodeLine{00332\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ s\textcolor{keywordtype}{size\_t}\ Ndim>\ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray<T,\ Ndim>}}\ \&\mbox{\hyperlink{classaare_1_1NDArray_a54edf15f9669a1e4601fa4aa936a2d92}{NDArray<T,\ Ndim>::operator*=}}(\textcolor{keyword}{const}\ T\ \&value)\ \{}
|
|
\DoxyCodeLine{00333\ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keywordtype}{int}\ i\ =\ 0;\ i\ <\ size\_;\ ++i)}
|
|
\DoxyCodeLine{00334\ \ \ \ \ \ \ \ \ data\_[i]\ *=\ value;}
|
|
\DoxyCodeLine{00335\ \ \ \ \ \textcolor{keywordflow}{return}\ *\textcolor{keyword}{this};}
|
|
\DoxyCodeLine{00336\ \}}
|
|
\DoxyCodeLine{00337\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ s\textcolor{keywordtype}{size\_t}\ Ndim>\ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray<T,\ Ndim>}}\ \mbox{\hyperlink{classaare_1_1NDArray_ae67f899470bc9f8c8df8b54d544f9171}{NDArray<T,\ Ndim>::operator*}}(\textcolor{keyword}{const}\ T\ \&value)\ \{}
|
|
\DoxyCodeLine{00338\ \ \ \ \ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray}}\ result\ =\ *\textcolor{keyword}{this};}
|
|
\DoxyCodeLine{00339\ \ \ \ \ result\ *=\ value;}
|
|
\DoxyCodeLine{00340\ \ \ \ \ \textcolor{keywordflow}{return}\ result;}
|
|
\DoxyCodeLine{00341\ \}}
|
|
\DoxyCodeLine{00342\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ s\textcolor{keywordtype}{size\_t}\ Ndim>\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{classaare_1_1NDArray_ad49628442cc054b7c0b56b3104d9ef20}{NDArray<T,\ Ndim>::Print}}()\ \{}
|
|
\DoxyCodeLine{00343\ \ \ \ \ \textcolor{keywordflow}{if}\ (shape\_[0]\ <\ 20\ \&\&\ shape\_[1]\ <\ 20)}
|
|
\DoxyCodeLine{00344\ \ \ \ \ \ \ \ \ Print\_all();}
|
|
\DoxyCodeLine{00345\ \ \ \ \ \textcolor{keywordflow}{else}}
|
|
\DoxyCodeLine{00346\ \ \ \ \ \ \ \ \ Print\_some();}
|
|
\DoxyCodeLine{00347\ \}}
|
|
\DoxyCodeLine{00348\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ s\textcolor{keywordtype}{size\_t}\ Ndim>\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{classaare_1_1NDArray_a6084445eed769b89387b4aca53306513}{NDArray<T,\ Ndim>::Print\_all}}()\ \{}
|
|
\DoxyCodeLine{00349\ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keyword}{auto}\ row\ =\ 0;\ row\ <\ shape\_[0];\ ++row)\ \{}
|
|
\DoxyCodeLine{00350\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keyword}{auto}\ col\ =\ 0;\ col\ <\ shape\_[1];\ ++col)\ \{}
|
|
\DoxyCodeLine{00351\ \ \ \ \ \ \ \ \ \ \ \ \ std::cout\ <<\ std::setw(3);}
|
|
\DoxyCodeLine{00352\ \ \ \ \ \ \ \ \ \ \ \ \ std::cout\ <<\ (*this)(row,\ col)\ <<\ \textcolor{stringliteral}{"{}\ "{}};}
|
|
\DoxyCodeLine{00353\ \ \ \ \ \ \ \ \ \}}
|
|
\DoxyCodeLine{00354\ \ \ \ \ \ \ \ \ std::cout\ <<\ \textcolor{stringliteral}{"{}\(\backslash\)n"{}};}
|
|
\DoxyCodeLine{00355\ \ \ \ \ \}}
|
|
\DoxyCodeLine{00356\ \}}
|
|
\DoxyCodeLine{00357\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ s\textcolor{keywordtype}{size\_t}\ Ndim>\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{classaare_1_1NDArray_a5dec49e82ec3abfa28bddfc328b1c4e9}{NDArray<T,\ Ndim>::Print\_some}}()\ \{}
|
|
\DoxyCodeLine{00358\ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keyword}{auto}\ row\ =\ 0;\ row\ <\ 5;\ ++row)\ \{}
|
|
\DoxyCodeLine{00359\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keyword}{auto}\ col\ =\ 0;\ col\ <\ 5;\ ++col)\ \{}
|
|
\DoxyCodeLine{00360\ \ \ \ \ \ \ \ \ \ \ \ \ std::cout\ <<\ std::setw(7);}
|
|
\DoxyCodeLine{00361\ \ \ \ \ \ \ \ \ \ \ \ \ std::cout\ <<\ (*this)(row,\ col)\ <<\ \textcolor{stringliteral}{"{}\ "{}};}
|
|
\DoxyCodeLine{00362\ \ \ \ \ \ \ \ \ \}}
|
|
\DoxyCodeLine{00363\ \ \ \ \ \ \ \ \ std::cout\ <<\ \textcolor{stringliteral}{"{}\(\backslash\)n"{}};}
|
|
\DoxyCodeLine{00364\ \ \ \ \ \}}
|
|
\DoxyCodeLine{00365\ \}}
|
|
\DoxyCodeLine{00366\ }
|
|
\DoxyCodeLine{00367\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ s\textcolor{keywordtype}{size\_t}\ Ndim>\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{namespaceaare_aac5d322f266bccdc416bcd66098eae33}{save}}(\mbox{\hyperlink{classaare_1_1NDArray}{NDArray<T,\ Ndim>}}\ \&img,\ std::string\ pathname)\ \{}
|
|
\DoxyCodeLine{00368\ \ \ \ \ std::ofstream\ f;}
|
|
\DoxyCodeLine{00369\ \ \ \ \ f.open(pathname,\ std::ios::binary);}
|
|
\DoxyCodeLine{00370\ \ \ \ \ f.write(img.\mbox{\hyperlink{classaare_1_1NDArray_af289b6a162612ed74ad2fd0606a479a9}{buffer}}(),\ img.\mbox{\hyperlink{classaare_1_1NDArray_a86632c60ddbdf7af8cfd3939df472127}{size}}()\ *\ \textcolor{keyword}{sizeof}(T));}
|
|
\DoxyCodeLine{00371\ \ \ \ \ f.close();}
|
|
\DoxyCodeLine{00372\ \}}
|
|
\DoxyCodeLine{00373\ }
|
|
\DoxyCodeLine{00374\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ s\textcolor{keywordtype}{size\_t}\ Ndim>}
|
|
\DoxyCodeLine{00375\ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray<T,\ Ndim>}}\ \mbox{\hyperlink{namespaceaare_a2868d09c334b1aa09be4da1979100ec5}{load}}(\textcolor{keyword}{const}\ std::string\ \&pathname,\ std::array<ssize\_t,\ Ndim>\ shape)\ \{}
|
|
\DoxyCodeLine{00376\ \ \ \ \ \mbox{\hyperlink{classaare_1_1NDArray}{NDArray<T,\ Ndim>}}\ img\{shape\};}
|
|
\DoxyCodeLine{00377\ \ \ \ \ std::ifstream\ f;}
|
|
\DoxyCodeLine{00378\ \ \ \ \ f.open(pathname,\ std::ios::binary);}
|
|
\DoxyCodeLine{00379\ \ \ \ \ f.read(img.buffer(),\ img.size()\ *\ \textcolor{keyword}{sizeof}(T));}
|
|
\DoxyCodeLine{00380\ \ \ \ \ f.close();}
|
|
\DoxyCodeLine{00381\ \ \ \ \ \textcolor{keywordflow}{return}\ img;}
|
|
\DoxyCodeLine{00382\ \}}
|
|
\DoxyCodeLine{00383\ }
|
|
\DoxyCodeLine{00384\ \}\ \textcolor{comment}{//\ namespace\ aare}}
|
|
|
|
\end{DoxyCode}
|