def norm(self):
result = Scalar(self.size, self.deriv)<EOL>result.v = np.sqrt(self.x.v**<NUM_LIT:2> + self.y.v**<NUM_LIT:2> + self.z.v**<NUM_LIT:2>)<EOL>if self.deriv > <NUM_LIT:0>:<EOL><INDENT>result.d += self.x.v*self.x.d<EOL>result.d += self.y.v*self.y.d<EOL>result.d += self.z.v*self.z.d<EOL>result.d /= result.v<EOL><DEDENT>if self.deriv > <NUM_LIT:1>:<EOL><INDENT>result.dd += self.x.v*self.x.dd<EOL>result.dd += self.y.v*self.y.dd<EOL>result.dd += self.z.v*self.z.dd<EOL>denom = result.v**<NUM_LIT:2><EOL>result.dd += (<NUM_LIT:1> - self.x.v**<NUM_LIT:2>/denom)*np.outer(self.x.d, self.x.d)<EOL>result.dd += (<NUM_LIT:1> - self.y.v**<NUM_LIT:2>/denom)*np.outer(self.y.d, self.y.d)<EOL>result.dd += (<NUM_LIT:1> - self.z.v**<NUM_LIT:2>/denom)*np.outer(self.z.d, self.z.d)<EOL>tmp = -self.x.v*self.y.v/denom*np.outer(self.x.d, self.y.d)<EOL>result.dd += tmp+tmp.transpose()<EOL>tmp = -self.y.v*self.z.v/denom*np.outer(self.y.d, self.z.d)<EOL>result.dd += tmp+tmp.transpose()<EOL>tmp = -self.z.v*self.x.v/denom*np.outer(self.z.d, self.x.d)<EOL>result.dd += tmp+tmp.transpose()<EOL>result.dd /= result.v<EOL><DEDENT>return result<EOL>
Return a Scalar object with the norm of this vector