oscar-system / Oscar.jl

A comprehensive open source computer algebra system for computations in algebra, geometry, and number theory.
https://www.oscar-system.org
Other
345 stars 126 forks source link

Add docstrings for types like fmpz, fmpz_mat, etc. etc #648

Closed fingolfin closed 1 year ago

fingolfin commented 3 years ago

Right now, I get this:

julia> using Oscar
...

help?> fmpz
search: fmpz fmpz_mod fmpz_mat fmpz_poly fmpz_mpoly fmpz_mod_mat fmpz_mod_poly FmpzPolyRing FmpzMatSpace

  fmpz(x::arb)

  Return x as an fmpz if it represents an unique integer, else throws an error.

  ────────────────────────────────────────────────────────────────────────────────────────────────────────────────

  fmpz(a::qqbar)

  Convert a to an integer of type fmpz. Throws if a is not an integer.

help?> fmpz_mat
search: fmpz_mat fmpz_mod_mat fmpz_mod_abs_series fmpz_mod fmpz_mpoly fmpz_mod_poly fmpz_mod_rel_series

  fmpz_mat(A::SMat{T}) where {T <: Integer}

  The same matrix A, but as an fmpz_mat. Requires a conversion from the base ring of A to \mathbb ZZ.

  ────────────────────────────────────────────────────────────────────────────────────────────────────────────────

  fmpz_mat(A::SMat{fmpz})

  The same matrix A, but as an fmpz_mat.

This is suboptimal. Not only are those just two out of many constructors (chosen seemingly at random?), there is also no real info how to use this. I suggest the following:

tthsqe12 commented 3 years ago

Can I assume all of nemo's doc strings for exp can be removed too (except perhaps p/qadic: just the ones that document f(x) as "return f of x")?

julia> using Nemo

help?> exp
search: exp exp2 Expr exp10 expm1 export exppii expint exp_gcd exponent exp_pi_i

  exp(x)

  Compute the natural base exponential of x, in other words e^x.

  Examples
  ≡≡≡≡≡≡≡≡≡≡

  julia> exp(1.0)
  2.718281828459045

  ────────────────────────────────────────────────────────────────────────────

  exp(A::AbstractMatrix)

  Compute the matrix exponential of A, defined by

  e^A = \sum_{n=0}^{\infty} \frac{A^n}{n!}.

  For symmetric or Hermitian A, an eigendecomposition (eigen) is used,
  otherwise the scaling and squaring algorithm (see [^H05]) is chosen.

  │ [^H05]
  │
  │  Nicholas J. Higham, "The squaring and scaling method for the
  │  matrix exponential revisited", SIAM Journal on Matrix Analysis and
  │  Applications, 26(4), 2005, 1179-1193. doi:10.1137/090768539
  │  (https://doi.org/10.1137/090768539)

  Examples
  ≡≡≡≡≡≡≡≡≡≡

  julia> A = Matrix(1.0I, 2, 2)
  2×2 Matrix{Float64}:
   1.0  0.0
   0.0  1.0

  julia> exp(A)
  2×2 Matrix{Float64}:
   2.71828  0.0
   0.0      2.71828

  ────────────────────────────────────────────────────────────────────────────

  exp(a::Generic.LaurentSeriesElem)

  Return the exponential of the power series a.

  ────────────────────────────────────────────────────────────────────────────

  exp(a::Generic.PuiseuxSeriesElem{T}) where T <: RingElement

  Return the exponential of the given Puiseux series a.

  ────────────────────────────────────────────────────────────────────────────

  exp(a::AbsSeriesElem)

  Return the exponential of the power series a.

  ────────────────────────────────────────────────────────────────────────────

  exp(a::RelSeriesElem)

  Return the exponential of the power series a.

  ────────────────────────────────────────────────────────────────────────────

  exp(a::fmpz_laurent_series)

  Return the exponential of the power series a.

  ────────────────────────────────────────────────────────────────────────────

  exp(a::FlintPuiseuxSeriesElem{T}) where T <: RingElem

  Return the exponential of the given Puiseux series.

  ────────────────────────────────────────────────────────────────────────────

  exp(x::arb)

  Return the exponential of x.

  ────────────────────────────────────────────────────────────────────────────

  exp(x::acb)

  Return the exponential of x.

  ────────────────────────────────────────────────────────────────────────────

  exp(a::ca)

  Return the exponential function of a.

  ────────────────────────────────────────────────────────────────────────────

  exp(a::padic)

  Return the p-adic exponential of a. We define this only when the valuation
  of a is positive (unless a = 0). The precision of the output will be the
  same as the precision of the input. If the input is not valid an exception
  is thrown.

  ────────────────────────────────────────────────────────────────────────────

  exp(a::qadic)

  Return the q-adic exponential of a. We define this only when the valuation
  of a is positive (unless a = 0). The precision of the output will be the
  same as the precision of the input. If the input is not valid an exception
  is thrown.

  ────────────────────────────────────────────────────────────────────────────

  exp(x::arb_mat)

  Returns the exponential of the matrix x.

  ────────────────────────────────────────────────────────────────────────────

  exp(x::acb_mat)

  Returns the exponential of the matrix x.
thofma commented 3 years ago

Yes, purge everything.

fingolfin commented 1 year ago

This was resolved by @mgkurtz I think (the original issue; we still may wish to prune "duplicate & trivial" docstrings for exp and other functions, but that's beyond what this issue was about)