documentation for torch.inverse

This commit is contained in:
koray kavukcuoglu 2012-02-21 00:38:30 -05:00
parent 4397f709be
commit 1a03adebb4

View File

@ -1352,6 +1352,37 @@ u,s,v = torch.svd(a)
</file>
==== torch.inverse([res,] x) ====
{{anchor:torch.inverse}}
Computes the inverse of square matrix ''x''.
''=torch.inverse(x)'' returns the result as a new matrix.
''torch.inverse(y,x)'' puts the result in ''y''.
<file lua>
x=torch.rand(10,10)
y=torch.inverse(x)
z=x*y
print(z)
1.0000 -0.0000 0.0000 -0.0000 0.0000 0.0000 0.0000 -0.0000 0.0000 0.0000
0.0000 1.0000 -0.0000 -0.0000 0.0000 0.0000 -0.0000 -0.0000 -0.0000 0.0000
0.0000 -0.0000 1.0000 -0.0000 0.0000 0.0000 -0.0000 -0.0000 0.0000 0.0000
0.0000 -0.0000 -0.0000 1.0000 -0.0000 0.0000 0.0000 -0.0000 -0.0000 0.0000
0.0000 -0.0000 0.0000 -0.0000 1.0000 0.0000 0.0000 -0.0000 -0.0000 0.0000
0.0000 -0.0000 0.0000 -0.0000 0.0000 1.0000 0.0000 -0.0000 -0.0000 0.0000
0.0000 -0.0000 0.0000 -0.0000 0.0000 0.0000 1.0000 -0.0000 0.0000 0.0000
0.0000 -0.0000 -0.0000 -0.0000 0.0000 0.0000 0.0000 1.0000 0.0000 0.0000
0.0000 -0.0000 -0.0000 -0.0000 0.0000 0.0000 -0.0000 -0.0000 1.0000 0.0000
0.0000 -0.0000 0.0000 -0.0000 0.0000 0.0000 0.0000 -0.0000 0.0000 1.0000
[torch.DoubleTensor of dimension 10x10]
print('Max nonzero = ', torch.max(torch.abs(z-torch.eye(10))))
Max nonzero = 2.3092638912203e-14
</file>
===== Logical Operations on Tensors =====
{{anchor:torch.logical.dok}}