next | previous | forward | backward | up | top | index | toc | Macaulay2 web site
Macaulay2Doc :: inverse(Matrix)

inverse(Matrix) -- compute the inverse

Synopsis

Code

/home/dan/src/M2/M2/Macaulay2/m2/methods.m2:536:52-545:26: --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 -- ...     /home/dan/src/M2/M2/Macaulay2/m2/methods.m2:536:21-536:22
| key    : Symbol          -- inverse /home/dan/src/M2/M2/Macaulay2/m2/methods.m2:536:14-536:17
| -- function f:
| /home/dan/src/M2/M2/Macaulay2/m2/matrix1.m2:624:8-631:15: --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))
|      )