Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
See what's new at GitLab
4
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
M
modgalrep
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Test Cases
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Peter Bruin
modgalrep
Commits
31be314f
Commit
31be314f
authored
Feb 13, 2019
by
Peter Bruin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
clean up jacobian.c
parent
03200890
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
101 deletions
+18
-101
jacobian/jacobian.c
jacobian/jacobian.c
+18
-101
No files found.
jacobian/jacobian.c
View file @
31be314f
#include <math.h>
/* log */
#include <pari/pari.h>
#include "algsmall.h"
#include "finite-fields.h"
#include "matsmall.h"
#include "addflip-chain.h"
#include "curve.h"
...
...
@@ -25,60 +22,29 @@
and we need to know \Gamma(X,{\cal L}_0^i) for i <= 9.
*/
static
GEN
jacobian_
V
(
GEN
X
)
{
switch
(
jacobian_type
(
X
))
{
static
long
jacobian_
power
(
GEN
J
)
{
switch
(
jacobian_type
(
J
))
{
case
JACOBIAN_TYPE_MEDIUM
:
/* For the medium model, V = \Gamma(X,{\cal L}_0^2). */
return
jacobian_V_0_2
(
X
)
;
return
2
;
case
JACOBIAN_TYPE_LARGE
:
/* For the large model, V = \Gamma(X,{\cal L}_0^3). */
return
jacobian_V_0_3
(
X
)
;
return
3
;
default:
pari_err
(
e_MISC
,
"invalid type for the Jacobian"
);
return
NULL
;
pari_err
(
e_MISC
,
"invalid type for the Jacobian"
);
return
0
;
}
}
static
GEN
jacobian_IGS_V
(
GEN
X
)
{
switch
(
jacobian_type
(
X
))
{
case
JACOBIAN_TYPE_MEDIUM
:
return
curve_IGS_V
(
X
,
2
);
case
JACOBIAN_TYPE_LARGE
:
return
curve_IGS_V
(
X
,
3
);
default:
pari_err
(
e_MISC
,
"invalid type for the Jacobian"
);
return
NULL
;
}
jacobian_V
(
GEN
J
)
{
return
curve_V
(
J
,
jacobian_power
(
J
));
}
static
int
jacobian_deg_L
(
GEN
X
)
{
switch
(
jacobian_type
(
X
))
{
case
JACOBIAN_TYPE_MEDIUM
:
/* For the medium model, {\cal L} = {\cal L}_0^2. */
return
2
*
jacobian_deg_L_0
(
X
);
case
JACOBIAN_TYPE_LARGE
:
/* For the large model, {\cal L} = {\cal L}_0^3. */
return
3
*
jacobian_deg_L_0
(
X
);
default:
pari_err
(
e_MISC
,
"invalid type for the Jacobian"
);
return
0
;
}
}
static
int
jacobian_dim_V_2
(
GEN
X
)
{
switch
(
jacobian_type
(
X
))
{
case
JACOBIAN_TYPE_MEDIUM
:
return
lg
(
curve_V
(
X
,
4
))
-
1
;
case
JACOBIAN_TYPE_LARGE
:
return
lg
(
curve_V
(
X
,
6
))
-
1
;
default:
pari_err
(
e_MISC
,
"invalid type for the Jacobian"
);
return
0
;
}
static
GEN
jacobian_IGS_V
(
GEN
J
)
{
return
curve_IGS_V
(
J
,
jacobian_power
(
J
));
}
/*
...
...
@@ -89,25 +55,7 @@ jacobian_dim_V_2 (GEN X) {
*/
GEN
jacobian_deflate
(
GEN
X
,
GEN
W_D
)
{
unsigned
long
p
=
curve_base_field_characteristic
(
X
);
GEN
T
=
curve_base_field_polynomial
(
X
);
GEN
V
=
jacobian_V
(
X
);
int
degree_D
=
jacobian_divisor_deg
(
X
,
W_D
);
int
dim_W_2_D
=
jacobian_dim_V_2
(
X
)
-
degree_D
;
const
float
alpha
=
0
.
9
;
int
h
=
1
+
ceil
(
log
((
jacobian_deg_L
(
X
)
-
degree_D
)
/
alpha
)
/
log_ffsize
(
p
,
T
));
GEN
IGS
,
IGS_V
;
pari_sp
av
=
avma
;
if
(
lg
(
W_D
)
<
4
)
return
gcopy
(
W_D
);
do
{
avma
=
av
;
IGS
=
matsmall_random_subspace
(
W_D
,
h
,
0
,
p
,
T
);
IGS_V
=
curve_multiply_subspaces
(
X
,
IGS
,
V
);
}
while
(
lg
(
IGS_V
)
-
1
<
dim_W_2_D
);
return
gerepileupto
(
av
,
IGS
);
return
curve_divisor_IGS
(
X
,
W_D
,
jacobian_power
(
X
));
}
/*
...
...
@@ -118,18 +66,7 @@ GEN
jacobian_inflate
(
GEN
X
,
GEN
IGS_D
)
{
GEN
V
=
jacobian_V
(
X
);
pari_sp
av
=
avma
;
int
i
;
switch
(
jacobian_type
(
X
))
{
case
JACOBIAN_TYPE_MEDIUM
:
i
=
2
;
break
;
case
JACOBIAN_TYPE_LARGE
:
i
=
3
;
break
;
default:
pari_err
(
e_MISC
,
"invalid type for the Jacobian"
);
return
NULL
;
}
long
i
=
jacobian_power
(
X
);
return
gerepileupto
(
av
,
curve_divide_subspaces
(
X
,
curve_multiply_subspaces
(
X
,
IGS_D
,
V
),
2
*
i
,
jacobian_IGS_V
(
X
),
i
));
...
...
@@ -146,18 +83,7 @@ GEN
jacobian_flip
(
GEN
X
,
GEN
W_D
,
GEN
s
)
{
GEN
V
=
jacobian_V
(
X
);
pari_sp
av
=
avma
;
int
i
;
switch
(
jacobian_type
(
X
))
{
case
JACOBIAN_TYPE_MEDIUM
:
i
=
2
;
break
;
case
JACOBIAN_TYPE_LARGE
:
i
=
3
;
break
;
default:
pari_err
(
e_MISC
,
"invalid type for the Jacobian"
);
return
NULL
;
}
long
i
=
jacobian_power
(
X
);
return
gerepileupto
(
av
,
curve_divide_subspaces
(
X
,
curve_multiply_section_subspace
(
X
,
s
,
V
),
2
*
i
,
jacobian_deflate
(
X
,
W_D
),
i
));
...
...
@@ -603,18 +529,9 @@ jacobian_count_points (GEN J) {
GEN
jacobian_random_point
(
GEN
J
)
{
/*
We need to find a random divisor of degree d.
In the case of the large model, the choice below means that
we pick a small divisor.
*/
long
d
=
curve_degree
(
J
);
if
(
jacobian_type
(
J
)
==
JACOBIAN_TYPE_MEDIUM
)
return
curve_random_divisor
(
J
,
d
,
2
);
if
(
jacobian_type
(
J
)
==
JACOBIAN_TYPE_LARGE
)
return
curve_random_divisor
(
J
,
d
,
3
);
pari_err
(
e_MISC
,
"invalid type for the Jacobian"
);
return
NULL
;
/* In the case of the large model, we pick a small divisor. */
return
curve_random_divisor
(
J
,
curve_degree
(
J
),
jacobian_power
(
J
));
}
GEN
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment