From 3477e80d518a77a9c99a31847dc728617f0c8835 Mon Sep 17 00:00:00 2001 From: fanasina Date: Thu, 15 Jan 2026 17:40:03 +0100 Subject: [PATCH] article: all tensor to one order tensor --- onedimensiontensor.tex | 453 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 453 insertions(+) create mode 100644 onedimensiontensor.tex diff --git a/onedimensiontensor.tex b/onedimensiontensor.tex new file mode 100644 index 0000000..d1795e5 --- /dev/null +++ b/onedimensiontensor.tex @@ -0,0 +1,453 @@ +\documentclass[a4paper,11pt]{report} +%\usepackage[utf8]{inputenc} + +\usepackage[cal=boondox,scr=boondoxo]{mathalfa} %%% endrikan'ny mathcal sy mathscr + +\usepackage[a4paper,bindingoffset=0cm,% + left=2cm,right=2cm,top=2cm,bottom=2cm,% + footskip=0.8cm]{geometry} + +\usepackage[utf8]{inputenc} +\usepackage[T1]{fontenc} +\usepackage[french]{babel} + +\frenchbsetup{StandardLists=true} % à inclure si on utilise \usepackage[french]{babel} +\usepackage{cite} % pour les citations multiples +\usepackage{enumitem} + +%\bibliographystyle{fr-plain} + + +\usepackage{amsmath, amsthm} % tr`es bon mode mathÂ?ematailletique +\usepackage{amsfonts,amssymb}% permet la definition des ensembles +\usepackage{mathtools} + +\usepackage{centernot} + +%\usepackage{tikz3d-fr} + +\usepackage{tikz,tkz-tab} +\usetikzlibrary{3d} + +%\usepackage{pgfplots} +%\usetikzlibrary{decorations.pathreplacing} + +\newtheorem{theorem}{Theorem}[section] +\newtheorem{definition}{Definition}[section] + +\begin{document} +\section{Goal: Write any tensor as vector !!} + +\begin{definition} +A dimension of a tensor $T$ is a vector $d\in \left(\mathbb{N}^*\right)^k$ $(k<\infty)$. We have $$T=(a)_d=(a)_{d_1,\ldots,d_k} =(a_{i_1,\ldots,i_k}^{\{k\}})_{0\le i_10$ is the order.\\ +The size of the Tensor is $d_1 \times \cdots \times d_k=\prod_{i=1}^kd_i$ + +% Here $\mathbb{K} = \mathbb{R}$ to simplify but it works for all filds. + + +We can write $$T\in \mathbb{K}^{d_1 \times d_2 \times \cdots \times d_k}$$ + + +\section{Bijection} + +For a given $d_1,\ldots,d_k\in \mathbb{N}^*$, there exists a bijective application between a set of tensor order 1 of size $n=d_1\cdot d_2 \cdots d_k$ $\mathbb{K}^{d_1\times d_2 \times \cdots \times d_k}$ and the set of tensor of order $k$ of the size $n= d_1\cdot d_2 \cdots d_k$ $\mathbb{K}^{d_1\times d_2 \times \cdots \times d_k}$. + +Little endian +$$ +\begin{array}{ccc} +\mathbb{K}^{d_1\times d_2 \times \cdots \times d_k} & \longrightarrow & \mathbb{K}^{d_1\cdot d_2\cdots d_k} \\ +\left(a_{(i_1,\ldots,i_k)_k}\right) & \longmapsto & \left(a_{\left(i_1+i_2\cdot d_1+\ldots+i_k \prod_{j=1}^{k-1}d_j\right)_1}\right) +\end{array} +$$ + +Big endian + +$$ +\begin{array}{ccc} +\mathbb{K}^{d_1\times d_2 \times \cdots \times d_k} & \longrightarrow & \mathbb{K}^{d_1\cdot d_2\cdots d_k} \\ +\left(a_{(i_1,\ldots,i_k)_k}\right) & \longmapsto & \left(a_{\left(i_1 \prod_{j=2}^kd_j+i_2\prod_{j=3}^k d_j+\ldots +i_{k-1} d_k +i_k \right)_1}\right) +\end{array} +$$ +For $a,b\in \mathbb{N}$, we note $ [\![ a,b ]\!] = [a.. b]=[a,b]\cap \mathbb{N}$ + +and $ [\![ a,b [\![ = [\![ a,b ) = [a.. b) = [a.. b[=[a,b[\cap \mathbb{N}$ + +If $a=0$ we note $[b]=[\![0,b]\!]$ and $[b)=[\![0,b[\![$ so here we defined a bijection of indexe, i.e, + +\begin{align*} + f:[d_1)\times[d_2)\times\cdots\times [d_k) & \longrightarrow [d_1\cdot d_2\cdots d_k)\\ + (i_1,i_2,\ldots,i_k)_k & \longrightarrow f(i_1,i_2,\ldots,i_k)=(i)_1 +\end{align*} +If little endian +\begin{align*} + i & =i_1 +i_2d_1+\cdots+i_k\prod_{j=1}^{k-1} d_j \\ + &=\sum_{j=1}^ki_j\prod_{l=1}^{j-1}d_l +\end{align*} +If big endian +\begin{align*} + i & =i_1 \prod_{j=2}^kd_j+i_2\prod_{j=3}^k d_j+\ldots +i_{k-1} d_k +i_k \\ + &=\sum_{j=1}^ki_j\prod_{l=i+1}^kd_l +\end{align*} + +$ $ + + +\section{Inverse indexes} +The inverse of Little endian : + +For any $i\in \mathbb{N} , i,>=latex] (0,0,0)--(1,0,0) node[right] {$\vec{\imath}$} ; +\draw[->,>=latex] (0,0,0)--(0,1,0) node[right] {$\vec{\jmath}$} ; +\draw[->,>=latex] (0,0,0)--(0,0,1) node[above] {$\vec{k}$} ; +\end{EnvTikzEspace} + +\begin{EmpilementCubes} +\BlocPetitsCubes{1,2,3,4,5 / 0,2,1,1,3 / 0,2,1,1,2 / 1,1,1,1,3} +\end{EmpilementCubes} +\fi + +\iffalse +\begin{tikzpicture} + \draw (0,0,0)--(1,0,0)--(1,1,0)--(0,1,0)--cycle; % face arrière +\draw (0,0,1)--(1,0,1)--(1,1,1)--(0,1,1)--cycle; % face avant +% arêtes horizontales, de l’arrière vers l’avant +\draw (0,0,0) -- (0,0,1); % bas gauche +\draw (1,0,0) -- (1,0,1); % bas droit +\draw (1,1,0) -- (1,1,1); % haut droit +\draw (0,1,0) -- (0,1,1); % haut gauche +\end{tikzpicture} + +\newcommand{\xangle}{13} %{15} +\newcommand{\yangle}{160}%{153} +\newcommand{\zangle}{90} + +\newcommand{\xlength}{1} +\newcommand{\ylength}{1} +\newcommand{\zlength}{1} + +\newcommand{\dimension}{1}% actually dimension-1 + +\pgfmathsetmacro{\xx}{\xlength*cos(\xangle)} +\pgfmathsetmacro{\xy}{\xlength*sin(\xangle)} +\pgfmathsetmacro{\yx}{\ylength*cos(\yangle)} +\pgfmathsetmacro{\yy}{\ylength*sin(\yangle)} +\pgfmathsetmacro{\zx}{\zlength*cos(\zangle)} +\pgfmathsetmacro{\zy}{\zlength*sin(\zangle)} + +\begin{tikzpicture} +[ x={(\xx cm,\xy cm)}, + y={(\yx cm,\yy cm)}, + z={(\zx cm,\zy cm)}, +] +\foreach \a in {0,...,\dimension} +{ \foreach \b in {0,...,\dimension} + { \pgfmathsetmacro{\c}{100-\a*7-\b*7} + \draw[canvas is xy plane at z=\a, black!\c] (\b,0) -- (\b,\dimension) (0,\b) -- (\dimension,\b); + \draw[canvas is xz plane at y=\a, black!\c] (\b,0) -- (\b,\dimension) (0,\b) -- (\dimension,\b); + \draw[canvas is yz plane at x=\a, black!\c] (\b,0) -- (\b,\dimension) (0,\b) -- (\dimension,\b); + } +} +\pgfmathsetmacro{\dim}{\dimension-1} +\foreach \a in {0,...,\dimension} +{ \foreach \b in {0,...,\dimension} + { \foreach \c in {0,...,\dimension} + { + \pgfmathsetmacro{\d}{\c+\b*\dimension+\a*\dimension*\dimension} +% \fill (\a,\b,\c) circle (0.05cm); + \node (1) at (\a,\b,\c) {$\d$}; + } + } +} +\end{tikzpicture} +\fi + +\end{document}