Macaulay2 » Documentation
Packages » Macaulay2Doc :: inverse(Matrix)
next | previous | forward | backward | up | index | toc

inverse(Matrix) -- compute the inverse

Synopsis

Code

../../../../../Macaulay2/m2/methods.m2:664:51-673:25: --source code:
cacheValue = key -> f -> new CacheFunction from (x -> (
          c := try x.cache else x.cache = new CacheTable;
          if c#?key then (
               val := c#key;
               if class val === CacheFunction then (
                    remove(c,key);
                    c#key = val x)
               else val
               )
          else c#key = f x))
| symbol  class            value                                                    location of symbol
| ------  -----            -----                                                    ------------------                                  
| f       FunctionClosure  FunctionClosure[../../../../../Macaulay2/m2/matrix1.m2.  ../../../../../Macaulay2/m2/methods.m2:664:20-664:21
| key     Symbol           inverse                                                  ../../../../../Macaulay2/m2/methods.m2:664:13-664:16
| -- function f:
| ../../../../../Macaulay2/m2/matrix1.m2:614:7-620:14: --source code:
|      m -> (
|       if hasEngineLinearAlgebra ring m and isBasicMatrix m then
|           basicInverse m
|       else (
|               (quo,rem) := quotientRemainder(id_(target m), m);
|               if rem != 0 then error "matrix not invertible";
|               quo))
|      )

Ways to use this method: