The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 795 - File: showthread.php PHP 7.4.33 (FreeBSD)
File Line Function
/showthread.php 795 errorHandler->error





Post Reply 
Cofactors and adjoint matrix
06-04-2015, 08:06 PM
Post: #1
Cofactors and adjoint matrix
hi,
this code doesn't run:
Code:

minor();

EXPORT cofactors(m)
BEGIN
local tempmat, cofact, r, c, j, k;
  r:=rowDim(m);
  c:=colDim(m);
  cofact:=  MAKEMAT(0,r,c);
  tempmat:= m;
  FOR j FROM 1 TO r DO
    FOR k FROM 1 to c DO
      cofact:= minor(tempmat, j, k);
      tempmat(j,k):= cofact;
    END; // inner for
  END; //for
  RETURN tempmat;
END;

minor(mat, r,c)
BEGIN
  mat:= delrows(mat,r);
  mat:= delcols(mat,c);
  RETURN mat;
END;

EXPORT adj(m)
BEGIN
local ad;
  ad:= cofactors(m);
RETURN TRN(ad);
END;

Is it not possible to have a matrix as item od another matrix?

I think the problem is in the line < tempmat(j,k):= cofact; >, in fact...
Any help?

Salvo

∫aL√0mic (IT9CLU) :: HP Prime 50g 41CX 71b 42s 39s 35s 12C 15C - DM42, DM41X - WP34s Prime Soft. Lib
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Cofactors and adjoint matrix - salvomic - 06-04-2015 08:06 PM



User(s) browsing this thread: 1 Guest(s)