Project

General

Profile

Feature #71

Feature #68: cleanup doc for matrix, MatrixViews, *Matrix*,....

ZeroMat & FilledMat

Added by John Abbott over 12 years ago. Updated over 10 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Tidying
Start date:
21 Dec 2011
Due date:
% Done:

100%

Estimated time:
2.00 h
Spent time:

Description

ZeroMat & FilledMat are very similar. Should they be condensed into a single function?

JAA suggests having just one function FilledMat(int r, int c, RingElem val)

Thus ZeroMat(R, r, c) would be replaced by FilledMat(r,c, zero(R)).

Versions of "old" FilledMat which took long/BigInt/BigRat would become
FilledMat(r, c, RingElem(R, val))

JAA thinks this would give a simpler interface while maintaining readability

History

#1 Updated by John Abbott over 12 years ago

John Abbott wrote:

ZeroMat & FilledMat are very similar. Should they be condensed into a single function?

Anna says that ZeroMat(R,r,c) is usefully clearer than FilledMat(r,c,zero(R)). John agrees.

John now asks whether FilledMat would ever really be useful (assuming ZeroMat exists).

A quick grep through the C5 source code suggests that FilledMat was created just
so that a backward compatible "NewMat" could easily be implemented in CoCoA5.

A quick grep through the C4 packages revealed just two places where "NewMat" is used with a non-zero 3rd argument. Its use in CantStop.cpkg cannot be mapped into C5 because the matrix contains strings! Its use in idealop5 was to create a column matrix full of 1s; it can easily be replaced by ColMat([1 | I in 1..N]);
All other calls (in C4 packages) to "NewMat" can be replaced by calls to "ZeroMat".

Should we eliminate "FilledMat"?

#2 Updated by Anna Maria Bigatti over 10 years ago

  • Target version set to CoCoALib-0.99533 Easter14

#3 Updated by John Abbott over 10 years ago

  • Category set to Tidying
  • Status changed from New to In Progress
  • % Done changed from 0 to 10

After 2 years I still think that FilledMat is essentially useless.

Any objections to deleting it?
It is used in MatForOrdering.C:269 (fn ElimMat) -- not sure how to work around
and in IdealOfPoints.C:93 -- easy to work around.

#4 Updated by John Abbott over 10 years ago

Unfortunately C5 publishes NewMat(R,C,entry) which calls FilledMat; it is used in primary.cpkg5

What to do???

#5 Updated by Anna Maria Bigatti over 10 years ago

I made some changes:
NewMat is now in BackwardCompatible.cpkg5 and is a straight call to ZeroMat
NewMat for a matrix filled with something is now called NewMatFilled and is in mat.cpkg5

NewMatFilled is used only (in our code) to make rows of ones for matrix orderings.
Is it really used (in the world) for anything else? who knows :-(

For backward compatibility should it be called NewMat? probably....

#6 Updated by John Abbott over 10 years ago

  • Status changed from In Progress to Feedback
  • Assignee set to John Abbott
  • % Done changed from 10 to 90

Removed FilledMat. See comment-5 for the conclusion.

#7 Updated by John Abbott over 10 years ago

  • Status changed from Feedback to Closed
  • % Done changed from 90 to 100

Also available in: Atom PDF