Re: [Axiom-mail] positive definite matrix predicate

2009-12-28 Thread Konstantin L. Metlov
 Definitely avoid subdomains. They require support from the interpreter.
 There are only 2 subdomains that have been properly implemented in Axiom,
 PositiveInteger and NonNegativeInteger and both required a lot of effort.
Even if what I really want is just check the predicate ?

From what I've read in The AXIOM System J.H. Davenport it seemed like the 
right feature to use for this... Yes, I understand that only the interpreter 
would automatically identify the matrix in its output as, let's say, 
Hermitean. In the SPAD code I'd write that my function requires a Hermitian 
matrix and will have to make an explicit coercion (which would check the 
predicate and ensure it is a Hermitian indeed or signal an error that it is 
not). For all the other purposes Hermitean matrix would be just a 
SquareMatrix.

I was thinking about defining a domain, but the problem, which turned this 
idea down, that this domain would not be closed. Yes, the sum of Hermitian 
(and positive definite) matrices is Hermitian (positive definite) too, but 
their product is only Hermitian if they commute. This seemed (on my current, 
almost non-existant, level of knowledge of Axiom) to be hard to capture by a 
type system... at least by a static one. The type of the result of the 
multiplication would depend on whether two particular matrices commute.

May be it is impossible to represent in Axiom ? Which would explain why it 
does not have these basic notions built into its matrix algebra...

With the best regards,
 Konstantin.

p.s. Is this feature (subdomains) going to be removed ?


___
Axiom-mail mailing list
Axiom-mail@nongnu.org
http://lists.nongnu.org/mailman/listinfo/axiom-mail


Re: [Axiom-mail] positive definite matrix predicate

2009-12-28 Thread Tim Daly

Konstantin L. Metlov wrote:

Definitely avoid subdomains. They require support from the interpreter.
There are only 2 subdomains that have been properly implemented in Axiom,
PositiveInteger and NonNegativeInteger and both required a lot of effort.


Even if what I really want is just check the predicate ?

From what I've read in The AXIOM System J.H. Davenport it seemed like the 
right feature to use for this... Yes, I understand that only the interpreter 
would automatically identify the matrix in its output as, let's say, 
Hermitean. In the SPAD code I'd write that my function requires a Hermitian 
matrix and will have to make an explicit coercion (which would check the 
predicate and ensure it is a Hermitian indeed or signal an error that it is 
not). For all the other purposes Hermitean matrix would be just a 
SquareMatrix.


I was thinking about defining a domain, but the problem, which turned this 
idea down, that this domain would not be closed. Yes, the sum of Hermitian 
(and positive definite) matrices is Hermitian (positive definite) too, but 
their product is only Hermitian if they commute. This seemed (on my current, 
almost non-existant, level of knowledge of Axiom) to be hard to capture by a 
type system... at least by a static one. The type of the result of the 
multiplication would depend on whether two particular matrices commute.


May be it is impossible to represent in Axiom ? Which would explain why it 
does not have these basic notions built into its matrix algebra...
  
I don't think it is impossible to represent in the algebra. The usual 
way to restrict a result is
to define a retractIfCan or coerceIfCan function that will attempt to 
return a restricted result.
If the retraction (of type Union(restrictedtype,failed)) returns 
failed then the wider result

is used.

With the best regards,
 Konstantin.

p.s. Is this feature (subdomains) going to be removed ?
  

No. Subdomains will continue to exist.


___
Axiom-mail mailing list
Axiom-mail@nongnu.org
http://lists.nongnu.org/mailman/listinfo/axiom-mail

  




___
Axiom-mail mailing list
Axiom-mail@nongnu.org
http://lists.nongnu.org/mailman/listinfo/axiom-mail


Re: [Axiom-mail] positive definite matrix predicate

2009-12-27 Thread Tim Daly

Konstantin

Hello ! I have a lot of questions :-)

Trying to implement a certain special function in Axiom (Epstein zeta, to be 
precise), which depends on a positive definite matrix argument. How do I 
properly implement the test that the matrix is positive definite?
  
I do not see this test anywhere. The only mention of the subject seems 
to be in MHROWRED

ModulareHermitianRowReduction but I do not see a test for this condition.
Did I overlook a standard predicate, which tests for this ? 


I do not think you overlooked anything.
Should I perform 
the test in my function (which, since such a test seems to be quite basis, 
may potentially lead to duplication of code in future) and potentially fail ? 
  

Write your own test but give some thought to making it general.
If I add such predicate to MatrixCategory (which looks like a proper place 
for such a basic thing), what are the conditions for the patch to be 
accepted ?
  
I'm not sure if this should be defined at the category level. That 
complicates the problem because
now you have to figure out all of the places where matrix category is 
used and check that your

category-level function is valid (e.g. over complex domains?).

You could look at MATLIN MatrixLinearAlgebraFunctions and add it there 
at the level
of generality you need. Does your code work over IntegralDomains? 
EuclideanDomains?

Fields?, etc.

There are no conditions for a patch to be accepted but I need to be 
fairly confident that the
patch doesn't break anything, and that the patch works as users expect. 
This is helped along
by having lots of simple test cases sent along with the patch. Even 
better is a set of explanations
of the function (which I'd otherwise have to create that documentation 
which takes time for me

to learn).

Tim




___
Axiom-mail mailing list
Axiom-mail@nongnu.org
http://lists.nongnu.org/mailman/listinfo/axiom-mail