gmp_libmpn_sec_sqr Method |
Set R to A^2, where A = {ap, an}, and R = {rp, 2 * an}.
Namespace:
Math.Gmp.Native
Assembly:
Math.Gmp.Native (in Math.Gmp.Native.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax public static void mpn_sec_sqr(
mp_ptr rp,
mp_ptr ap,
mp_size_t an,
mp_ptr tp
)
Public Shared Sub mpn_sec_sqr (
rp As mp_ptr,
ap As mp_ptr,
an As mp_size_t,
tp As mp_ptr
)
public:
static void mpn_sec_sqr(
mp_ptr^ rp,
mp_ptr^ ap,
mp_size_t an,
mp_ptr^ tp
)
static member mpn_sec_sqr :
rp : mp_ptr *
ap : mp_ptr *
an : mp_size_t *
tp : mp_ptr -> unit
Parameters
- rp
- Type: Math.Gmp.Nativemp_ptr
The result operand. - ap
- Type: Math.Gmp.Nativemp_ptr
The operand integer. - an
- Type: Math.Gmp.Nativemp_size_t
The number of limbs of ap. - tp
- Type: Math.Gmp.Nativemp_ptr
The scratch operand integer.
Remarks
It is required that an > 0.
No overlapping between R and the input operands is allowed.
This function requires scratch space of mpn_sec_sqr_itch(an)
limbs to be passed in the tp parameter.
The scratch space requirements are guaranteed to increase monotonously in the operand size.
Examples
mp_ptr ap = new mp_ptr(new uint[] { 0xffffffff, 0xffffffff });
mp_ptr result = new mp_ptr(new uint[] { 0x00000001, 0x00000000, 0xfffffffe, 0xffffffff });
mp_ptr rp = new mp_ptr(2 * ap.Size);
mp_size_t size = gmp_lib.mpn_sec_sqr_itch(ap.Size);
mp_ptr tp = new mp_ptr(size);
gmp_lib.mpn_sec_sqr(rp, ap, ap.Size, tp);
Assert.IsTrue(rp.SequenceEqual(result));
gmp_lib.free(rp, ap, tp, result);
Dim ap As New mp_ptr(New UInteger() { &HffffffffUI, &HffffffffUI})
Dim result As New mp_ptr(New UInteger() { &H1, &H0, &HfffffffeUI, &HffffffffUI})
Dim rp As New mp_ptr(2 * ap.Size)
Dim size As mp_size_t = gmp_lib.mpn_sec_sqr_itch(ap.Size)
Dim tp As New mp_ptr(size)
gmp_lib.mpn_sec_sqr(rp, ap, ap.Size, tp)
Assert.IsTrue(rp.SequenceEqual(result))
gmp_lib.free(rp, ap, tp, result)
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
See Also