An n-inputs analog adder configured to perform an analog adder circuit function, the magnetic device comprising a plurality of magnetic units, each of the plurality of magnetic units including: n magnetic tunnel junctions (2, 2', 2', 2''',...), each magnetic tunnel junction (2, 2', 2', 2''',...) comprising a storage magnetic layer having a storage magnetization, a sense magnetic layer having a sense magnetization that can be varied with respect to the storage magnetization, and a tunnel barrier layer between the sense magnetic layer and the storage magnetic layer (21, 23); a current line electrically connecting in series said n magnetic tunnel junctions (2, 2', 2', 2''',...); n input lines (4, 4', 4', 4''',...), each input line being configured to generate a magnetic field (42, 42', 42', 42''',...) adapted for varying a direction of the sense magnetization and a junction resistance (R 1, R 2, R 3, R 4,...) of a corresponding one of said n magnetic tunnel junctions (2, 2', 2', 2''',...), based on a corresponding input (41, 41', 41', 41''',...), wherein the junction resistance (R 1, R 2, R 3, R 4,...) of said corresponding one of said n magnetic tunnel junctions (2, 2', 2', 2''',...) varies linearly based on said corresponding input signal(41, 41', 41', 41''',...); and wherein each of the plurality of magnetic units is configured to add said n inputs (41, 41') to generate an output signal (V out) that varies in response to the n junction resistances (R 1, R 2, R 3, R 4,...) of said n magnetic tunnel junctions (2, 2', 2', 2''',...), and, each of the n input lines (4, 4', 4', 4''',...) are independent of one another such that the the n input lines (4, 4', 4', 4''',...) can conduct n independent input signals so that the output signal (V out) can vary as a function of said n independent input signals; and wherein said plurality of magnetic units comprises N magnetic units electrically connected in series along said n input lines (4, 4', 4', 4''',...) and wherein said N magnetic units are arranged such that for each input line of the n input lines (4, 4', 4', 4''',...) the corresponding magnetic tunnel junctions of all the magnetic units are aligned in a direction parallel to the one of said input line. n magnetic tunnel junctions (2, 2', 2', 2''',...), each magnetic tunnel junction (2, 2', 2', 2''',...) comprising a storage magnetic layer having a storage magnetization, a sense magnetic layer having a sense magnetization that can be varied with respect to the storage magnetization, and a tunnel barrier layer between the sense magnetic layer and the storage magnetic layer (21, 23); a current line electrically connecting in series said n magnetic tunnel junctions (2, 2', 2', 2''',...); n input lines (4, 4', 4', 4''',...), each input line being configured to generate a magnetic field (42, 42', 42', 42''',...) adapted for varying a direction of the sense magnetization and a junction resistance (R 1, R 2, R 3, R 4,...) of a corresponding one of said n magnetic tunnel junctions (2, 2', 2', 2''',...), based on a corresponding input (41, 41', 41', 41''',...), wherein the junction resistance (R 1, R 2, R 3, R 4,...) of said corresponding one of said n magnetic tunnel junctions (2, 2', 2', 2''',...) varies linearly based on said corresponding input signal(41, 41', 41', 41''',...); and wherein each of the plurality of magnetic units is configured to add said n inputs (41, 41') to generate an output signal (V out) that varies in response to the n junction resistances (R 1, R 2, R 3, R 4,...) of said n magnetic tunnel junctions (2, 2', 2', 2''',...), and, each of the n input lines (4, 4', 4', 4''',...) are independent of one another such that the the n input lines (4, 4', 4', 4''',...) can conduct n independent input signals so that the output signal (V out) can vary as a function of said n independent input signals; and wherein said plurality of magnetic units comprises N magnetic units electrically connected in series along said n input lines (4, 4', 4', 4''',...) and wherein said N magnetic units are arranged such that for each input line of the n input lines (4, 4', 4', 4''',...) the corresponding magnetic tunnel junctions of all the magnetic units are aligned in a direction parallel to the one of said input line.