mirror of
https://github.com/twitter/the-algorithm.git
synced 2024-12-22 08:35:33 +00:00
Twitter Recommendation Algorithm
Please note we have force-pushed a new initial commit in order to remove some publicly-available Twitter user information. Note that this process may be required in the future.
This commit is contained in:
commit
ef4c5eb65e
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
.DS_Store
|
||||||
|
|
661
COPYING
Normal file
661
COPYING
Normal file
|
@ -0,0 +1,661 @@
|
||||||
|
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||||
|
Version 3, 19 November 2007
|
||||||
|
|
||||||
|
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The GNU Affero General Public License is a free, copyleft license for
|
||||||
|
software and other kinds of works, specifically designed to ensure
|
||||||
|
cooperation with the community in the case of network server software.
|
||||||
|
|
||||||
|
The licenses for most software and other practical works are designed
|
||||||
|
to take away your freedom to share and change the works. By contrast,
|
||||||
|
our General Public Licenses are intended to guarantee your freedom to
|
||||||
|
share and change all versions of a program--to make sure it remains free
|
||||||
|
software for all its users.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
them if you wish), that you receive source code or can get it if you
|
||||||
|
want it, that you can change the software or use pieces of it in new
|
||||||
|
free programs, and that you know you can do these things.
|
||||||
|
|
||||||
|
Developers that use our General Public Licenses protect your rights
|
||||||
|
with two steps: (1) assert copyright on the software, and (2) offer
|
||||||
|
you this License which gives you legal permission to copy, distribute
|
||||||
|
and/or modify the software.
|
||||||
|
|
||||||
|
A secondary benefit of defending all users' freedom is that
|
||||||
|
improvements made in alternate versions of the program, if they
|
||||||
|
receive widespread use, become available for other developers to
|
||||||
|
incorporate. Many developers of free software are heartened and
|
||||||
|
encouraged by the resulting cooperation. However, in the case of
|
||||||
|
software used on network servers, this result may fail to come about.
|
||||||
|
The GNU General Public License permits making a modified version and
|
||||||
|
letting the public access it on a server without ever releasing its
|
||||||
|
source code to the public.
|
||||||
|
|
||||||
|
The GNU Affero General Public License is designed specifically to
|
||||||
|
ensure that, in such cases, the modified source code becomes available
|
||||||
|
to the community. It requires the operator of a network server to
|
||||||
|
provide the source code of the modified version running there to the
|
||||||
|
users of that server. Therefore, public use of a modified version, on
|
||||||
|
a publicly accessible server, gives the public access to the source
|
||||||
|
code of the modified version.
|
||||||
|
|
||||||
|
An older license, called the Affero General Public License and
|
||||||
|
published by Affero, was designed to accomplish similar goals. This is
|
||||||
|
a different license, not a version of the Affero GPL, but Affero has
|
||||||
|
released a new version of the Affero GPL which permits relicensing under
|
||||||
|
this license.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
0. Definitions.
|
||||||
|
|
||||||
|
"This License" refers to version 3 of the GNU Affero General Public License.
|
||||||
|
|
||||||
|
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||||
|
works, such as semiconductor masks.
|
||||||
|
|
||||||
|
"The Program" refers to any copyrightable work licensed under this
|
||||||
|
License. Each licensee is addressed as "you". "Licensees" and
|
||||||
|
"recipients" may be individuals or organizations.
|
||||||
|
|
||||||
|
To "modify" a work means to copy from or adapt all or part of the work
|
||||||
|
in a fashion requiring copyright permission, other than the making of an
|
||||||
|
exact copy. The resulting work is called a "modified version" of the
|
||||||
|
earlier work or a work "based on" the earlier work.
|
||||||
|
|
||||||
|
A "covered work" means either the unmodified Program or a work based
|
||||||
|
on the Program.
|
||||||
|
|
||||||
|
To "propagate" a work means to do anything with it that, without
|
||||||
|
permission, would make you directly or secondarily liable for
|
||||||
|
infringement under applicable copyright law, except executing it on a
|
||||||
|
computer or modifying a private copy. Propagation includes copying,
|
||||||
|
distribution (with or without modification), making available to the
|
||||||
|
public, and in some countries other activities as well.
|
||||||
|
|
||||||
|
To "convey" a work means any kind of propagation that enables other
|
||||||
|
parties to make or receive copies. Mere interaction with a user through
|
||||||
|
a computer network, with no transfer of a copy, is not conveying.
|
||||||
|
|
||||||
|
An interactive user interface displays "Appropriate Legal Notices"
|
||||||
|
to the extent that it includes a convenient and prominently visible
|
||||||
|
feature that (1) displays an appropriate copyright notice, and (2)
|
||||||
|
tells the user that there is no warranty for the work (except to the
|
||||||
|
extent that warranties are provided), that licensees may convey the
|
||||||
|
work under this License, and how to view a copy of this License. If
|
||||||
|
the interface presents a list of user commands or options, such as a
|
||||||
|
menu, a prominent item in the list meets this criterion.
|
||||||
|
|
||||||
|
1. Source Code.
|
||||||
|
|
||||||
|
The "source code" for a work means the preferred form of the work
|
||||||
|
for making modifications to it. "Object code" means any non-source
|
||||||
|
form of a work.
|
||||||
|
|
||||||
|
A "Standard Interface" means an interface that either is an official
|
||||||
|
standard defined by a recognized standards body, or, in the case of
|
||||||
|
interfaces specified for a particular programming language, one that
|
||||||
|
is widely used among developers working in that language.
|
||||||
|
|
||||||
|
The "System Libraries" of an executable work include anything, other
|
||||||
|
than the work as a whole, that (a) is included in the normal form of
|
||||||
|
packaging a Major Component, but which is not part of that Major
|
||||||
|
Component, and (b) serves only to enable use of the work with that
|
||||||
|
Major Component, or to implement a Standard Interface for which an
|
||||||
|
implementation is available to the public in source code form. A
|
||||||
|
"Major Component", in this context, means a major essential component
|
||||||
|
(kernel, window system, and so on) of the specific operating system
|
||||||
|
(if any) on which the executable work runs, or a compiler used to
|
||||||
|
produce the work, or an object code interpreter used to run it.
|
||||||
|
|
||||||
|
The "Corresponding Source" for a work in object code form means all
|
||||||
|
the source code needed to generate, install, and (for an executable
|
||||||
|
work) run the object code and to modify the work, including scripts to
|
||||||
|
control those activities. However, it does not include the work's
|
||||||
|
System Libraries, or general-purpose tools or generally available free
|
||||||
|
programs which are used unmodified in performing those activities but
|
||||||
|
which are not part of the work. For example, Corresponding Source
|
||||||
|
includes interface definition files associated with source files for
|
||||||
|
the work, and the source code for shared libraries and dynamically
|
||||||
|
linked subprograms that the work is specifically designed to require,
|
||||||
|
such as by intimate data communication or control flow between those
|
||||||
|
subprograms and other parts of the work.
|
||||||
|
|
||||||
|
The Corresponding Source need not include anything that users
|
||||||
|
can regenerate automatically from other parts of the Corresponding
|
||||||
|
Source.
|
||||||
|
|
||||||
|
The Corresponding Source for a work in source code form is that
|
||||||
|
same work.
|
||||||
|
|
||||||
|
2. Basic Permissions.
|
||||||
|
|
||||||
|
All rights granted under this License are granted for the term of
|
||||||
|
copyright on the Program, and are irrevocable provided the stated
|
||||||
|
conditions are met. This License explicitly affirms your unlimited
|
||||||
|
permission to run the unmodified Program. The output from running a
|
||||||
|
covered work is covered by this License only if the output, given its
|
||||||
|
content, constitutes a covered work. This License acknowledges your
|
||||||
|
rights of fair use or other equivalent, as provided by copyright law.
|
||||||
|
|
||||||
|
You may make, run and propagate covered works that you do not
|
||||||
|
convey, without conditions so long as your license otherwise remains
|
||||||
|
in force. You may convey covered works to others for the sole purpose
|
||||||
|
of having them make modifications exclusively for you, or provide you
|
||||||
|
with facilities for running those works, provided that you comply with
|
||||||
|
the terms of this License in conveying all material for which you do
|
||||||
|
not control copyright. Those thus making or running the covered works
|
||||||
|
for you must do so exclusively on your behalf, under your direction
|
||||||
|
and control, on terms that prohibit them from making any copies of
|
||||||
|
your copyrighted material outside their relationship with you.
|
||||||
|
|
||||||
|
Conveying under any other circumstances is permitted solely under
|
||||||
|
the conditions stated below. Sublicensing is not allowed; section 10
|
||||||
|
makes it unnecessary.
|
||||||
|
|
||||||
|
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||||
|
|
||||||
|
No covered work shall be deemed part of an effective technological
|
||||||
|
measure under any applicable law fulfilling obligations under article
|
||||||
|
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||||
|
similar laws prohibiting or restricting circumvention of such
|
||||||
|
measures.
|
||||||
|
|
||||||
|
When you convey a covered work, you waive any legal power to forbid
|
||||||
|
circumvention of technological measures to the extent such circumvention
|
||||||
|
is effected by exercising rights under this License with respect to
|
||||||
|
the covered work, and you disclaim any intention to limit operation or
|
||||||
|
modification of the work as a means of enforcing, against the work's
|
||||||
|
users, your or third parties' legal rights to forbid circumvention of
|
||||||
|
technological measures.
|
||||||
|
|
||||||
|
4. Conveying Verbatim Copies.
|
||||||
|
|
||||||
|
You may convey verbatim copies of the Program's source code as you
|
||||||
|
receive it, in any medium, provided that you conspicuously and
|
||||||
|
appropriately publish on each copy an appropriate copyright notice;
|
||||||
|
keep intact all notices stating that this License and any
|
||||||
|
non-permissive terms added in accord with section 7 apply to the code;
|
||||||
|
keep intact all notices of the absence of any warranty; and give all
|
||||||
|
recipients a copy of this License along with the Program.
|
||||||
|
|
||||||
|
You may charge any price or no price for each copy that you convey,
|
||||||
|
and you may offer support or warranty protection for a fee.
|
||||||
|
|
||||||
|
5. Conveying Modified Source Versions.
|
||||||
|
|
||||||
|
You may convey a work based on the Program, or the modifications to
|
||||||
|
produce it from the Program, in the form of source code under the
|
||||||
|
terms of section 4, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) The work must carry prominent notices stating that you modified
|
||||||
|
it, and giving a relevant date.
|
||||||
|
|
||||||
|
b) The work must carry prominent notices stating that it is
|
||||||
|
released under this License and any conditions added under section
|
||||||
|
7. This requirement modifies the requirement in section 4 to
|
||||||
|
"keep intact all notices".
|
||||||
|
|
||||||
|
c) You must license the entire work, as a whole, under this
|
||||||
|
License to anyone who comes into possession of a copy. This
|
||||||
|
License will therefore apply, along with any applicable section 7
|
||||||
|
additional terms, to the whole of the work, and all its parts,
|
||||||
|
regardless of how they are packaged. This License gives no
|
||||||
|
permission to license the work in any other way, but it does not
|
||||||
|
invalidate such permission if you have separately received it.
|
||||||
|
|
||||||
|
d) If the work has interactive user interfaces, each must display
|
||||||
|
Appropriate Legal Notices; however, if the Program has interactive
|
||||||
|
interfaces that do not display Appropriate Legal Notices, your
|
||||||
|
work need not make them do so.
|
||||||
|
|
||||||
|
A compilation of a covered work with other separate and independent
|
||||||
|
works, which are not by their nature extensions of the covered work,
|
||||||
|
and which are not combined with it such as to form a larger program,
|
||||||
|
in or on a volume of a storage or distribution medium, is called an
|
||||||
|
"aggregate" if the compilation and its resulting copyright are not
|
||||||
|
used to limit the access or legal rights of the compilation's users
|
||||||
|
beyond what the individual works permit. Inclusion of a covered work
|
||||||
|
in an aggregate does not cause this License to apply to the other
|
||||||
|
parts of the aggregate.
|
||||||
|
|
||||||
|
6. Conveying Non-Source Forms.
|
||||||
|
|
||||||
|
You may convey a covered work in object code form under the terms
|
||||||
|
of sections 4 and 5, provided that you also convey the
|
||||||
|
machine-readable Corresponding Source under the terms of this License,
|
||||||
|
in one of these ways:
|
||||||
|
|
||||||
|
a) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by the
|
||||||
|
Corresponding Source fixed on a durable physical medium
|
||||||
|
customarily used for software interchange.
|
||||||
|
|
||||||
|
b) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by a
|
||||||
|
written offer, valid for at least three years and valid for as
|
||||||
|
long as you offer spare parts or customer support for that product
|
||||||
|
model, to give anyone who possesses the object code either (1) a
|
||||||
|
copy of the Corresponding Source for all the software in the
|
||||||
|
product that is covered by this License, on a durable physical
|
||||||
|
medium customarily used for software interchange, for a price no
|
||||||
|
more than your reasonable cost of physically performing this
|
||||||
|
conveying of source, or (2) access to copy the
|
||||||
|
Corresponding Source from a network server at no charge.
|
||||||
|
|
||||||
|
c) Convey individual copies of the object code with a copy of the
|
||||||
|
written offer to provide the Corresponding Source. This
|
||||||
|
alternative is allowed only occasionally and noncommercially, and
|
||||||
|
only if you received the object code with such an offer, in accord
|
||||||
|
with subsection 6b.
|
||||||
|
|
||||||
|
d) Convey the object code by offering access from a designated
|
||||||
|
place (gratis or for a charge), and offer equivalent access to the
|
||||||
|
Corresponding Source in the same way through the same place at no
|
||||||
|
further charge. You need not require recipients to copy the
|
||||||
|
Corresponding Source along with the object code. If the place to
|
||||||
|
copy the object code is a network server, the Corresponding Source
|
||||||
|
may be on a different server (operated by you or a third party)
|
||||||
|
that supports equivalent copying facilities, provided you maintain
|
||||||
|
clear directions next to the object code saying where to find the
|
||||||
|
Corresponding Source. Regardless of what server hosts the
|
||||||
|
Corresponding Source, you remain obligated to ensure that it is
|
||||||
|
available for as long as needed to satisfy these requirements.
|
||||||
|
|
||||||
|
e) Convey the object code using peer-to-peer transmission, provided
|
||||||
|
you inform other peers where the object code and Corresponding
|
||||||
|
Source of the work are being offered to the general public at no
|
||||||
|
charge under subsection 6d.
|
||||||
|
|
||||||
|
A separable portion of the object code, whose source code is excluded
|
||||||
|
from the Corresponding Source as a System Library, need not be
|
||||||
|
included in conveying the object code work.
|
||||||
|
|
||||||
|
A "User Product" is either (1) a "consumer product", which means any
|
||||||
|
tangible personal property which is normally used for personal, family,
|
||||||
|
or household purposes, or (2) anything designed or sold for incorporation
|
||||||
|
into a dwelling. In determining whether a product is a consumer product,
|
||||||
|
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||||
|
product received by a particular user, "normally used" refers to a
|
||||||
|
typical or common use of that class of product, regardless of the status
|
||||||
|
of the particular user or of the way in which the particular user
|
||||||
|
actually uses, or expects or is expected to use, the product. A product
|
||||||
|
is a consumer product regardless of whether the product has substantial
|
||||||
|
commercial, industrial or non-consumer uses, unless such uses represent
|
||||||
|
the only significant mode of use of the product.
|
||||||
|
|
||||||
|
"Installation Information" for a User Product means any methods,
|
||||||
|
procedures, authorization keys, or other information required to install
|
||||||
|
and execute modified versions of a covered work in that User Product from
|
||||||
|
a modified version of its Corresponding Source. The information must
|
||||||
|
suffice to ensure that the continued functioning of the modified object
|
||||||
|
code is in no case prevented or interfered with solely because
|
||||||
|
modification has been made.
|
||||||
|
|
||||||
|
If you convey an object code work under this section in, or with, or
|
||||||
|
specifically for use in, a User Product, and the conveying occurs as
|
||||||
|
part of a transaction in which the right of possession and use of the
|
||||||
|
User Product is transferred to the recipient in perpetuity or for a
|
||||||
|
fixed term (regardless of how the transaction is characterized), the
|
||||||
|
Corresponding Source conveyed under this section must be accompanied
|
||||||
|
by the Installation Information. But this requirement does not apply
|
||||||
|
if neither you nor any third party retains the ability to install
|
||||||
|
modified object code on the User Product (for example, the work has
|
||||||
|
been installed in ROM).
|
||||||
|
|
||||||
|
The requirement to provide Installation Information does not include a
|
||||||
|
requirement to continue to provide support service, warranty, or updates
|
||||||
|
for a work that has been modified or installed by the recipient, or for
|
||||||
|
the User Product in which it has been modified or installed. Access to a
|
||||||
|
network may be denied when the modification itself materially and
|
||||||
|
adversely affects the operation of the network or violates the rules and
|
||||||
|
protocols for communication across the network.
|
||||||
|
|
||||||
|
Corresponding Source conveyed, and Installation Information provided,
|
||||||
|
in accord with this section must be in a format that is publicly
|
||||||
|
documented (and with an implementation available to the public in
|
||||||
|
source code form), and must require no special password or key for
|
||||||
|
unpacking, reading or copying.
|
||||||
|
|
||||||
|
7. Additional Terms.
|
||||||
|
|
||||||
|
"Additional permissions" are terms that supplement the terms of this
|
||||||
|
License by making exceptions from one or more of its conditions.
|
||||||
|
Additional permissions that are applicable to the entire Program shall
|
||||||
|
be treated as though they were included in this License, to the extent
|
||||||
|
that they are valid under applicable law. If additional permissions
|
||||||
|
apply only to part of the Program, that part may be used separately
|
||||||
|
under those permissions, but the entire Program remains governed by
|
||||||
|
this License without regard to the additional permissions.
|
||||||
|
|
||||||
|
When you convey a copy of a covered work, you may at your option
|
||||||
|
remove any additional permissions from that copy, or from any part of
|
||||||
|
it. (Additional permissions may be written to require their own
|
||||||
|
removal in certain cases when you modify the work.) You may place
|
||||||
|
additional permissions on material, added by you to a covered work,
|
||||||
|
for which you have or can give appropriate copyright permission.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, for material you
|
||||||
|
add to a covered work, you may (if authorized by the copyright holders of
|
||||||
|
that material) supplement the terms of this License with terms:
|
||||||
|
|
||||||
|
a) Disclaiming warranty or limiting liability differently from the
|
||||||
|
terms of sections 15 and 16 of this License; or
|
||||||
|
|
||||||
|
b) Requiring preservation of specified reasonable legal notices or
|
||||||
|
author attributions in that material or in the Appropriate Legal
|
||||||
|
Notices displayed by works containing it; or
|
||||||
|
|
||||||
|
c) Prohibiting misrepresentation of the origin of that material, or
|
||||||
|
requiring that modified versions of such material be marked in
|
||||||
|
reasonable ways as different from the original version; or
|
||||||
|
|
||||||
|
d) Limiting the use for publicity purposes of names of licensors or
|
||||||
|
authors of the material; or
|
||||||
|
|
||||||
|
e) Declining to grant rights under trademark law for use of some
|
||||||
|
trade names, trademarks, or service marks; or
|
||||||
|
|
||||||
|
f) Requiring indemnification of licensors and authors of that
|
||||||
|
material by anyone who conveys the material (or modified versions of
|
||||||
|
it) with contractual assumptions of liability to the recipient, for
|
||||||
|
any liability that these contractual assumptions directly impose on
|
||||||
|
those licensors and authors.
|
||||||
|
|
||||||
|
All other non-permissive additional terms are considered "further
|
||||||
|
restrictions" within the meaning of section 10. If the Program as you
|
||||||
|
received it, or any part of it, contains a notice stating that it is
|
||||||
|
governed by this License along with a term that is a further
|
||||||
|
restriction, you may remove that term. If a license document contains
|
||||||
|
a further restriction but permits relicensing or conveying under this
|
||||||
|
License, you may add to a covered work material governed by the terms
|
||||||
|
of that license document, provided that the further restriction does
|
||||||
|
not survive such relicensing or conveying.
|
||||||
|
|
||||||
|
If you add terms to a covered work in accord with this section, you
|
||||||
|
must place, in the relevant source files, a statement of the
|
||||||
|
additional terms that apply to those files, or a notice indicating
|
||||||
|
where to find the applicable terms.
|
||||||
|
|
||||||
|
Additional terms, permissive or non-permissive, may be stated in the
|
||||||
|
form of a separately written license, or stated as exceptions;
|
||||||
|
the above requirements apply either way.
|
||||||
|
|
||||||
|
8. Termination.
|
||||||
|
|
||||||
|
You may not propagate or modify a covered work except as expressly
|
||||||
|
provided under this License. Any attempt otherwise to propagate or
|
||||||
|
modify it is void, and will automatically terminate your rights under
|
||||||
|
this License (including any patent licenses granted under the third
|
||||||
|
paragraph of section 11).
|
||||||
|
|
||||||
|
However, if you cease all violation of this License, then your
|
||||||
|
license from a particular copyright holder is reinstated (a)
|
||||||
|
provisionally, unless and until the copyright holder explicitly and
|
||||||
|
finally terminates your license, and (b) permanently, if the copyright
|
||||||
|
holder fails to notify you of the violation by some reasonable means
|
||||||
|
prior to 60 days after the cessation.
|
||||||
|
|
||||||
|
Moreover, your license from a particular copyright holder is
|
||||||
|
reinstated permanently if the copyright holder notifies you of the
|
||||||
|
violation by some reasonable means, this is the first time you have
|
||||||
|
received notice of violation of this License (for any work) from that
|
||||||
|
copyright holder, and you cure the violation prior to 30 days after
|
||||||
|
your receipt of the notice.
|
||||||
|
|
||||||
|
Termination of your rights under this section does not terminate the
|
||||||
|
licenses of parties who have received copies or rights from you under
|
||||||
|
this License. If your rights have been terminated and not permanently
|
||||||
|
reinstated, you do not qualify to receive new licenses for the same
|
||||||
|
material under section 10.
|
||||||
|
|
||||||
|
9. Acceptance Not Required for Having Copies.
|
||||||
|
|
||||||
|
You are not required to accept this License in order to receive or
|
||||||
|
run a copy of the Program. Ancillary propagation of a covered work
|
||||||
|
occurring solely as a consequence of using peer-to-peer transmission
|
||||||
|
to receive a copy likewise does not require acceptance. However,
|
||||||
|
nothing other than this License grants you permission to propagate or
|
||||||
|
modify any covered work. These actions infringe copyright if you do
|
||||||
|
not accept this License. Therefore, by modifying or propagating a
|
||||||
|
covered work, you indicate your acceptance of this License to do so.
|
||||||
|
|
||||||
|
10. Automatic Licensing of Downstream Recipients.
|
||||||
|
|
||||||
|
Each time you convey a covered work, the recipient automatically
|
||||||
|
receives a license from the original licensors, to run, modify and
|
||||||
|
propagate that work, subject to this License. You are not responsible
|
||||||
|
for enforcing compliance by third parties with this License.
|
||||||
|
|
||||||
|
An "entity transaction" is a transaction transferring control of an
|
||||||
|
organization, or substantially all assets of one, or subdividing an
|
||||||
|
organization, or merging organizations. If propagation of a covered
|
||||||
|
work results from an entity transaction, each party to that
|
||||||
|
transaction who receives a copy of the work also receives whatever
|
||||||
|
licenses to the work the party's predecessor in interest had or could
|
||||||
|
give under the previous paragraph, plus a right to possession of the
|
||||||
|
Corresponding Source of the work from the predecessor in interest, if
|
||||||
|
the predecessor has it or can get it with reasonable efforts.
|
||||||
|
|
||||||
|
You may not impose any further restrictions on the exercise of the
|
||||||
|
rights granted or affirmed under this License. For example, you may
|
||||||
|
not impose a license fee, royalty, or other charge for exercise of
|
||||||
|
rights granted under this License, and you may not initiate litigation
|
||||||
|
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||||
|
any patent claim is infringed by making, using, selling, offering for
|
||||||
|
sale, or importing the Program or any portion of it.
|
||||||
|
|
||||||
|
11. Patents.
|
||||||
|
|
||||||
|
A "contributor" is a copyright holder who authorizes use under this
|
||||||
|
License of the Program or a work on which the Program is based. The
|
||||||
|
work thus licensed is called the contributor's "contributor version".
|
||||||
|
|
||||||
|
A contributor's "essential patent claims" are all patent claims
|
||||||
|
owned or controlled by the contributor, whether already acquired or
|
||||||
|
hereafter acquired, that would be infringed by some manner, permitted
|
||||||
|
by this License, of making, using, or selling its contributor version,
|
||||||
|
but do not include claims that would be infringed only as a
|
||||||
|
consequence of further modification of the contributor version. For
|
||||||
|
purposes of this definition, "control" includes the right to grant
|
||||||
|
patent sublicenses in a manner consistent with the requirements of
|
||||||
|
this License.
|
||||||
|
|
||||||
|
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||||
|
patent license under the contributor's essential patent claims, to
|
||||||
|
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||||
|
propagate the contents of its contributor version.
|
||||||
|
|
||||||
|
In the following three paragraphs, a "patent license" is any express
|
||||||
|
agreement or commitment, however denominated, not to enforce a patent
|
||||||
|
(such as an express permission to practice a patent or covenant not to
|
||||||
|
sue for patent infringement). To "grant" such a patent license to a
|
||||||
|
party means to make such an agreement or commitment not to enforce a
|
||||||
|
patent against the party.
|
||||||
|
|
||||||
|
If you convey a covered work, knowingly relying on a patent license,
|
||||||
|
and the Corresponding Source of the work is not available for anyone
|
||||||
|
to copy, free of charge and under the terms of this License, through a
|
||||||
|
publicly available network server or other readily accessible means,
|
||||||
|
then you must either (1) cause the Corresponding Source to be so
|
||||||
|
available, or (2) arrange to deprive yourself of the benefit of the
|
||||||
|
patent license for this particular work, or (3) arrange, in a manner
|
||||||
|
consistent with the requirements of this License, to extend the patent
|
||||||
|
license to downstream recipients. "Knowingly relying" means you have
|
||||||
|
actual knowledge that, but for the patent license, your conveying the
|
||||||
|
covered work in a country, or your recipient's use of the covered work
|
||||||
|
in a country, would infringe one or more identifiable patents in that
|
||||||
|
country that you have reason to believe are valid.
|
||||||
|
|
||||||
|
If, pursuant to or in connection with a single transaction or
|
||||||
|
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||||
|
covered work, and grant a patent license to some of the parties
|
||||||
|
receiving the covered work authorizing them to use, propagate, modify
|
||||||
|
or convey a specific copy of the covered work, then the patent license
|
||||||
|
you grant is automatically extended to all recipients of the covered
|
||||||
|
work and works based on it.
|
||||||
|
|
||||||
|
A patent license is "discriminatory" if it does not include within
|
||||||
|
the scope of its coverage, prohibits the exercise of, or is
|
||||||
|
conditioned on the non-exercise of one or more of the rights that are
|
||||||
|
specifically granted under this License. You may not convey a covered
|
||||||
|
work if you are a party to an arrangement with a third party that is
|
||||||
|
in the business of distributing software, under which you make payment
|
||||||
|
to the third party based on the extent of your activity of conveying
|
||||||
|
the work, and under which the third party grants, to any of the
|
||||||
|
parties who would receive the covered work from you, a discriminatory
|
||||||
|
patent license (a) in connection with copies of the covered work
|
||||||
|
conveyed by you (or copies made from those copies), or (b) primarily
|
||||||
|
for and in connection with specific products or compilations that
|
||||||
|
contain the covered work, unless you entered into that arrangement,
|
||||||
|
or that patent license was granted, prior to 28 March 2007.
|
||||||
|
|
||||||
|
Nothing in this License shall be construed as excluding or limiting
|
||||||
|
any implied license or other defenses to infringement that may
|
||||||
|
otherwise be available to you under applicable patent law.
|
||||||
|
|
||||||
|
12. No Surrender of Others' Freedom.
|
||||||
|
|
||||||
|
If conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot convey a
|
||||||
|
covered work so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you may
|
||||||
|
not convey it at all. For example, if you agree to terms that obligate you
|
||||||
|
to collect a royalty for further conveying from those to whom you convey
|
||||||
|
the Program, the only way you could satisfy both those terms and this
|
||||||
|
License would be to refrain entirely from conveying the Program.
|
||||||
|
|
||||||
|
13. Remote Network Interaction; Use with the GNU General Public License.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, if you modify the
|
||||||
|
Program, your modified version must prominently offer all users
|
||||||
|
interacting with it remotely through a computer network (if your version
|
||||||
|
supports such interaction) an opportunity to receive the Corresponding
|
||||||
|
Source of your version by providing access to the Corresponding Source
|
||||||
|
from a network server at no charge, through some standard or customary
|
||||||
|
means of facilitating copying of software. This Corresponding Source
|
||||||
|
shall include the Corresponding Source for any work covered by version 3
|
||||||
|
of the GNU General Public License that is incorporated pursuant to the
|
||||||
|
following paragraph.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, you have
|
||||||
|
permission to link or combine any covered work with a work licensed
|
||||||
|
under version 3 of the GNU General Public License into a single
|
||||||
|
combined work, and to convey the resulting work. The terms of this
|
||||||
|
License will continue to apply to the part which is the covered work,
|
||||||
|
but the work with which it is combined will remain governed by version
|
||||||
|
3 of the GNU General Public License.
|
||||||
|
|
||||||
|
14. Revised Versions of this License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions of
|
||||||
|
the GNU Affero General Public License from time to time. Such new versions
|
||||||
|
will be similar in spirit to the present version, but may differ in detail to
|
||||||
|
address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the
|
||||||
|
Program specifies that a certain numbered version of the GNU Affero General
|
||||||
|
Public License "or any later version" applies to it, you have the
|
||||||
|
option of following the terms and conditions either of that numbered
|
||||||
|
version or of any later version published by the Free Software
|
||||||
|
Foundation. If the Program does not specify a version number of the
|
||||||
|
GNU Affero General Public License, you may choose any version ever published
|
||||||
|
by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Program specifies that a proxy can decide which future
|
||||||
|
versions of the GNU Affero General Public License can be used, that proxy's
|
||||||
|
public statement of acceptance of a version permanently authorizes you
|
||||||
|
to choose that version for the Program.
|
||||||
|
|
||||||
|
Later license versions may give you additional or different
|
||||||
|
permissions. However, no additional obligations are imposed on any
|
||||||
|
author or copyright holder as a result of your choosing to follow a
|
||||||
|
later version.
|
||||||
|
|
||||||
|
15. Disclaimer of Warranty.
|
||||||
|
|
||||||
|
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||||
|
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||||
|
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||||
|
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||||
|
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||||
|
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
16. Limitation of Liability.
|
||||||
|
|
||||||
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||||
|
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||||
|
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||||
|
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||||
|
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||||
|
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||||
|
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||||
|
SUCH DAMAGES.
|
||||||
|
|
||||||
|
17. Interpretation of Sections 15 and 16.
|
||||||
|
|
||||||
|
If the disclaimer of warranty and limitation of liability provided
|
||||||
|
above cannot be given local legal effect according to their terms,
|
||||||
|
reviewing courts shall apply local law that most closely approximates
|
||||||
|
an absolute waiver of all civil liability in connection with the
|
||||||
|
Program, unless a warranty or assumption of liability accompanies a
|
||||||
|
copy of the Program in return for a fee.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest
|
||||||
|
to attach them to the start of each source file to most effectively
|
||||||
|
state the exclusion of warranty; and each file should have at least
|
||||||
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Affero General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Affero General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Affero General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If your software can interact with users remotely through a computer
|
||||||
|
network, you should also make sure that it provides a way for users to
|
||||||
|
get its source. For example, if your program is a web application, its
|
||||||
|
interface could display a "Source" link that leads users to an archive
|
||||||
|
of the code. There are many ways you could offer source, and different
|
||||||
|
solutions will be better for different programs; see section 13 for the
|
||||||
|
specific requirements.
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or school,
|
||||||
|
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||||
|
For more information on this, and how to apply and follow the GNU AGPL, see
|
||||||
|
<https://www.gnu.org/licenses/>.
|
39
README.md
Normal file
39
README.md
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
# Twitter Recommendation Algorithm
|
||||||
|
|
||||||
|
The Twitter Recommendation Algorithm is a set of services and jobs that are responsible for constructing and serving the
|
||||||
|
Home Timeline. For an introduction to how the algorithm works, please refer to our [engineering blog](https://blog.twitter.com/engineering/en_us/topics/open-source/2023/twitter-recommendation-algorithm). The
|
||||||
|
diagram below illustrates how major services and jobs interconnect.
|
||||||
|
|
||||||
|
![](docs/system-diagram.png)
|
||||||
|
|
||||||
|
These are the main components of the Recommendation Algorithm included in this repository:
|
||||||
|
|
||||||
|
| Type | Component | Description |
|
||||||
|
|------------|------------|------------|
|
||||||
|
| Feature | [simclusters-ann](simclusters-ann/README.md) | Community detection and sparse embeddings into those communities. |
|
||||||
|
| | [TwHIN](https://github.com/twitter/the-algorithm-ml/blob/main/projects/twhin/README.md) | Dense knowledge graph embeddings for Users and Tweets. |
|
||||||
|
| | [trust-and-safety-models](trust_and_safety_models/README.md) | Models for detecting NSFW or abusive content. |
|
||||||
|
| | [real-graph](src/scala/com/twitter/interaction_graph/README.md) | Model to predict likelihood of a Twitter User interacting with another User. |
|
||||||
|
| | [tweepcred](src/scala/com/twitter/graph/batch/job/tweepcred/README) | Page-Rank algorithm for calculating Twitter User reputation. |
|
||||||
|
| | [recos-injector](recos-injector/README.md) | Streaming event processor for building input streams for [GraphJet](https://github.com/twitter/GraphJet) based services. |
|
||||||
|
| | [graph-feature-service](graph-feature-service/README.md) | Serves graph features for a directed pair of Users (e.g. how many of User A's following liked Tweets from User B). |
|
||||||
|
| Candidate Source | [search-index](src/java/com/twitter/search/README.md) | Find and rank In-Network Tweets. ~50% of Tweets come from this candidate source. |
|
||||||
|
| | [cr-mixer](cr-mixer/README.md) | Coordination layer for fetching Out-of-Network tweet candidates from underlying compute services. |
|
||||||
|
| | [user-tweet-entity-graph](src/scala/com/twitter/recos/user_tweet_entity_graph/README.md) (UTEG)| Maintains an in memory User to Tweet interaction graph, and finds candidates based on traversals of this graph. This is built on the [GraphJet](https://github.com/twitter/GraphJet) framework. Several other GraphJet based features and candidate sources are located [here](src/scala/com/twitter/recos) |
|
||||||
|
| | [follow-recommendation-service](follow-recommendations-service/README.md) (FRS)| Provides Users with recommendations for accounts to follow, and Tweets from those accounts. |
|
||||||
|
| Ranking | [light-ranker](src/python/twitter/deepbird/projects/timelines/scripts/models/earlybird/README.md) | Light ranker model used by search index (Earlybird) to rank Tweets. |
|
||||||
|
| | [heavy-ranker](https://github.com/twitter/the-algorithm-ml/blob/main/projects/home/recap/README.md) | Neural network for ranking candidate tweets. One of the main signals used to select timeline Tweets post candidate sourcing. |
|
||||||
|
| Tweet mixing & filtering | [home-mixer](home-mixer/README.md) | Main service used to construct and serve the Home Timeline. Built on [product-mixer](product-mixer/README.md) |
|
||||||
|
| | [visibility-filters](visibilitylib/README.md) | Responsible for filtering Twitter content to support legal compliance, improve product quality, increase user trust, protect revenue through the use of hard-filtering, visible product treatments, and coarse-grained downranking. |
|
||||||
|
| | [timelineranker](timelineranker/README.md) | Legacy service which provides relevance-scored tweets from the Earlybird Search Index and UTEG service. |
|
||||||
|
| Software framework | [navi](navi/navi/README.md) | High performance, machine learning model serving written in Rust. |
|
||||||
|
| | [product-mixer](product-mixer/README.md) | Software framework for building feeds of content. |
|
||||||
|
| | [twml](twml/README.md) | Legacy machine learning framework built on TensorFlow v1. |
|
||||||
|
|
||||||
|
We include Bazel BUILD files for most components, but not a top level BUILD or WORKSPACE file.
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
|
||||||
|
We invite the community to submit GitHub issues and pull requests for suggestions on improving the recommendation algorithm. We are working on tools to manage these suggestions and sync changes to our internal repository. Any security concerns or issues should be routed to our official [bug bounty program](https://hackerone.com/twitter) through HackerOne. We hope to benefit from the collective intelligence and expertise of the global community in helping us identify issues and suggest improvements, ultimately leading to a better Twitter.
|
||||||
|
|
||||||
|
Read our blog on the open source initiative [here](https://blog.twitter.com/en_us/topics/company/2023/a-new-era-of-transparency-for-twitter).
|
15
ann/src/main/java/com/twitter/ann/faiss/BUILD
Normal file
15
ann/src/main/java/com/twitter/ann/faiss/BUILD
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
target(
|
||||||
|
name = "faiss",
|
||||||
|
dependencies = [
|
||||||
|
"ann/src/main/java/com/twitter/ann/faiss/swig:swig-artifactory",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
java_library(
|
||||||
|
name = "swig-native-utils",
|
||||||
|
sources = ["*.java"],
|
||||||
|
compiler_option_sets = ["fatal_warnings"],
|
||||||
|
platform = "java8",
|
||||||
|
tags = ["bazel-compatible"],
|
||||||
|
dependencies = [],
|
||||||
|
)
|
151
ann/src/main/java/com/twitter/ann/faiss/NativeUtils.java
Normal file
151
ann/src/main/java/com/twitter/ann/faiss/NativeUtils.java
Normal file
|
@ -0,0 +1,151 @@
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.StandardCopyOption;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
public final class NativeUtils {
|
||||||
|
|
||||||
|
private static final int MIN_PREFIX_LENGTH = 3;
|
||||||
|
public static final String NATIVE_FOLDER_PATH_PREFIX = "nativeutils";
|
||||||
|
|
||||||
|
public static File temporaryDir;
|
||||||
|
|
||||||
|
private NativeUtils() {
|
||||||
|
}
|
||||||
|
|
||||||
|
private static File unpackLibraryFromJarInternal(String path) throws IOException {
|
||||||
|
if (null == path || !path.startsWith("/")) {
|
||||||
|
throw new IllegalArgumentException("The path has to be absolute (start with '/').");
|
||||||
|
}
|
||||||
|
|
||||||
|
String[] parts = path.split("/");
|
||||||
|
String filename = (parts.length > 1) ? parts[parts.length - 1] : null;
|
||||||
|
|
||||||
|
if (filename == null || filename.length() < MIN_PREFIX_LENGTH) {
|
||||||
|
throw new IllegalArgumentException("The filename has to be at least 3 characters long.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (temporaryDir == null) {
|
||||||
|
temporaryDir = createTempDirectory(NATIVE_FOLDER_PATH_PREFIX);
|
||||||
|
temporaryDir.deleteOnExit();
|
||||||
|
}
|
||||||
|
|
||||||
|
File temp = new File(temporaryDir, filename);
|
||||||
|
|
||||||
|
try (InputStream is = NativeUtils.class.getResourceAsStream(path)) {
|
||||||
|
Files.copy(is, temp.toPath(), StandardCopyOption.REPLACE_EXISTING);
|
||||||
|
} catch (IOException e) {
|
||||||
|
temp.delete();
|
||||||
|
throw e;
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
temp.delete();
|
||||||
|
throw new FileNotFoundException("File " + path + " was not found inside JAR.");
|
||||||
|
}
|
||||||
|
|
||||||
|
return temp;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unpack library from JAR into temporary path
|
||||||
|
*
|
||||||
|
* @param path The path of file inside JAR as absolute path (beginning with
|
||||||
|
* '/'), e.g. /package/File.ext
|
||||||
|
* @throws IOException If temporary file creation or read/write
|
||||||
|
* operation fails
|
||||||
|
* @throws IllegalArgumentException If source file (param path) does not exist
|
||||||
|
* @throws IllegalArgumentException If the path is not absolute or if the
|
||||||
|
* filename is shorter than three characters
|
||||||
|
* (restriction of
|
||||||
|
* {@link File#createTempFile(java.lang.String, java.lang.String)}).
|
||||||
|
* @throws FileNotFoundException If the file could not be found inside the
|
||||||
|
* JAR.
|
||||||
|
*/
|
||||||
|
public static void unpackLibraryFromJar(String path) throws IOException {
|
||||||
|
unpackLibraryFromJarInternal(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads library from current JAR archive
|
||||||
|
* <p>
|
||||||
|
* The file from JAR is copied into system temporary directory and then loaded.
|
||||||
|
* The temporary file is deleted after
|
||||||
|
* exiting.
|
||||||
|
* Method uses String as filename because the pathname is "abstract", not
|
||||||
|
* system-dependent.
|
||||||
|
*
|
||||||
|
* @param path The path of file inside JAR as absolute path (beginning with
|
||||||
|
* '/'), e.g. /package/File.ext
|
||||||
|
* @throws IOException If temporary file creation or read/write
|
||||||
|
* operation fails
|
||||||
|
* @throws IllegalArgumentException If source file (param path) does not exist
|
||||||
|
* @throws IllegalArgumentException If the path is not absolute or if the
|
||||||
|
* filename is shorter than three characters
|
||||||
|
* (restriction of
|
||||||
|
* {@link File#createTempFile(java.lang.String, java.lang.String)}).
|
||||||
|
* @throws FileNotFoundException If the file could not be found inside the
|
||||||
|
* JAR.
|
||||||
|
*/
|
||||||
|
public static void loadLibraryFromJar(String path) throws IOException {
|
||||||
|
File temp = unpackLibraryFromJarInternal(path);
|
||||||
|
|
||||||
|
try (InputStream is = NativeUtils.class.getResourceAsStream(path)) {
|
||||||
|
Files.copy(is, temp.toPath(), StandardCopyOption.REPLACE_EXISTING);
|
||||||
|
} catch (IOException e) {
|
||||||
|
temp.delete();
|
||||||
|
throw e;
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
temp.delete();
|
||||||
|
throw new FileNotFoundException("File " + path + " was not found inside JAR.");
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
System.load(temp.getAbsolutePath());
|
||||||
|
} finally {
|
||||||
|
temp.deleteOnExit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static File createTempDirectory(String prefix) throws IOException {
|
||||||
|
String tempDir = System.getProperty("java.io.tmpdir");
|
||||||
|
File generatedDir = new File(tempDir, prefix + System.nanoTime());
|
||||||
|
|
||||||
|
if (!generatedDir.mkdir()) {
|
||||||
|
throw new IOException("Failed to create temp directory " + generatedDir.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
return generatedDir;
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum OSType {
|
||||||
|
Windows, MacOS, Linux, Other
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static OSType detectedOS;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* detect the operating system from the os.name System property and cache
|
||||||
|
* the result
|
||||||
|
*
|
||||||
|
* @returns - the operating system detected
|
||||||
|
*/
|
||||||
|
public static OSType getOperatingSystemType() {
|
||||||
|
if (detectedOS == null) {
|
||||||
|
String osname = System.getProperty("os.name", "generic").toLowerCase(Locale.ENGLISH);
|
||||||
|
if ((osname.contains("mac")) || (osname.contains("darwin"))) {
|
||||||
|
detectedOS = OSType.MacOS;
|
||||||
|
} else if (osname.contains("win")) {
|
||||||
|
detectedOS = OSType.Windows;
|
||||||
|
} else if (osname.contains("nux")) {
|
||||||
|
detectedOS = OSType.Linux;
|
||||||
|
} else {
|
||||||
|
detectedOS = OSType.Other;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return detectedOS;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,98 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class AlignedTableFloat32 {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
protected transient boolean swigCMemOwn;
|
||||||
|
|
||||||
|
protected AlignedTableFloat32(long cPtr, boolean cMemoryOwn) {
|
||||||
|
swigCMemOwn = cMemoryOwn;
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(AlignedTableFloat32 obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_AlignedTableFloat32(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTab(SWIGTYPE_p_faiss__AlignedTableTightAllocT_float_32_t value) {
|
||||||
|
swigfaissJNI.AlignedTableFloat32_tab_set(swigCPtr, this, SWIGTYPE_p_faiss__AlignedTableTightAllocT_float_32_t.getCPtr(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
public SWIGTYPE_p_faiss__AlignedTableTightAllocT_float_32_t getTab() {
|
||||||
|
long cPtr = swigfaissJNI.AlignedTableFloat32_tab_get(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new SWIGTYPE_p_faiss__AlignedTableTightAllocT_float_32_t(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNumel(long value) {
|
||||||
|
swigfaissJNI.AlignedTableFloat32_numel_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getNumel() {
|
||||||
|
return swigfaissJNI.AlignedTableFloat32_numel_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static long round_capacity(long n) {
|
||||||
|
return swigfaissJNI.AlignedTableFloat32_round_capacity(n);
|
||||||
|
}
|
||||||
|
|
||||||
|
public AlignedTableFloat32() {
|
||||||
|
this(swigfaissJNI.new_AlignedTableFloat32__SWIG_0(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public AlignedTableFloat32(long n) {
|
||||||
|
this(swigfaissJNI.new_AlignedTableFloat32__SWIG_1(n), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long itemsize() {
|
||||||
|
return swigfaissJNI.AlignedTableFloat32_itemsize(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void resize(long n) {
|
||||||
|
swigfaissJNI.AlignedTableFloat32_resize(swigCPtr, this, n);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clear() {
|
||||||
|
swigfaissJNI.AlignedTableFloat32_clear(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long size() {
|
||||||
|
return swigfaissJNI.AlignedTableFloat32_size(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long nbytes() {
|
||||||
|
return swigfaissJNI.AlignedTableFloat32_nbytes(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SWIGTYPE_p_float get() {
|
||||||
|
long cPtr = swigfaissJNI.AlignedTableFloat32_get__SWIG_0(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new SWIGTYPE_p_float(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SWIGTYPE_p_float data() {
|
||||||
|
long cPtr = swigfaissJNI.AlignedTableFloat32_data__SWIG_0(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new SWIGTYPE_p_float(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,98 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class AlignedTableUint16 {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
protected transient boolean swigCMemOwn;
|
||||||
|
|
||||||
|
protected AlignedTableUint16(long cPtr, boolean cMemoryOwn) {
|
||||||
|
swigCMemOwn = cMemoryOwn;
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(AlignedTableUint16 obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_AlignedTableUint16(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTab(SWIGTYPE_p_faiss__AlignedTableTightAllocT_uint16_t_32_t value) {
|
||||||
|
swigfaissJNI.AlignedTableUint16_tab_set(swigCPtr, this, SWIGTYPE_p_faiss__AlignedTableTightAllocT_uint16_t_32_t.getCPtr(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
public SWIGTYPE_p_faiss__AlignedTableTightAllocT_uint16_t_32_t getTab() {
|
||||||
|
long cPtr = swigfaissJNI.AlignedTableUint16_tab_get(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new SWIGTYPE_p_faiss__AlignedTableTightAllocT_uint16_t_32_t(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNumel(long value) {
|
||||||
|
swigfaissJNI.AlignedTableUint16_numel_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getNumel() {
|
||||||
|
return swigfaissJNI.AlignedTableUint16_numel_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static long round_capacity(long n) {
|
||||||
|
return swigfaissJNI.AlignedTableUint16_round_capacity(n);
|
||||||
|
}
|
||||||
|
|
||||||
|
public AlignedTableUint16() {
|
||||||
|
this(swigfaissJNI.new_AlignedTableUint16__SWIG_0(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public AlignedTableUint16(long n) {
|
||||||
|
this(swigfaissJNI.new_AlignedTableUint16__SWIG_1(n), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long itemsize() {
|
||||||
|
return swigfaissJNI.AlignedTableUint16_itemsize(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void resize(long n) {
|
||||||
|
swigfaissJNI.AlignedTableUint16_resize(swigCPtr, this, n);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clear() {
|
||||||
|
swigfaissJNI.AlignedTableUint16_clear(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long size() {
|
||||||
|
return swigfaissJNI.AlignedTableUint16_size(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long nbytes() {
|
||||||
|
return swigfaissJNI.AlignedTableUint16_nbytes(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SWIGTYPE_p_uint16_t get() {
|
||||||
|
long cPtr = swigfaissJNI.AlignedTableUint16_get__SWIG_0(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new SWIGTYPE_p_uint16_t(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SWIGTYPE_p_uint16_t data() {
|
||||||
|
long cPtr = swigfaissJNI.AlignedTableUint16_data__SWIG_0(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new SWIGTYPE_p_uint16_t(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,98 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class AlignedTableUint8 {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
protected transient boolean swigCMemOwn;
|
||||||
|
|
||||||
|
protected AlignedTableUint8(long cPtr, boolean cMemoryOwn) {
|
||||||
|
swigCMemOwn = cMemoryOwn;
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(AlignedTableUint8 obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_AlignedTableUint8(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTab(SWIGTYPE_p_faiss__AlignedTableTightAllocT_unsigned_char_32_t value) {
|
||||||
|
swigfaissJNI.AlignedTableUint8_tab_set(swigCPtr, this, SWIGTYPE_p_faiss__AlignedTableTightAllocT_unsigned_char_32_t.getCPtr(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
public SWIGTYPE_p_faiss__AlignedTableTightAllocT_unsigned_char_32_t getTab() {
|
||||||
|
long cPtr = swigfaissJNI.AlignedTableUint8_tab_get(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new SWIGTYPE_p_faiss__AlignedTableTightAllocT_unsigned_char_32_t(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNumel(long value) {
|
||||||
|
swigfaissJNI.AlignedTableUint8_numel_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getNumel() {
|
||||||
|
return swigfaissJNI.AlignedTableUint8_numel_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static long round_capacity(long n) {
|
||||||
|
return swigfaissJNI.AlignedTableUint8_round_capacity(n);
|
||||||
|
}
|
||||||
|
|
||||||
|
public AlignedTableUint8() {
|
||||||
|
this(swigfaissJNI.new_AlignedTableUint8__SWIG_0(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public AlignedTableUint8(long n) {
|
||||||
|
this(swigfaissJNI.new_AlignedTableUint8__SWIG_1(n), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long itemsize() {
|
||||||
|
return swigfaissJNI.AlignedTableUint8_itemsize(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void resize(long n) {
|
||||||
|
swigfaissJNI.AlignedTableUint8_resize(swigCPtr, this, n);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clear() {
|
||||||
|
swigfaissJNI.AlignedTableUint8_clear(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long size() {
|
||||||
|
return swigfaissJNI.AlignedTableUint8_size(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long nbytes() {
|
||||||
|
return swigfaissJNI.AlignedTableUint8_nbytes(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SWIGTYPE_p_unsigned_char get() {
|
||||||
|
long cPtr = swigfaissJNI.AlignedTableUint8_get__SWIG_0(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SWIGTYPE_p_unsigned_char data() {
|
||||||
|
long cPtr = swigfaissJNI.AlignedTableUint8_data__SWIG_0(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,86 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class ArrayInvertedLists extends InvertedLists {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
|
||||||
|
protected ArrayInvertedLists(long cPtr, boolean cMemoryOwn) {
|
||||||
|
super(swigfaissJNI.ArrayInvertedLists_SWIGUpcast(cPtr), cMemoryOwn);
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(ArrayInvertedLists obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_ArrayInvertedLists(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
super.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCodes(ByteVectorVector value) {
|
||||||
|
swigfaissJNI.ArrayInvertedLists_codes_set(swigCPtr, this, ByteVectorVector.getCPtr(value), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ByteVectorVector getCodes() {
|
||||||
|
long cPtr = swigfaissJNI.ArrayInvertedLists_codes_get(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new ByteVectorVector(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIds(SWIGTYPE_p_std__vectorT_std__vectorT_int64_t_t_t value) {
|
||||||
|
swigfaissJNI.ArrayInvertedLists_ids_set(swigCPtr, this, SWIGTYPE_p_std__vectorT_std__vectorT_int64_t_t_t.getCPtr(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
public SWIGTYPE_p_std__vectorT_std__vectorT_int64_t_t_t getIds() {
|
||||||
|
long cPtr = swigfaissJNI.ArrayInvertedLists_ids_get(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new SWIGTYPE_p_std__vectorT_std__vectorT_int64_t_t_t(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayInvertedLists(long nlist, long code_size) {
|
||||||
|
this(swigfaissJNI.new_ArrayInvertedLists(nlist, code_size), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long list_size(long list_no) {
|
||||||
|
return swigfaissJNI.ArrayInvertedLists_list_size(swigCPtr, this, list_no);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SWIGTYPE_p_unsigned_char get_codes(long list_no) {
|
||||||
|
long cPtr = swigfaissJNI.ArrayInvertedLists_get_codes(swigCPtr, this, list_no);
|
||||||
|
return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public LongVector get_ids(long list_no) {
|
||||||
|
return new LongVector(swigfaissJNI.ArrayInvertedLists_get_ids(swigCPtr, this, list_no), false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long add_entries(long list_no, long n_entry, LongVector ids, SWIGTYPE_p_unsigned_char code) {
|
||||||
|
return swigfaissJNI.ArrayInvertedLists_add_entries(swigCPtr, this, list_no, n_entry, SWIGTYPE_p_long_long.getCPtr(ids.data()), ids, SWIGTYPE_p_unsigned_char.getCPtr(code));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void update_entries(long list_no, long offset, long n_entry, LongVector ids, SWIGTYPE_p_unsigned_char code) {
|
||||||
|
swigfaissJNI.ArrayInvertedLists_update_entries(swigCPtr, this, list_no, offset, n_entry, SWIGTYPE_p_long_long.getCPtr(ids.data()), ids, SWIGTYPE_p_unsigned_char.getCPtr(code));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void resize(long list_no, long new_size) {
|
||||||
|
swigfaissJNI.ArrayInvertedLists_resize(swigCPtr, this, list_no, new_size);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,89 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class AutoTuneCriterion {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
protected transient boolean swigCMemOwn;
|
||||||
|
|
||||||
|
protected AutoTuneCriterion(long cPtr, boolean cMemoryOwn) {
|
||||||
|
swigCMemOwn = cMemoryOwn;
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(AutoTuneCriterion obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_AutoTuneCriterion(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNq(long value) {
|
||||||
|
swigfaissJNI.AutoTuneCriterion_nq_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getNq() {
|
||||||
|
return swigfaissJNI.AutoTuneCriterion_nq_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNnn(long value) {
|
||||||
|
swigfaissJNI.AutoTuneCriterion_nnn_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getNnn() {
|
||||||
|
return swigfaissJNI.AutoTuneCriterion_nnn_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGt_nnn(long value) {
|
||||||
|
swigfaissJNI.AutoTuneCriterion_gt_nnn_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getGt_nnn() {
|
||||||
|
return swigfaissJNI.AutoTuneCriterion_gt_nnn_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGt_D(FloatVector value) {
|
||||||
|
swigfaissJNI.AutoTuneCriterion_gt_D_set(swigCPtr, this, FloatVector.getCPtr(value), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public FloatVector getGt_D() {
|
||||||
|
long cPtr = swigfaissJNI.AutoTuneCriterion_gt_D_get(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new FloatVector(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGt_I(SWIGTYPE_p_std__vectorT_int64_t_t value) {
|
||||||
|
swigfaissJNI.AutoTuneCriterion_gt_I_set(swigCPtr, this, SWIGTYPE_p_std__vectorT_int64_t_t.getCPtr(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
public SWIGTYPE_p_std__vectorT_int64_t_t getGt_I() {
|
||||||
|
long cPtr = swigfaissJNI.AutoTuneCriterion_gt_I_get(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new SWIGTYPE_p_std__vectorT_int64_t_t(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void set_groundtruth(int gt_nnn, SWIGTYPE_p_float gt_D_in, LongVector gt_I_in) {
|
||||||
|
swigfaissJNI.AutoTuneCriterion_set_groundtruth(swigCPtr, this, gt_nnn, SWIGTYPE_p_float.getCPtr(gt_D_in), SWIGTYPE_p_long_long.getCPtr(gt_I_in.data()), gt_I_in);
|
||||||
|
}
|
||||||
|
|
||||||
|
public double evaluate(SWIGTYPE_p_float D, LongVector I) {
|
||||||
|
return swigfaissJNI.AutoTuneCriterion_evaluate(swigCPtr, this, SWIGTYPE_p_float.getCPtr(D), SWIGTYPE_p_long_long.getCPtr(I.data()), I);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
26
ann/src/main/java/com/twitter/ann/faiss/swig/BUILD
Normal file
26
ann/src/main/java/com/twitter/ann/faiss/swig/BUILD
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
java_library(
|
||||||
|
name = "swig-local",
|
||||||
|
sources = ["*.java"],
|
||||||
|
compiler_option_sets = ["fatal_warnings"],
|
||||||
|
platform = "java8",
|
||||||
|
tags = [
|
||||||
|
"bazel-compatible",
|
||||||
|
"bazel-only",
|
||||||
|
],
|
||||||
|
dependencies = [
|
||||||
|
"ann/src/main/java/com/twitter/ann/faiss:swig-native-utils",
|
||||||
|
"ann/src/main/java/com/twitter/ann/faiss/swig/resources",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
java_library(
|
||||||
|
name = "swig-artifactory",
|
||||||
|
sources = ["*.java"],
|
||||||
|
compiler_option_sets = ["fatal_warnings"],
|
||||||
|
platform = "java8",
|
||||||
|
tags = ["bazel-compatible"],
|
||||||
|
dependencies = [
|
||||||
|
"3rdparty/jvm/com/twitter/ann/faiss/swig:resources",
|
||||||
|
"ann/src/main/java/com/twitter/ann/faiss:swig-native-utils",
|
||||||
|
],
|
||||||
|
)
|
|
@ -0,0 +1,72 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class BitstringReader {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
protected transient boolean swigCMemOwn;
|
||||||
|
|
||||||
|
protected BitstringReader(long cPtr, boolean cMemoryOwn) {
|
||||||
|
swigCMemOwn = cMemoryOwn;
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(BitstringReader obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_BitstringReader(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCode(SWIGTYPE_p_unsigned_char value) {
|
||||||
|
swigfaissJNI.BitstringReader_code_set(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
public SWIGTYPE_p_unsigned_char getCode() {
|
||||||
|
long cPtr = swigfaissJNI.BitstringReader_code_get(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCode_size(long value) {
|
||||||
|
swigfaissJNI.BitstringReader_code_size_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getCode_size() {
|
||||||
|
return swigfaissJNI.BitstringReader_code_size_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setI(long value) {
|
||||||
|
swigfaissJNI.BitstringReader_i_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getI() {
|
||||||
|
return swigfaissJNI.BitstringReader_i_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public BitstringReader(SWIGTYPE_p_unsigned_char code, long code_size) {
|
||||||
|
this(swigfaissJNI.new_BitstringReader(SWIGTYPE_p_unsigned_char.getCPtr(code), code_size), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long read(int nbit) {
|
||||||
|
return swigfaissJNI.BitstringReader_read(swigCPtr, this, nbit);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,72 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class BitstringWriter {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
protected transient boolean swigCMemOwn;
|
||||||
|
|
||||||
|
protected BitstringWriter(long cPtr, boolean cMemoryOwn) {
|
||||||
|
swigCMemOwn = cMemoryOwn;
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(BitstringWriter obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_BitstringWriter(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCode(SWIGTYPE_p_unsigned_char value) {
|
||||||
|
swigfaissJNI.BitstringWriter_code_set(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
public SWIGTYPE_p_unsigned_char getCode() {
|
||||||
|
long cPtr = swigfaissJNI.BitstringWriter_code_get(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCode_size(long value) {
|
||||||
|
swigfaissJNI.BitstringWriter_code_size_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getCode_size() {
|
||||||
|
return swigfaissJNI.BitstringWriter_code_size_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setI(long value) {
|
||||||
|
swigfaissJNI.BitstringWriter_i_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getI() {
|
||||||
|
return swigfaissJNI.BitstringWriter_i_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public BitstringWriter(SWIGTYPE_p_unsigned_char code, long code_size) {
|
||||||
|
this(swigfaissJNI.new_BitstringWriter(SWIGTYPE_p_unsigned_char.getCPtr(code), code_size), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void write(long x, int nbit) {
|
||||||
|
swigfaissJNI.BitstringWriter_write(swigCPtr, this, x, nbit);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
80
ann/src/main/java/com/twitter/ann/faiss/swig/BufferList.java
Normal file
80
ann/src/main/java/com/twitter/ann/faiss/swig/BufferList.java
Normal file
|
@ -0,0 +1,80 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class BufferList {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
protected transient boolean swigCMemOwn;
|
||||||
|
|
||||||
|
protected BufferList(long cPtr, boolean cMemoryOwn) {
|
||||||
|
swigCMemOwn = cMemoryOwn;
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(BufferList obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_BufferList(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBuffer_size(long value) {
|
||||||
|
swigfaissJNI.BufferList_buffer_size_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getBuffer_size() {
|
||||||
|
return swigfaissJNI.BufferList_buffer_size_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBuffers(SWIGTYPE_p_std__vectorT_faiss__BufferList__Buffer_t value) {
|
||||||
|
swigfaissJNI.BufferList_buffers_set(swigCPtr, this, SWIGTYPE_p_std__vectorT_faiss__BufferList__Buffer_t.getCPtr(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
public SWIGTYPE_p_std__vectorT_faiss__BufferList__Buffer_t getBuffers() {
|
||||||
|
long cPtr = swigfaissJNI.BufferList_buffers_get(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new SWIGTYPE_p_std__vectorT_faiss__BufferList__Buffer_t(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWp(long value) {
|
||||||
|
swigfaissJNI.BufferList_wp_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getWp() {
|
||||||
|
return swigfaissJNI.BufferList_wp_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public BufferList(long buffer_size) {
|
||||||
|
this(swigfaissJNI.new_BufferList(buffer_size), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void append_buffer() {
|
||||||
|
swigfaissJNI.BufferList_append_buffer(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void add(long id, float dis) {
|
||||||
|
swigfaissJNI.BufferList_add(swigCPtr, this, id, dis);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void copy_range(long ofs, long n, LongVector dest_ids, SWIGTYPE_p_float dest_dis) {
|
||||||
|
swigfaissJNI.BufferList_copy_range(swigCPtr, this, ofs, n, SWIGTYPE_p_long_long.getCPtr(dest_ids.data()), dest_ids, SWIGTYPE_p_float.getCPtr(dest_dis));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
76
ann/src/main/java/com/twitter/ann/faiss/swig/ByteVector.java
Normal file
76
ann/src/main/java/com/twitter/ann/faiss/swig/ByteVector.java
Normal file
|
@ -0,0 +1,76 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class ByteVector {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
protected transient boolean swigCMemOwn;
|
||||||
|
|
||||||
|
protected ByteVector(long cPtr, boolean cMemoryOwn) {
|
||||||
|
swigCMemOwn = cMemoryOwn;
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(ByteVector obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_ByteVector(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ByteVector() {
|
||||||
|
this(swigfaissJNI.new_ByteVector(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void push_back(short arg0) {
|
||||||
|
swigfaissJNI.ByteVector_push_back(swigCPtr, this, arg0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clear() {
|
||||||
|
swigfaissJNI.ByteVector_clear(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SWIGTYPE_p_unsigned_char data() {
|
||||||
|
long cPtr = swigfaissJNI.ByteVector_data(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long size() {
|
||||||
|
return swigfaissJNI.ByteVector_size(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public short at(long n) {
|
||||||
|
return swigfaissJNI.ByteVector_at(swigCPtr, this, n);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void resize(long n) {
|
||||||
|
swigfaissJNI.ByteVector_resize(swigCPtr, this, n);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reserve(long n) {
|
||||||
|
swigfaissJNI.ByteVector_reserve(swigCPtr, this, n);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void swap(ByteVector other) {
|
||||||
|
swigfaissJNI.ByteVector_swap(swigCPtr, this, ByteVector.getCPtr(other), other);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,76 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class ByteVectorVector {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
protected transient boolean swigCMemOwn;
|
||||||
|
|
||||||
|
protected ByteVectorVector(long cPtr, boolean cMemoryOwn) {
|
||||||
|
swigCMemOwn = cMemoryOwn;
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(ByteVectorVector obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_ByteVectorVector(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ByteVectorVector() {
|
||||||
|
this(swigfaissJNI.new_ByteVectorVector(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void push_back(ByteVector arg0) {
|
||||||
|
swigfaissJNI.ByteVectorVector_push_back(swigCPtr, this, ByteVector.getCPtr(arg0), arg0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clear() {
|
||||||
|
swigfaissJNI.ByteVectorVector_clear(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ByteVector data() {
|
||||||
|
long cPtr = swigfaissJNI.ByteVectorVector_data(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new ByteVector(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long size() {
|
||||||
|
return swigfaissJNI.ByteVectorVector_size(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ByteVector at(long n) {
|
||||||
|
return new ByteVector(swigfaissJNI.ByteVectorVector_at(swigCPtr, this, n), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void resize(long n) {
|
||||||
|
swigfaissJNI.ByteVectorVector_resize(swigCPtr, this, n);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reserve(long n) {
|
||||||
|
swigfaissJNI.ByteVectorVector_reserve(swigCPtr, this, n);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void swap(ByteVectorVector other) {
|
||||||
|
swigfaissJNI.ByteVectorVector_swap(swigCPtr, this, ByteVectorVector.getCPtr(other), other);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,68 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class CenteringTransform extends VectorTransform {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
|
||||||
|
protected CenteringTransform(long cPtr, boolean cMemoryOwn) {
|
||||||
|
super(swigfaissJNI.CenteringTransform_SWIGUpcast(cPtr), cMemoryOwn);
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(CenteringTransform obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_CenteringTransform(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
super.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMean(FloatVector value) {
|
||||||
|
swigfaissJNI.CenteringTransform_mean_set(swigCPtr, this, FloatVector.getCPtr(value), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public FloatVector getMean() {
|
||||||
|
long cPtr = swigfaissJNI.CenteringTransform_mean_get(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new FloatVector(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public CenteringTransform(int d) {
|
||||||
|
this(swigfaissJNI.new_CenteringTransform__SWIG_0(d), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public CenteringTransform() {
|
||||||
|
this(swigfaissJNI.new_CenteringTransform__SWIG_1(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void train(long n, SWIGTYPE_p_float x) {
|
||||||
|
swigfaissJNI.CenteringTransform_train(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void apply_noalloc(long n, SWIGTYPE_p_float x, SWIGTYPE_p_float xt) {
|
||||||
|
swigfaissJNI.CenteringTransform_apply_noalloc(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_float.getCPtr(xt));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reverse_transform(long n, SWIGTYPE_p_float xt, SWIGTYPE_p_float x) {
|
||||||
|
swigfaissJNI.CenteringTransform_reverse_transform(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(xt), SWIGTYPE_p_float.getCPtr(x));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
75
ann/src/main/java/com/twitter/ann/faiss/swig/CharVector.java
Normal file
75
ann/src/main/java/com/twitter/ann/faiss/swig/CharVector.java
Normal file
|
@ -0,0 +1,75 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class CharVector {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
protected transient boolean swigCMemOwn;
|
||||||
|
|
||||||
|
protected CharVector(long cPtr, boolean cMemoryOwn) {
|
||||||
|
swigCMemOwn = cMemoryOwn;
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(CharVector obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_CharVector(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public CharVector() {
|
||||||
|
this(swigfaissJNI.new_CharVector(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void push_back(char arg0) {
|
||||||
|
swigfaissJNI.CharVector_push_back(swigCPtr, this, arg0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clear() {
|
||||||
|
swigfaissJNI.CharVector_clear(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String data() {
|
||||||
|
return swigfaissJNI.CharVector_data(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long size() {
|
||||||
|
return swigfaissJNI.CharVector_size(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public char at(long n) {
|
||||||
|
return swigfaissJNI.CharVector_at(swigCPtr, this, n);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void resize(long n) {
|
||||||
|
swigfaissJNI.CharVector_resize(swigCPtr, this, n);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reserve(long n) {
|
||||||
|
swigfaissJNI.CharVector_reserve(swigCPtr, this, n);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void swap(CharVector other) {
|
||||||
|
swigfaissJNI.CharVector_swap(swigCPtr, this, CharVector.getCPtr(other), other);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
101
ann/src/main/java/com/twitter/ann/faiss/swig/Clustering.java
Normal file
101
ann/src/main/java/com/twitter/ann/faiss/swig/Clustering.java
Normal file
|
@ -0,0 +1,101 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class Clustering extends ClusteringParameters {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
|
||||||
|
protected Clustering(long cPtr, boolean cMemoryOwn) {
|
||||||
|
super(swigfaissJNI.Clustering_SWIGUpcast(cPtr), cMemoryOwn);
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(Clustering obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_Clustering(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
super.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setD(long value) {
|
||||||
|
swigfaissJNI.Clustering_d_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getD() {
|
||||||
|
return swigfaissJNI.Clustering_d_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setK(long value) {
|
||||||
|
swigfaissJNI.Clustering_k_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getK() {
|
||||||
|
return swigfaissJNI.Clustering_k_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCentroids(FloatVector value) {
|
||||||
|
swigfaissJNI.Clustering_centroids_set(swigCPtr, this, FloatVector.getCPtr(value), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public FloatVector getCentroids() {
|
||||||
|
long cPtr = swigfaissJNI.Clustering_centroids_get(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new FloatVector(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIteration_stats(SWIGTYPE_p_std__vectorT_faiss__ClusteringIterationStats_t value) {
|
||||||
|
swigfaissJNI.Clustering_iteration_stats_set(swigCPtr, this, SWIGTYPE_p_std__vectorT_faiss__ClusteringIterationStats_t.getCPtr(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
public SWIGTYPE_p_std__vectorT_faiss__ClusteringIterationStats_t getIteration_stats() {
|
||||||
|
long cPtr = swigfaissJNI.Clustering_iteration_stats_get(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new SWIGTYPE_p_std__vectorT_faiss__ClusteringIterationStats_t(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Clustering(int d, int k) {
|
||||||
|
this(swigfaissJNI.new_Clustering__SWIG_0(d, k), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Clustering(int d, int k, ClusteringParameters cp) {
|
||||||
|
this(swigfaissJNI.new_Clustering__SWIG_1(d, k, ClusteringParameters.getCPtr(cp), cp), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void train(long n, SWIGTYPE_p_float x, Index index, SWIGTYPE_p_float x_weights) {
|
||||||
|
swigfaissJNI.Clustering_train__SWIG_0(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), Index.getCPtr(index), index, SWIGTYPE_p_float.getCPtr(x_weights));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void train(long n, SWIGTYPE_p_float x, Index index) {
|
||||||
|
swigfaissJNI.Clustering_train__SWIG_1(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), Index.getCPtr(index), index);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void train_encoded(long nx, SWIGTYPE_p_unsigned_char x_in, Index codec, Index index, SWIGTYPE_p_float weights) {
|
||||||
|
swigfaissJNI.Clustering_train_encoded__SWIG_0(swigCPtr, this, nx, SWIGTYPE_p_unsigned_char.getCPtr(x_in), Index.getCPtr(codec), codec, Index.getCPtr(index), index, SWIGTYPE_p_float.getCPtr(weights));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void train_encoded(long nx, SWIGTYPE_p_unsigned_char x_in, Index codec, Index index) {
|
||||||
|
swigfaissJNI.Clustering_train_encoded__SWIG_1(swigCPtr, this, nx, SWIGTYPE_p_unsigned_char.getCPtr(x_in), Index.getCPtr(codec), codec, Index.getCPtr(index), index);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void post_process_centroids() {
|
||||||
|
swigfaissJNI.Clustering_post_process_centroids(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,51 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class Clustering1D extends Clustering {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
|
||||||
|
protected Clustering1D(long cPtr, boolean cMemoryOwn) {
|
||||||
|
super(swigfaissJNI.Clustering1D_SWIGUpcast(cPtr), cMemoryOwn);
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(Clustering1D obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_Clustering1D(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
super.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Clustering1D(int k) {
|
||||||
|
this(swigfaissJNI.new_Clustering1D__SWIG_0(k), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Clustering1D(int k, ClusteringParameters cp) {
|
||||||
|
this(swigfaissJNI.new_Clustering1D__SWIG_1(k, ClusteringParameters.getCPtr(cp), cp), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void train_exact(long n, SWIGTYPE_p_float x) {
|
||||||
|
swigfaissJNI.Clustering1D_train_exact(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,83 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class ClusteringIterationStats {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
protected transient boolean swigCMemOwn;
|
||||||
|
|
||||||
|
protected ClusteringIterationStats(long cPtr, boolean cMemoryOwn) {
|
||||||
|
swigCMemOwn = cMemoryOwn;
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(ClusteringIterationStats obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_ClusteringIterationStats(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setObj(float value) {
|
||||||
|
swigfaissJNI.ClusteringIterationStats_obj_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getObj() {
|
||||||
|
return swigfaissJNI.ClusteringIterationStats_obj_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTime(double value) {
|
||||||
|
swigfaissJNI.ClusteringIterationStats_time_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getTime() {
|
||||||
|
return swigfaissJNI.ClusteringIterationStats_time_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTime_search(double value) {
|
||||||
|
swigfaissJNI.ClusteringIterationStats_time_search_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getTime_search() {
|
||||||
|
return swigfaissJNI.ClusteringIterationStats_time_search_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setImbalance_factor(double value) {
|
||||||
|
swigfaissJNI.ClusteringIterationStats_imbalance_factor_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getImbalance_factor() {
|
||||||
|
return swigfaissJNI.ClusteringIterationStats_imbalance_factor_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNsplit(int value) {
|
||||||
|
swigfaissJNI.ClusteringIterationStats_nsplit_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getNsplit() {
|
||||||
|
return swigfaissJNI.ClusteringIterationStats_nsplit_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ClusteringIterationStats() {
|
||||||
|
this(swigfaissJNI.new_ClusteringIterationStats(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,131 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class ClusteringParameters {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
protected transient boolean swigCMemOwn;
|
||||||
|
|
||||||
|
protected ClusteringParameters(long cPtr, boolean cMemoryOwn) {
|
||||||
|
swigCMemOwn = cMemoryOwn;
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(ClusteringParameters obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_ClusteringParameters(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNiter(int value) {
|
||||||
|
swigfaissJNI.ClusteringParameters_niter_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getNiter() {
|
||||||
|
return swigfaissJNI.ClusteringParameters_niter_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNredo(int value) {
|
||||||
|
swigfaissJNI.ClusteringParameters_nredo_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getNredo() {
|
||||||
|
return swigfaissJNI.ClusteringParameters_nredo_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVerbose(boolean value) {
|
||||||
|
swigfaissJNI.ClusteringParameters_verbose_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getVerbose() {
|
||||||
|
return swigfaissJNI.ClusteringParameters_verbose_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSpherical(boolean value) {
|
||||||
|
swigfaissJNI.ClusteringParameters_spherical_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getSpherical() {
|
||||||
|
return swigfaissJNI.ClusteringParameters_spherical_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setInt_centroids(boolean value) {
|
||||||
|
swigfaissJNI.ClusteringParameters_int_centroids_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getInt_centroids() {
|
||||||
|
return swigfaissJNI.ClusteringParameters_int_centroids_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUpdate_index(boolean value) {
|
||||||
|
swigfaissJNI.ClusteringParameters_update_index_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getUpdate_index() {
|
||||||
|
return swigfaissJNI.ClusteringParameters_update_index_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFrozen_centroids(boolean value) {
|
||||||
|
swigfaissJNI.ClusteringParameters_frozen_centroids_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getFrozen_centroids() {
|
||||||
|
return swigfaissJNI.ClusteringParameters_frozen_centroids_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMin_points_per_centroid(int value) {
|
||||||
|
swigfaissJNI.ClusteringParameters_min_points_per_centroid_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMin_points_per_centroid() {
|
||||||
|
return swigfaissJNI.ClusteringParameters_min_points_per_centroid_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMax_points_per_centroid(int value) {
|
||||||
|
swigfaissJNI.ClusteringParameters_max_points_per_centroid_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMax_points_per_centroid() {
|
||||||
|
return swigfaissJNI.ClusteringParameters_max_points_per_centroid_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSeed(int value) {
|
||||||
|
swigfaissJNI.ClusteringParameters_seed_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getSeed() {
|
||||||
|
return swigfaissJNI.ClusteringParameters_seed_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDecode_block_size(long value) {
|
||||||
|
swigfaissJNI.ClusteringParameters_decode_block_size_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getDecode_block_size() {
|
||||||
|
return swigfaissJNI.ClusteringParameters_decode_block_size_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ClusteringParameters() {
|
||||||
|
this(swigfaissJNI.new_ClusteringParameters(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,47 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class DistanceComputer {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
protected transient boolean swigCMemOwn;
|
||||||
|
|
||||||
|
protected DistanceComputer(long cPtr, boolean cMemoryOwn) {
|
||||||
|
swigCMemOwn = cMemoryOwn;
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(DistanceComputer obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_DistanceComputer(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void set_query(SWIGTYPE_p_float x) {
|
||||||
|
swigfaissJNI.DistanceComputer_set_query(swigCPtr, this, SWIGTYPE_p_float.getCPtr(x));
|
||||||
|
}
|
||||||
|
|
||||||
|
public float symmetric_dis(long i, long j) {
|
||||||
|
return swigfaissJNI.DistanceComputer_symmetric_dis(swigCPtr, this, i, j);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,76 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class DoubleVector {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
protected transient boolean swigCMemOwn;
|
||||||
|
|
||||||
|
protected DoubleVector(long cPtr, boolean cMemoryOwn) {
|
||||||
|
swigCMemOwn = cMemoryOwn;
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(DoubleVector obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_DoubleVector(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public DoubleVector() {
|
||||||
|
this(swigfaissJNI.new_DoubleVector(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void push_back(double arg0) {
|
||||||
|
swigfaissJNI.DoubleVector_push_back(swigCPtr, this, arg0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clear() {
|
||||||
|
swigfaissJNI.DoubleVector_clear(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SWIGTYPE_p_double data() {
|
||||||
|
long cPtr = swigfaissJNI.DoubleVector_data(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new SWIGTYPE_p_double(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long size() {
|
||||||
|
return swigfaissJNI.DoubleVector_size(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public double at(long n) {
|
||||||
|
return swigfaissJNI.DoubleVector_at(swigCPtr, this, n);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void resize(long n) {
|
||||||
|
swigfaissJNI.DoubleVector_resize(swigCPtr, this, n);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reserve(long n) {
|
||||||
|
swigfaissJNI.DoubleVector_reserve(swigCPtr, this, n);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void swap(DoubleVector other) {
|
||||||
|
swigfaissJNI.DoubleVector_swap(swigCPtr, this, DoubleVector.getCPtr(other), other);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,76 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class FloatVector {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
protected transient boolean swigCMemOwn;
|
||||||
|
|
||||||
|
protected FloatVector(long cPtr, boolean cMemoryOwn) {
|
||||||
|
swigCMemOwn = cMemoryOwn;
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(FloatVector obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_FloatVector(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public FloatVector() {
|
||||||
|
this(swigfaissJNI.new_FloatVector(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void push_back(float arg0) {
|
||||||
|
swigfaissJNI.FloatVector_push_back(swigCPtr, this, arg0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clear() {
|
||||||
|
swigfaissJNI.FloatVector_clear(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SWIGTYPE_p_float data() {
|
||||||
|
long cPtr = swigfaissJNI.FloatVector_data(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new SWIGTYPE_p_float(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long size() {
|
||||||
|
return swigfaissJNI.FloatVector_size(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public float at(long n) {
|
||||||
|
return swigfaissJNI.FloatVector_at(swigCPtr, this, n);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void resize(long n) {
|
||||||
|
swigfaissJNI.FloatVector_resize(swigCPtr, this, n);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reserve(long n) {
|
||||||
|
swigfaissJNI.FloatVector_reserve(swigCPtr, this, n);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void swap(FloatVector other) {
|
||||||
|
swigfaissJNI.FloatVector_swap(swigCPtr, this, FloatVector.getCPtr(other), other);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,76 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class FloatVectorVector {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
protected transient boolean swigCMemOwn;
|
||||||
|
|
||||||
|
protected FloatVectorVector(long cPtr, boolean cMemoryOwn) {
|
||||||
|
swigCMemOwn = cMemoryOwn;
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(FloatVectorVector obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_FloatVectorVector(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public FloatVectorVector() {
|
||||||
|
this(swigfaissJNI.new_FloatVectorVector(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void push_back(FloatVector arg0) {
|
||||||
|
swigfaissJNI.FloatVectorVector_push_back(swigCPtr, this, FloatVector.getCPtr(arg0), arg0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clear() {
|
||||||
|
swigfaissJNI.FloatVectorVector_clear(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public FloatVector data() {
|
||||||
|
long cPtr = swigfaissJNI.FloatVectorVector_data(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new FloatVector(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long size() {
|
||||||
|
return swigfaissJNI.FloatVectorVector_size(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public FloatVector at(long n) {
|
||||||
|
return new FloatVector(swigfaissJNI.FloatVectorVector_at(swigCPtr, this, n), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void resize(long n) {
|
||||||
|
swigfaissJNI.FloatVectorVector_resize(swigCPtr, this, n);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reserve(long n) {
|
||||||
|
swigfaissJNI.FloatVectorVector_reserve(swigCPtr, this, n);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void swap(FloatVectorVector other) {
|
||||||
|
swigfaissJNI.FloatVectorVector_swap(swigCPtr, this, FloatVectorVector.getCPtr(other), other);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,63 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class GenHammingComputer16 {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
protected transient boolean swigCMemOwn;
|
||||||
|
|
||||||
|
protected GenHammingComputer16(long cPtr, boolean cMemoryOwn) {
|
||||||
|
swigCMemOwn = cMemoryOwn;
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(GenHammingComputer16 obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_GenHammingComputer16(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setA0(long value) {
|
||||||
|
swigfaissJNI.GenHammingComputer16_a0_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getA0() {
|
||||||
|
return swigfaissJNI.GenHammingComputer16_a0_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setA1(long value) {
|
||||||
|
swigfaissJNI.GenHammingComputer16_a1_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getA1() {
|
||||||
|
return swigfaissJNI.GenHammingComputer16_a1_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public GenHammingComputer16(SWIGTYPE_p_unsigned_char a8, int code_size) {
|
||||||
|
this(swigfaissJNI.new_GenHammingComputer16(SWIGTYPE_p_unsigned_char.getCPtr(a8), code_size), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int hamming(SWIGTYPE_p_unsigned_char b8) {
|
||||||
|
return swigfaissJNI.GenHammingComputer16_hamming(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(b8));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,79 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class GenHammingComputer32 {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
protected transient boolean swigCMemOwn;
|
||||||
|
|
||||||
|
protected GenHammingComputer32(long cPtr, boolean cMemoryOwn) {
|
||||||
|
swigCMemOwn = cMemoryOwn;
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(GenHammingComputer32 obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_GenHammingComputer32(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setA0(long value) {
|
||||||
|
swigfaissJNI.GenHammingComputer32_a0_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getA0() {
|
||||||
|
return swigfaissJNI.GenHammingComputer32_a0_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setA1(long value) {
|
||||||
|
swigfaissJNI.GenHammingComputer32_a1_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getA1() {
|
||||||
|
return swigfaissJNI.GenHammingComputer32_a1_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setA2(long value) {
|
||||||
|
swigfaissJNI.GenHammingComputer32_a2_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getA2() {
|
||||||
|
return swigfaissJNI.GenHammingComputer32_a2_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setA3(long value) {
|
||||||
|
swigfaissJNI.GenHammingComputer32_a3_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getA3() {
|
||||||
|
return swigfaissJNI.GenHammingComputer32_a3_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public GenHammingComputer32(SWIGTYPE_p_unsigned_char a8, int code_size) {
|
||||||
|
this(swigfaissJNI.new_GenHammingComputer32(SWIGTYPE_p_unsigned_char.getCPtr(a8), code_size), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int hamming(SWIGTYPE_p_unsigned_char b8) {
|
||||||
|
return swigfaissJNI.GenHammingComputer32_hamming(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(b8));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,55 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class GenHammingComputer8 {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
protected transient boolean swigCMemOwn;
|
||||||
|
|
||||||
|
protected GenHammingComputer8(long cPtr, boolean cMemoryOwn) {
|
||||||
|
swigCMemOwn = cMemoryOwn;
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(GenHammingComputer8 obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_GenHammingComputer8(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setA0(long value) {
|
||||||
|
swigfaissJNI.GenHammingComputer8_a0_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getA0() {
|
||||||
|
return swigfaissJNI.GenHammingComputer8_a0_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public GenHammingComputer8(SWIGTYPE_p_unsigned_char a, int code_size) {
|
||||||
|
this(swigfaissJNI.new_GenHammingComputer8(SWIGTYPE_p_unsigned_char.getCPtr(a), code_size), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int hamming(SWIGTYPE_p_unsigned_char b) {
|
||||||
|
return swigfaissJNI.GenHammingComputer8_hamming(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(b));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,64 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class GenHammingComputerM8 {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
protected transient boolean swigCMemOwn;
|
||||||
|
|
||||||
|
protected GenHammingComputerM8(long cPtr, boolean cMemoryOwn) {
|
||||||
|
swigCMemOwn = cMemoryOwn;
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(GenHammingComputerM8 obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_GenHammingComputerM8(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setA(SWIGTYPE_p_unsigned_long value) {
|
||||||
|
swigfaissJNI.GenHammingComputerM8_a_set(swigCPtr, this, SWIGTYPE_p_unsigned_long.getCPtr(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
public SWIGTYPE_p_unsigned_long getA() {
|
||||||
|
long cPtr = swigfaissJNI.GenHammingComputerM8_a_get(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_long(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setN(int value) {
|
||||||
|
swigfaissJNI.GenHammingComputerM8_n_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getN() {
|
||||||
|
return swigfaissJNI.GenHammingComputerM8_n_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public GenHammingComputerM8(SWIGTYPE_p_unsigned_char a8, int code_size) {
|
||||||
|
this(swigfaissJNI.new_GenHammingComputerM8(SWIGTYPE_p_unsigned_char.getCPtr(a8), code_size), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int hamming(SWIGTYPE_p_unsigned_char b8) {
|
||||||
|
return swigfaissJNI.GenHammingComputerM8_hamming(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(b8));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
437
ann/src/main/java/com/twitter/ann/faiss/swig/HNSW.java
Normal file
437
ann/src/main/java/com/twitter/ann/faiss/swig/HNSW.java
Normal file
|
@ -0,0 +1,437 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class HNSW {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
protected transient boolean swigCMemOwn;
|
||||||
|
|
||||||
|
protected HNSW(long cPtr, boolean cMemoryOwn) {
|
||||||
|
swigCMemOwn = cMemoryOwn;
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(HNSW obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_HNSW(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static public class MinimaxHeap {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
protected transient boolean swigCMemOwn;
|
||||||
|
|
||||||
|
protected MinimaxHeap(long cPtr, boolean cMemoryOwn) {
|
||||||
|
swigCMemOwn = cMemoryOwn;
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(MinimaxHeap obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_HNSW_MinimaxHeap(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setN(int value) {
|
||||||
|
swigfaissJNI.HNSW_MinimaxHeap_n_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getN() {
|
||||||
|
return swigfaissJNI.HNSW_MinimaxHeap_n_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setK(int value) {
|
||||||
|
swigfaissJNI.HNSW_MinimaxHeap_k_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getK() {
|
||||||
|
return swigfaissJNI.HNSW_MinimaxHeap_k_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNvalid(int value) {
|
||||||
|
swigfaissJNI.HNSW_MinimaxHeap_nvalid_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getNvalid() {
|
||||||
|
return swigfaissJNI.HNSW_MinimaxHeap_nvalid_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIds(IntVector value) {
|
||||||
|
swigfaissJNI.HNSW_MinimaxHeap_ids_set(swigCPtr, this, IntVector.getCPtr(value), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IntVector getIds() {
|
||||||
|
long cPtr = swigfaissJNI.HNSW_MinimaxHeap_ids_get(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new IntVector(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDis(FloatVector value) {
|
||||||
|
swigfaissJNI.HNSW_MinimaxHeap_dis_set(swigCPtr, this, FloatVector.getCPtr(value), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public FloatVector getDis() {
|
||||||
|
long cPtr = swigfaissJNI.HNSW_MinimaxHeap_dis_get(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new FloatVector(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public MinimaxHeap(int n) {
|
||||||
|
this(swigfaissJNI.new_HNSW_MinimaxHeap(n), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void push(int i, float v) {
|
||||||
|
swigfaissJNI.HNSW_MinimaxHeap_push(swigCPtr, this, i, v);
|
||||||
|
}
|
||||||
|
|
||||||
|
public float max() {
|
||||||
|
return swigfaissJNI.HNSW_MinimaxHeap_max(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int size() {
|
||||||
|
return swigfaissJNI.HNSW_MinimaxHeap_size(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clear() {
|
||||||
|
swigfaissJNI.HNSW_MinimaxHeap_clear(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int pop_min(SWIGTYPE_p_float vmin_out) {
|
||||||
|
return swigfaissJNI.HNSW_MinimaxHeap_pop_min__SWIG_0(swigCPtr, this, SWIGTYPE_p_float.getCPtr(vmin_out));
|
||||||
|
}
|
||||||
|
|
||||||
|
public int pop_min() {
|
||||||
|
return swigfaissJNI.HNSW_MinimaxHeap_pop_min__SWIG_1(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int count_below(float thresh) {
|
||||||
|
return swigfaissJNI.HNSW_MinimaxHeap_count_below(swigCPtr, this, thresh);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static public class NodeDistCloser {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
protected transient boolean swigCMemOwn;
|
||||||
|
|
||||||
|
protected NodeDistCloser(long cPtr, boolean cMemoryOwn) {
|
||||||
|
swigCMemOwn = cMemoryOwn;
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(NodeDistCloser obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_HNSW_NodeDistCloser(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setD(float value) {
|
||||||
|
swigfaissJNI.HNSW_NodeDistCloser_d_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getD() {
|
||||||
|
return swigfaissJNI.HNSW_NodeDistCloser_d_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(int value) {
|
||||||
|
swigfaissJNI.HNSW_NodeDistCloser_id_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return swigfaissJNI.HNSW_NodeDistCloser_id_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public NodeDistCloser(float d, int id) {
|
||||||
|
this(swigfaissJNI.new_HNSW_NodeDistCloser(d, id), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static public class NodeDistFarther {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
protected transient boolean swigCMemOwn;
|
||||||
|
|
||||||
|
protected NodeDistFarther(long cPtr, boolean cMemoryOwn) {
|
||||||
|
swigCMemOwn = cMemoryOwn;
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(NodeDistFarther obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_HNSW_NodeDistFarther(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setD(float value) {
|
||||||
|
swigfaissJNI.HNSW_NodeDistFarther_d_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getD() {
|
||||||
|
return swigfaissJNI.HNSW_NodeDistFarther_d_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(int value) {
|
||||||
|
swigfaissJNI.HNSW_NodeDistFarther_id_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return swigfaissJNI.HNSW_NodeDistFarther_id_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public NodeDistFarther(float d, int id) {
|
||||||
|
this(swigfaissJNI.new_HNSW_NodeDistFarther(d, id), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAssign_probas(DoubleVector value) {
|
||||||
|
swigfaissJNI.HNSW_assign_probas_set(swigCPtr, this, DoubleVector.getCPtr(value), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public DoubleVector getAssign_probas() {
|
||||||
|
long cPtr = swigfaissJNI.HNSW_assign_probas_get(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new DoubleVector(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCum_nneighbor_per_level(IntVector value) {
|
||||||
|
swigfaissJNI.HNSW_cum_nneighbor_per_level_set(swigCPtr, this, IntVector.getCPtr(value), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IntVector getCum_nneighbor_per_level() {
|
||||||
|
long cPtr = swigfaissJNI.HNSW_cum_nneighbor_per_level_get(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new IntVector(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLevels(IntVector value) {
|
||||||
|
swigfaissJNI.HNSW_levels_set(swigCPtr, this, IntVector.getCPtr(value), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IntVector getLevels() {
|
||||||
|
long cPtr = swigfaissJNI.HNSW_levels_get(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new IntVector(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOffsets(Uint64Vector value) {
|
||||||
|
swigfaissJNI.HNSW_offsets_set(swigCPtr, this, Uint64Vector.getCPtr(value), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Uint64Vector getOffsets() {
|
||||||
|
long cPtr = swigfaissJNI.HNSW_offsets_get(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new Uint64Vector(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNeighbors(IntVector value) {
|
||||||
|
swigfaissJNI.HNSW_neighbors_set(swigCPtr, this, IntVector.getCPtr(value), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IntVector getNeighbors() {
|
||||||
|
long cPtr = swigfaissJNI.HNSW_neighbors_get(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new IntVector(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEntry_point(int value) {
|
||||||
|
swigfaissJNI.HNSW_entry_point_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getEntry_point() {
|
||||||
|
return swigfaissJNI.HNSW_entry_point_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRng(SWIGTYPE_p_faiss__RandomGenerator value) {
|
||||||
|
swigfaissJNI.HNSW_rng_set(swigCPtr, this, SWIGTYPE_p_faiss__RandomGenerator.getCPtr(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
public SWIGTYPE_p_faiss__RandomGenerator getRng() {
|
||||||
|
long cPtr = swigfaissJNI.HNSW_rng_get(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new SWIGTYPE_p_faiss__RandomGenerator(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMax_level(int value) {
|
||||||
|
swigfaissJNI.HNSW_max_level_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMax_level() {
|
||||||
|
return swigfaissJNI.HNSW_max_level_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEfConstruction(int value) {
|
||||||
|
swigfaissJNI.HNSW_efConstruction_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getEfConstruction() {
|
||||||
|
return swigfaissJNI.HNSW_efConstruction_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEfSearch(int value) {
|
||||||
|
swigfaissJNI.HNSW_efSearch_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getEfSearch() {
|
||||||
|
return swigfaissJNI.HNSW_efSearch_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCheck_relative_distance(boolean value) {
|
||||||
|
swigfaissJNI.HNSW_check_relative_distance_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getCheck_relative_distance() {
|
||||||
|
return swigfaissJNI.HNSW_check_relative_distance_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUpper_beam(int value) {
|
||||||
|
swigfaissJNI.HNSW_upper_beam_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getUpper_beam() {
|
||||||
|
return swigfaissJNI.HNSW_upper_beam_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSearch_bounded_queue(boolean value) {
|
||||||
|
swigfaissJNI.HNSW_search_bounded_queue_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getSearch_bounded_queue() {
|
||||||
|
return swigfaissJNI.HNSW_search_bounded_queue_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void set_default_probas(int M, float levelMult) {
|
||||||
|
swigfaissJNI.HNSW_set_default_probas(swigCPtr, this, M, levelMult);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void set_nb_neighbors(int level_no, int n) {
|
||||||
|
swigfaissJNI.HNSW_set_nb_neighbors(swigCPtr, this, level_no, n);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int nb_neighbors(int layer_no) {
|
||||||
|
return swigfaissJNI.HNSW_nb_neighbors(swigCPtr, this, layer_no);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int cum_nb_neighbors(int layer_no) {
|
||||||
|
return swigfaissJNI.HNSW_cum_nb_neighbors(swigCPtr, this, layer_no);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void neighbor_range(long no, int layer_no, SWIGTYPE_p_unsigned_long begin, SWIGTYPE_p_unsigned_long end) {
|
||||||
|
swigfaissJNI.HNSW_neighbor_range(swigCPtr, this, no, layer_no, SWIGTYPE_p_unsigned_long.getCPtr(begin), SWIGTYPE_p_unsigned_long.getCPtr(end));
|
||||||
|
}
|
||||||
|
|
||||||
|
public HNSW(int M) {
|
||||||
|
this(swigfaissJNI.new_HNSW__SWIG_0(M), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public HNSW() {
|
||||||
|
this(swigfaissJNI.new_HNSW__SWIG_1(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int random_level() {
|
||||||
|
return swigfaissJNI.HNSW_random_level(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void fill_with_random_links(long n) {
|
||||||
|
swigfaissJNI.HNSW_fill_with_random_links(swigCPtr, this, n);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void add_links_starting_from(DistanceComputer ptdis, int pt_id, int nearest, float d_nearest, int level, SWIGTYPE_p_omp_lock_t locks, VisitedTable vt) {
|
||||||
|
swigfaissJNI.HNSW_add_links_starting_from(swigCPtr, this, DistanceComputer.getCPtr(ptdis), ptdis, pt_id, nearest, d_nearest, level, SWIGTYPE_p_omp_lock_t.getCPtr(locks), VisitedTable.getCPtr(vt), vt);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void add_with_locks(DistanceComputer ptdis, int pt_level, int pt_id, SWIGTYPE_p_std__vectorT_omp_lock_t_t locks, VisitedTable vt) {
|
||||||
|
swigfaissJNI.HNSW_add_with_locks(swigCPtr, this, DistanceComputer.getCPtr(ptdis), ptdis, pt_level, pt_id, SWIGTYPE_p_std__vectorT_omp_lock_t_t.getCPtr(locks), VisitedTable.getCPtr(vt), vt);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int search_from_candidates(DistanceComputer qdis, int k, LongVector I, SWIGTYPE_p_float D, HNSW.MinimaxHeap candidates, VisitedTable vt, HNSWStats stats, int level, int nres_in) {
|
||||||
|
return swigfaissJNI.HNSW_search_from_candidates__SWIG_0(swigCPtr, this, DistanceComputer.getCPtr(qdis), qdis, k, SWIGTYPE_p_long_long.getCPtr(I.data()), I, SWIGTYPE_p_float.getCPtr(D), HNSW.MinimaxHeap.getCPtr(candidates), candidates, VisitedTable.getCPtr(vt), vt, HNSWStats.getCPtr(stats), stats, level, nres_in);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int search_from_candidates(DistanceComputer qdis, int k, LongVector I, SWIGTYPE_p_float D, HNSW.MinimaxHeap candidates, VisitedTable vt, HNSWStats stats, int level) {
|
||||||
|
return swigfaissJNI.HNSW_search_from_candidates__SWIG_1(swigCPtr, this, DistanceComputer.getCPtr(qdis), qdis, k, SWIGTYPE_p_long_long.getCPtr(I.data()), I, SWIGTYPE_p_float.getCPtr(D), HNSW.MinimaxHeap.getCPtr(candidates), candidates, VisitedTable.getCPtr(vt), vt, HNSWStats.getCPtr(stats), stats, level);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SWIGTYPE_p_std__priority_queueT_std__pairT_float_int_t_t search_from_candidate_unbounded(SWIGTYPE_p_std__pairT_float_int_t node, DistanceComputer qdis, int ef, VisitedTable vt, HNSWStats stats) {
|
||||||
|
return new SWIGTYPE_p_std__priority_queueT_std__pairT_float_int_t_t(swigfaissJNI.HNSW_search_from_candidate_unbounded(swigCPtr, this, SWIGTYPE_p_std__pairT_float_int_t.getCPtr(node), DistanceComputer.getCPtr(qdis), qdis, ef, VisitedTable.getCPtr(vt), vt, HNSWStats.getCPtr(stats), stats), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public HNSWStats search(DistanceComputer qdis, int k, LongVector I, SWIGTYPE_p_float D, VisitedTable vt) {
|
||||||
|
return new HNSWStats(swigfaissJNI.HNSW_search(swigCPtr, this, DistanceComputer.getCPtr(qdis), qdis, k, SWIGTYPE_p_long_long.getCPtr(I.data()), I, SWIGTYPE_p_float.getCPtr(D), VisitedTable.getCPtr(vt), vt), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reset() {
|
||||||
|
swigfaissJNI.HNSW_reset(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clear_neighbor_tables(int level) {
|
||||||
|
swigfaissJNI.HNSW_clear_neighbor_tables(swigCPtr, this, level);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void print_neighbor_stats(int level) {
|
||||||
|
swigfaissJNI.HNSW_print_neighbor_stats(swigCPtr, this, level);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int prepare_level_tab(long n, boolean preset_levels) {
|
||||||
|
return swigfaissJNI.HNSW_prepare_level_tab__SWIG_0(swigCPtr, this, n, preset_levels);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int prepare_level_tab(long n) {
|
||||||
|
return swigfaissJNI.HNSW_prepare_level_tab__SWIG_1(swigCPtr, this, n);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void shrink_neighbor_list(DistanceComputer qdis, SWIGTYPE_p_std__priority_queueT_faiss__HNSW__NodeDistFarther_t input, SWIGTYPE_p_std__vectorT_faiss__HNSW__NodeDistFarther_t output, int max_size) {
|
||||||
|
swigfaissJNI.HNSW_shrink_neighbor_list(DistanceComputer.getCPtr(qdis), qdis, SWIGTYPE_p_std__priority_queueT_faiss__HNSW__NodeDistFarther_t.getCPtr(input), SWIGTYPE_p_std__vectorT_faiss__HNSW__NodeDistFarther_t.getCPtr(output), max_size);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
111
ann/src/main/java/com/twitter/ann/faiss/swig/HNSWStats.java
Normal file
111
ann/src/main/java/com/twitter/ann/faiss/swig/HNSWStats.java
Normal file
|
@ -0,0 +1,111 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class HNSWStats {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
protected transient boolean swigCMemOwn;
|
||||||
|
|
||||||
|
protected HNSWStats(long cPtr, boolean cMemoryOwn) {
|
||||||
|
swigCMemOwn = cMemoryOwn;
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(HNSWStats obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_HNSWStats(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setN1(long value) {
|
||||||
|
swigfaissJNI.HNSWStats_n1_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getN1() {
|
||||||
|
return swigfaissJNI.HNSWStats_n1_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setN2(long value) {
|
||||||
|
swigfaissJNI.HNSWStats_n2_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getN2() {
|
||||||
|
return swigfaissJNI.HNSWStats_n2_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setN3(long value) {
|
||||||
|
swigfaissJNI.HNSWStats_n3_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getN3() {
|
||||||
|
return swigfaissJNI.HNSWStats_n3_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNdis(long value) {
|
||||||
|
swigfaissJNI.HNSWStats_ndis_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getNdis() {
|
||||||
|
return swigfaissJNI.HNSWStats_ndis_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNreorder(long value) {
|
||||||
|
swigfaissJNI.HNSWStats_nreorder_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getNreorder() {
|
||||||
|
return swigfaissJNI.HNSWStats_nreorder_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public HNSWStats(long n1, long n2, long n3, long ndis, long nreorder) {
|
||||||
|
this(swigfaissJNI.new_HNSWStats__SWIG_0(n1, n2, n3, ndis, nreorder), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public HNSWStats(long n1, long n2, long n3, long ndis) {
|
||||||
|
this(swigfaissJNI.new_HNSWStats__SWIG_1(n1, n2, n3, ndis), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public HNSWStats(long n1, long n2, long n3) {
|
||||||
|
this(swigfaissJNI.new_HNSWStats__SWIG_2(n1, n2, n3), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public HNSWStats(long n1, long n2) {
|
||||||
|
this(swigfaissJNI.new_HNSWStats__SWIG_3(n1, n2), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public HNSWStats(long n1) {
|
||||||
|
this(swigfaissJNI.new_HNSWStats__SWIG_4(n1), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public HNSWStats() {
|
||||||
|
this(swigfaissJNI.new_HNSWStats__SWIG_5(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reset() {
|
||||||
|
swigfaissJNI.HNSWStats_reset(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void combine(HNSWStats other) {
|
||||||
|
swigfaissJNI.HNSWStats_combine(swigCPtr, this, HNSWStats.getCPtr(other), other);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,86 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class HStackInvertedLists extends ReadOnlyInvertedLists {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
|
||||||
|
protected HStackInvertedLists(long cPtr, boolean cMemoryOwn) {
|
||||||
|
super(swigfaissJNI.HStackInvertedLists_SWIGUpcast(cPtr), cMemoryOwn);
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(HStackInvertedLists obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_HStackInvertedLists(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
super.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIls(SWIGTYPE_p_std__vectorT_faiss__InvertedLists_const_p_t value) {
|
||||||
|
swigfaissJNI.HStackInvertedLists_ils_set(swigCPtr, this, SWIGTYPE_p_std__vectorT_faiss__InvertedLists_const_p_t.getCPtr(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
public SWIGTYPE_p_std__vectorT_faiss__InvertedLists_const_p_t getIls() {
|
||||||
|
long cPtr = swigfaissJNI.HStackInvertedLists_ils_get(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new SWIGTYPE_p_std__vectorT_faiss__InvertedLists_const_p_t(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public HStackInvertedLists(int nil, SWIGTYPE_p_p_faiss__InvertedLists ils) {
|
||||||
|
this(swigfaissJNI.new_HStackInvertedLists(nil, SWIGTYPE_p_p_faiss__InvertedLists.getCPtr(ils)), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long list_size(long list_no) {
|
||||||
|
return swigfaissJNI.HStackInvertedLists_list_size(swigCPtr, this, list_no);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SWIGTYPE_p_unsigned_char get_codes(long list_no) {
|
||||||
|
long cPtr = swigfaissJNI.HStackInvertedLists_get_codes(swigCPtr, this, list_no);
|
||||||
|
return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public LongVector get_ids(long list_no) {
|
||||||
|
return new LongVector(swigfaissJNI.HStackInvertedLists_get_ids(swigCPtr, this, list_no), false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void prefetch_lists(LongVector list_nos, int nlist) {
|
||||||
|
swigfaissJNI.HStackInvertedLists_prefetch_lists(swigCPtr, this, SWIGTYPE_p_long_long.getCPtr(list_nos.data()), list_nos, nlist);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void release_codes(long list_no, SWIGTYPE_p_unsigned_char codes) {
|
||||||
|
swigfaissJNI.HStackInvertedLists_release_codes(swigCPtr, this, list_no, SWIGTYPE_p_unsigned_char.getCPtr(codes));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void release_ids(long list_no, LongVector ids) {
|
||||||
|
swigfaissJNI.HStackInvertedLists_release_ids(swigCPtr, this, list_no, SWIGTYPE_p_long_long.getCPtr(ids.data()), ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long get_single_id(long list_no, long offset) {
|
||||||
|
return swigfaissJNI.HStackInvertedLists_get_single_id(swigCPtr, this, list_no, offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SWIGTYPE_p_unsigned_char get_single_code(long list_no, long offset) {
|
||||||
|
long cPtr = swigfaissJNI.HStackInvertedLists_get_single_code(swigCPtr, this, list_no, offset);
|
||||||
|
return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,71 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class HammingComputer16 {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
protected transient boolean swigCMemOwn;
|
||||||
|
|
||||||
|
protected HammingComputer16(long cPtr, boolean cMemoryOwn) {
|
||||||
|
swigCMemOwn = cMemoryOwn;
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(HammingComputer16 obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_HammingComputer16(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setA0(long value) {
|
||||||
|
swigfaissJNI.HammingComputer16_a0_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getA0() {
|
||||||
|
return swigfaissJNI.HammingComputer16_a0_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setA1(long value) {
|
||||||
|
swigfaissJNI.HammingComputer16_a1_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getA1() {
|
||||||
|
return swigfaissJNI.HammingComputer16_a1_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public HammingComputer16() {
|
||||||
|
this(swigfaissJNI.new_HammingComputer16__SWIG_0(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public HammingComputer16(SWIGTYPE_p_unsigned_char a8, int code_size) {
|
||||||
|
this(swigfaissJNI.new_HammingComputer16__SWIG_1(SWIGTYPE_p_unsigned_char.getCPtr(a8), code_size), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void set(SWIGTYPE_p_unsigned_char a8, int code_size) {
|
||||||
|
swigfaissJNI.HammingComputer16_set(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(a8), code_size);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int hamming(SWIGTYPE_p_unsigned_char b8) {
|
||||||
|
return swigfaissJNI.HammingComputer16_hamming(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(b8));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,79 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class HammingComputer20 {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
protected transient boolean swigCMemOwn;
|
||||||
|
|
||||||
|
protected HammingComputer20(long cPtr, boolean cMemoryOwn) {
|
||||||
|
swigCMemOwn = cMemoryOwn;
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(HammingComputer20 obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_HammingComputer20(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setA0(long value) {
|
||||||
|
swigfaissJNI.HammingComputer20_a0_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getA0() {
|
||||||
|
return swigfaissJNI.HammingComputer20_a0_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setA1(long value) {
|
||||||
|
swigfaissJNI.HammingComputer20_a1_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getA1() {
|
||||||
|
return swigfaissJNI.HammingComputer20_a1_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setA2(SWIGTYPE_p_uint32_t value) {
|
||||||
|
swigfaissJNI.HammingComputer20_a2_set(swigCPtr, this, SWIGTYPE_p_uint32_t.getCPtr(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
public SWIGTYPE_p_uint32_t getA2() {
|
||||||
|
return new SWIGTYPE_p_uint32_t(swigfaissJNI.HammingComputer20_a2_get(swigCPtr, this), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public HammingComputer20() {
|
||||||
|
this(swigfaissJNI.new_HammingComputer20__SWIG_0(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public HammingComputer20(SWIGTYPE_p_unsigned_char a8, int code_size) {
|
||||||
|
this(swigfaissJNI.new_HammingComputer20__SWIG_1(SWIGTYPE_p_unsigned_char.getCPtr(a8), code_size), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void set(SWIGTYPE_p_unsigned_char a8, int code_size) {
|
||||||
|
swigfaissJNI.HammingComputer20_set(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(a8), code_size);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int hamming(SWIGTYPE_p_unsigned_char b8) {
|
||||||
|
return swigfaissJNI.HammingComputer20_hamming(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(b8));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,87 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class HammingComputer32 {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
protected transient boolean swigCMemOwn;
|
||||||
|
|
||||||
|
protected HammingComputer32(long cPtr, boolean cMemoryOwn) {
|
||||||
|
swigCMemOwn = cMemoryOwn;
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(HammingComputer32 obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_HammingComputer32(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setA0(long value) {
|
||||||
|
swigfaissJNI.HammingComputer32_a0_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getA0() {
|
||||||
|
return swigfaissJNI.HammingComputer32_a0_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setA1(long value) {
|
||||||
|
swigfaissJNI.HammingComputer32_a1_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getA1() {
|
||||||
|
return swigfaissJNI.HammingComputer32_a1_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setA2(long value) {
|
||||||
|
swigfaissJNI.HammingComputer32_a2_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getA2() {
|
||||||
|
return swigfaissJNI.HammingComputer32_a2_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setA3(long value) {
|
||||||
|
swigfaissJNI.HammingComputer32_a3_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getA3() {
|
||||||
|
return swigfaissJNI.HammingComputer32_a3_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public HammingComputer32() {
|
||||||
|
this(swigfaissJNI.new_HammingComputer32__SWIG_0(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public HammingComputer32(SWIGTYPE_p_unsigned_char a8, int code_size) {
|
||||||
|
this(swigfaissJNI.new_HammingComputer32__SWIG_1(SWIGTYPE_p_unsigned_char.getCPtr(a8), code_size), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void set(SWIGTYPE_p_unsigned_char a8, int code_size) {
|
||||||
|
swigfaissJNI.HammingComputer32_set(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(a8), code_size);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int hamming(SWIGTYPE_p_unsigned_char b8) {
|
||||||
|
return swigfaissJNI.HammingComputer32_hamming(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(b8));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,63 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class HammingComputer4 {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
protected transient boolean swigCMemOwn;
|
||||||
|
|
||||||
|
protected HammingComputer4(long cPtr, boolean cMemoryOwn) {
|
||||||
|
swigCMemOwn = cMemoryOwn;
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(HammingComputer4 obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_HammingComputer4(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setA0(SWIGTYPE_p_uint32_t value) {
|
||||||
|
swigfaissJNI.HammingComputer4_a0_set(swigCPtr, this, SWIGTYPE_p_uint32_t.getCPtr(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
public SWIGTYPE_p_uint32_t getA0() {
|
||||||
|
return new SWIGTYPE_p_uint32_t(swigfaissJNI.HammingComputer4_a0_get(swigCPtr, this), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public HammingComputer4() {
|
||||||
|
this(swigfaissJNI.new_HammingComputer4__SWIG_0(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public HammingComputer4(SWIGTYPE_p_unsigned_char a, int code_size) {
|
||||||
|
this(swigfaissJNI.new_HammingComputer4__SWIG_1(SWIGTYPE_p_unsigned_char.getCPtr(a), code_size), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void set(SWIGTYPE_p_unsigned_char a, int code_size) {
|
||||||
|
swigfaissJNI.HammingComputer4_set(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(a), code_size);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int hamming(SWIGTYPE_p_unsigned_char b) {
|
||||||
|
return swigfaissJNI.HammingComputer4_hamming(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(b));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,119 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class HammingComputer64 {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
protected transient boolean swigCMemOwn;
|
||||||
|
|
||||||
|
protected HammingComputer64(long cPtr, boolean cMemoryOwn) {
|
||||||
|
swigCMemOwn = cMemoryOwn;
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(HammingComputer64 obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_HammingComputer64(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setA0(long value) {
|
||||||
|
swigfaissJNI.HammingComputer64_a0_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getA0() {
|
||||||
|
return swigfaissJNI.HammingComputer64_a0_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setA1(long value) {
|
||||||
|
swigfaissJNI.HammingComputer64_a1_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getA1() {
|
||||||
|
return swigfaissJNI.HammingComputer64_a1_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setA2(long value) {
|
||||||
|
swigfaissJNI.HammingComputer64_a2_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getA2() {
|
||||||
|
return swigfaissJNI.HammingComputer64_a2_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setA3(long value) {
|
||||||
|
swigfaissJNI.HammingComputer64_a3_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getA3() {
|
||||||
|
return swigfaissJNI.HammingComputer64_a3_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setA4(long value) {
|
||||||
|
swigfaissJNI.HammingComputer64_a4_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getA4() {
|
||||||
|
return swigfaissJNI.HammingComputer64_a4_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setA5(long value) {
|
||||||
|
swigfaissJNI.HammingComputer64_a5_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getA5() {
|
||||||
|
return swigfaissJNI.HammingComputer64_a5_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setA6(long value) {
|
||||||
|
swigfaissJNI.HammingComputer64_a6_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getA6() {
|
||||||
|
return swigfaissJNI.HammingComputer64_a6_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setA7(long value) {
|
||||||
|
swigfaissJNI.HammingComputer64_a7_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getA7() {
|
||||||
|
return swigfaissJNI.HammingComputer64_a7_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public HammingComputer64() {
|
||||||
|
this(swigfaissJNI.new_HammingComputer64__SWIG_0(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public HammingComputer64(SWIGTYPE_p_unsigned_char a8, int code_size) {
|
||||||
|
this(swigfaissJNI.new_HammingComputer64__SWIG_1(SWIGTYPE_p_unsigned_char.getCPtr(a8), code_size), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void set(SWIGTYPE_p_unsigned_char a8, int code_size) {
|
||||||
|
swigfaissJNI.HammingComputer64_set(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(a8), code_size);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int hamming(SWIGTYPE_p_unsigned_char b8) {
|
||||||
|
return swigfaissJNI.HammingComputer64_hamming(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(b8));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,63 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class HammingComputer8 {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
protected transient boolean swigCMemOwn;
|
||||||
|
|
||||||
|
protected HammingComputer8(long cPtr, boolean cMemoryOwn) {
|
||||||
|
swigCMemOwn = cMemoryOwn;
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(HammingComputer8 obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_HammingComputer8(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setA0(long value) {
|
||||||
|
swigfaissJNI.HammingComputer8_a0_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getA0() {
|
||||||
|
return swigfaissJNI.HammingComputer8_a0_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public HammingComputer8() {
|
||||||
|
this(swigfaissJNI.new_HammingComputer8__SWIG_0(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public HammingComputer8(SWIGTYPE_p_unsigned_char a, int code_size) {
|
||||||
|
this(swigfaissJNI.new_HammingComputer8__SWIG_1(SWIGTYPE_p_unsigned_char.getCPtr(a), code_size), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void set(SWIGTYPE_p_unsigned_char a, int code_size) {
|
||||||
|
swigfaissJNI.HammingComputer8_set(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(a), code_size);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int hamming(SWIGTYPE_p_unsigned_char b) {
|
||||||
|
return swigfaissJNI.HammingComputer8_hamming(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(b));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,80 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class HammingComputerDefault {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
protected transient boolean swigCMemOwn;
|
||||||
|
|
||||||
|
protected HammingComputerDefault(long cPtr, boolean cMemoryOwn) {
|
||||||
|
swigCMemOwn = cMemoryOwn;
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(HammingComputerDefault obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_HammingComputerDefault(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setA8(SWIGTYPE_p_unsigned_char value) {
|
||||||
|
swigfaissJNI.HammingComputerDefault_a8_set(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
public SWIGTYPE_p_unsigned_char getA8() {
|
||||||
|
long cPtr = swigfaissJNI.HammingComputerDefault_a8_get(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQuotient8(int value) {
|
||||||
|
swigfaissJNI.HammingComputerDefault_quotient8_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getQuotient8() {
|
||||||
|
return swigfaissJNI.HammingComputerDefault_quotient8_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRemainder8(int value) {
|
||||||
|
swigfaissJNI.HammingComputerDefault_remainder8_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getRemainder8() {
|
||||||
|
return swigfaissJNI.HammingComputerDefault_remainder8_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public HammingComputerDefault() {
|
||||||
|
this(swigfaissJNI.new_HammingComputerDefault__SWIG_0(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public HammingComputerDefault(SWIGTYPE_p_unsigned_char a8, int code_size) {
|
||||||
|
this(swigfaissJNI.new_HammingComputerDefault__SWIG_1(SWIGTYPE_p_unsigned_char.getCPtr(a8), code_size), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void set(SWIGTYPE_p_unsigned_char a8, int code_size) {
|
||||||
|
swigfaissJNI.HammingComputerDefault_set(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(a8), code_size);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int hamming(SWIGTYPE_p_unsigned_char b8) {
|
||||||
|
return swigfaissJNI.HammingComputerDefault_hamming(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(b8));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,72 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class HammingComputerM4 {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
protected transient boolean swigCMemOwn;
|
||||||
|
|
||||||
|
protected HammingComputerM4(long cPtr, boolean cMemoryOwn) {
|
||||||
|
swigCMemOwn = cMemoryOwn;
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(HammingComputerM4 obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_HammingComputerM4(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setA(SWIGTYPE_p_uint32_t value) {
|
||||||
|
swigfaissJNI.HammingComputerM4_a_set(swigCPtr, this, SWIGTYPE_p_uint32_t.getCPtr(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
public SWIGTYPE_p_uint32_t getA() {
|
||||||
|
long cPtr = swigfaissJNI.HammingComputerM4_a_get(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new SWIGTYPE_p_uint32_t(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setN(int value) {
|
||||||
|
swigfaissJNI.HammingComputerM4_n_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getN() {
|
||||||
|
return swigfaissJNI.HammingComputerM4_n_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public HammingComputerM4() {
|
||||||
|
this(swigfaissJNI.new_HammingComputerM4__SWIG_0(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public HammingComputerM4(SWIGTYPE_p_unsigned_char a4, int code_size) {
|
||||||
|
this(swigfaissJNI.new_HammingComputerM4__SWIG_1(SWIGTYPE_p_unsigned_char.getCPtr(a4), code_size), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void set(SWIGTYPE_p_unsigned_char a4, int code_size) {
|
||||||
|
swigfaissJNI.HammingComputerM4_set(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(a4), code_size);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int hamming(SWIGTYPE_p_unsigned_char b8) {
|
||||||
|
return swigfaissJNI.HammingComputerM4_hamming(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(b8));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,72 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class HammingComputerM8 {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
protected transient boolean swigCMemOwn;
|
||||||
|
|
||||||
|
protected HammingComputerM8(long cPtr, boolean cMemoryOwn) {
|
||||||
|
swigCMemOwn = cMemoryOwn;
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(HammingComputerM8 obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_HammingComputerM8(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setA(SWIGTYPE_p_unsigned_long value) {
|
||||||
|
swigfaissJNI.HammingComputerM8_a_set(swigCPtr, this, SWIGTYPE_p_unsigned_long.getCPtr(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
public SWIGTYPE_p_unsigned_long getA() {
|
||||||
|
long cPtr = swigfaissJNI.HammingComputerM8_a_get(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_long(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setN(int value) {
|
||||||
|
swigfaissJNI.HammingComputerM8_n_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getN() {
|
||||||
|
return swigfaissJNI.HammingComputerM8_n_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public HammingComputerM8() {
|
||||||
|
this(swigfaissJNI.new_HammingComputerM8__SWIG_0(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public HammingComputerM8(SWIGTYPE_p_unsigned_char a8, int code_size) {
|
||||||
|
this(swigfaissJNI.new_HammingComputerM8__SWIG_1(SWIGTYPE_p_unsigned_char.getCPtr(a8), code_size), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void set(SWIGTYPE_p_unsigned_char a8, int code_size) {
|
||||||
|
swigfaissJNI.HammingComputerM8_set(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(a8), code_size);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int hamming(SWIGTYPE_p_unsigned_char b8) {
|
||||||
|
return swigfaissJNI.HammingComputerM8_hamming(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(b8));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
43
ann/src/main/java/com/twitter/ann/faiss/swig/IDSelector.java
Normal file
43
ann/src/main/java/com/twitter/ann/faiss/swig/IDSelector.java
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class IDSelector {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
protected transient boolean swigCMemOwn;
|
||||||
|
|
||||||
|
protected IDSelector(long cPtr, boolean cMemoryOwn) {
|
||||||
|
swigCMemOwn = cMemoryOwn;
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(IDSelector obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_IDSelector(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean is_member(long id) {
|
||||||
|
return swigfaissJNI.IDSelector_is_member(swigCPtr, this, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,63 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class IDSelectorArray extends IDSelector {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
|
||||||
|
protected IDSelectorArray(long cPtr, boolean cMemoryOwn) {
|
||||||
|
super(swigfaissJNI.IDSelectorArray_SWIGUpcast(cPtr), cMemoryOwn);
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(IDSelectorArray obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_IDSelectorArray(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
super.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setN(long value) {
|
||||||
|
swigfaissJNI.IDSelectorArray_n_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getN() {
|
||||||
|
return swigfaissJNI.IDSelectorArray_n_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIds(LongVector value) {
|
||||||
|
swigfaissJNI.IDSelectorArray_ids_set(swigCPtr, this, SWIGTYPE_p_long_long.getCPtr(value.data()), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public LongVector getIds() {
|
||||||
|
return new LongVector(swigfaissJNI.IDSelectorArray_ids_get(swigCPtr, this), false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IDSelectorArray(long n, LongVector ids) {
|
||||||
|
this(swigfaissJNI.new_IDSelectorArray(n, SWIGTYPE_p_long_long.getCPtr(ids.data()), ids), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean is_member(long id) {
|
||||||
|
return swigfaissJNI.IDSelectorArray_is_member(swigCPtr, this, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,63 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class IDSelectorBatch extends IDSelector {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
|
||||||
|
protected IDSelectorBatch(long cPtr, boolean cMemoryOwn) {
|
||||||
|
super(swigfaissJNI.IDSelectorBatch_SWIGUpcast(cPtr), cMemoryOwn);
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(IDSelectorBatch obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_IDSelectorBatch(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
super.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNbits(int value) {
|
||||||
|
swigfaissJNI.IDSelectorBatch_nbits_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getNbits() {
|
||||||
|
return swigfaissJNI.IDSelectorBatch_nbits_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMask(long value) {
|
||||||
|
swigfaissJNI.IDSelectorBatch_mask_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getMask() {
|
||||||
|
return swigfaissJNI.IDSelectorBatch_mask_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IDSelectorBatch(long n, LongVector indices) {
|
||||||
|
this(swigfaissJNI.new_IDSelectorBatch(n, SWIGTYPE_p_long_long.getCPtr(indices.data()), indices), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean is_member(long id) {
|
||||||
|
return swigfaissJNI.IDSelectorBatch_is_member(swigCPtr, this, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,63 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class IDSelectorRange extends IDSelector {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
|
||||||
|
protected IDSelectorRange(long cPtr, boolean cMemoryOwn) {
|
||||||
|
super(swigfaissJNI.IDSelectorRange_SWIGUpcast(cPtr), cMemoryOwn);
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(IDSelectorRange obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_IDSelectorRange(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
super.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setImin(long value) {
|
||||||
|
swigfaissJNI.IDSelectorRange_imin_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getImin() {
|
||||||
|
return swigfaissJNI.IDSelectorRange_imin_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setImax(long value) {
|
||||||
|
swigfaissJNI.IDSelectorRange_imax_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getImax() {
|
||||||
|
return swigfaissJNI.IDSelectorRange_imax_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IDSelectorRange(long imin, long imax) {
|
||||||
|
this(swigfaissJNI.new_IDSelectorRange(imin, imax), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean is_member(long id) {
|
||||||
|
return swigfaissJNI.IDSelectorRange_is_member(swigCPtr, this, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
76
ann/src/main/java/com/twitter/ann/faiss/swig/ITQMatrix.java
Normal file
76
ann/src/main/java/com/twitter/ann/faiss/swig/ITQMatrix.java
Normal file
|
@ -0,0 +1,76 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class ITQMatrix extends LinearTransform {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
|
||||||
|
protected ITQMatrix(long cPtr, boolean cMemoryOwn) {
|
||||||
|
super(swigfaissJNI.ITQMatrix_SWIGUpcast(cPtr), cMemoryOwn);
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(ITQMatrix obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_ITQMatrix(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
super.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMax_iter(int value) {
|
||||||
|
swigfaissJNI.ITQMatrix_max_iter_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMax_iter() {
|
||||||
|
return swigfaissJNI.ITQMatrix_max_iter_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSeed(int value) {
|
||||||
|
swigfaissJNI.ITQMatrix_seed_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getSeed() {
|
||||||
|
return swigfaissJNI.ITQMatrix_seed_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setInit_rotation(DoubleVector value) {
|
||||||
|
swigfaissJNI.ITQMatrix_init_rotation_set(swigCPtr, this, DoubleVector.getCPtr(value), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public DoubleVector getInit_rotation() {
|
||||||
|
long cPtr = swigfaissJNI.ITQMatrix_init_rotation_get(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new DoubleVector(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ITQMatrix(int d) {
|
||||||
|
this(swigfaissJNI.new_ITQMatrix__SWIG_0(d), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ITQMatrix() {
|
||||||
|
this(swigfaissJNI.new_ITQMatrix__SWIG_1(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void train(long n, SWIGTYPE_p_float x) {
|
||||||
|
swigfaissJNI.ITQMatrix_train(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
106
ann/src/main/java/com/twitter/ann/faiss/swig/ITQTransform.java
Normal file
106
ann/src/main/java/com/twitter/ann/faiss/swig/ITQTransform.java
Normal file
|
@ -0,0 +1,106 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class ITQTransform extends VectorTransform {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
|
||||||
|
protected ITQTransform(long cPtr, boolean cMemoryOwn) {
|
||||||
|
super(swigfaissJNI.ITQTransform_SWIGUpcast(cPtr), cMemoryOwn);
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(ITQTransform obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_ITQTransform(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
super.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMean(FloatVector value) {
|
||||||
|
swigfaissJNI.ITQTransform_mean_set(swigCPtr, this, FloatVector.getCPtr(value), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public FloatVector getMean() {
|
||||||
|
long cPtr = swigfaissJNI.ITQTransform_mean_get(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new FloatVector(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDo_pca(boolean value) {
|
||||||
|
swigfaissJNI.ITQTransform_do_pca_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getDo_pca() {
|
||||||
|
return swigfaissJNI.ITQTransform_do_pca_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setItq(ITQMatrix value) {
|
||||||
|
swigfaissJNI.ITQTransform_itq_set(swigCPtr, this, ITQMatrix.getCPtr(value), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ITQMatrix getItq() {
|
||||||
|
long cPtr = swigfaissJNI.ITQTransform_itq_get(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new ITQMatrix(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMax_train_per_dim(int value) {
|
||||||
|
swigfaissJNI.ITQTransform_max_train_per_dim_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMax_train_per_dim() {
|
||||||
|
return swigfaissJNI.ITQTransform_max_train_per_dim_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPca_then_itq(LinearTransform value) {
|
||||||
|
swigfaissJNI.ITQTransform_pca_then_itq_set(swigCPtr, this, LinearTransform.getCPtr(value), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public LinearTransform getPca_then_itq() {
|
||||||
|
long cPtr = swigfaissJNI.ITQTransform_pca_then_itq_get(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new LinearTransform(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ITQTransform(int d_in, int d_out, boolean do_pca) {
|
||||||
|
this(swigfaissJNI.new_ITQTransform__SWIG_0(d_in, d_out, do_pca), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ITQTransform(int d_in, int d_out) {
|
||||||
|
this(swigfaissJNI.new_ITQTransform__SWIG_1(d_in, d_out), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ITQTransform(int d_in) {
|
||||||
|
this(swigfaissJNI.new_ITQTransform__SWIG_2(d_in), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ITQTransform() {
|
||||||
|
this(swigfaissJNI.new_ITQTransform__SWIG_3(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void train(long n, SWIGTYPE_p_float x) {
|
||||||
|
swigfaissJNI.ITQTransform_train(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void apply_noalloc(long n, SWIGTYPE_p_float x, SWIGTYPE_p_float xt) {
|
||||||
|
swigfaissJNI.ITQTransform_apply_noalloc(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_float.getCPtr(xt));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,59 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class IVFPQSearchParameters extends IVFSearchParameters {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
|
||||||
|
protected IVFPQSearchParameters(long cPtr, boolean cMemoryOwn) {
|
||||||
|
super(swigfaissJNI.IVFPQSearchParameters_SWIGUpcast(cPtr), cMemoryOwn);
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(IVFPQSearchParameters obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_IVFPQSearchParameters(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
super.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setScan_table_threshold(long value) {
|
||||||
|
swigfaissJNI.IVFPQSearchParameters_scan_table_threshold_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getScan_table_threshold() {
|
||||||
|
return swigfaissJNI.IVFPQSearchParameters_scan_table_threshold_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPolysemous_ht(int value) {
|
||||||
|
swigfaissJNI.IVFPQSearchParameters_polysemous_ht_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPolysemous_ht() {
|
||||||
|
return swigfaissJNI.IVFPQSearchParameters_polysemous_ht_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IVFPQSearchParameters() {
|
||||||
|
this(swigfaissJNI.new_IVFPQSearchParameters(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,59 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class IVFSearchParameters {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
protected transient boolean swigCMemOwn;
|
||||||
|
|
||||||
|
protected IVFSearchParameters(long cPtr, boolean cMemoryOwn) {
|
||||||
|
swigCMemOwn = cMemoryOwn;
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(IVFSearchParameters obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_IVFSearchParameters(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNprobe(long value) {
|
||||||
|
swigfaissJNI.IVFSearchParameters_nprobe_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getNprobe() {
|
||||||
|
return swigfaissJNI.IVFSearchParameters_nprobe_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMax_codes(long value) {
|
||||||
|
swigfaissJNI.IVFSearchParameters_max_codes_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getMax_codes() {
|
||||||
|
return swigfaissJNI.IVFSearchParameters_max_codes_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IVFSearchParameters() {
|
||||||
|
this(swigfaissJNI.new_IVFSearchParameters(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
165
ann/src/main/java/com/twitter/ann/faiss/swig/Index.java
Normal file
165
ann/src/main/java/com/twitter/ann/faiss/swig/Index.java
Normal file
|
@ -0,0 +1,165 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class Index {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
protected transient boolean swigCMemOwn;
|
||||||
|
|
||||||
|
protected Index(long cPtr, boolean cMemoryOwn) {
|
||||||
|
swigCMemOwn = cMemoryOwn;
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(Index obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_Index(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setD(int value) {
|
||||||
|
swigfaissJNI.Index_d_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getD() {
|
||||||
|
return swigfaissJNI.Index_d_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNtotal(long value) {
|
||||||
|
swigfaissJNI.Index_ntotal_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getNtotal() {
|
||||||
|
return swigfaissJNI.Index_ntotal_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVerbose(boolean value) {
|
||||||
|
swigfaissJNI.Index_verbose_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getVerbose() {
|
||||||
|
return swigfaissJNI.Index_verbose_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIs_trained(boolean value) {
|
||||||
|
swigfaissJNI.Index_is_trained_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getIs_trained() {
|
||||||
|
return swigfaissJNI.Index_is_trained_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMetric_type(MetricType value) {
|
||||||
|
swigfaissJNI.Index_metric_type_set(swigCPtr, this, value.swigValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
public MetricType getMetric_type() {
|
||||||
|
return MetricType.swigToEnum(swigfaissJNI.Index_metric_type_get(swigCPtr, this));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMetric_arg(float value) {
|
||||||
|
swigfaissJNI.Index_metric_arg_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getMetric_arg() {
|
||||||
|
return swigfaissJNI.Index_metric_arg_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void train(long n, SWIGTYPE_p_float x) {
|
||||||
|
swigfaissJNI.Index_train(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void add(long n, SWIGTYPE_p_float x) {
|
||||||
|
swigfaissJNI.Index_add(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void add_with_ids(long n, SWIGTYPE_p_float x, LongVector xids) {
|
||||||
|
swigfaissJNI.Index_add_with_ids(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_long_long.getCPtr(xids.data()), xids);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void search(long n, SWIGTYPE_p_float x, long k, SWIGTYPE_p_float distances, LongVector labels) {
|
||||||
|
swigfaissJNI.Index_search(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), k, SWIGTYPE_p_float.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void range_search(long n, SWIGTYPE_p_float x, float radius, RangeSearchResult result) {
|
||||||
|
swigfaissJNI.Index_range_search(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), radius, RangeSearchResult.getCPtr(result), result);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void assign(long n, SWIGTYPE_p_float x, LongVector labels, long k) {
|
||||||
|
swigfaissJNI.Index_assign__SWIG_0(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels, k);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void assign(long n, SWIGTYPE_p_float x, LongVector labels) {
|
||||||
|
swigfaissJNI.Index_assign__SWIG_1(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reset() {
|
||||||
|
swigfaissJNI.Index_reset(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long remove_ids(IDSelector sel) {
|
||||||
|
return swigfaissJNI.Index_remove_ids(swigCPtr, this, IDSelector.getCPtr(sel), sel);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reconstruct(long key, SWIGTYPE_p_float recons) {
|
||||||
|
swigfaissJNI.Index_reconstruct(swigCPtr, this, key, SWIGTYPE_p_float.getCPtr(recons));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reconstruct_n(long i0, long ni, SWIGTYPE_p_float recons) {
|
||||||
|
swigfaissJNI.Index_reconstruct_n(swigCPtr, this, i0, ni, SWIGTYPE_p_float.getCPtr(recons));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void search_and_reconstruct(long n, SWIGTYPE_p_float x, long k, SWIGTYPE_p_float distances, LongVector labels, SWIGTYPE_p_float recons) {
|
||||||
|
swigfaissJNI.Index_search_and_reconstruct(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), k, SWIGTYPE_p_float.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels, SWIGTYPE_p_float.getCPtr(recons));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void compute_residual(SWIGTYPE_p_float x, SWIGTYPE_p_float residual, long key) {
|
||||||
|
swigfaissJNI.Index_compute_residual(swigCPtr, this, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_float.getCPtr(residual), key);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void compute_residual_n(long n, SWIGTYPE_p_float xs, SWIGTYPE_p_float residuals, LongVector keys) {
|
||||||
|
swigfaissJNI.Index_compute_residual_n(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(xs), SWIGTYPE_p_float.getCPtr(residuals), SWIGTYPE_p_long_long.getCPtr(keys.data()), keys);
|
||||||
|
}
|
||||||
|
|
||||||
|
public DistanceComputer get_distance_computer() {
|
||||||
|
long cPtr = swigfaissJNI.Index_get_distance_computer(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new DistanceComputer(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long sa_code_size() {
|
||||||
|
return swigfaissJNI.Index_sa_code_size(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sa_encode(long n, SWIGTYPE_p_float x, SWIGTYPE_p_unsigned_char bytes) {
|
||||||
|
swigfaissJNI.Index_sa_encode(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_unsigned_char.getCPtr(bytes));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sa_decode(long n, SWIGTYPE_p_unsigned_char bytes, SWIGTYPE_p_float x) {
|
||||||
|
swigfaissJNI.Index_sa_decode(swigCPtr, this, n, SWIGTYPE_p_unsigned_char.getCPtr(bytes), SWIGTYPE_p_float.getCPtr(x));
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexIVF toIVF() {
|
||||||
|
long cPtr = swigfaissJNI.Index_toIVF(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new IndexIVF(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
114
ann/src/main/java/com/twitter/ann/faiss/swig/Index2Layer.java
Normal file
114
ann/src/main/java/com/twitter/ann/faiss/swig/Index2Layer.java
Normal file
|
@ -0,0 +1,114 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class Index2Layer extends IndexFlatCodes {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
|
||||||
|
protected Index2Layer(long cPtr, boolean cMemoryOwn) {
|
||||||
|
super(swigfaissJNI.Index2Layer_SWIGUpcast(cPtr), cMemoryOwn);
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(Index2Layer obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_Index2Layer(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
super.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQ1(Level1Quantizer value) {
|
||||||
|
swigfaissJNI.Index2Layer_q1_set(swigCPtr, this, Level1Quantizer.getCPtr(value), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Level1Quantizer getQ1() {
|
||||||
|
long cPtr = swigfaissJNI.Index2Layer_q1_get(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new Level1Quantizer(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPq(ProductQuantizer value) {
|
||||||
|
swigfaissJNI.Index2Layer_pq_set(swigCPtr, this, ProductQuantizer.getCPtr(value), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProductQuantizer getPq() {
|
||||||
|
long cPtr = swigfaissJNI.Index2Layer_pq_get(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new ProductQuantizer(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCode_size_1(long value) {
|
||||||
|
swigfaissJNI.Index2Layer_code_size_1_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getCode_size_1() {
|
||||||
|
return swigfaissJNI.Index2Layer_code_size_1_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCode_size_2(long value) {
|
||||||
|
swigfaissJNI.Index2Layer_code_size_2_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getCode_size_2() {
|
||||||
|
return swigfaissJNI.Index2Layer_code_size_2_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Index2Layer(Index quantizer, long nlist, int M, int nbit, MetricType metric) {
|
||||||
|
this(swigfaissJNI.new_Index2Layer__SWIG_0(Index.getCPtr(quantizer), quantizer, nlist, M, nbit, metric.swigValue()), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Index2Layer(Index quantizer, long nlist, int M, int nbit) {
|
||||||
|
this(swigfaissJNI.new_Index2Layer__SWIG_1(Index.getCPtr(quantizer), quantizer, nlist, M, nbit), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Index2Layer(Index quantizer, long nlist, int M) {
|
||||||
|
this(swigfaissJNI.new_Index2Layer__SWIG_2(Index.getCPtr(quantizer), quantizer, nlist, M), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Index2Layer() {
|
||||||
|
this(swigfaissJNI.new_Index2Layer__SWIG_3(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void train(long n, SWIGTYPE_p_float x) {
|
||||||
|
swigfaissJNI.Index2Layer_train(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void search(long n, SWIGTYPE_p_float x, long k, SWIGTYPE_p_float distances, LongVector labels) {
|
||||||
|
swigfaissJNI.Index2Layer_search(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), k, SWIGTYPE_p_float.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels);
|
||||||
|
}
|
||||||
|
|
||||||
|
public DistanceComputer get_distance_computer() {
|
||||||
|
long cPtr = swigfaissJNI.Index2Layer_get_distance_computer(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new DistanceComputer(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void transfer_to_IVFPQ(IndexIVFPQ other) {
|
||||||
|
swigfaissJNI.Index2Layer_transfer_to_IVFPQ(swigCPtr, this, IndexIVFPQ.getCPtr(other), other);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sa_encode(long n, SWIGTYPE_p_float x, SWIGTYPE_p_unsigned_char bytes) {
|
||||||
|
swigfaissJNI.Index2Layer_sa_encode(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_unsigned_char.getCPtr(bytes));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sa_decode(long n, SWIGTYPE_p_unsigned_char bytes, SWIGTYPE_p_float x) {
|
||||||
|
swigfaissJNI.Index2Layer_sa_decode(swigCPtr, this, n, SWIGTYPE_p_unsigned_char.getCPtr(bytes), SWIGTYPE_p_float.getCPtr(x));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
139
ann/src/main/java/com/twitter/ann/faiss/swig/IndexBinary.java
Normal file
139
ann/src/main/java/com/twitter/ann/faiss/swig/IndexBinary.java
Normal file
|
@ -0,0 +1,139 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class IndexBinary {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
protected transient boolean swigCMemOwn;
|
||||||
|
|
||||||
|
protected IndexBinary(long cPtr, boolean cMemoryOwn) {
|
||||||
|
swigCMemOwn = cMemoryOwn;
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(IndexBinary obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_IndexBinary(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setD(int value) {
|
||||||
|
swigfaissJNI.IndexBinary_d_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getD() {
|
||||||
|
return swigfaissJNI.IndexBinary_d_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCode_size(int value) {
|
||||||
|
swigfaissJNI.IndexBinary_code_size_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCode_size() {
|
||||||
|
return swigfaissJNI.IndexBinary_code_size_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNtotal(long value) {
|
||||||
|
swigfaissJNI.IndexBinary_ntotal_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getNtotal() {
|
||||||
|
return swigfaissJNI.IndexBinary_ntotal_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVerbose(boolean value) {
|
||||||
|
swigfaissJNI.IndexBinary_verbose_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getVerbose() {
|
||||||
|
return swigfaissJNI.IndexBinary_verbose_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIs_trained(boolean value) {
|
||||||
|
swigfaissJNI.IndexBinary_is_trained_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getIs_trained() {
|
||||||
|
return swigfaissJNI.IndexBinary_is_trained_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMetric_type(MetricType value) {
|
||||||
|
swigfaissJNI.IndexBinary_metric_type_set(swigCPtr, this, value.swigValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
public MetricType getMetric_type() {
|
||||||
|
return MetricType.swigToEnum(swigfaissJNI.IndexBinary_metric_type_get(swigCPtr, this));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void train(long n, SWIGTYPE_p_unsigned_char x) {
|
||||||
|
swigfaissJNI.IndexBinary_train(swigCPtr, this, n, SWIGTYPE_p_unsigned_char.getCPtr(x));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void add(long n, SWIGTYPE_p_unsigned_char x) {
|
||||||
|
swigfaissJNI.IndexBinary_add(swigCPtr, this, n, SWIGTYPE_p_unsigned_char.getCPtr(x));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void add_with_ids(long n, SWIGTYPE_p_unsigned_char x, LongVector xids) {
|
||||||
|
swigfaissJNI.IndexBinary_add_with_ids(swigCPtr, this, n, SWIGTYPE_p_unsigned_char.getCPtr(x), SWIGTYPE_p_long_long.getCPtr(xids.data()), xids);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void search(long n, SWIGTYPE_p_unsigned_char x, long k, SWIGTYPE_p_int distances, LongVector labels) {
|
||||||
|
swigfaissJNI.IndexBinary_search(swigCPtr, this, n, SWIGTYPE_p_unsigned_char.getCPtr(x), k, SWIGTYPE_p_int.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void range_search(long n, SWIGTYPE_p_unsigned_char x, int radius, RangeSearchResult result) {
|
||||||
|
swigfaissJNI.IndexBinary_range_search(swigCPtr, this, n, SWIGTYPE_p_unsigned_char.getCPtr(x), radius, RangeSearchResult.getCPtr(result), result);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void assign(long n, SWIGTYPE_p_unsigned_char x, LongVector labels, long k) {
|
||||||
|
swigfaissJNI.IndexBinary_assign__SWIG_0(swigCPtr, this, n, SWIGTYPE_p_unsigned_char.getCPtr(x), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels, k);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void assign(long n, SWIGTYPE_p_unsigned_char x, LongVector labels) {
|
||||||
|
swigfaissJNI.IndexBinary_assign__SWIG_1(swigCPtr, this, n, SWIGTYPE_p_unsigned_char.getCPtr(x), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reset() {
|
||||||
|
swigfaissJNI.IndexBinary_reset(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long remove_ids(IDSelector sel) {
|
||||||
|
return swigfaissJNI.IndexBinary_remove_ids(swigCPtr, this, IDSelector.getCPtr(sel), sel);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reconstruct(long key, SWIGTYPE_p_unsigned_char recons) {
|
||||||
|
swigfaissJNI.IndexBinary_reconstruct(swigCPtr, this, key, SWIGTYPE_p_unsigned_char.getCPtr(recons));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reconstruct_n(long i0, long ni, SWIGTYPE_p_unsigned_char recons) {
|
||||||
|
swigfaissJNI.IndexBinary_reconstruct_n(swigCPtr, this, i0, ni, SWIGTYPE_p_unsigned_char.getCPtr(recons));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void search_and_reconstruct(long n, SWIGTYPE_p_unsigned_char x, long k, SWIGTYPE_p_int distances, LongVector labels, SWIGTYPE_p_unsigned_char recons) {
|
||||||
|
swigfaissJNI.IndexBinary_search_and_reconstruct(swigCPtr, this, n, SWIGTYPE_p_unsigned_char.getCPtr(x), k, SWIGTYPE_p_int.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels, SWIGTYPE_p_unsigned_char.getCPtr(recons));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void display() {
|
||||||
|
swigfaissJNI.IndexBinary_display(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,96 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class IndexBinaryFlat extends IndexBinary {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
|
||||||
|
protected IndexBinaryFlat(long cPtr, boolean cMemoryOwn) {
|
||||||
|
super(swigfaissJNI.IndexBinaryFlat_SWIGUpcast(cPtr), cMemoryOwn);
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(IndexBinaryFlat obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_IndexBinaryFlat(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
super.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setXb(ByteVector value) {
|
||||||
|
swigfaissJNI.IndexBinaryFlat_xb_set(swigCPtr, this, ByteVector.getCPtr(value), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ByteVector getXb() {
|
||||||
|
long cPtr = swigfaissJNI.IndexBinaryFlat_xb_get(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new ByteVector(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUse_heap(boolean value) {
|
||||||
|
swigfaissJNI.IndexBinaryFlat_use_heap_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getUse_heap() {
|
||||||
|
return swigfaissJNI.IndexBinaryFlat_use_heap_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQuery_batch_size(long value) {
|
||||||
|
swigfaissJNI.IndexBinaryFlat_query_batch_size_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getQuery_batch_size() {
|
||||||
|
return swigfaissJNI.IndexBinaryFlat_query_batch_size_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexBinaryFlat(long d) {
|
||||||
|
this(swigfaissJNI.new_IndexBinaryFlat__SWIG_0(d), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void add(long n, SWIGTYPE_p_unsigned_char x) {
|
||||||
|
swigfaissJNI.IndexBinaryFlat_add(swigCPtr, this, n, SWIGTYPE_p_unsigned_char.getCPtr(x));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reset() {
|
||||||
|
swigfaissJNI.IndexBinaryFlat_reset(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void search(long n, SWIGTYPE_p_unsigned_char x, long k, SWIGTYPE_p_int distances, LongVector labels) {
|
||||||
|
swigfaissJNI.IndexBinaryFlat_search(swigCPtr, this, n, SWIGTYPE_p_unsigned_char.getCPtr(x), k, SWIGTYPE_p_int.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void range_search(long n, SWIGTYPE_p_unsigned_char x, int radius, RangeSearchResult result) {
|
||||||
|
swigfaissJNI.IndexBinaryFlat_range_search(swigCPtr, this, n, SWIGTYPE_p_unsigned_char.getCPtr(x), radius, RangeSearchResult.getCPtr(result), result);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reconstruct(long key, SWIGTYPE_p_unsigned_char recons) {
|
||||||
|
swigfaissJNI.IndexBinaryFlat_reconstruct(swigCPtr, this, key, SWIGTYPE_p_unsigned_char.getCPtr(recons));
|
||||||
|
}
|
||||||
|
|
||||||
|
public long remove_ids(IDSelector sel) {
|
||||||
|
return swigfaissJNI.IndexBinaryFlat_remove_ids(swigCPtr, this, IDSelector.getCPtr(sel), sel);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexBinaryFlat() {
|
||||||
|
this(swigfaissJNI.new_IndexBinaryFlat__SWIG_1(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,80 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class IndexBinaryFromFloat extends IndexBinary {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
|
||||||
|
protected IndexBinaryFromFloat(long cPtr, boolean cMemoryOwn) {
|
||||||
|
super(swigfaissJNI.IndexBinaryFromFloat_SWIGUpcast(cPtr), cMemoryOwn);
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(IndexBinaryFromFloat obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_IndexBinaryFromFloat(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
super.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIndex(Index value) {
|
||||||
|
swigfaissJNI.IndexBinaryFromFloat_index_set(swigCPtr, this, Index.getCPtr(value), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Index getIndex() {
|
||||||
|
long cPtr = swigfaissJNI.IndexBinaryFromFloat_index_get(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new Index(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOwn_fields(boolean value) {
|
||||||
|
swigfaissJNI.IndexBinaryFromFloat_own_fields_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getOwn_fields() {
|
||||||
|
return swigfaissJNI.IndexBinaryFromFloat_own_fields_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexBinaryFromFloat() {
|
||||||
|
this(swigfaissJNI.new_IndexBinaryFromFloat__SWIG_0(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexBinaryFromFloat(Index index) {
|
||||||
|
this(swigfaissJNI.new_IndexBinaryFromFloat__SWIG_1(Index.getCPtr(index), index), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void add(long n, SWIGTYPE_p_unsigned_char x) {
|
||||||
|
swigfaissJNI.IndexBinaryFromFloat_add(swigCPtr, this, n, SWIGTYPE_p_unsigned_char.getCPtr(x));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reset() {
|
||||||
|
swigfaissJNI.IndexBinaryFromFloat_reset(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void search(long n, SWIGTYPE_p_unsigned_char x, long k, SWIGTYPE_p_int distances, LongVector labels) {
|
||||||
|
swigfaissJNI.IndexBinaryFromFloat_search(swigCPtr, this, n, SWIGTYPE_p_unsigned_char.getCPtr(x), k, SWIGTYPE_p_int.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void train(long n, SWIGTYPE_p_unsigned_char x) {
|
||||||
|
swigfaissJNI.IndexBinaryFromFloat_train(swigCPtr, this, n, SWIGTYPE_p_unsigned_char.getCPtr(x));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,110 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class IndexBinaryHNSW extends IndexBinary {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
|
||||||
|
protected IndexBinaryHNSW(long cPtr, boolean cMemoryOwn) {
|
||||||
|
super(swigfaissJNI.IndexBinaryHNSW_SWIGUpcast(cPtr), cMemoryOwn);
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(IndexBinaryHNSW obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_IndexBinaryHNSW(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
super.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHnsw(HNSW value) {
|
||||||
|
swigfaissJNI.IndexBinaryHNSW_hnsw_set(swigCPtr, this, HNSW.getCPtr(value), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public HNSW getHnsw() {
|
||||||
|
long cPtr = swigfaissJNI.IndexBinaryHNSW_hnsw_get(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new HNSW(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOwn_fields(boolean value) {
|
||||||
|
swigfaissJNI.IndexBinaryHNSW_own_fields_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getOwn_fields() {
|
||||||
|
return swigfaissJNI.IndexBinaryHNSW_own_fields_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStorage(IndexBinary value) {
|
||||||
|
swigfaissJNI.IndexBinaryHNSW_storage_set(swigCPtr, this, IndexBinary.getCPtr(value), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexBinary getStorage() {
|
||||||
|
long cPtr = swigfaissJNI.IndexBinaryHNSW_storage_get(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new IndexBinary(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexBinaryHNSW() {
|
||||||
|
this(swigfaissJNI.new_IndexBinaryHNSW__SWIG_0(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexBinaryHNSW(int d, int M) {
|
||||||
|
this(swigfaissJNI.new_IndexBinaryHNSW__SWIG_1(d, M), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexBinaryHNSW(int d) {
|
||||||
|
this(swigfaissJNI.new_IndexBinaryHNSW__SWIG_2(d), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexBinaryHNSW(IndexBinary storage, int M) {
|
||||||
|
this(swigfaissJNI.new_IndexBinaryHNSW__SWIG_3(IndexBinary.getCPtr(storage), storage, M), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexBinaryHNSW(IndexBinary storage) {
|
||||||
|
this(swigfaissJNI.new_IndexBinaryHNSW__SWIG_4(IndexBinary.getCPtr(storage), storage), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public DistanceComputer get_distance_computer() {
|
||||||
|
long cPtr = swigfaissJNI.IndexBinaryHNSW_get_distance_computer(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new DistanceComputer(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void add(long n, SWIGTYPE_p_unsigned_char x) {
|
||||||
|
swigfaissJNI.IndexBinaryHNSW_add(swigCPtr, this, n, SWIGTYPE_p_unsigned_char.getCPtr(x));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void train(long n, SWIGTYPE_p_unsigned_char x) {
|
||||||
|
swigfaissJNI.IndexBinaryHNSW_train(swigCPtr, this, n, SWIGTYPE_p_unsigned_char.getCPtr(x));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void search(long n, SWIGTYPE_p_unsigned_char x, long k, SWIGTYPE_p_int distances, LongVector labels) {
|
||||||
|
swigfaissJNI.IndexBinaryHNSW_search(swigCPtr, this, n, SWIGTYPE_p_unsigned_char.getCPtr(x), k, SWIGTYPE_p_int.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reconstruct(long key, SWIGTYPE_p_unsigned_char recons) {
|
||||||
|
swigfaissJNI.IndexBinaryHNSW_reconstruct(swigCPtr, this, key, SWIGTYPE_p_unsigned_char.getCPtr(recons));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reset() {
|
||||||
|
swigfaissJNI.IndexBinaryHNSW_reset(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
237
ann/src/main/java/com/twitter/ann/faiss/swig/IndexBinaryIVF.java
Normal file
237
ann/src/main/java/com/twitter/ann/faiss/swig/IndexBinaryIVF.java
Normal file
|
@ -0,0 +1,237 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class IndexBinaryIVF extends IndexBinary {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
|
||||||
|
protected IndexBinaryIVF(long cPtr, boolean cMemoryOwn) {
|
||||||
|
super(swigfaissJNI.IndexBinaryIVF_SWIGUpcast(cPtr), cMemoryOwn);
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(IndexBinaryIVF obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_IndexBinaryIVF(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
super.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setInvlists(InvertedLists value) {
|
||||||
|
swigfaissJNI.IndexBinaryIVF_invlists_set(swigCPtr, this, InvertedLists.getCPtr(value), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public InvertedLists getInvlists() {
|
||||||
|
long cPtr = swigfaissJNI.IndexBinaryIVF_invlists_get(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new InvertedLists(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOwn_invlists(boolean value) {
|
||||||
|
swigfaissJNI.IndexBinaryIVF_own_invlists_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getOwn_invlists() {
|
||||||
|
return swigfaissJNI.IndexBinaryIVF_own_invlists_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNprobe(long value) {
|
||||||
|
swigfaissJNI.IndexBinaryIVF_nprobe_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getNprobe() {
|
||||||
|
return swigfaissJNI.IndexBinaryIVF_nprobe_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMax_codes(long value) {
|
||||||
|
swigfaissJNI.IndexBinaryIVF_max_codes_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getMax_codes() {
|
||||||
|
return swigfaissJNI.IndexBinaryIVF_max_codes_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUse_heap(boolean value) {
|
||||||
|
swigfaissJNI.IndexBinaryIVF_use_heap_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getUse_heap() {
|
||||||
|
return swigfaissJNI.IndexBinaryIVF_use_heap_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDirect_map(SWIGTYPE_p_DirectMap value) {
|
||||||
|
swigfaissJNI.IndexBinaryIVF_direct_map_set(swigCPtr, this, SWIGTYPE_p_DirectMap.getCPtr(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
public SWIGTYPE_p_DirectMap getDirect_map() {
|
||||||
|
return new SWIGTYPE_p_DirectMap(swigfaissJNI.IndexBinaryIVF_direct_map_get(swigCPtr, this), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQuantizer(IndexBinary value) {
|
||||||
|
swigfaissJNI.IndexBinaryIVF_quantizer_set(swigCPtr, this, IndexBinary.getCPtr(value), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexBinary getQuantizer() {
|
||||||
|
long cPtr = swigfaissJNI.IndexBinaryIVF_quantizer_get(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new IndexBinary(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNlist(long value) {
|
||||||
|
swigfaissJNI.IndexBinaryIVF_nlist_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getNlist() {
|
||||||
|
return swigfaissJNI.IndexBinaryIVF_nlist_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOwn_fields(boolean value) {
|
||||||
|
swigfaissJNI.IndexBinaryIVF_own_fields_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getOwn_fields() {
|
||||||
|
return swigfaissJNI.IndexBinaryIVF_own_fields_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCp(ClusteringParameters value) {
|
||||||
|
swigfaissJNI.IndexBinaryIVF_cp_set(swigCPtr, this, ClusteringParameters.getCPtr(value), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ClusteringParameters getCp() {
|
||||||
|
long cPtr = swigfaissJNI.IndexBinaryIVF_cp_get(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new ClusteringParameters(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setClustering_index(Index value) {
|
||||||
|
swigfaissJNI.IndexBinaryIVF_clustering_index_set(swigCPtr, this, Index.getCPtr(value), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Index getClustering_index() {
|
||||||
|
long cPtr = swigfaissJNI.IndexBinaryIVF_clustering_index_get(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new Index(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexBinaryIVF(IndexBinary quantizer, long d, long nlist) {
|
||||||
|
this(swigfaissJNI.new_IndexBinaryIVF__SWIG_0(IndexBinary.getCPtr(quantizer), quantizer, d, nlist), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexBinaryIVF() {
|
||||||
|
this(swigfaissJNI.new_IndexBinaryIVF__SWIG_1(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reset() {
|
||||||
|
swigfaissJNI.IndexBinaryIVF_reset(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void train(long n, SWIGTYPE_p_unsigned_char x) {
|
||||||
|
swigfaissJNI.IndexBinaryIVF_train(swigCPtr, this, n, SWIGTYPE_p_unsigned_char.getCPtr(x));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void add(long n, SWIGTYPE_p_unsigned_char x) {
|
||||||
|
swigfaissJNI.IndexBinaryIVF_add(swigCPtr, this, n, SWIGTYPE_p_unsigned_char.getCPtr(x));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void add_with_ids(long n, SWIGTYPE_p_unsigned_char x, LongVector xids) {
|
||||||
|
swigfaissJNI.IndexBinaryIVF_add_with_ids(swigCPtr, this, n, SWIGTYPE_p_unsigned_char.getCPtr(x), SWIGTYPE_p_long_long.getCPtr(xids.data()), xids);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void add_core(long n, SWIGTYPE_p_unsigned_char x, LongVector xids, LongVector precomputed_idx) {
|
||||||
|
swigfaissJNI.IndexBinaryIVF_add_core(swigCPtr, this, n, SWIGTYPE_p_unsigned_char.getCPtr(x), SWIGTYPE_p_long_long.getCPtr(xids.data()), xids, SWIGTYPE_p_long_long.getCPtr(precomputed_idx.data()), precomputed_idx);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void search_preassigned(long n, SWIGTYPE_p_unsigned_char x, long k, LongVector assign, SWIGTYPE_p_int centroid_dis, SWIGTYPE_p_int distances, LongVector labels, boolean store_pairs, IVFSearchParameters params) {
|
||||||
|
swigfaissJNI.IndexBinaryIVF_search_preassigned__SWIG_0(swigCPtr, this, n, SWIGTYPE_p_unsigned_char.getCPtr(x), k, SWIGTYPE_p_long_long.getCPtr(assign.data()), assign, SWIGTYPE_p_int.getCPtr(centroid_dis), SWIGTYPE_p_int.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels, store_pairs, IVFSearchParameters.getCPtr(params), params);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void search_preassigned(long n, SWIGTYPE_p_unsigned_char x, long k, LongVector assign, SWIGTYPE_p_int centroid_dis, SWIGTYPE_p_int distances, LongVector labels, boolean store_pairs) {
|
||||||
|
swigfaissJNI.IndexBinaryIVF_search_preassigned__SWIG_1(swigCPtr, this, n, SWIGTYPE_p_unsigned_char.getCPtr(x), k, SWIGTYPE_p_long_long.getCPtr(assign.data()), assign, SWIGTYPE_p_int.getCPtr(centroid_dis), SWIGTYPE_p_int.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels, store_pairs);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SWIGTYPE_p_faiss__BinaryInvertedListScanner get_InvertedListScanner(boolean store_pairs) {
|
||||||
|
long cPtr = swigfaissJNI.IndexBinaryIVF_get_InvertedListScanner__SWIG_0(swigCPtr, this, store_pairs);
|
||||||
|
return (cPtr == 0) ? null : new SWIGTYPE_p_faiss__BinaryInvertedListScanner(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SWIGTYPE_p_faiss__BinaryInvertedListScanner get_InvertedListScanner() {
|
||||||
|
long cPtr = swigfaissJNI.IndexBinaryIVF_get_InvertedListScanner__SWIG_1(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new SWIGTYPE_p_faiss__BinaryInvertedListScanner(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void search(long n, SWIGTYPE_p_unsigned_char x, long k, SWIGTYPE_p_int distances, LongVector labels) {
|
||||||
|
swigfaissJNI.IndexBinaryIVF_search(swigCPtr, this, n, SWIGTYPE_p_unsigned_char.getCPtr(x), k, SWIGTYPE_p_int.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void range_search(long n, SWIGTYPE_p_unsigned_char x, int radius, RangeSearchResult result) {
|
||||||
|
swigfaissJNI.IndexBinaryIVF_range_search(swigCPtr, this, n, SWIGTYPE_p_unsigned_char.getCPtr(x), radius, RangeSearchResult.getCPtr(result), result);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void range_search_preassigned(long n, SWIGTYPE_p_unsigned_char x, int radius, LongVector assign, SWIGTYPE_p_int centroid_dis, RangeSearchResult result) {
|
||||||
|
swigfaissJNI.IndexBinaryIVF_range_search_preassigned(swigCPtr, this, n, SWIGTYPE_p_unsigned_char.getCPtr(x), radius, SWIGTYPE_p_long_long.getCPtr(assign.data()), assign, SWIGTYPE_p_int.getCPtr(centroid_dis), RangeSearchResult.getCPtr(result), result);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reconstruct(long key, SWIGTYPE_p_unsigned_char recons) {
|
||||||
|
swigfaissJNI.IndexBinaryIVF_reconstruct(swigCPtr, this, key, SWIGTYPE_p_unsigned_char.getCPtr(recons));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reconstruct_n(long i0, long ni, SWIGTYPE_p_unsigned_char recons) {
|
||||||
|
swigfaissJNI.IndexBinaryIVF_reconstruct_n(swigCPtr, this, i0, ni, SWIGTYPE_p_unsigned_char.getCPtr(recons));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void search_and_reconstruct(long n, SWIGTYPE_p_unsigned_char x, long k, SWIGTYPE_p_int distances, LongVector labels, SWIGTYPE_p_unsigned_char recons) {
|
||||||
|
swigfaissJNI.IndexBinaryIVF_search_and_reconstruct(swigCPtr, this, n, SWIGTYPE_p_unsigned_char.getCPtr(x), k, SWIGTYPE_p_int.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels, SWIGTYPE_p_unsigned_char.getCPtr(recons));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reconstruct_from_offset(long list_no, long offset, SWIGTYPE_p_unsigned_char recons) {
|
||||||
|
swigfaissJNI.IndexBinaryIVF_reconstruct_from_offset(swigCPtr, this, list_no, offset, SWIGTYPE_p_unsigned_char.getCPtr(recons));
|
||||||
|
}
|
||||||
|
|
||||||
|
public long remove_ids(IDSelector sel) {
|
||||||
|
return swigfaissJNI.IndexBinaryIVF_remove_ids(swigCPtr, this, IDSelector.getCPtr(sel), sel);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void merge_from(IndexBinaryIVF other, long add_id) {
|
||||||
|
swigfaissJNI.IndexBinaryIVF_merge_from(swigCPtr, this, IndexBinaryIVF.getCPtr(other), other, add_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long get_list_size(long list_no) {
|
||||||
|
return swigfaissJNI.IndexBinaryIVF_get_list_size(swigCPtr, this, list_no);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void make_direct_map(boolean new_maintain_direct_map) {
|
||||||
|
swigfaissJNI.IndexBinaryIVF_make_direct_map__SWIG_0(swigCPtr, this, new_maintain_direct_map);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void make_direct_map() {
|
||||||
|
swigfaissJNI.IndexBinaryIVF_make_direct_map__SWIG_1(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void set_direct_map_type(SWIGTYPE_p_DirectMap__Type type) {
|
||||||
|
swigfaissJNI.IndexBinaryIVF_set_direct_map_type(swigCPtr, this, SWIGTYPE_p_DirectMap__Type.getCPtr(type));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void replace_invlists(InvertedLists il, boolean own) {
|
||||||
|
swigfaissJNI.IndexBinaryIVF_replace_invlists__SWIG_0(swigCPtr, this, InvertedLists.getCPtr(il), il, own);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void replace_invlists(InvertedLists il) {
|
||||||
|
swigfaissJNI.IndexBinaryIVF_replace_invlists__SWIG_1(swigCPtr, this, InvertedLists.getCPtr(il), il);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
85
ann/src/main/java/com/twitter/ann/faiss/swig/IndexFlat.java
Normal file
85
ann/src/main/java/com/twitter/ann/faiss/swig/IndexFlat.java
Normal file
|
@ -0,0 +1,85 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class IndexFlat extends IndexFlatCodes {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
|
||||||
|
protected IndexFlat(long cPtr, boolean cMemoryOwn) {
|
||||||
|
super(swigfaissJNI.IndexFlat_SWIGUpcast(cPtr), cMemoryOwn);
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(IndexFlat obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_IndexFlat(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
super.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexFlat(long d, MetricType metric) {
|
||||||
|
this(swigfaissJNI.new_IndexFlat__SWIG_0(d, metric.swigValue()), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexFlat(long d) {
|
||||||
|
this(swigfaissJNI.new_IndexFlat__SWIG_1(d), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void search(long n, SWIGTYPE_p_float x, long k, SWIGTYPE_p_float distances, LongVector labels) {
|
||||||
|
swigfaissJNI.IndexFlat_search(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), k, SWIGTYPE_p_float.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void range_search(long n, SWIGTYPE_p_float x, float radius, RangeSearchResult result) {
|
||||||
|
swigfaissJNI.IndexFlat_range_search(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), radius, RangeSearchResult.getCPtr(result), result);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reconstruct(long key, SWIGTYPE_p_float recons) {
|
||||||
|
swigfaissJNI.IndexFlat_reconstruct(swigCPtr, this, key, SWIGTYPE_p_float.getCPtr(recons));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void compute_distance_subset(long n, SWIGTYPE_p_float x, long k, SWIGTYPE_p_float distances, LongVector labels) {
|
||||||
|
swigfaissJNI.IndexFlat_compute_distance_subset(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), k, SWIGTYPE_p_float.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SWIGTYPE_p_float get_xb() {
|
||||||
|
long cPtr = swigfaissJNI.IndexFlat_get_xb__SWIG_0(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new SWIGTYPE_p_float(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexFlat() {
|
||||||
|
this(swigfaissJNI.new_IndexFlat__SWIG_2(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public DistanceComputer get_distance_computer() {
|
||||||
|
long cPtr = swigfaissJNI.IndexFlat_get_distance_computer(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new DistanceComputer(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sa_encode(long n, SWIGTYPE_p_float x, SWIGTYPE_p_unsigned_char bytes) {
|
||||||
|
swigfaissJNI.IndexFlat_sa_encode(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_unsigned_char.getCPtr(bytes));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sa_decode(long n, SWIGTYPE_p_unsigned_char bytes, SWIGTYPE_p_float x) {
|
||||||
|
swigfaissJNI.IndexFlat_sa_decode(swigCPtr, this, n, SWIGTYPE_p_unsigned_char.getCPtr(bytes), SWIGTYPE_p_float.getCPtr(x));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,80 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class IndexFlat1D extends IndexFlatL2 {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
|
||||||
|
protected IndexFlat1D(long cPtr, boolean cMemoryOwn) {
|
||||||
|
super(swigfaissJNI.IndexFlat1D_SWIGUpcast(cPtr), cMemoryOwn);
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(IndexFlat1D obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_IndexFlat1D(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
super.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setContinuous_update(boolean value) {
|
||||||
|
swigfaissJNI.IndexFlat1D_continuous_update_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getContinuous_update() {
|
||||||
|
return swigfaissJNI.IndexFlat1D_continuous_update_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPerm(SWIGTYPE_p_std__vectorT_int64_t_t value) {
|
||||||
|
swigfaissJNI.IndexFlat1D_perm_set(swigCPtr, this, SWIGTYPE_p_std__vectorT_int64_t_t.getCPtr(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
public SWIGTYPE_p_std__vectorT_int64_t_t getPerm() {
|
||||||
|
long cPtr = swigfaissJNI.IndexFlat1D_perm_get(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new SWIGTYPE_p_std__vectorT_int64_t_t(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexFlat1D(boolean continuous_update) {
|
||||||
|
this(swigfaissJNI.new_IndexFlat1D__SWIG_0(continuous_update), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexFlat1D() {
|
||||||
|
this(swigfaissJNI.new_IndexFlat1D__SWIG_1(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void update_permutation() {
|
||||||
|
swigfaissJNI.IndexFlat1D_update_permutation(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void add(long n, SWIGTYPE_p_float x) {
|
||||||
|
swigfaissJNI.IndexFlat1D_add(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reset() {
|
||||||
|
swigfaissJNI.IndexFlat1D_reset(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void search(long n, SWIGTYPE_p_float x, long k, SWIGTYPE_p_float distances, LongVector labels) {
|
||||||
|
swigfaissJNI.IndexFlat1D_search(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), k, SWIGTYPE_p_float.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,80 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class IndexFlatCodes extends Index {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
|
||||||
|
protected IndexFlatCodes(long cPtr, boolean cMemoryOwn) {
|
||||||
|
super(swigfaissJNI.IndexFlatCodes_SWIGUpcast(cPtr), cMemoryOwn);
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(IndexFlatCodes obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_IndexFlatCodes(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
super.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCode_size(long value) {
|
||||||
|
swigfaissJNI.IndexFlatCodes_code_size_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getCode_size() {
|
||||||
|
return swigfaissJNI.IndexFlatCodes_code_size_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCodes(ByteVector value) {
|
||||||
|
swigfaissJNI.IndexFlatCodes_codes_set(swigCPtr, this, ByteVector.getCPtr(value), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ByteVector getCodes() {
|
||||||
|
long cPtr = swigfaissJNI.IndexFlatCodes_codes_get(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new ByteVector(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void add(long n, SWIGTYPE_p_float x) {
|
||||||
|
swigfaissJNI.IndexFlatCodes_add(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reset() {
|
||||||
|
swigfaissJNI.IndexFlatCodes_reset(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reconstruct_n(long i0, long ni, SWIGTYPE_p_float recons) {
|
||||||
|
swigfaissJNI.IndexFlatCodes_reconstruct_n(swigCPtr, this, i0, ni, SWIGTYPE_p_float.getCPtr(recons));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reconstruct(long key, SWIGTYPE_p_float recons) {
|
||||||
|
swigfaissJNI.IndexFlatCodes_reconstruct(swigCPtr, this, key, SWIGTYPE_p_float.getCPtr(recons));
|
||||||
|
}
|
||||||
|
|
||||||
|
public long sa_code_size() {
|
||||||
|
return swigfaissJNI.IndexFlatCodes_sa_code_size(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long remove_ids(IDSelector sel) {
|
||||||
|
return swigfaissJNI.IndexFlatCodes_remove_ids(swigCPtr, this, IDSelector.getCPtr(sel), sel);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,47 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class IndexFlatIP extends IndexFlat {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
|
||||||
|
protected IndexFlatIP(long cPtr, boolean cMemoryOwn) {
|
||||||
|
super(swigfaissJNI.IndexFlatIP_SWIGUpcast(cPtr), cMemoryOwn);
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(IndexFlatIP obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_IndexFlatIP(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
super.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexFlatIP(long d) {
|
||||||
|
this(swigfaissJNI.new_IndexFlatIP__SWIG_0(d), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexFlatIP() {
|
||||||
|
this(swigfaissJNI.new_IndexFlatIP__SWIG_1(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,47 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class IndexFlatL2 extends IndexFlat {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
|
||||||
|
protected IndexFlatL2(long cPtr, boolean cMemoryOwn) {
|
||||||
|
super(swigfaissJNI.IndexFlatL2_SWIGUpcast(cPtr), cMemoryOwn);
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(IndexFlatL2 obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_IndexFlatL2(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
super.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexFlatL2(long d) {
|
||||||
|
this(swigfaissJNI.new_IndexFlatL2__SWIG_0(d), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexFlatL2() {
|
||||||
|
this(swigfaissJNI.new_IndexFlatL2__SWIG_1(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
150
ann/src/main/java/com/twitter/ann/faiss/swig/IndexHNSW.java
Normal file
150
ann/src/main/java/com/twitter/ann/faiss/swig/IndexHNSW.java
Normal file
|
@ -0,0 +1,150 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class IndexHNSW extends Index {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
|
||||||
|
protected IndexHNSW(long cPtr, boolean cMemoryOwn) {
|
||||||
|
super(swigfaissJNI.IndexHNSW_SWIGUpcast(cPtr), cMemoryOwn);
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(IndexHNSW obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_IndexHNSW(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
super.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHnsw(HNSW value) {
|
||||||
|
swigfaissJNI.IndexHNSW_hnsw_set(swigCPtr, this, HNSW.getCPtr(value), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public HNSW getHnsw() {
|
||||||
|
long cPtr = swigfaissJNI.IndexHNSW_hnsw_get(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new HNSW(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOwn_fields(boolean value) {
|
||||||
|
swigfaissJNI.IndexHNSW_own_fields_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getOwn_fields() {
|
||||||
|
return swigfaissJNI.IndexHNSW_own_fields_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStorage(Index value) {
|
||||||
|
swigfaissJNI.IndexHNSW_storage_set(swigCPtr, this, Index.getCPtr(value), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Index getStorage() {
|
||||||
|
long cPtr = swigfaissJNI.IndexHNSW_storage_get(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new Index(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReconstruct_from_neighbors(ReconstructFromNeighbors value) {
|
||||||
|
swigfaissJNI.IndexHNSW_reconstruct_from_neighbors_set(swigCPtr, this, ReconstructFromNeighbors.getCPtr(value), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ReconstructFromNeighbors getReconstruct_from_neighbors() {
|
||||||
|
long cPtr = swigfaissJNI.IndexHNSW_reconstruct_from_neighbors_get(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new ReconstructFromNeighbors(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexHNSW(int d, int M, MetricType metric) {
|
||||||
|
this(swigfaissJNI.new_IndexHNSW__SWIG_0(d, M, metric.swigValue()), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexHNSW(int d, int M) {
|
||||||
|
this(swigfaissJNI.new_IndexHNSW__SWIG_1(d, M), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexHNSW(int d) {
|
||||||
|
this(swigfaissJNI.new_IndexHNSW__SWIG_2(d), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexHNSW() {
|
||||||
|
this(swigfaissJNI.new_IndexHNSW__SWIG_3(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexHNSW(Index storage, int M) {
|
||||||
|
this(swigfaissJNI.new_IndexHNSW__SWIG_4(Index.getCPtr(storage), storage, M), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexHNSW(Index storage) {
|
||||||
|
this(swigfaissJNI.new_IndexHNSW__SWIG_5(Index.getCPtr(storage), storage), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void add(long n, SWIGTYPE_p_float x) {
|
||||||
|
swigfaissJNI.IndexHNSW_add(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void train(long n, SWIGTYPE_p_float x) {
|
||||||
|
swigfaissJNI.IndexHNSW_train(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void search(long n, SWIGTYPE_p_float x, long k, SWIGTYPE_p_float distances, LongVector labels) {
|
||||||
|
swigfaissJNI.IndexHNSW_search(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), k, SWIGTYPE_p_float.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reconstruct(long key, SWIGTYPE_p_float recons) {
|
||||||
|
swigfaissJNI.IndexHNSW_reconstruct(swigCPtr, this, key, SWIGTYPE_p_float.getCPtr(recons));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reset() {
|
||||||
|
swigfaissJNI.IndexHNSW_reset(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void shrink_level_0_neighbors(int size) {
|
||||||
|
swigfaissJNI.IndexHNSW_shrink_level_0_neighbors(swigCPtr, this, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void search_level_0(long n, SWIGTYPE_p_float x, long k, SWIGTYPE_p_int nearest, SWIGTYPE_p_float nearest_d, SWIGTYPE_p_float distances, LongVector labels, int nprobe, int search_type) {
|
||||||
|
swigfaissJNI.IndexHNSW_search_level_0__SWIG_0(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), k, SWIGTYPE_p_int.getCPtr(nearest), SWIGTYPE_p_float.getCPtr(nearest_d), SWIGTYPE_p_float.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels, nprobe, search_type);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void search_level_0(long n, SWIGTYPE_p_float x, long k, SWIGTYPE_p_int nearest, SWIGTYPE_p_float nearest_d, SWIGTYPE_p_float distances, LongVector labels, int nprobe) {
|
||||||
|
swigfaissJNI.IndexHNSW_search_level_0__SWIG_1(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), k, SWIGTYPE_p_int.getCPtr(nearest), SWIGTYPE_p_float.getCPtr(nearest_d), SWIGTYPE_p_float.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels, nprobe);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void search_level_0(long n, SWIGTYPE_p_float x, long k, SWIGTYPE_p_int nearest, SWIGTYPE_p_float nearest_d, SWIGTYPE_p_float distances, LongVector labels) {
|
||||||
|
swigfaissJNI.IndexHNSW_search_level_0__SWIG_2(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), k, SWIGTYPE_p_int.getCPtr(nearest), SWIGTYPE_p_float.getCPtr(nearest_d), SWIGTYPE_p_float.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void init_level_0_from_knngraph(int k, SWIGTYPE_p_float D, LongVector I) {
|
||||||
|
swigfaissJNI.IndexHNSW_init_level_0_from_knngraph(swigCPtr, this, k, SWIGTYPE_p_float.getCPtr(D), SWIGTYPE_p_long_long.getCPtr(I.data()), I);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void init_level_0_from_entry_points(int npt, SWIGTYPE_p_int points, SWIGTYPE_p_int nearests) {
|
||||||
|
swigfaissJNI.IndexHNSW_init_level_0_from_entry_points(swigCPtr, this, npt, SWIGTYPE_p_int.getCPtr(points), SWIGTYPE_p_int.getCPtr(nearests));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reorder_links() {
|
||||||
|
swigfaissJNI.IndexHNSW_reorder_links(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void link_singletons() {
|
||||||
|
swigfaissJNI.IndexHNSW_link_singletons(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,55 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class IndexHNSW2Level extends IndexHNSW {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
|
||||||
|
protected IndexHNSW2Level(long cPtr, boolean cMemoryOwn) {
|
||||||
|
super(swigfaissJNI.IndexHNSW2Level_SWIGUpcast(cPtr), cMemoryOwn);
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(IndexHNSW2Level obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_IndexHNSW2Level(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
super.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexHNSW2Level() {
|
||||||
|
this(swigfaissJNI.new_IndexHNSW2Level__SWIG_0(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexHNSW2Level(Index quantizer, long nlist, int m_pq, int M) {
|
||||||
|
this(swigfaissJNI.new_IndexHNSW2Level__SWIG_1(Index.getCPtr(quantizer), quantizer, nlist, m_pq, M), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void flip_to_ivf() {
|
||||||
|
swigfaissJNI.IndexHNSW2Level_flip_to_ivf(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void search(long n, SWIGTYPE_p_float x, long k, SWIGTYPE_p_float distances, LongVector labels) {
|
||||||
|
swigfaissJNI.IndexHNSW2Level_search(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), k, SWIGTYPE_p_float.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,51 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class IndexHNSWFlat extends IndexHNSW {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
|
||||||
|
protected IndexHNSWFlat(long cPtr, boolean cMemoryOwn) {
|
||||||
|
super(swigfaissJNI.IndexHNSWFlat_SWIGUpcast(cPtr), cMemoryOwn);
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(IndexHNSWFlat obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_IndexHNSWFlat(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
super.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexHNSWFlat() {
|
||||||
|
this(swigfaissJNI.new_IndexHNSWFlat__SWIG_0(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexHNSWFlat(int d, int M, MetricType metric) {
|
||||||
|
this(swigfaissJNI.new_IndexHNSWFlat__SWIG_1(d, M, metric.swigValue()), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexHNSWFlat(int d, int M) {
|
||||||
|
this(swigfaissJNI.new_IndexHNSWFlat__SWIG_2(d, M), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,51 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class IndexHNSWPQ extends IndexHNSW {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
|
||||||
|
protected IndexHNSWPQ(long cPtr, boolean cMemoryOwn) {
|
||||||
|
super(swigfaissJNI.IndexHNSWPQ_SWIGUpcast(cPtr), cMemoryOwn);
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(IndexHNSWPQ obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_IndexHNSWPQ(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
super.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexHNSWPQ() {
|
||||||
|
this(swigfaissJNI.new_IndexHNSWPQ__SWIG_0(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexHNSWPQ(int d, int pq_m, int M) {
|
||||||
|
this(swigfaissJNI.new_IndexHNSWPQ__SWIG_1(d, pq_m, M), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void train(long n, SWIGTYPE_p_float x) {
|
||||||
|
swigfaissJNI.IndexHNSWPQ_train(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,51 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class IndexHNSWSQ extends IndexHNSW {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
|
||||||
|
protected IndexHNSWSQ(long cPtr, boolean cMemoryOwn) {
|
||||||
|
super(swigfaissJNI.IndexHNSWSQ_SWIGUpcast(cPtr), cMemoryOwn);
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(IndexHNSWSQ obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_IndexHNSWSQ(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
super.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexHNSWSQ() {
|
||||||
|
this(swigfaissJNI.new_IndexHNSWSQ__SWIG_0(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexHNSWSQ(int d, SWIGTYPE_p_ScalarQuantizer__QuantizerType qtype, int M, MetricType metric) {
|
||||||
|
this(swigfaissJNI.new_IndexHNSWSQ__SWIG_1(d, SWIGTYPE_p_ScalarQuantizer__QuantizerType.getCPtr(qtype), M, metric.swigValue()), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexHNSWSQ(int d, SWIGTYPE_p_ScalarQuantizer__QuantizerType qtype, int M) {
|
||||||
|
this(swigfaissJNI.new_IndexHNSWSQ__SWIG_2(d, SWIGTYPE_p_ScalarQuantizer__QuantizerType.getCPtr(qtype), M), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
101
ann/src/main/java/com/twitter/ann/faiss/swig/IndexIDMap.java
Normal file
101
ann/src/main/java/com/twitter/ann/faiss/swig/IndexIDMap.java
Normal file
|
@ -0,0 +1,101 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class IndexIDMap extends Index {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
|
||||||
|
protected IndexIDMap(long cPtr, boolean cMemoryOwn) {
|
||||||
|
super(swigfaissJNI.IndexIDMap_SWIGUpcast(cPtr), cMemoryOwn);
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(IndexIDMap obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_IndexIDMap(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
super.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIndex(Index value) {
|
||||||
|
swigfaissJNI.IndexIDMap_index_set(swigCPtr, this, Index.getCPtr(value), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Index getIndex() {
|
||||||
|
long cPtr = swigfaissJNI.IndexIDMap_index_get(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new Index(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOwn_fields(boolean value) {
|
||||||
|
swigfaissJNI.IndexIDMap_own_fields_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getOwn_fields() {
|
||||||
|
return swigfaissJNI.IndexIDMap_own_fields_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId_map(SWIGTYPE_p_std__vectorT_int64_t_t value) {
|
||||||
|
swigfaissJNI.IndexIDMap_id_map_set(swigCPtr, this, SWIGTYPE_p_std__vectorT_int64_t_t.getCPtr(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
public SWIGTYPE_p_std__vectorT_int64_t_t getId_map() {
|
||||||
|
long cPtr = swigfaissJNI.IndexIDMap_id_map_get(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new SWIGTYPE_p_std__vectorT_int64_t_t(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexIDMap(Index index) {
|
||||||
|
this(swigfaissJNI.new_IndexIDMap__SWIG_0(Index.getCPtr(index), index), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void add_with_ids(long n, SWIGTYPE_p_float x, LongVector xids) {
|
||||||
|
swigfaissJNI.IndexIDMap_add_with_ids(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_long_long.getCPtr(xids.data()), xids);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void add(long n, SWIGTYPE_p_float x) {
|
||||||
|
swigfaissJNI.IndexIDMap_add(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void search(long n, SWIGTYPE_p_float x, long k, SWIGTYPE_p_float distances, LongVector labels) {
|
||||||
|
swigfaissJNI.IndexIDMap_search(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), k, SWIGTYPE_p_float.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void train(long n, SWIGTYPE_p_float x) {
|
||||||
|
swigfaissJNI.IndexIDMap_train(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reset() {
|
||||||
|
swigfaissJNI.IndexIDMap_reset(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long remove_ids(IDSelector sel) {
|
||||||
|
return swigfaissJNI.IndexIDMap_remove_ids(swigCPtr, this, IDSelector.getCPtr(sel), sel);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void range_search(long n, SWIGTYPE_p_float x, float radius, RangeSearchResult result) {
|
||||||
|
swigfaissJNI.IndexIDMap_range_search(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), radius, RangeSearchResult.getCPtr(result), result);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexIDMap() {
|
||||||
|
this(swigfaissJNI.new_IndexIDMap__SWIG_1(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
250
ann/src/main/java/com/twitter/ann/faiss/swig/IndexIVF.java
Normal file
250
ann/src/main/java/com/twitter/ann/faiss/swig/IndexIVF.java
Normal file
|
@ -0,0 +1,250 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class IndexIVF extends Index {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
|
||||||
|
protected IndexIVF(long cPtr, boolean cMemoryOwn) {
|
||||||
|
super(swigfaissJNI.IndexIVF_SWIGUpcast(cPtr), cMemoryOwn);
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(IndexIVF obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_IndexIVF(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
super.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setInvlists(InvertedLists value) {
|
||||||
|
swigfaissJNI.IndexIVF_invlists_set(swigCPtr, this, InvertedLists.getCPtr(value), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public InvertedLists getInvlists() {
|
||||||
|
long cPtr = swigfaissJNI.IndexIVF_invlists_get(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new InvertedLists(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOwn_invlists(boolean value) {
|
||||||
|
swigfaissJNI.IndexIVF_own_invlists_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getOwn_invlists() {
|
||||||
|
return swigfaissJNI.IndexIVF_own_invlists_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCode_size(long value) {
|
||||||
|
swigfaissJNI.IndexIVF_code_size_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getCode_size() {
|
||||||
|
return swigfaissJNI.IndexIVF_code_size_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNprobe(long value) {
|
||||||
|
swigfaissJNI.IndexIVF_nprobe_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getNprobe() {
|
||||||
|
return swigfaissJNI.IndexIVF_nprobe_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMax_codes(long value) {
|
||||||
|
swigfaissJNI.IndexIVF_max_codes_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getMax_codes() {
|
||||||
|
return swigfaissJNI.IndexIVF_max_codes_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setParallel_mode(int value) {
|
||||||
|
swigfaissJNI.IndexIVF_parallel_mode_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getParallel_mode() {
|
||||||
|
return swigfaissJNI.IndexIVF_parallel_mode_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPARALLEL_MODE_NO_HEAP_INIT() {
|
||||||
|
return swigfaissJNI.IndexIVF_PARALLEL_MODE_NO_HEAP_INIT_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDirect_map(SWIGTYPE_p_DirectMap value) {
|
||||||
|
swigfaissJNI.IndexIVF_direct_map_set(swigCPtr, this, SWIGTYPE_p_DirectMap.getCPtr(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
public SWIGTYPE_p_DirectMap getDirect_map() {
|
||||||
|
return new SWIGTYPE_p_DirectMap(swigfaissJNI.IndexIVF_direct_map_get(swigCPtr, this), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reset() {
|
||||||
|
swigfaissJNI.IndexIVF_reset(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void train(long n, SWIGTYPE_p_float x) {
|
||||||
|
swigfaissJNI.IndexIVF_train(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void add(long n, SWIGTYPE_p_float x) {
|
||||||
|
swigfaissJNI.IndexIVF_add(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void add_with_ids(long n, SWIGTYPE_p_float x, LongVector xids) {
|
||||||
|
swigfaissJNI.IndexIVF_add_with_ids(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_long_long.getCPtr(xids.data()), xids);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void add_core(long n, SWIGTYPE_p_float x, LongVector xids, LongVector precomputed_idx) {
|
||||||
|
swigfaissJNI.IndexIVF_add_core(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_long_long.getCPtr(xids.data()), xids, SWIGTYPE_p_long_long.getCPtr(precomputed_idx.data()), precomputed_idx);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void encode_vectors(long n, SWIGTYPE_p_float x, LongVector list_nos, SWIGTYPE_p_unsigned_char codes, boolean include_listno) {
|
||||||
|
swigfaissJNI.IndexIVF_encode_vectors__SWIG_0(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_long_long.getCPtr(list_nos.data()), list_nos, SWIGTYPE_p_unsigned_char.getCPtr(codes), include_listno);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void encode_vectors(long n, SWIGTYPE_p_float x, LongVector list_nos, SWIGTYPE_p_unsigned_char codes) {
|
||||||
|
swigfaissJNI.IndexIVF_encode_vectors__SWIG_1(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_long_long.getCPtr(list_nos.data()), list_nos, SWIGTYPE_p_unsigned_char.getCPtr(codes));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void add_sa_codes(long n, SWIGTYPE_p_unsigned_char codes, LongVector xids) {
|
||||||
|
swigfaissJNI.IndexIVF_add_sa_codes(swigCPtr, this, n, SWIGTYPE_p_unsigned_char.getCPtr(codes), SWIGTYPE_p_long_long.getCPtr(xids.data()), xids);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void train_residual(long n, SWIGTYPE_p_float x) {
|
||||||
|
swigfaissJNI.IndexIVF_train_residual(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void search_preassigned(long n, SWIGTYPE_p_float x, long k, LongVector assign, SWIGTYPE_p_float centroid_dis, SWIGTYPE_p_float distances, LongVector labels, boolean store_pairs, IVFSearchParameters params, IndexIVFStats stats) {
|
||||||
|
swigfaissJNI.IndexIVF_search_preassigned__SWIG_0(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), k, SWIGTYPE_p_long_long.getCPtr(assign.data()), assign, SWIGTYPE_p_float.getCPtr(centroid_dis), SWIGTYPE_p_float.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels, store_pairs, IVFSearchParameters.getCPtr(params), params, IndexIVFStats.getCPtr(stats), stats);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void search_preassigned(long n, SWIGTYPE_p_float x, long k, LongVector assign, SWIGTYPE_p_float centroid_dis, SWIGTYPE_p_float distances, LongVector labels, boolean store_pairs, IVFSearchParameters params) {
|
||||||
|
swigfaissJNI.IndexIVF_search_preassigned__SWIG_1(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), k, SWIGTYPE_p_long_long.getCPtr(assign.data()), assign, SWIGTYPE_p_float.getCPtr(centroid_dis), SWIGTYPE_p_float.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels, store_pairs, IVFSearchParameters.getCPtr(params), params);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void search_preassigned(long n, SWIGTYPE_p_float x, long k, LongVector assign, SWIGTYPE_p_float centroid_dis, SWIGTYPE_p_float distances, LongVector labels, boolean store_pairs) {
|
||||||
|
swigfaissJNI.IndexIVF_search_preassigned__SWIG_2(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), k, SWIGTYPE_p_long_long.getCPtr(assign.data()), assign, SWIGTYPE_p_float.getCPtr(centroid_dis), SWIGTYPE_p_float.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels, store_pairs);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void search(long n, SWIGTYPE_p_float x, long k, SWIGTYPE_p_float distances, LongVector labels) {
|
||||||
|
swigfaissJNI.IndexIVF_search(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), k, SWIGTYPE_p_float.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void range_search(long n, SWIGTYPE_p_float x, float radius, RangeSearchResult result) {
|
||||||
|
swigfaissJNI.IndexIVF_range_search(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), radius, RangeSearchResult.getCPtr(result), result);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void range_search_preassigned(long nx, SWIGTYPE_p_float x, float radius, LongVector keys, SWIGTYPE_p_float coarse_dis, RangeSearchResult result, boolean store_pairs, IVFSearchParameters params, IndexIVFStats stats) {
|
||||||
|
swigfaissJNI.IndexIVF_range_search_preassigned__SWIG_0(swigCPtr, this, nx, SWIGTYPE_p_float.getCPtr(x), radius, SWIGTYPE_p_long_long.getCPtr(keys.data()), keys, SWIGTYPE_p_float.getCPtr(coarse_dis), RangeSearchResult.getCPtr(result), result, store_pairs, IVFSearchParameters.getCPtr(params), params, IndexIVFStats.getCPtr(stats), stats);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void range_search_preassigned(long nx, SWIGTYPE_p_float x, float radius, LongVector keys, SWIGTYPE_p_float coarse_dis, RangeSearchResult result, boolean store_pairs, IVFSearchParameters params) {
|
||||||
|
swigfaissJNI.IndexIVF_range_search_preassigned__SWIG_1(swigCPtr, this, nx, SWIGTYPE_p_float.getCPtr(x), radius, SWIGTYPE_p_long_long.getCPtr(keys.data()), keys, SWIGTYPE_p_float.getCPtr(coarse_dis), RangeSearchResult.getCPtr(result), result, store_pairs, IVFSearchParameters.getCPtr(params), params);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void range_search_preassigned(long nx, SWIGTYPE_p_float x, float radius, LongVector keys, SWIGTYPE_p_float coarse_dis, RangeSearchResult result, boolean store_pairs) {
|
||||||
|
swigfaissJNI.IndexIVF_range_search_preassigned__SWIG_2(swigCPtr, this, nx, SWIGTYPE_p_float.getCPtr(x), radius, SWIGTYPE_p_long_long.getCPtr(keys.data()), keys, SWIGTYPE_p_float.getCPtr(coarse_dis), RangeSearchResult.getCPtr(result), result, store_pairs);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void range_search_preassigned(long nx, SWIGTYPE_p_float x, float radius, LongVector keys, SWIGTYPE_p_float coarse_dis, RangeSearchResult result) {
|
||||||
|
swigfaissJNI.IndexIVF_range_search_preassigned__SWIG_3(swigCPtr, this, nx, SWIGTYPE_p_float.getCPtr(x), radius, SWIGTYPE_p_long_long.getCPtr(keys.data()), keys, SWIGTYPE_p_float.getCPtr(coarse_dis), RangeSearchResult.getCPtr(result), result);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SWIGTYPE_p_faiss__InvertedListScanner get_InvertedListScanner(boolean store_pairs) {
|
||||||
|
long cPtr = swigfaissJNI.IndexIVF_get_InvertedListScanner__SWIG_0(swigCPtr, this, store_pairs);
|
||||||
|
return (cPtr == 0) ? null : new SWIGTYPE_p_faiss__InvertedListScanner(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SWIGTYPE_p_faiss__InvertedListScanner get_InvertedListScanner() {
|
||||||
|
long cPtr = swigfaissJNI.IndexIVF_get_InvertedListScanner__SWIG_1(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new SWIGTYPE_p_faiss__InvertedListScanner(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reconstruct(long key, SWIGTYPE_p_float recons) {
|
||||||
|
swigfaissJNI.IndexIVF_reconstruct(swigCPtr, this, key, SWIGTYPE_p_float.getCPtr(recons));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void update_vectors(int nv, LongVector idx, SWIGTYPE_p_float v) {
|
||||||
|
swigfaissJNI.IndexIVF_update_vectors(swigCPtr, this, nv, SWIGTYPE_p_long_long.getCPtr(idx.data()), idx, SWIGTYPE_p_float.getCPtr(v));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reconstruct_n(long i0, long ni, SWIGTYPE_p_float recons) {
|
||||||
|
swigfaissJNI.IndexIVF_reconstruct_n(swigCPtr, this, i0, ni, SWIGTYPE_p_float.getCPtr(recons));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void search_and_reconstruct(long n, SWIGTYPE_p_float x, long k, SWIGTYPE_p_float distances, LongVector labels, SWIGTYPE_p_float recons) {
|
||||||
|
swigfaissJNI.IndexIVF_search_and_reconstruct(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), k, SWIGTYPE_p_float.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels, SWIGTYPE_p_float.getCPtr(recons));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reconstruct_from_offset(long list_no, long offset, SWIGTYPE_p_float recons) {
|
||||||
|
swigfaissJNI.IndexIVF_reconstruct_from_offset(swigCPtr, this, list_no, offset, SWIGTYPE_p_float.getCPtr(recons));
|
||||||
|
}
|
||||||
|
|
||||||
|
public long remove_ids(IDSelector sel) {
|
||||||
|
return swigfaissJNI.IndexIVF_remove_ids(swigCPtr, this, IDSelector.getCPtr(sel), sel);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void check_compatible_for_merge(IndexIVF other) {
|
||||||
|
swigfaissJNI.IndexIVF_check_compatible_for_merge(swigCPtr, this, IndexIVF.getCPtr(other), other);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void merge_from(IndexIVF other, long add_id) {
|
||||||
|
swigfaissJNI.IndexIVF_merge_from(swigCPtr, this, IndexIVF.getCPtr(other), other, add_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void copy_subset_to(IndexIVF other, int subset_type, long a1, long a2) {
|
||||||
|
swigfaissJNI.IndexIVF_copy_subset_to(swigCPtr, this, IndexIVF.getCPtr(other), other, subset_type, a1, a2);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long get_list_size(long list_no) {
|
||||||
|
return swigfaissJNI.IndexIVF_get_list_size(swigCPtr, this, list_no);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void make_direct_map(boolean new_maintain_direct_map) {
|
||||||
|
swigfaissJNI.IndexIVF_make_direct_map__SWIG_0(swigCPtr, this, new_maintain_direct_map);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void make_direct_map() {
|
||||||
|
swigfaissJNI.IndexIVF_make_direct_map__SWIG_1(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void set_direct_map_type(SWIGTYPE_p_DirectMap__Type type) {
|
||||||
|
swigfaissJNI.IndexIVF_set_direct_map_type(swigCPtr, this, SWIGTYPE_p_DirectMap__Type.getCPtr(type));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void replace_invlists(InvertedLists il, boolean own) {
|
||||||
|
swigfaissJNI.IndexIVF_replace_invlists__SWIG_0(swigCPtr, this, InvertedLists.getCPtr(il), il, own);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void replace_invlists(InvertedLists il) {
|
||||||
|
swigfaissJNI.IndexIVF_replace_invlists__SWIG_1(swigCPtr, this, InvertedLists.getCPtr(il), il);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long sa_code_size() {
|
||||||
|
return swigfaissJNI.IndexIVF_sa_code_size(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sa_encode(long n, SWIGTYPE_p_float x, SWIGTYPE_p_unsigned_char bytes) {
|
||||||
|
swigfaissJNI.IndexIVF_sa_encode(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_unsigned_char.getCPtr(bytes));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,76 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class IndexIVFFlat extends IndexIVF {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
|
||||||
|
protected IndexIVFFlat(long cPtr, boolean cMemoryOwn) {
|
||||||
|
super(swigfaissJNI.IndexIVFFlat_SWIGUpcast(cPtr), cMemoryOwn);
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(IndexIVFFlat obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_IndexIVFFlat(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
super.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexIVFFlat(Index quantizer, long d, long nlist_, MetricType arg3) {
|
||||||
|
this(swigfaissJNI.new_IndexIVFFlat__SWIG_0(Index.getCPtr(quantizer), quantizer, d, nlist_, arg3.swigValue()), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexIVFFlat(Index quantizer, long d, long nlist_) {
|
||||||
|
this(swigfaissJNI.new_IndexIVFFlat__SWIG_1(Index.getCPtr(quantizer), quantizer, d, nlist_), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void add_core(long n, SWIGTYPE_p_float x, LongVector xids, LongVector precomputed_idx) {
|
||||||
|
swigfaissJNI.IndexIVFFlat_add_core(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_long_long.getCPtr(xids.data()), xids, SWIGTYPE_p_long_long.getCPtr(precomputed_idx.data()), precomputed_idx);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void encode_vectors(long n, SWIGTYPE_p_float x, LongVector list_nos, SWIGTYPE_p_unsigned_char codes, boolean include_listnos) {
|
||||||
|
swigfaissJNI.IndexIVFFlat_encode_vectors__SWIG_0(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_long_long.getCPtr(list_nos.data()), list_nos, SWIGTYPE_p_unsigned_char.getCPtr(codes), include_listnos);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void encode_vectors(long n, SWIGTYPE_p_float x, LongVector list_nos, SWIGTYPE_p_unsigned_char codes) {
|
||||||
|
swigfaissJNI.IndexIVFFlat_encode_vectors__SWIG_1(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_long_long.getCPtr(list_nos.data()), list_nos, SWIGTYPE_p_unsigned_char.getCPtr(codes));
|
||||||
|
}
|
||||||
|
|
||||||
|
public SWIGTYPE_p_faiss__InvertedListScanner get_InvertedListScanner(boolean store_pairs) {
|
||||||
|
long cPtr = swigfaissJNI.IndexIVFFlat_get_InvertedListScanner(swigCPtr, this, store_pairs);
|
||||||
|
return (cPtr == 0) ? null : new SWIGTYPE_p_faiss__InvertedListScanner(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reconstruct_from_offset(long list_no, long offset, SWIGTYPE_p_float recons) {
|
||||||
|
swigfaissJNI.IndexIVFFlat_reconstruct_from_offset(swigCPtr, this, list_no, offset, SWIGTYPE_p_float.getCPtr(recons));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sa_decode(long n, SWIGTYPE_p_unsigned_char bytes, SWIGTYPE_p_float x) {
|
||||||
|
swigfaissJNI.IndexIVFFlat_sa_decode(swigCPtr, this, n, SWIGTYPE_p_unsigned_char.getCPtr(bytes), SWIGTYPE_p_float.getCPtr(x));
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexIVFFlat() {
|
||||||
|
this(swigfaissJNI.new_IndexIVFFlat__SWIG_2(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,95 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class IndexIVFFlatDedup extends IndexIVFFlat {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
|
||||||
|
protected IndexIVFFlatDedup(long cPtr, boolean cMemoryOwn) {
|
||||||
|
super(swigfaissJNI.IndexIVFFlatDedup_SWIGUpcast(cPtr), cMemoryOwn);
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(IndexIVFFlatDedup obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_IndexIVFFlatDedup(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
super.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setInstances(SWIGTYPE_p_std__unordered_multimapT_int64_t_int64_t_t value) {
|
||||||
|
swigfaissJNI.IndexIVFFlatDedup_instances_set(swigCPtr, this, SWIGTYPE_p_std__unordered_multimapT_int64_t_int64_t_t.getCPtr(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
public SWIGTYPE_p_std__unordered_multimapT_int64_t_int64_t_t getInstances() {
|
||||||
|
return new SWIGTYPE_p_std__unordered_multimapT_int64_t_int64_t_t(swigfaissJNI.IndexIVFFlatDedup_instances_get(swigCPtr, this), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexIVFFlatDedup(Index quantizer, long d, long nlist_, MetricType arg3) {
|
||||||
|
this(swigfaissJNI.new_IndexIVFFlatDedup__SWIG_0(Index.getCPtr(quantizer), quantizer, d, nlist_, arg3.swigValue()), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexIVFFlatDedup(Index quantizer, long d, long nlist_) {
|
||||||
|
this(swigfaissJNI.new_IndexIVFFlatDedup__SWIG_1(Index.getCPtr(quantizer), quantizer, d, nlist_), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void train(long n, SWIGTYPE_p_float x) {
|
||||||
|
swigfaissJNI.IndexIVFFlatDedup_train(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void add_with_ids(long n, SWIGTYPE_p_float x, LongVector xids) {
|
||||||
|
swigfaissJNI.IndexIVFFlatDedup_add_with_ids(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_long_long.getCPtr(xids.data()), xids);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void search_preassigned(long n, SWIGTYPE_p_float x, long k, LongVector assign, SWIGTYPE_p_float centroid_dis, SWIGTYPE_p_float distances, LongVector labels, boolean store_pairs, IVFSearchParameters params, IndexIVFStats stats) {
|
||||||
|
swigfaissJNI.IndexIVFFlatDedup_search_preassigned__SWIG_0(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), k, SWIGTYPE_p_long_long.getCPtr(assign.data()), assign, SWIGTYPE_p_float.getCPtr(centroid_dis), SWIGTYPE_p_float.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels, store_pairs, IVFSearchParameters.getCPtr(params), params, IndexIVFStats.getCPtr(stats), stats);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void search_preassigned(long n, SWIGTYPE_p_float x, long k, LongVector assign, SWIGTYPE_p_float centroid_dis, SWIGTYPE_p_float distances, LongVector labels, boolean store_pairs, IVFSearchParameters params) {
|
||||||
|
swigfaissJNI.IndexIVFFlatDedup_search_preassigned__SWIG_1(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), k, SWIGTYPE_p_long_long.getCPtr(assign.data()), assign, SWIGTYPE_p_float.getCPtr(centroid_dis), SWIGTYPE_p_float.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels, store_pairs, IVFSearchParameters.getCPtr(params), params);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void search_preassigned(long n, SWIGTYPE_p_float x, long k, LongVector assign, SWIGTYPE_p_float centroid_dis, SWIGTYPE_p_float distances, LongVector labels, boolean store_pairs) {
|
||||||
|
swigfaissJNI.IndexIVFFlatDedup_search_preassigned__SWIG_2(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), k, SWIGTYPE_p_long_long.getCPtr(assign.data()), assign, SWIGTYPE_p_float.getCPtr(centroid_dis), SWIGTYPE_p_float.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels, store_pairs);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long remove_ids(IDSelector sel) {
|
||||||
|
return swigfaissJNI.IndexIVFFlatDedup_remove_ids(swigCPtr, this, IDSelector.getCPtr(sel), sel);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void range_search(long n, SWIGTYPE_p_float x, float radius, RangeSearchResult result) {
|
||||||
|
swigfaissJNI.IndexIVFFlatDedup_range_search(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), radius, RangeSearchResult.getCPtr(result), result);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void update_vectors(int nv, LongVector idx, SWIGTYPE_p_float v) {
|
||||||
|
swigfaissJNI.IndexIVFFlatDedup_update_vectors(swigCPtr, this, nv, SWIGTYPE_p_long_long.getCPtr(idx.data()), idx, SWIGTYPE_p_float.getCPtr(v));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reconstruct_from_offset(long list_no, long offset, SWIGTYPE_p_float recons) {
|
||||||
|
swigfaissJNI.IndexIVFFlatDedup_reconstruct_from_offset(swigCPtr, this, list_no, offset, SWIGTYPE_p_float.getCPtr(recons));
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexIVFFlatDedup() {
|
||||||
|
this(swigfaissJNI.new_IndexIVFFlatDedup__SWIG_2(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
182
ann/src/main/java/com/twitter/ann/faiss/swig/IndexIVFPQ.java
Normal file
182
ann/src/main/java/com/twitter/ann/faiss/swig/IndexIVFPQ.java
Normal file
|
@ -0,0 +1,182 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class IndexIVFPQ extends IndexIVF {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
|
||||||
|
protected IndexIVFPQ(long cPtr, boolean cMemoryOwn) {
|
||||||
|
super(swigfaissJNI.IndexIVFPQ_SWIGUpcast(cPtr), cMemoryOwn);
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(IndexIVFPQ obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_IndexIVFPQ(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
super.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBy_residual(boolean value) {
|
||||||
|
swigfaissJNI.IndexIVFPQ_by_residual_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getBy_residual() {
|
||||||
|
return swigfaissJNI.IndexIVFPQ_by_residual_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPq(ProductQuantizer value) {
|
||||||
|
swigfaissJNI.IndexIVFPQ_pq_set(swigCPtr, this, ProductQuantizer.getCPtr(value), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProductQuantizer getPq() {
|
||||||
|
long cPtr = swigfaissJNI.IndexIVFPQ_pq_get(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new ProductQuantizer(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDo_polysemous_training(boolean value) {
|
||||||
|
swigfaissJNI.IndexIVFPQ_do_polysemous_training_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getDo_polysemous_training() {
|
||||||
|
return swigfaissJNI.IndexIVFPQ_do_polysemous_training_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPolysemous_training(PolysemousTraining value) {
|
||||||
|
swigfaissJNI.IndexIVFPQ_polysemous_training_set(swigCPtr, this, PolysemousTraining.getCPtr(value), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public PolysemousTraining getPolysemous_training() {
|
||||||
|
long cPtr = swigfaissJNI.IndexIVFPQ_polysemous_training_get(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new PolysemousTraining(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setScan_table_threshold(long value) {
|
||||||
|
swigfaissJNI.IndexIVFPQ_scan_table_threshold_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getScan_table_threshold() {
|
||||||
|
return swigfaissJNI.IndexIVFPQ_scan_table_threshold_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPolysemous_ht(int value) {
|
||||||
|
swigfaissJNI.IndexIVFPQ_polysemous_ht_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPolysemous_ht() {
|
||||||
|
return swigfaissJNI.IndexIVFPQ_polysemous_ht_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUse_precomputed_table(int value) {
|
||||||
|
swigfaissJNI.IndexIVFPQ_use_precomputed_table_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getUse_precomputed_table() {
|
||||||
|
return swigfaissJNI.IndexIVFPQ_use_precomputed_table_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPrecomputed_table(SWIGTYPE_p_AlignedTableT_float_t value) {
|
||||||
|
swigfaissJNI.IndexIVFPQ_precomputed_table_set(swigCPtr, this, SWIGTYPE_p_AlignedTableT_float_t.getCPtr(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
public SWIGTYPE_p_AlignedTableT_float_t getPrecomputed_table() {
|
||||||
|
return new SWIGTYPE_p_AlignedTableT_float_t(swigfaissJNI.IndexIVFPQ_precomputed_table_get(swigCPtr, this), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexIVFPQ(Index quantizer, long d, long nlist, long M, long nbits_per_idx, MetricType metric) {
|
||||||
|
this(swigfaissJNI.new_IndexIVFPQ__SWIG_0(Index.getCPtr(quantizer), quantizer, d, nlist, M, nbits_per_idx, metric.swigValue()), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexIVFPQ(Index quantizer, long d, long nlist, long M, long nbits_per_idx) {
|
||||||
|
this(swigfaissJNI.new_IndexIVFPQ__SWIG_1(Index.getCPtr(quantizer), quantizer, d, nlist, M, nbits_per_idx), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void encode_vectors(long n, SWIGTYPE_p_float x, LongVector list_nos, SWIGTYPE_p_unsigned_char codes, boolean include_listnos) {
|
||||||
|
swigfaissJNI.IndexIVFPQ_encode_vectors__SWIG_0(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_long_long.getCPtr(list_nos.data()), list_nos, SWIGTYPE_p_unsigned_char.getCPtr(codes), include_listnos);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void encode_vectors(long n, SWIGTYPE_p_float x, LongVector list_nos, SWIGTYPE_p_unsigned_char codes) {
|
||||||
|
swigfaissJNI.IndexIVFPQ_encode_vectors__SWIG_1(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_long_long.getCPtr(list_nos.data()), list_nos, SWIGTYPE_p_unsigned_char.getCPtr(codes));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sa_decode(long n, SWIGTYPE_p_unsigned_char bytes, SWIGTYPE_p_float x) {
|
||||||
|
swigfaissJNI.IndexIVFPQ_sa_decode(swigCPtr, this, n, SWIGTYPE_p_unsigned_char.getCPtr(bytes), SWIGTYPE_p_float.getCPtr(x));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void add_core(long n, SWIGTYPE_p_float x, LongVector xids, LongVector precomputed_idx) {
|
||||||
|
swigfaissJNI.IndexIVFPQ_add_core(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_long_long.getCPtr(xids.data()), xids, SWIGTYPE_p_long_long.getCPtr(precomputed_idx.data()), precomputed_idx);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void add_core_o(long n, SWIGTYPE_p_float x, LongVector xids, SWIGTYPE_p_float residuals_2, LongVector precomputed_idx) {
|
||||||
|
swigfaissJNI.IndexIVFPQ_add_core_o__SWIG_0(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_long_long.getCPtr(xids.data()), xids, SWIGTYPE_p_float.getCPtr(residuals_2), SWIGTYPE_p_long_long.getCPtr(precomputed_idx.data()), precomputed_idx);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void add_core_o(long n, SWIGTYPE_p_float x, LongVector xids, SWIGTYPE_p_float residuals_2) {
|
||||||
|
swigfaissJNI.IndexIVFPQ_add_core_o__SWIG_1(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_long_long.getCPtr(xids.data()), xids, SWIGTYPE_p_float.getCPtr(residuals_2));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void train_residual(long n, SWIGTYPE_p_float x) {
|
||||||
|
swigfaissJNI.IndexIVFPQ_train_residual(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void train_residual_o(long n, SWIGTYPE_p_float x, SWIGTYPE_p_float residuals_2) {
|
||||||
|
swigfaissJNI.IndexIVFPQ_train_residual_o(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_float.getCPtr(residuals_2));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reconstruct_from_offset(long list_no, long offset, SWIGTYPE_p_float recons) {
|
||||||
|
swigfaissJNI.IndexIVFPQ_reconstruct_from_offset(swigCPtr, this, list_no, offset, SWIGTYPE_p_float.getCPtr(recons));
|
||||||
|
}
|
||||||
|
|
||||||
|
public long find_duplicates(LongVector ids, SWIGTYPE_p_unsigned_long lims) {
|
||||||
|
return swigfaissJNI.IndexIVFPQ_find_duplicates(swigCPtr, this, SWIGTYPE_p_long_long.getCPtr(ids.data()), ids, SWIGTYPE_p_unsigned_long.getCPtr(lims));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void encode(long key, SWIGTYPE_p_float x, SWIGTYPE_p_unsigned_char code) {
|
||||||
|
swigfaissJNI.IndexIVFPQ_encode(swigCPtr, this, key, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_unsigned_char.getCPtr(code));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void encode_multiple(long n, LongVector keys, SWIGTYPE_p_float x, SWIGTYPE_p_unsigned_char codes, boolean compute_keys) {
|
||||||
|
swigfaissJNI.IndexIVFPQ_encode_multiple__SWIG_0(swigCPtr, this, n, SWIGTYPE_p_long_long.getCPtr(keys.data()), keys, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_unsigned_char.getCPtr(codes), compute_keys);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void encode_multiple(long n, LongVector keys, SWIGTYPE_p_float x, SWIGTYPE_p_unsigned_char codes) {
|
||||||
|
swigfaissJNI.IndexIVFPQ_encode_multiple__SWIG_1(swigCPtr, this, n, SWIGTYPE_p_long_long.getCPtr(keys.data()), keys, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_unsigned_char.getCPtr(codes));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void decode_multiple(long n, LongVector keys, SWIGTYPE_p_unsigned_char xcodes, SWIGTYPE_p_float x) {
|
||||||
|
swigfaissJNI.IndexIVFPQ_decode_multiple(swigCPtr, this, n, SWIGTYPE_p_long_long.getCPtr(keys.data()), keys, SWIGTYPE_p_unsigned_char.getCPtr(xcodes), SWIGTYPE_p_float.getCPtr(x));
|
||||||
|
}
|
||||||
|
|
||||||
|
public SWIGTYPE_p_faiss__InvertedListScanner get_InvertedListScanner(boolean store_pairs) {
|
||||||
|
long cPtr = swigfaissJNI.IndexIVFPQ_get_InvertedListScanner(swigCPtr, this, store_pairs);
|
||||||
|
return (cPtr == 0) ? null : new SWIGTYPE_p_faiss__InvertedListScanner(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void precompute_table() {
|
||||||
|
swigfaissJNI.IndexIVFPQ_precompute_table(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexIVFPQ() {
|
||||||
|
this(swigfaissJNI.new_IndexIVFPQ__SWIG_2(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,79 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class IndexIVFPQStats {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
protected transient boolean swigCMemOwn;
|
||||||
|
|
||||||
|
protected IndexIVFPQStats(long cPtr, boolean cMemoryOwn) {
|
||||||
|
swigCMemOwn = cMemoryOwn;
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(IndexIVFPQStats obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_IndexIVFPQStats(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNrefine(long value) {
|
||||||
|
swigfaissJNI.IndexIVFPQStats_nrefine_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getNrefine() {
|
||||||
|
return swigfaissJNI.IndexIVFPQStats_nrefine_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setN_hamming_pass(long value) {
|
||||||
|
swigfaissJNI.IndexIVFPQStats_n_hamming_pass_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getN_hamming_pass() {
|
||||||
|
return swigfaissJNI.IndexIVFPQStats_n_hamming_pass_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSearch_cycles(long value) {
|
||||||
|
swigfaissJNI.IndexIVFPQStats_search_cycles_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getSearch_cycles() {
|
||||||
|
return swigfaissJNI.IndexIVFPQStats_search_cycles_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRefine_cycles(long value) {
|
||||||
|
swigfaissJNI.IndexIVFPQStats_refine_cycles_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getRefine_cycles() {
|
||||||
|
return swigfaissJNI.IndexIVFPQStats_refine_cycles_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexIVFPQStats() {
|
||||||
|
this(swigfaissJNI.new_IndexIVFPQStats(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reset() {
|
||||||
|
swigfaissJNI.IndexIVFPQStats_reset(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,100 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class IndexIVFScalarQuantizer extends IndexIVF {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
|
||||||
|
protected IndexIVFScalarQuantizer(long cPtr, boolean cMemoryOwn) {
|
||||||
|
super(swigfaissJNI.IndexIVFScalarQuantizer_SWIGUpcast(cPtr), cMemoryOwn);
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(IndexIVFScalarQuantizer obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_IndexIVFScalarQuantizer(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
super.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSq(SWIGTYPE_p_ScalarQuantizer value) {
|
||||||
|
swigfaissJNI.IndexIVFScalarQuantizer_sq_set(swigCPtr, this, SWIGTYPE_p_ScalarQuantizer.getCPtr(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
public SWIGTYPE_p_ScalarQuantizer getSq() {
|
||||||
|
return new SWIGTYPE_p_ScalarQuantizer(swigfaissJNI.IndexIVFScalarQuantizer_sq_get(swigCPtr, this), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBy_residual(boolean value) {
|
||||||
|
swigfaissJNI.IndexIVFScalarQuantizer_by_residual_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getBy_residual() {
|
||||||
|
return swigfaissJNI.IndexIVFScalarQuantizer_by_residual_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexIVFScalarQuantizer(Index quantizer, long d, long nlist, SWIGTYPE_p_ScalarQuantizer__QuantizerType qtype, MetricType metric, boolean encode_residual) {
|
||||||
|
this(swigfaissJNI.new_IndexIVFScalarQuantizer__SWIG_0(Index.getCPtr(quantizer), quantizer, d, nlist, SWIGTYPE_p_ScalarQuantizer__QuantizerType.getCPtr(qtype), metric.swigValue(), encode_residual), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexIVFScalarQuantizer(Index quantizer, long d, long nlist, SWIGTYPE_p_ScalarQuantizer__QuantizerType qtype, MetricType metric) {
|
||||||
|
this(swigfaissJNI.new_IndexIVFScalarQuantizer__SWIG_1(Index.getCPtr(quantizer), quantizer, d, nlist, SWIGTYPE_p_ScalarQuantizer__QuantizerType.getCPtr(qtype), metric.swigValue()), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexIVFScalarQuantizer(Index quantizer, long d, long nlist, SWIGTYPE_p_ScalarQuantizer__QuantizerType qtype) {
|
||||||
|
this(swigfaissJNI.new_IndexIVFScalarQuantizer__SWIG_2(Index.getCPtr(quantizer), quantizer, d, nlist, SWIGTYPE_p_ScalarQuantizer__QuantizerType.getCPtr(qtype)), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexIVFScalarQuantizer() {
|
||||||
|
this(swigfaissJNI.new_IndexIVFScalarQuantizer__SWIG_3(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void train_residual(long n, SWIGTYPE_p_float x) {
|
||||||
|
swigfaissJNI.IndexIVFScalarQuantizer_train_residual(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void encode_vectors(long n, SWIGTYPE_p_float x, LongVector list_nos, SWIGTYPE_p_unsigned_char codes, boolean include_listnos) {
|
||||||
|
swigfaissJNI.IndexIVFScalarQuantizer_encode_vectors__SWIG_0(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_long_long.getCPtr(list_nos.data()), list_nos, SWIGTYPE_p_unsigned_char.getCPtr(codes), include_listnos);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void encode_vectors(long n, SWIGTYPE_p_float x, LongVector list_nos, SWIGTYPE_p_unsigned_char codes) {
|
||||||
|
swigfaissJNI.IndexIVFScalarQuantizer_encode_vectors__SWIG_1(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_long_long.getCPtr(list_nos.data()), list_nos, SWIGTYPE_p_unsigned_char.getCPtr(codes));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void add_core(long n, SWIGTYPE_p_float x, LongVector xids, LongVector precomputed_idx) {
|
||||||
|
swigfaissJNI.IndexIVFScalarQuantizer_add_core(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_long_long.getCPtr(xids.data()), xids, SWIGTYPE_p_long_long.getCPtr(precomputed_idx.data()), precomputed_idx);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SWIGTYPE_p_faiss__InvertedListScanner get_InvertedListScanner(boolean store_pairs) {
|
||||||
|
long cPtr = swigfaissJNI.IndexIVFScalarQuantizer_get_InvertedListScanner(swigCPtr, this, store_pairs);
|
||||||
|
return (cPtr == 0) ? null : new SWIGTYPE_p_faiss__InvertedListScanner(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reconstruct_from_offset(long list_no, long offset, SWIGTYPE_p_float recons) {
|
||||||
|
swigfaissJNI.IndexIVFScalarQuantizer_reconstruct_from_offset(swigCPtr, this, list_no, offset, SWIGTYPE_p_float.getCPtr(recons));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sa_decode(long n, SWIGTYPE_p_unsigned_char bytes, SWIGTYPE_p_float x) {
|
||||||
|
swigfaissJNI.IndexIVFScalarQuantizer_sa_decode(swigCPtr, this, n, SWIGTYPE_p_unsigned_char.getCPtr(bytes), SWIGTYPE_p_float.getCPtr(x));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,99 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class IndexIVFStats {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
protected transient boolean swigCMemOwn;
|
||||||
|
|
||||||
|
protected IndexIVFStats(long cPtr, boolean cMemoryOwn) {
|
||||||
|
swigCMemOwn = cMemoryOwn;
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(IndexIVFStats obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_IndexIVFStats(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNq(long value) {
|
||||||
|
swigfaissJNI.IndexIVFStats_nq_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getNq() {
|
||||||
|
return swigfaissJNI.IndexIVFStats_nq_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNlist(long value) {
|
||||||
|
swigfaissJNI.IndexIVFStats_nlist_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getNlist() {
|
||||||
|
return swigfaissJNI.IndexIVFStats_nlist_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNdis(long value) {
|
||||||
|
swigfaissJNI.IndexIVFStats_ndis_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getNdis() {
|
||||||
|
return swigfaissJNI.IndexIVFStats_ndis_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNheap_updates(long value) {
|
||||||
|
swigfaissJNI.IndexIVFStats_nheap_updates_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getNheap_updates() {
|
||||||
|
return swigfaissJNI.IndexIVFStats_nheap_updates_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQuantization_time(double value) {
|
||||||
|
swigfaissJNI.IndexIVFStats_quantization_time_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getQuantization_time() {
|
||||||
|
return swigfaissJNI.IndexIVFStats_quantization_time_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSearch_time(double value) {
|
||||||
|
swigfaissJNI.IndexIVFStats_search_time_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getSearch_time() {
|
||||||
|
return swigfaissJNI.IndexIVFStats_search_time_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexIVFStats() {
|
||||||
|
this(swigfaissJNI.new_IndexIVFStats(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reset() {
|
||||||
|
swigfaissJNI.IndexIVFStats_reset(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void add(IndexIVFStats other) {
|
||||||
|
swigfaissJNI.IndexIVFStats_add(swigCPtr, this, IndexIVFStats.getCPtr(other), other);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
122
ann/src/main/java/com/twitter/ann/faiss/swig/IndexLSH.java
Normal file
122
ann/src/main/java/com/twitter/ann/faiss/swig/IndexLSH.java
Normal file
|
@ -0,0 +1,122 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class IndexLSH extends IndexFlatCodes {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
|
||||||
|
protected IndexLSH(long cPtr, boolean cMemoryOwn) {
|
||||||
|
super(swigfaissJNI.IndexLSH_SWIGUpcast(cPtr), cMemoryOwn);
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(IndexLSH obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_IndexLSH(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
super.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNbits(int value) {
|
||||||
|
swigfaissJNI.IndexLSH_nbits_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getNbits() {
|
||||||
|
return swigfaissJNI.IndexLSH_nbits_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRotate_data(boolean value) {
|
||||||
|
swigfaissJNI.IndexLSH_rotate_data_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getRotate_data() {
|
||||||
|
return swigfaissJNI.IndexLSH_rotate_data_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTrain_thresholds(boolean value) {
|
||||||
|
swigfaissJNI.IndexLSH_train_thresholds_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getTrain_thresholds() {
|
||||||
|
return swigfaissJNI.IndexLSH_train_thresholds_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRrot(RandomRotationMatrix value) {
|
||||||
|
swigfaissJNI.IndexLSH_rrot_set(swigCPtr, this, RandomRotationMatrix.getCPtr(value), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public RandomRotationMatrix getRrot() {
|
||||||
|
long cPtr = swigfaissJNI.IndexLSH_rrot_get(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new RandomRotationMatrix(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setThresholds(FloatVector value) {
|
||||||
|
swigfaissJNI.IndexLSH_thresholds_set(swigCPtr, this, FloatVector.getCPtr(value), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public FloatVector getThresholds() {
|
||||||
|
long cPtr = swigfaissJNI.IndexLSH_thresholds_get(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new FloatVector(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexLSH(long d, int nbits, boolean rotate_data, boolean train_thresholds) {
|
||||||
|
this(swigfaissJNI.new_IndexLSH__SWIG_0(d, nbits, rotate_data, train_thresholds), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexLSH(long d, int nbits, boolean rotate_data) {
|
||||||
|
this(swigfaissJNI.new_IndexLSH__SWIG_1(d, nbits, rotate_data), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexLSH(long d, int nbits) {
|
||||||
|
this(swigfaissJNI.new_IndexLSH__SWIG_2(d, nbits), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SWIGTYPE_p_float apply_preprocess(long n, SWIGTYPE_p_float x) {
|
||||||
|
long cPtr = swigfaissJNI.IndexLSH_apply_preprocess(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x));
|
||||||
|
return (cPtr == 0) ? null : new SWIGTYPE_p_float(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void train(long n, SWIGTYPE_p_float x) {
|
||||||
|
swigfaissJNI.IndexLSH_train(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void search(long n, SWIGTYPE_p_float x, long k, SWIGTYPE_p_float distances, LongVector labels) {
|
||||||
|
swigfaissJNI.IndexLSH_search(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), k, SWIGTYPE_p_float.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void transfer_thresholds(LinearTransform vt) {
|
||||||
|
swigfaissJNI.IndexLSH_transfer_thresholds(swigCPtr, this, LinearTransform.getCPtr(vt), vt);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexLSH() {
|
||||||
|
this(swigfaissJNI.new_IndexLSH__SWIG_3(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sa_encode(long n, SWIGTYPE_p_float x, SWIGTYPE_p_unsigned_char bytes) {
|
||||||
|
swigfaissJNI.IndexLSH_sa_encode(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_unsigned_char.getCPtr(bytes));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sa_decode(long n, SWIGTYPE_p_unsigned_char bytes, SWIGTYPE_p_float x) {
|
||||||
|
swigfaissJNI.IndexLSH_sa_decode(swigCPtr, this, n, SWIGTYPE_p_unsigned_char.getCPtr(bytes), SWIGTYPE_p_float.getCPtr(x));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
182
ann/src/main/java/com/twitter/ann/faiss/swig/IndexPQ.java
Normal file
182
ann/src/main/java/com/twitter/ann/faiss/swig/IndexPQ.java
Normal file
|
@ -0,0 +1,182 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class IndexPQ extends IndexFlatCodes {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
|
||||||
|
protected IndexPQ(long cPtr, boolean cMemoryOwn) {
|
||||||
|
super(swigfaissJNI.IndexPQ_SWIGUpcast(cPtr), cMemoryOwn);
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(IndexPQ obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_IndexPQ(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
super.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPq(ProductQuantizer value) {
|
||||||
|
swigfaissJNI.IndexPQ_pq_set(swigCPtr, this, ProductQuantizer.getCPtr(value), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProductQuantizer getPq() {
|
||||||
|
long cPtr = swigfaissJNI.IndexPQ_pq_get(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new ProductQuantizer(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexPQ(int d, long M, long nbits, MetricType metric) {
|
||||||
|
this(swigfaissJNI.new_IndexPQ__SWIG_0(d, M, nbits, metric.swigValue()), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexPQ(int d, long M, long nbits) {
|
||||||
|
this(swigfaissJNI.new_IndexPQ__SWIG_1(d, M, nbits), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexPQ() {
|
||||||
|
this(swigfaissJNI.new_IndexPQ__SWIG_2(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void train(long n, SWIGTYPE_p_float x) {
|
||||||
|
swigfaissJNI.IndexPQ_train(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void search(long n, SWIGTYPE_p_float x, long k, SWIGTYPE_p_float distances, LongVector labels) {
|
||||||
|
swigfaissJNI.IndexPQ_search(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), k, SWIGTYPE_p_float.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sa_encode(long n, SWIGTYPE_p_float x, SWIGTYPE_p_unsigned_char bytes) {
|
||||||
|
swigfaissJNI.IndexPQ_sa_encode(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_unsigned_char.getCPtr(bytes));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sa_decode(long n, SWIGTYPE_p_unsigned_char bytes, SWIGTYPE_p_float x) {
|
||||||
|
swigfaissJNI.IndexPQ_sa_decode(swigCPtr, this, n, SWIGTYPE_p_unsigned_char.getCPtr(bytes), SWIGTYPE_p_float.getCPtr(x));
|
||||||
|
}
|
||||||
|
|
||||||
|
public DistanceComputer get_distance_computer() {
|
||||||
|
long cPtr = swigfaissJNI.IndexPQ_get_distance_computer(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new DistanceComputer(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDo_polysemous_training(boolean value) {
|
||||||
|
swigfaissJNI.IndexPQ_do_polysemous_training_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getDo_polysemous_training() {
|
||||||
|
return swigfaissJNI.IndexPQ_do_polysemous_training_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPolysemous_training(PolysemousTraining value) {
|
||||||
|
swigfaissJNI.IndexPQ_polysemous_training_set(swigCPtr, this, PolysemousTraining.getCPtr(value), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public PolysemousTraining getPolysemous_training() {
|
||||||
|
long cPtr = swigfaissJNI.IndexPQ_polysemous_training_get(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new PolysemousTraining(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSearch_type(IndexPQ.Search_type_t value) {
|
||||||
|
swigfaissJNI.IndexPQ_search_type_set(swigCPtr, this, value.swigValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexPQ.Search_type_t getSearch_type() {
|
||||||
|
return IndexPQ.Search_type_t.swigToEnum(swigfaissJNI.IndexPQ_search_type_get(swigCPtr, this));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEncode_signs(boolean value) {
|
||||||
|
swigfaissJNI.IndexPQ_encode_signs_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getEncode_signs() {
|
||||||
|
return swigfaissJNI.IndexPQ_encode_signs_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPolysemous_ht(int value) {
|
||||||
|
swigfaissJNI.IndexPQ_polysemous_ht_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPolysemous_ht() {
|
||||||
|
return swigfaissJNI.IndexPQ_polysemous_ht_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void search_core_polysemous(long n, SWIGTYPE_p_float x, long k, SWIGTYPE_p_float distances, LongVector labels) {
|
||||||
|
swigfaissJNI.IndexPQ_search_core_polysemous(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), k, SWIGTYPE_p_float.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void hamming_distance_histogram(long n, SWIGTYPE_p_float x, long nb, SWIGTYPE_p_float xb, LongVector dist_histogram) {
|
||||||
|
swigfaissJNI.IndexPQ_hamming_distance_histogram(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), nb, SWIGTYPE_p_float.getCPtr(xb), SWIGTYPE_p_long_long.getCPtr(dist_histogram.data()), dist_histogram);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void hamming_distance_table(long n, SWIGTYPE_p_float x, SWIGTYPE_p_int dis) {
|
||||||
|
swigfaissJNI.IndexPQ_hamming_distance_table(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_int.getCPtr(dis));
|
||||||
|
}
|
||||||
|
|
||||||
|
public final static class Search_type_t {
|
||||||
|
public final static IndexPQ.Search_type_t ST_PQ = new IndexPQ.Search_type_t("ST_PQ");
|
||||||
|
public final static IndexPQ.Search_type_t ST_HE = new IndexPQ.Search_type_t("ST_HE");
|
||||||
|
public final static IndexPQ.Search_type_t ST_generalized_HE = new IndexPQ.Search_type_t("ST_generalized_HE");
|
||||||
|
public final static IndexPQ.Search_type_t ST_SDC = new IndexPQ.Search_type_t("ST_SDC");
|
||||||
|
public final static IndexPQ.Search_type_t ST_polysemous = new IndexPQ.Search_type_t("ST_polysemous");
|
||||||
|
public final static IndexPQ.Search_type_t ST_polysemous_generalize = new IndexPQ.Search_type_t("ST_polysemous_generalize");
|
||||||
|
|
||||||
|
public final int swigValue() {
|
||||||
|
return swigValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toString() {
|
||||||
|
return swigName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Search_type_t swigToEnum(int swigValue) {
|
||||||
|
if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
|
||||||
|
return swigValues[swigValue];
|
||||||
|
for (int i = 0; i < swigValues.length; i++)
|
||||||
|
if (swigValues[i].swigValue == swigValue)
|
||||||
|
return swigValues[i];
|
||||||
|
throw new IllegalArgumentException("No enum " + Search_type_t.class + " with value " + swigValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Search_type_t(String swigName) {
|
||||||
|
this.swigName = swigName;
|
||||||
|
this.swigValue = swigNext++;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Search_type_t(String swigName, int swigValue) {
|
||||||
|
this.swigName = swigName;
|
||||||
|
this.swigValue = swigValue;
|
||||||
|
swigNext = swigValue+1;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Search_type_t(String swigName, Search_type_t swigEnum) {
|
||||||
|
this.swigName = swigName;
|
||||||
|
this.swigValue = swigEnum.swigValue;
|
||||||
|
swigNext = this.swigValue+1;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Search_type_t[] swigValues = { ST_PQ, ST_HE, ST_generalized_HE, ST_SDC, ST_polysemous, ST_polysemous_generalize };
|
||||||
|
private static int swigNext = 0;
|
||||||
|
private final int swigValue;
|
||||||
|
private final String swigName;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,71 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class IndexPQStats {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
protected transient boolean swigCMemOwn;
|
||||||
|
|
||||||
|
protected IndexPQStats(long cPtr, boolean cMemoryOwn) {
|
||||||
|
swigCMemOwn = cMemoryOwn;
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(IndexPQStats obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_IndexPQStats(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNq(long value) {
|
||||||
|
swigfaissJNI.IndexPQStats_nq_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getNq() {
|
||||||
|
return swigfaissJNI.IndexPQStats_nq_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNcode(long value) {
|
||||||
|
swigfaissJNI.IndexPQStats_ncode_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getNcode() {
|
||||||
|
return swigfaissJNI.IndexPQStats_ncode_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setN_hamming_pass(long value) {
|
||||||
|
swigfaissJNI.IndexPQStats_n_hamming_pass_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getN_hamming_pass() {
|
||||||
|
return swigfaissJNI.IndexPQStats_n_hamming_pass_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexPQStats() {
|
||||||
|
this(swigfaissJNI.new_IndexPQStats(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reset() {
|
||||||
|
swigfaissJNI.IndexPQStats_reset(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
121
ann/src/main/java/com/twitter/ann/faiss/swig/IndexRefine.java
Normal file
121
ann/src/main/java/com/twitter/ann/faiss/swig/IndexRefine.java
Normal file
|
@ -0,0 +1,121 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class IndexRefine extends Index {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
|
||||||
|
protected IndexRefine(long cPtr, boolean cMemoryOwn) {
|
||||||
|
super(swigfaissJNI.IndexRefine_SWIGUpcast(cPtr), cMemoryOwn);
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(IndexRefine obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_IndexRefine(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
super.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBase_index(Index value) {
|
||||||
|
swigfaissJNI.IndexRefine_base_index_set(swigCPtr, this, Index.getCPtr(value), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Index getBase_index() {
|
||||||
|
long cPtr = swigfaissJNI.IndexRefine_base_index_get(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new Index(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRefine_index(Index value) {
|
||||||
|
swigfaissJNI.IndexRefine_refine_index_set(swigCPtr, this, Index.getCPtr(value), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Index getRefine_index() {
|
||||||
|
long cPtr = swigfaissJNI.IndexRefine_refine_index_get(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new Index(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOwn_fields(boolean value) {
|
||||||
|
swigfaissJNI.IndexRefine_own_fields_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getOwn_fields() {
|
||||||
|
return swigfaissJNI.IndexRefine_own_fields_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOwn_refine_index(boolean value) {
|
||||||
|
swigfaissJNI.IndexRefine_own_refine_index_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getOwn_refine_index() {
|
||||||
|
return swigfaissJNI.IndexRefine_own_refine_index_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setK_factor(float value) {
|
||||||
|
swigfaissJNI.IndexRefine_k_factor_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getK_factor() {
|
||||||
|
return swigfaissJNI.IndexRefine_k_factor_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexRefine(Index base_index, Index refine_index) {
|
||||||
|
this(swigfaissJNI.new_IndexRefine__SWIG_0(Index.getCPtr(base_index), base_index, Index.getCPtr(refine_index), refine_index), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexRefine() {
|
||||||
|
this(swigfaissJNI.new_IndexRefine__SWIG_1(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void train(long n, SWIGTYPE_p_float x) {
|
||||||
|
swigfaissJNI.IndexRefine_train(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void add(long n, SWIGTYPE_p_float x) {
|
||||||
|
swigfaissJNI.IndexRefine_add(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reset() {
|
||||||
|
swigfaissJNI.IndexRefine_reset(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void search(long n, SWIGTYPE_p_float x, long k, SWIGTYPE_p_float distances, LongVector labels) {
|
||||||
|
swigfaissJNI.IndexRefine_search(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), k, SWIGTYPE_p_float.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reconstruct(long key, SWIGTYPE_p_float recons) {
|
||||||
|
swigfaissJNI.IndexRefine_reconstruct(swigCPtr, this, key, SWIGTYPE_p_float.getCPtr(recons));
|
||||||
|
}
|
||||||
|
|
||||||
|
public long sa_code_size() {
|
||||||
|
return swigfaissJNI.IndexRefine_sa_code_size(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sa_encode(long n, SWIGTYPE_p_float x, SWIGTYPE_p_unsigned_char bytes) {
|
||||||
|
swigfaissJNI.IndexRefine_sa_encode(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_unsigned_char.getCPtr(bytes));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sa_decode(long n, SWIGTYPE_p_unsigned_char bytes, SWIGTYPE_p_float x) {
|
||||||
|
swigfaissJNI.IndexRefine_sa_decode(swigCPtr, this, n, SWIGTYPE_p_unsigned_char.getCPtr(bytes), SWIGTYPE_p_float.getCPtr(x));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,55 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class IndexRefineFlat extends IndexRefine {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
|
||||||
|
protected IndexRefineFlat(long cPtr, boolean cMemoryOwn) {
|
||||||
|
super(swigfaissJNI.IndexRefineFlat_SWIGUpcast(cPtr), cMemoryOwn);
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(IndexRefineFlat obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_IndexRefineFlat(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
super.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexRefineFlat(Index base_index) {
|
||||||
|
this(swigfaissJNI.new_IndexRefineFlat__SWIG_0(Index.getCPtr(base_index), base_index), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexRefineFlat(Index base_index, SWIGTYPE_p_float xb) {
|
||||||
|
this(swigfaissJNI.new_IndexRefineFlat__SWIG_1(Index.getCPtr(base_index), base_index, SWIGTYPE_p_float.getCPtr(xb)), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexRefineFlat() {
|
||||||
|
this(swigfaissJNI.new_IndexRefineFlat__SWIG_2(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void search(long n, SWIGTYPE_p_float x, long k, SWIGTYPE_p_float distances, LongVector labels) {
|
||||||
|
swigfaissJNI.IndexRefineFlat_search(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), k, SWIGTYPE_p_float.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,80 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class IndexScalarQuantizer extends IndexFlatCodes {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
|
||||||
|
protected IndexScalarQuantizer(long cPtr, boolean cMemoryOwn) {
|
||||||
|
super(swigfaissJNI.IndexScalarQuantizer_SWIGUpcast(cPtr), cMemoryOwn);
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(IndexScalarQuantizer obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_IndexScalarQuantizer(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
super.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSq(SWIGTYPE_p_ScalarQuantizer value) {
|
||||||
|
swigfaissJNI.IndexScalarQuantizer_sq_set(swigCPtr, this, SWIGTYPE_p_ScalarQuantizer.getCPtr(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
public SWIGTYPE_p_ScalarQuantizer getSq() {
|
||||||
|
return new SWIGTYPE_p_ScalarQuantizer(swigfaissJNI.IndexScalarQuantizer_sq_get(swigCPtr, this), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexScalarQuantizer(int d, SWIGTYPE_p_ScalarQuantizer__QuantizerType qtype, MetricType metric) {
|
||||||
|
this(swigfaissJNI.new_IndexScalarQuantizer__SWIG_0(d, SWIGTYPE_p_ScalarQuantizer__QuantizerType.getCPtr(qtype), metric.swigValue()), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexScalarQuantizer(int d, SWIGTYPE_p_ScalarQuantizer__QuantizerType qtype) {
|
||||||
|
this(swigfaissJNI.new_IndexScalarQuantizer__SWIG_1(d, SWIGTYPE_p_ScalarQuantizer__QuantizerType.getCPtr(qtype)), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexScalarQuantizer() {
|
||||||
|
this(swigfaissJNI.new_IndexScalarQuantizer__SWIG_2(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void train(long n, SWIGTYPE_p_float x) {
|
||||||
|
swigfaissJNI.IndexScalarQuantizer_train(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void search(long n, SWIGTYPE_p_float x, long k, SWIGTYPE_p_float distances, LongVector labels) {
|
||||||
|
swigfaissJNI.IndexScalarQuantizer_search(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), k, SWIGTYPE_p_float.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels);
|
||||||
|
}
|
||||||
|
|
||||||
|
public DistanceComputer get_distance_computer() {
|
||||||
|
long cPtr = swigfaissJNI.IndexScalarQuantizer_get_distance_computer(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new DistanceComputer(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sa_encode(long n, SWIGTYPE_p_float x, SWIGTYPE_p_unsigned_char bytes) {
|
||||||
|
swigfaissJNI.IndexScalarQuantizer_sa_encode(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_unsigned_char.getCPtr(bytes));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sa_decode(long n, SWIGTYPE_p_unsigned_char bytes, SWIGTYPE_p_float x) {
|
||||||
|
swigfaissJNI.IndexScalarQuantizer_sa_decode(swigCPtr, this, n, SWIGTYPE_p_unsigned_char.getCPtr(bytes), SWIGTYPE_p_float.getCPtr(x));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,99 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class IndexShards {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
protected transient boolean swigCMemOwn;
|
||||||
|
|
||||||
|
protected IndexShards(long cPtr, boolean cMemoryOwn) {
|
||||||
|
swigCMemOwn = cMemoryOwn;
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(IndexShards obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_IndexShards(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexShards(boolean threaded, boolean successive_ids) {
|
||||||
|
this(swigfaissJNI.new_IndexShards__SWIG_0(threaded, successive_ids), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexShards(boolean threaded) {
|
||||||
|
this(swigfaissJNI.new_IndexShards__SWIG_1(threaded), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexShards() {
|
||||||
|
this(swigfaissJNI.new_IndexShards__SWIG_2(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexShards(int d, boolean threaded, boolean successive_ids) {
|
||||||
|
this(swigfaissJNI.new_IndexShards__SWIG_3(d, threaded, successive_ids), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexShards(int d, boolean threaded) {
|
||||||
|
this(swigfaissJNI.new_IndexShards__SWIG_4(d, threaded), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexShards(int d) {
|
||||||
|
this(swigfaissJNI.new_IndexShards__SWIG_5(d), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void add_shard(Index index) {
|
||||||
|
swigfaissJNI.IndexShards_add_shard(swigCPtr, this, Index.getCPtr(index), index);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void remove_shard(Index index) {
|
||||||
|
swigfaissJNI.IndexShards_remove_shard(swigCPtr, this, Index.getCPtr(index), index);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void add(long n, SWIGTYPE_p_float x) {
|
||||||
|
swigfaissJNI.IndexShards_add(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void add_with_ids(long n, SWIGTYPE_p_float x, LongVector xids) {
|
||||||
|
swigfaissJNI.IndexShards_add_with_ids(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_long_long.getCPtr(xids.data()), xids);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void search(long n, SWIGTYPE_p_float x, long k, SWIGTYPE_p_float distances, LongVector labels) {
|
||||||
|
swigfaissJNI.IndexShards_search(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), k, SWIGTYPE_p_float.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void train(long n, SWIGTYPE_p_float x) {
|
||||||
|
swigfaissJNI.IndexShards_train(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSuccessive_ids(boolean value) {
|
||||||
|
swigfaissJNI.IndexShards_successive_ids_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getSuccessive_ids() {
|
||||||
|
return swigfaissJNI.IndexShards_successive_ids_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void syncWithSubIndexes() {
|
||||||
|
swigfaissJNI.IndexShards_syncWithSubIndexes(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,96 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class IndexSplitVectors extends Index {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
|
||||||
|
protected IndexSplitVectors(long cPtr, boolean cMemoryOwn) {
|
||||||
|
super(swigfaissJNI.IndexSplitVectors_SWIGUpcast(cPtr), cMemoryOwn);
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(IndexSplitVectors obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_IndexSplitVectors(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
super.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOwn_fields(boolean value) {
|
||||||
|
swigfaissJNI.IndexSplitVectors_own_fields_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getOwn_fields() {
|
||||||
|
return swigfaissJNI.IndexSplitVectors_own_fields_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setThreaded(boolean value) {
|
||||||
|
swigfaissJNI.IndexSplitVectors_threaded_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getThreaded() {
|
||||||
|
return swigfaissJNI.IndexSplitVectors_threaded_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSub_indexes(SWIGTYPE_p_std__vectorT_faiss__Index_p_t value) {
|
||||||
|
swigfaissJNI.IndexSplitVectors_sub_indexes_set(swigCPtr, this, SWIGTYPE_p_std__vectorT_faiss__Index_p_t.getCPtr(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
public SWIGTYPE_p_std__vectorT_faiss__Index_p_t getSub_indexes() {
|
||||||
|
long cPtr = swigfaissJNI.IndexSplitVectors_sub_indexes_get(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new SWIGTYPE_p_std__vectorT_faiss__Index_p_t(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSum_d(long value) {
|
||||||
|
swigfaissJNI.IndexSplitVectors_sum_d_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getSum_d() {
|
||||||
|
return swigfaissJNI.IndexSplitVectors_sum_d_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void add_sub_index(Index arg0) {
|
||||||
|
swigfaissJNI.IndexSplitVectors_add_sub_index(swigCPtr, this, Index.getCPtr(arg0), arg0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sync_with_sub_indexes() {
|
||||||
|
swigfaissJNI.IndexSplitVectors_sync_with_sub_indexes(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void add(long n, SWIGTYPE_p_float x) {
|
||||||
|
swigfaissJNI.IndexSplitVectors_add(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void search(long n, SWIGTYPE_p_float x, long k, SWIGTYPE_p_float distances, LongVector labels) {
|
||||||
|
swigfaissJNI.IndexSplitVectors_search(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), k, SWIGTYPE_p_float.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void train(long n, SWIGTYPE_p_float x) {
|
||||||
|
swigfaissJNI.IndexSplitVectors_train(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reset() {
|
||||||
|
swigfaissJNI.IndexSplitVectors_reset(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
76
ann/src/main/java/com/twitter/ann/faiss/swig/IntVector.java
Normal file
76
ann/src/main/java/com/twitter/ann/faiss/swig/IntVector.java
Normal file
|
@ -0,0 +1,76 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class IntVector {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
protected transient boolean swigCMemOwn;
|
||||||
|
|
||||||
|
protected IntVector(long cPtr, boolean cMemoryOwn) {
|
||||||
|
swigCMemOwn = cMemoryOwn;
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(IntVector obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_IntVector(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public IntVector() {
|
||||||
|
this(swigfaissJNI.new_IntVector(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void push_back(int arg0) {
|
||||||
|
swigfaissJNI.IntVector_push_back(swigCPtr, this, arg0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clear() {
|
||||||
|
swigfaissJNI.IntVector_clear(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SWIGTYPE_p_int data() {
|
||||||
|
long cPtr = swigfaissJNI.IntVector_data(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new SWIGTYPE_p_int(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long size() {
|
||||||
|
return swigfaissJNI.IntVector_size(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int at(long n) {
|
||||||
|
return swigfaissJNI.IntVector_at(swigCPtr, this, n);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void resize(long n) {
|
||||||
|
swigfaissJNI.IntVector_resize(swigCPtr, this, n);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reserve(long n) {
|
||||||
|
swigfaissJNI.IntVector_reserve(swigCPtr, this, n);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void swap(IntVector other) {
|
||||||
|
swigfaissJNI.IntVector_swap(swigCPtr, this, IntVector.getCPtr(other), other);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,59 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class InterruptCallback {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
protected transient boolean swigCMemOwn;
|
||||||
|
|
||||||
|
protected InterruptCallback(long cPtr, boolean cMemoryOwn) {
|
||||||
|
swigCMemOwn = cMemoryOwn;
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(InterruptCallback obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_InterruptCallback(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean want_interrupt() {
|
||||||
|
return swigfaissJNI.InterruptCallback_want_interrupt(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void clear_instance() {
|
||||||
|
swigfaissJNI.InterruptCallback_clear_instance();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void check() {
|
||||||
|
swigfaissJNI.InterruptCallback_check();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean is_interrupted() {
|
||||||
|
return swigfaissJNI.InterruptCallback_is_interrupted();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static long get_period_hint(long flops) {
|
||||||
|
return swigfaissJNI.InterruptCallback_get_period_hint(flops);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,55 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class IntersectionCriterion extends AutoTuneCriterion {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
|
||||||
|
protected IntersectionCriterion(long cPtr, boolean cMemoryOwn) {
|
||||||
|
super(swigfaissJNI.IntersectionCriterion_SWIGUpcast(cPtr), cMemoryOwn);
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(IntersectionCriterion obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_IntersectionCriterion(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
super.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setR(long value) {
|
||||||
|
swigfaissJNI.IntersectionCriterion_R_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getR() {
|
||||||
|
return swigfaissJNI.IntersectionCriterion_R_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IntersectionCriterion(long nq, long R) {
|
||||||
|
this(swigfaissJNI.new_IntersectionCriterion(nq, R), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public double evaluate(SWIGTYPE_p_float D, LongVector I) {
|
||||||
|
return swigfaissJNI.IntersectionCriterion_evaluate(swigCPtr, this, SWIGTYPE_p_float.getCPtr(D), SWIGTYPE_p_long_long.getCPtr(I.data()), I);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
262
ann/src/main/java/com/twitter/ann/faiss/swig/InvertedLists.java
Normal file
262
ann/src/main/java/com/twitter/ann/faiss/swig/InvertedLists.java
Normal file
|
@ -0,0 +1,262 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class InvertedLists {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
protected transient boolean swigCMemOwn;
|
||||||
|
|
||||||
|
protected InvertedLists(long cPtr, boolean cMemoryOwn) {
|
||||||
|
swigCMemOwn = cMemoryOwn;
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(InvertedLists obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_InvertedLists(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNlist(long value) {
|
||||||
|
swigfaissJNI.InvertedLists_nlist_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getNlist() {
|
||||||
|
return swigfaissJNI.InvertedLists_nlist_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCode_size(long value) {
|
||||||
|
swigfaissJNI.InvertedLists_code_size_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getCode_size() {
|
||||||
|
return swigfaissJNI.InvertedLists_code_size_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long list_size(long list_no) {
|
||||||
|
return swigfaissJNI.InvertedLists_list_size(swigCPtr, this, list_no);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SWIGTYPE_p_unsigned_char get_codes(long list_no) {
|
||||||
|
long cPtr = swigfaissJNI.InvertedLists_get_codes(swigCPtr, this, list_no);
|
||||||
|
return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public LongVector get_ids(long list_no) {
|
||||||
|
return new LongVector(swigfaissJNI.InvertedLists_get_ids(swigCPtr, this, list_no), false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void release_codes(long list_no, SWIGTYPE_p_unsigned_char codes) {
|
||||||
|
swigfaissJNI.InvertedLists_release_codes(swigCPtr, this, list_no, SWIGTYPE_p_unsigned_char.getCPtr(codes));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void release_ids(long list_no, LongVector ids) {
|
||||||
|
swigfaissJNI.InvertedLists_release_ids(swigCPtr, this, list_no, SWIGTYPE_p_long_long.getCPtr(ids.data()), ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long get_single_id(long list_no, long offset) {
|
||||||
|
return swigfaissJNI.InvertedLists_get_single_id(swigCPtr, this, list_no, offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SWIGTYPE_p_unsigned_char get_single_code(long list_no, long offset) {
|
||||||
|
long cPtr = swigfaissJNI.InvertedLists_get_single_code(swigCPtr, this, list_no, offset);
|
||||||
|
return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void prefetch_lists(LongVector list_nos, int nlist) {
|
||||||
|
swigfaissJNI.InvertedLists_prefetch_lists(swigCPtr, this, SWIGTYPE_p_long_long.getCPtr(list_nos.data()), list_nos, nlist);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long add_entry(long list_no, long theid, SWIGTYPE_p_unsigned_char code) {
|
||||||
|
return swigfaissJNI.InvertedLists_add_entry(swigCPtr, this, list_no, theid, SWIGTYPE_p_unsigned_char.getCPtr(code));
|
||||||
|
}
|
||||||
|
|
||||||
|
public long add_entries(long list_no, long n_entry, LongVector ids, SWIGTYPE_p_unsigned_char code) {
|
||||||
|
return swigfaissJNI.InvertedLists_add_entries(swigCPtr, this, list_no, n_entry, SWIGTYPE_p_long_long.getCPtr(ids.data()), ids, SWIGTYPE_p_unsigned_char.getCPtr(code));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void update_entry(long list_no, long offset, long id, SWIGTYPE_p_unsigned_char code) {
|
||||||
|
swigfaissJNI.InvertedLists_update_entry(swigCPtr, this, list_no, offset, id, SWIGTYPE_p_unsigned_char.getCPtr(code));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void update_entries(long list_no, long offset, long n_entry, LongVector ids, SWIGTYPE_p_unsigned_char code) {
|
||||||
|
swigfaissJNI.InvertedLists_update_entries(swigCPtr, this, list_no, offset, n_entry, SWIGTYPE_p_long_long.getCPtr(ids.data()), ids, SWIGTYPE_p_unsigned_char.getCPtr(code));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void resize(long list_no, long new_size) {
|
||||||
|
swigfaissJNI.InvertedLists_resize(swigCPtr, this, list_no, new_size);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reset() {
|
||||||
|
swigfaissJNI.InvertedLists_reset(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void merge_from(InvertedLists oivf, long add_id) {
|
||||||
|
swigfaissJNI.InvertedLists_merge_from(swigCPtr, this, InvertedLists.getCPtr(oivf), oivf, add_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public double imbalance_factor() {
|
||||||
|
return swigfaissJNI.InvertedLists_imbalance_factor(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void print_stats() {
|
||||||
|
swigfaissJNI.InvertedLists_print_stats(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long compute_ntotal() {
|
||||||
|
return swigfaissJNI.InvertedLists_compute_ntotal(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
static public class ScopedIds {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
protected transient boolean swigCMemOwn;
|
||||||
|
|
||||||
|
protected ScopedIds(long cPtr, boolean cMemoryOwn) {
|
||||||
|
swigCMemOwn = cMemoryOwn;
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(ScopedIds obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_InvertedLists_ScopedIds(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIl(InvertedLists value) {
|
||||||
|
swigfaissJNI.InvertedLists_ScopedIds_il_set(swigCPtr, this, InvertedLists.getCPtr(value), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public InvertedLists getIl() {
|
||||||
|
long cPtr = swigfaissJNI.InvertedLists_ScopedIds_il_get(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new InvertedLists(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIds(LongVector value) {
|
||||||
|
swigfaissJNI.InvertedLists_ScopedIds_ids_set(swigCPtr, this, SWIGTYPE_p_long_long.getCPtr(value.data()), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public LongVector getIds() {
|
||||||
|
return new LongVector(swigfaissJNI.InvertedLists_ScopedIds_ids_get(swigCPtr, this), false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setList_no(long value) {
|
||||||
|
swigfaissJNI.InvertedLists_ScopedIds_list_no_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getList_no() {
|
||||||
|
return swigfaissJNI.InvertedLists_ScopedIds_list_no_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScopedIds(InvertedLists il, long list_no) {
|
||||||
|
this(swigfaissJNI.new_InvertedLists_ScopedIds(InvertedLists.getCPtr(il), il, list_no), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public LongVector get() {
|
||||||
|
return new LongVector(swigfaissJNI.InvertedLists_ScopedIds_get(swigCPtr, this), false);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static public class ScopedCodes {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
protected transient boolean swigCMemOwn;
|
||||||
|
|
||||||
|
protected ScopedCodes(long cPtr, boolean cMemoryOwn) {
|
||||||
|
swigCMemOwn = cMemoryOwn;
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(ScopedCodes obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_InvertedLists_ScopedCodes(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIl(InvertedLists value) {
|
||||||
|
swigfaissJNI.InvertedLists_ScopedCodes_il_set(swigCPtr, this, InvertedLists.getCPtr(value), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public InvertedLists getIl() {
|
||||||
|
long cPtr = swigfaissJNI.InvertedLists_ScopedCodes_il_get(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new InvertedLists(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCodes(SWIGTYPE_p_unsigned_char value) {
|
||||||
|
swigfaissJNI.InvertedLists_ScopedCodes_codes_set(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
public SWIGTYPE_p_unsigned_char getCodes() {
|
||||||
|
long cPtr = swigfaissJNI.InvertedLists_ScopedCodes_codes_get(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setList_no(long value) {
|
||||||
|
swigfaissJNI.InvertedLists_ScopedCodes_list_no_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getList_no() {
|
||||||
|
return swigfaissJNI.InvertedLists_ScopedCodes_list_no_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScopedCodes(InvertedLists il, long list_no) {
|
||||||
|
this(swigfaissJNI.new_InvertedLists_ScopedCodes__SWIG_0(InvertedLists.getCPtr(il), il, list_no), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScopedCodes(InvertedLists il, long list_no, long offset) {
|
||||||
|
this(swigfaissJNI.new_InvertedLists_ScopedCodes__SWIG_1(InvertedLists.getCPtr(il), il, list_no, offset), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SWIGTYPE_p_unsigned_char get() {
|
||||||
|
long cPtr = swigfaissJNI.InvertedLists_ScopedCodes_get(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public final static long INVALID_CODE_SIZE = swigfaissJNI.InvertedLists_INVALID_CODE_SIZE_get();
|
||||||
|
}
|
|
@ -0,0 +1,77 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class InvertedListsPtrVector {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
protected transient boolean swigCMemOwn;
|
||||||
|
|
||||||
|
protected InvertedListsPtrVector(long cPtr, boolean cMemoryOwn) {
|
||||||
|
swigCMemOwn = cMemoryOwn;
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(InvertedListsPtrVector obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_InvertedListsPtrVector(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public InvertedListsPtrVector() {
|
||||||
|
this(swigfaissJNI.new_InvertedListsPtrVector(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void push_back(InvertedLists arg0) {
|
||||||
|
swigfaissJNI.InvertedListsPtrVector_push_back(swigCPtr, this, InvertedLists.getCPtr(arg0), arg0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clear() {
|
||||||
|
swigfaissJNI.InvertedListsPtrVector_clear(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SWIGTYPE_p_p_faiss__InvertedLists data() {
|
||||||
|
long cPtr = swigfaissJNI.InvertedListsPtrVector_data(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new SWIGTYPE_p_p_faiss__InvertedLists(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long size() {
|
||||||
|
return swigfaissJNI.InvertedListsPtrVector_size(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public InvertedLists at(long n) {
|
||||||
|
long cPtr = swigfaissJNI.InvertedListsPtrVector_at(swigCPtr, this, n);
|
||||||
|
return (cPtr == 0) ? null : new InvertedLists(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void resize(long n) {
|
||||||
|
swigfaissJNI.InvertedListsPtrVector_resize(swigCPtr, this, n);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reserve(long n) {
|
||||||
|
swigfaissJNI.InvertedListsPtrVector_reserve(swigCPtr, this, n);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void swap(InvertedListsPtrVector other) {
|
||||||
|
swigfaissJNI.InvertedListsPtrVector_swap(swigCPtr, this, InvertedListsPtrVector.getCPtr(other), other);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,114 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class Level1Quantizer {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
protected transient boolean swigCMemOwn;
|
||||||
|
|
||||||
|
protected Level1Quantizer(long cPtr, boolean cMemoryOwn) {
|
||||||
|
swigCMemOwn = cMemoryOwn;
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(Level1Quantizer obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_Level1Quantizer(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQuantizer(Index value) {
|
||||||
|
swigfaissJNI.Level1Quantizer_quantizer_set(swigCPtr, this, Index.getCPtr(value), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Index getQuantizer() {
|
||||||
|
long cPtr = swigfaissJNI.Level1Quantizer_quantizer_get(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new Index(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNlist(long value) {
|
||||||
|
swigfaissJNI.Level1Quantizer_nlist_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getNlist() {
|
||||||
|
return swigfaissJNI.Level1Quantizer_nlist_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQuantizer_trains_alone(char value) {
|
||||||
|
swigfaissJNI.Level1Quantizer_quantizer_trains_alone_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public char getQuantizer_trains_alone() {
|
||||||
|
return swigfaissJNI.Level1Quantizer_quantizer_trains_alone_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOwn_fields(boolean value) {
|
||||||
|
swigfaissJNI.Level1Quantizer_own_fields_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getOwn_fields() {
|
||||||
|
return swigfaissJNI.Level1Quantizer_own_fields_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCp(ClusteringParameters value) {
|
||||||
|
swigfaissJNI.Level1Quantizer_cp_set(swigCPtr, this, ClusteringParameters.getCPtr(value), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ClusteringParameters getCp() {
|
||||||
|
long cPtr = swigfaissJNI.Level1Quantizer_cp_get(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new ClusteringParameters(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setClustering_index(Index value) {
|
||||||
|
swigfaissJNI.Level1Quantizer_clustering_index_set(swigCPtr, this, Index.getCPtr(value), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Index getClustering_index() {
|
||||||
|
long cPtr = swigfaissJNI.Level1Quantizer_clustering_index_get(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new Index(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void train_q1(long n, SWIGTYPE_p_float x, boolean verbose, MetricType metric_type) {
|
||||||
|
swigfaissJNI.Level1Quantizer_train_q1(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), verbose, metric_type.swigValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
public long coarse_code_size() {
|
||||||
|
return swigfaissJNI.Level1Quantizer_coarse_code_size(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void encode_listno(long list_no, SWIGTYPE_p_unsigned_char code) {
|
||||||
|
swigfaissJNI.Level1Quantizer_encode_listno(swigCPtr, this, list_no, SWIGTYPE_p_unsigned_char.getCPtr(code));
|
||||||
|
}
|
||||||
|
|
||||||
|
public long decode_listno(SWIGTYPE_p_unsigned_char code) {
|
||||||
|
return swigfaissJNI.Level1Quantizer_decode_listno(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(code));
|
||||||
|
}
|
||||||
|
|
||||||
|
public Level1Quantizer(Index quantizer, long nlist) {
|
||||||
|
this(swigfaissJNI.new_Level1Quantizer__SWIG_0(Index.getCPtr(quantizer), quantizer, nlist), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Level1Quantizer() {
|
||||||
|
this(swigfaissJNI.new_Level1Quantizer__SWIG_1(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,117 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class LinearTransform extends VectorTransform {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
|
||||||
|
protected LinearTransform(long cPtr, boolean cMemoryOwn) {
|
||||||
|
super(swigfaissJNI.LinearTransform_SWIGUpcast(cPtr), cMemoryOwn);
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(LinearTransform obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_LinearTransform(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
super.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHave_bias(boolean value) {
|
||||||
|
swigfaissJNI.LinearTransform_have_bias_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getHave_bias() {
|
||||||
|
return swigfaissJNI.LinearTransform_have_bias_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIs_orthonormal(boolean value) {
|
||||||
|
swigfaissJNI.LinearTransform_is_orthonormal_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getIs_orthonormal() {
|
||||||
|
return swigfaissJNI.LinearTransform_is_orthonormal_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setA(FloatVector value) {
|
||||||
|
swigfaissJNI.LinearTransform_A_set(swigCPtr, this, FloatVector.getCPtr(value), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public FloatVector getA() {
|
||||||
|
long cPtr = swigfaissJNI.LinearTransform_A_get(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new FloatVector(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setB(FloatVector value) {
|
||||||
|
swigfaissJNI.LinearTransform_b_set(swigCPtr, this, FloatVector.getCPtr(value), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public FloatVector getB() {
|
||||||
|
long cPtr = swigfaissJNI.LinearTransform_b_get(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new FloatVector(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public LinearTransform(int d_in, int d_out, boolean have_bias) {
|
||||||
|
this(swigfaissJNI.new_LinearTransform__SWIG_0(d_in, d_out, have_bias), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public LinearTransform(int d_in, int d_out) {
|
||||||
|
this(swigfaissJNI.new_LinearTransform__SWIG_1(d_in, d_out), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public LinearTransform(int d_in) {
|
||||||
|
this(swigfaissJNI.new_LinearTransform__SWIG_2(d_in), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public LinearTransform() {
|
||||||
|
this(swigfaissJNI.new_LinearTransform__SWIG_3(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void apply_noalloc(long n, SWIGTYPE_p_float x, SWIGTYPE_p_float xt) {
|
||||||
|
swigfaissJNI.LinearTransform_apply_noalloc(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_float.getCPtr(xt));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void transform_transpose(long n, SWIGTYPE_p_float y, SWIGTYPE_p_float x) {
|
||||||
|
swigfaissJNI.LinearTransform_transform_transpose(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(y), SWIGTYPE_p_float.getCPtr(x));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reverse_transform(long n, SWIGTYPE_p_float xt, SWIGTYPE_p_float x) {
|
||||||
|
swigfaissJNI.LinearTransform_reverse_transform(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(xt), SWIGTYPE_p_float.getCPtr(x));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void set_is_orthonormal() {
|
||||||
|
swigfaissJNI.LinearTransform_set_is_orthonormal(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVerbose(boolean value) {
|
||||||
|
swigfaissJNI.LinearTransform_verbose_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getVerbose() {
|
||||||
|
return swigfaissJNI.LinearTransform_verbose_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void print_if_verbose(String name, DoubleVector mat, int n, int d) {
|
||||||
|
swigfaissJNI.LinearTransform_print_if_verbose(swigCPtr, this, name, DoubleVector.getCPtr(mat), mat, n, d);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
76
ann/src/main/java/com/twitter/ann/faiss/swig/LongVector.java
Normal file
76
ann/src/main/java/com/twitter/ann/faiss/swig/LongVector.java
Normal file
|
@ -0,0 +1,76 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class LongVector {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
protected transient boolean swigCMemOwn;
|
||||||
|
|
||||||
|
protected LongVector(long cPtr, boolean cMemoryOwn) {
|
||||||
|
swigCMemOwn = cMemoryOwn;
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(LongVector obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_LongVector(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public LongVector() {
|
||||||
|
this(swigfaissJNI.new_LongVector(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void push_back(long arg0) {
|
||||||
|
swigfaissJNI.LongVector_push_back(swigCPtr, this, arg0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clear() {
|
||||||
|
swigfaissJNI.LongVector_clear(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SWIGTYPE_p_long_long data() {
|
||||||
|
long cPtr = swigfaissJNI.LongVector_data(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new SWIGTYPE_p_long_long(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long size() {
|
||||||
|
return swigfaissJNI.LongVector_size(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long at(long n) {
|
||||||
|
return swigfaissJNI.LongVector_at(swigCPtr, this, n);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void resize(long n) {
|
||||||
|
swigfaissJNI.LongVector_resize(swigCPtr, this, n);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reserve(long n) {
|
||||||
|
swigfaissJNI.LongVector_reserve(swigCPtr, this, n);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void swap(LongVector other) {
|
||||||
|
swigfaissJNI.LongVector_swap(swigCPtr, this, LongVector.getCPtr(other), other);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,76 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class LongVectorVector {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
protected transient boolean swigCMemOwn;
|
||||||
|
|
||||||
|
protected LongVectorVector(long cPtr, boolean cMemoryOwn) {
|
||||||
|
swigCMemOwn = cMemoryOwn;
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(LongVectorVector obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_LongVectorVector(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public LongVectorVector() {
|
||||||
|
this(swigfaissJNI.new_LongVectorVector(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void push_back(SWIGTYPE_p_std__vectorT_long_t arg0) {
|
||||||
|
swigfaissJNI.LongVectorVector_push_back(swigCPtr, this, SWIGTYPE_p_std__vectorT_long_t.getCPtr(arg0));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clear() {
|
||||||
|
swigfaissJNI.LongVectorVector_clear(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SWIGTYPE_p_std__vectorT_long_t data() {
|
||||||
|
long cPtr = swigfaissJNI.LongVectorVector_data(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new SWIGTYPE_p_std__vectorT_long_t(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long size() {
|
||||||
|
return swigfaissJNI.LongVectorVector_size(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SWIGTYPE_p_std__vectorT_long_t at(long n) {
|
||||||
|
return new SWIGTYPE_p_std__vectorT_long_t(swigfaissJNI.LongVectorVector_at(swigCPtr, this, n), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void resize(long n) {
|
||||||
|
swigfaissJNI.LongVectorVector_resize(swigCPtr, this, n);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reserve(long n) {
|
||||||
|
swigfaissJNI.LongVectorVector_reserve(swigCPtr, this, n);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void swap(LongVectorVector other) {
|
||||||
|
swigfaissJNI.LongVectorVector_swap(swigCPtr, this, LongVectorVector.getCPtr(other), other);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,63 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class MapLong2Long {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
protected transient boolean swigCMemOwn;
|
||||||
|
|
||||||
|
protected MapLong2Long(long cPtr, boolean cMemoryOwn) {
|
||||||
|
swigCMemOwn = cMemoryOwn;
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(MapLong2Long obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_MapLong2Long(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMap(SWIGTYPE_p_std__unordered_mapT_long_long_t value) {
|
||||||
|
swigfaissJNI.MapLong2Long_map_set(swigCPtr, this, SWIGTYPE_p_std__unordered_mapT_long_long_t.getCPtr(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
public SWIGTYPE_p_std__unordered_mapT_long_long_t getMap() {
|
||||||
|
return new SWIGTYPE_p_std__unordered_mapT_long_long_t(swigfaissJNI.MapLong2Long_map_get(swigCPtr, this), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void add(long n, SWIGTYPE_p_long keys, SWIGTYPE_p_long vals) {
|
||||||
|
swigfaissJNI.MapLong2Long_add(swigCPtr, this, n, SWIGTYPE_p_long.getCPtr(keys), SWIGTYPE_p_long.getCPtr(vals));
|
||||||
|
}
|
||||||
|
|
||||||
|
public int search(int key) {
|
||||||
|
return swigfaissJNI.MapLong2Long_search(swigCPtr, this, key);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void search_multiple(long n, SWIGTYPE_p_long keys, SWIGTYPE_p_long vals) {
|
||||||
|
swigfaissJNI.MapLong2Long_search_multiple(swigCPtr, this, n, SWIGTYPE_p_long.getCPtr(keys), SWIGTYPE_p_long.getCPtr(vals));
|
||||||
|
}
|
||||||
|
|
||||||
|
public MapLong2Long() {
|
||||||
|
this(swigfaissJNI.new_MapLong2Long(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,95 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class MaskedInvertedLists extends ReadOnlyInvertedLists {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
|
||||||
|
protected MaskedInvertedLists(long cPtr, boolean cMemoryOwn) {
|
||||||
|
super(swigfaissJNI.MaskedInvertedLists_SWIGUpcast(cPtr), cMemoryOwn);
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(MaskedInvertedLists obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_MaskedInvertedLists(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
super.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIl0(InvertedLists value) {
|
||||||
|
swigfaissJNI.MaskedInvertedLists_il0_set(swigCPtr, this, InvertedLists.getCPtr(value), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public InvertedLists getIl0() {
|
||||||
|
long cPtr = swigfaissJNI.MaskedInvertedLists_il0_get(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new InvertedLists(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIl1(InvertedLists value) {
|
||||||
|
swigfaissJNI.MaskedInvertedLists_il1_set(swigCPtr, this, InvertedLists.getCPtr(value), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public InvertedLists getIl1() {
|
||||||
|
long cPtr = swigfaissJNI.MaskedInvertedLists_il1_get(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new InvertedLists(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public MaskedInvertedLists(InvertedLists il0, InvertedLists il1) {
|
||||||
|
this(swigfaissJNI.new_MaskedInvertedLists(InvertedLists.getCPtr(il0), il0, InvertedLists.getCPtr(il1), il1), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long list_size(long list_no) {
|
||||||
|
return swigfaissJNI.MaskedInvertedLists_list_size(swigCPtr, this, list_no);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SWIGTYPE_p_unsigned_char get_codes(long list_no) {
|
||||||
|
long cPtr = swigfaissJNI.MaskedInvertedLists_get_codes(swigCPtr, this, list_no);
|
||||||
|
return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public LongVector get_ids(long list_no) {
|
||||||
|
return new LongVector(swigfaissJNI.MaskedInvertedLists_get_ids(swigCPtr, this, list_no), false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void release_codes(long list_no, SWIGTYPE_p_unsigned_char codes) {
|
||||||
|
swigfaissJNI.MaskedInvertedLists_release_codes(swigCPtr, this, list_no, SWIGTYPE_p_unsigned_char.getCPtr(codes));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void release_ids(long list_no, LongVector ids) {
|
||||||
|
swigfaissJNI.MaskedInvertedLists_release_ids(swigCPtr, this, list_no, SWIGTYPE_p_long_long.getCPtr(ids.data()), ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long get_single_id(long list_no, long offset) {
|
||||||
|
return swigfaissJNI.MaskedInvertedLists_get_single_id(swigCPtr, this, list_no, offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SWIGTYPE_p_unsigned_char get_single_code(long list_no, long offset) {
|
||||||
|
long cPtr = swigfaissJNI.MaskedInvertedLists_get_single_code(swigCPtr, this, list_no, offset);
|
||||||
|
return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void prefetch_lists(LongVector list_nos, int nlist) {
|
||||||
|
swigfaissJNI.MaskedInvertedLists_prefetch_lists(swigCPtr, this, SWIGTYPE_p_long_long.getCPtr(list_nos.data()), list_nos, nlist);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
60
ann/src/main/java/com/twitter/ann/faiss/swig/MetricType.java
Normal file
60
ann/src/main/java/com/twitter/ann/faiss/swig/MetricType.java
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public final class MetricType {
|
||||||
|
public final static MetricType METRIC_INNER_PRODUCT = new MetricType("METRIC_INNER_PRODUCT", swigfaissJNI.METRIC_INNER_PRODUCT_get());
|
||||||
|
public final static MetricType METRIC_L2 = new MetricType("METRIC_L2", swigfaissJNI.METRIC_L2_get());
|
||||||
|
public final static MetricType METRIC_L1 = new MetricType("METRIC_L1");
|
||||||
|
public final static MetricType METRIC_Linf = new MetricType("METRIC_Linf");
|
||||||
|
public final static MetricType METRIC_Lp = new MetricType("METRIC_Lp");
|
||||||
|
public final static MetricType METRIC_Canberra = new MetricType("METRIC_Canberra", swigfaissJNI.METRIC_Canberra_get());
|
||||||
|
public final static MetricType METRIC_BrayCurtis = new MetricType("METRIC_BrayCurtis");
|
||||||
|
public final static MetricType METRIC_JensenShannon = new MetricType("METRIC_JensenShannon");
|
||||||
|
|
||||||
|
public final int swigValue() {
|
||||||
|
return swigValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toString() {
|
||||||
|
return swigName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static MetricType swigToEnum(int swigValue) {
|
||||||
|
if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
|
||||||
|
return swigValues[swigValue];
|
||||||
|
for (int i = 0; i < swigValues.length; i++)
|
||||||
|
if (swigValues[i].swigValue == swigValue)
|
||||||
|
return swigValues[i];
|
||||||
|
throw new IllegalArgumentException("No enum " + MetricType.class + " with value " + swigValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
private MetricType(String swigName) {
|
||||||
|
this.swigName = swigName;
|
||||||
|
this.swigValue = swigNext++;
|
||||||
|
}
|
||||||
|
|
||||||
|
private MetricType(String swigName, int swigValue) {
|
||||||
|
this.swigName = swigName;
|
||||||
|
this.swigValue = swigValue;
|
||||||
|
swigNext = swigValue+1;
|
||||||
|
}
|
||||||
|
|
||||||
|
private MetricType(String swigName, MetricType swigEnum) {
|
||||||
|
this.swigName = swigName;
|
||||||
|
this.swigValue = swigEnum.swigValue;
|
||||||
|
swigNext = this.swigValue+1;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static MetricType[] swigValues = { METRIC_INNER_PRODUCT, METRIC_L2, METRIC_L1, METRIC_Linf, METRIC_Lp, METRIC_Canberra, METRIC_BrayCurtis, METRIC_JensenShannon };
|
||||||
|
private static int swigNext = 0;
|
||||||
|
private final int swigValue;
|
||||||
|
private final String swigName;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,76 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class MultiIndexQuantizer extends Index {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
|
||||||
|
protected MultiIndexQuantizer(long cPtr, boolean cMemoryOwn) {
|
||||||
|
super(swigfaissJNI.MultiIndexQuantizer_SWIGUpcast(cPtr), cMemoryOwn);
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(MultiIndexQuantizer obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_MultiIndexQuantizer(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
super.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPq(ProductQuantizer value) {
|
||||||
|
swigfaissJNI.MultiIndexQuantizer_pq_set(swigCPtr, this, ProductQuantizer.getCPtr(value), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProductQuantizer getPq() {
|
||||||
|
long cPtr = swigfaissJNI.MultiIndexQuantizer_pq_get(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new ProductQuantizer(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public MultiIndexQuantizer(int d, long M, long nbits) {
|
||||||
|
this(swigfaissJNI.new_MultiIndexQuantizer__SWIG_0(d, M, nbits), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void train(long n, SWIGTYPE_p_float x) {
|
||||||
|
swigfaissJNI.MultiIndexQuantizer_train(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void search(long n, SWIGTYPE_p_float x, long k, SWIGTYPE_p_float distances, LongVector labels) {
|
||||||
|
swigfaissJNI.MultiIndexQuantizer_search(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), k, SWIGTYPE_p_float.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void add(long n, SWIGTYPE_p_float x) {
|
||||||
|
swigfaissJNI.MultiIndexQuantizer_add(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reset() {
|
||||||
|
swigfaissJNI.MultiIndexQuantizer_reset(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public MultiIndexQuantizer() {
|
||||||
|
this(swigfaissJNI.new_MultiIndexQuantizer__SWIG_1(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reconstruct(long key, SWIGTYPE_p_float recons) {
|
||||||
|
swigfaissJNI.MultiIndexQuantizer_reconstruct(swigCPtr, this, key, SWIGTYPE_p_float.getCPtr(recons));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,72 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class MultiIndexQuantizer2 extends MultiIndexQuantizer {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
|
||||||
|
protected MultiIndexQuantizer2(long cPtr, boolean cMemoryOwn) {
|
||||||
|
super(swigfaissJNI.MultiIndexQuantizer2_SWIGUpcast(cPtr), cMemoryOwn);
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(MultiIndexQuantizer2 obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_MultiIndexQuantizer2(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
super.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAssign_indexes(SWIGTYPE_p_std__vectorT_faiss__Index_p_t value) {
|
||||||
|
swigfaissJNI.MultiIndexQuantizer2_assign_indexes_set(swigCPtr, this, SWIGTYPE_p_std__vectorT_faiss__Index_p_t.getCPtr(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
public SWIGTYPE_p_std__vectorT_faiss__Index_p_t getAssign_indexes() {
|
||||||
|
long cPtr = swigfaissJNI.MultiIndexQuantizer2_assign_indexes_get(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new SWIGTYPE_p_std__vectorT_faiss__Index_p_t(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOwn_fields(boolean value) {
|
||||||
|
swigfaissJNI.MultiIndexQuantizer2_own_fields_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getOwn_fields() {
|
||||||
|
return swigfaissJNI.MultiIndexQuantizer2_own_fields_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public MultiIndexQuantizer2(int d, long M, long nbits, SWIGTYPE_p_p_faiss__Index indexes) {
|
||||||
|
this(swigfaissJNI.new_MultiIndexQuantizer2__SWIG_0(d, M, nbits, SWIGTYPE_p_p_faiss__Index.getCPtr(indexes)), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public MultiIndexQuantizer2(int d, long nbits, Index assign_index_0, Index assign_index_1) {
|
||||||
|
this(swigfaissJNI.new_MultiIndexQuantizer2__SWIG_1(d, nbits, Index.getCPtr(assign_index_0), assign_index_0, Index.getCPtr(assign_index_1), assign_index_1), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void train(long n, SWIGTYPE_p_float x) {
|
||||||
|
swigfaissJNI.MultiIndexQuantizer2_train(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void search(long n, SWIGTYPE_p_float x, long k, SWIGTYPE_p_float distances, LongVector labels) {
|
||||||
|
swigfaissJNI.MultiIndexQuantizer2_search(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), k, SWIGTYPE_p_float.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,67 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class NormalizationTransform extends VectorTransform {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
|
||||||
|
protected NormalizationTransform(long cPtr, boolean cMemoryOwn) {
|
||||||
|
super(swigfaissJNI.NormalizationTransform_SWIGUpcast(cPtr), cMemoryOwn);
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(NormalizationTransform obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_NormalizationTransform(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
super.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNorm(float value) {
|
||||||
|
swigfaissJNI.NormalizationTransform_norm_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getNorm() {
|
||||||
|
return swigfaissJNI.NormalizationTransform_norm_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public NormalizationTransform(int d, float norm) {
|
||||||
|
this(swigfaissJNI.new_NormalizationTransform__SWIG_0(d, norm), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public NormalizationTransform(int d) {
|
||||||
|
this(swigfaissJNI.new_NormalizationTransform__SWIG_1(d), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public NormalizationTransform() {
|
||||||
|
this(swigfaissJNI.new_NormalizationTransform__SWIG_2(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void apply_noalloc(long n, SWIGTYPE_p_float x, SWIGTYPE_p_float xt) {
|
||||||
|
swigfaissJNI.NormalizationTransform_apply_noalloc(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_float.getCPtr(xt));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reverse_transform(long n, SWIGTYPE_p_float xt, SWIGTYPE_p_float x) {
|
||||||
|
swigfaissJNI.NormalizationTransform_reverse_transform(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(xt), SWIGTYPE_p_float.getCPtr(x));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
116
ann/src/main/java/com/twitter/ann/faiss/swig/OPQMatrix.java
Normal file
116
ann/src/main/java/com/twitter/ann/faiss/swig/OPQMatrix.java
Normal file
|
@ -0,0 +1,116 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class OPQMatrix extends LinearTransform {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
|
||||||
|
protected OPQMatrix(long cPtr, boolean cMemoryOwn) {
|
||||||
|
super(swigfaissJNI.OPQMatrix_SWIGUpcast(cPtr), cMemoryOwn);
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(OPQMatrix obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_OPQMatrix(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
super.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setM(int value) {
|
||||||
|
swigfaissJNI.OPQMatrix_M_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getM() {
|
||||||
|
return swigfaissJNI.OPQMatrix_M_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNiter(int value) {
|
||||||
|
swigfaissJNI.OPQMatrix_niter_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getNiter() {
|
||||||
|
return swigfaissJNI.OPQMatrix_niter_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNiter_pq(int value) {
|
||||||
|
swigfaissJNI.OPQMatrix_niter_pq_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getNiter_pq() {
|
||||||
|
return swigfaissJNI.OPQMatrix_niter_pq_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNiter_pq_0(int value) {
|
||||||
|
swigfaissJNI.OPQMatrix_niter_pq_0_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getNiter_pq_0() {
|
||||||
|
return swigfaissJNI.OPQMatrix_niter_pq_0_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMax_train_points(long value) {
|
||||||
|
swigfaissJNI.OPQMatrix_max_train_points_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getMax_train_points() {
|
||||||
|
return swigfaissJNI.OPQMatrix_max_train_points_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVerbose(boolean value) {
|
||||||
|
swigfaissJNI.OPQMatrix_verbose_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getVerbose() {
|
||||||
|
return swigfaissJNI.OPQMatrix_verbose_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPq(ProductQuantizer value) {
|
||||||
|
swigfaissJNI.OPQMatrix_pq_set(swigCPtr, this, ProductQuantizer.getCPtr(value), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProductQuantizer getPq() {
|
||||||
|
long cPtr = swigfaissJNI.OPQMatrix_pq_get(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new ProductQuantizer(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public OPQMatrix(int d, int M, int d2) {
|
||||||
|
this(swigfaissJNI.new_OPQMatrix__SWIG_0(d, M, d2), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public OPQMatrix(int d, int M) {
|
||||||
|
this(swigfaissJNI.new_OPQMatrix__SWIG_1(d, M), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public OPQMatrix(int d) {
|
||||||
|
this(swigfaissJNI.new_OPQMatrix__SWIG_2(d), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public OPQMatrix() {
|
||||||
|
this(swigfaissJNI.new_OPQMatrix__SWIG_3(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void train(long n, SWIGTYPE_p_float x) {
|
||||||
|
swigfaissJNI.OPQMatrix_train(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,251 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
|
* Version 4.0.2
|
||||||
|
*
|
||||||
|
* Do not make changes to this file unless you know what you are doing--modify
|
||||||
|
* the SWIG interface file instead.
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
package com.twitter.ann.faiss;
|
||||||
|
|
||||||
|
public class OnDiskInvertedLists extends InvertedLists {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
|
||||||
|
protected OnDiskInvertedLists(long cPtr, boolean cMemoryOwn) {
|
||||||
|
super(swigfaissJNI.OnDiskInvertedLists_SWIGUpcast(cPtr), cMemoryOwn);
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(OnDiskInvertedLists obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_OnDiskInvertedLists(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
super.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLists(SWIGTYPE_p_std__vectorT_faiss__OnDiskOneList_t value) {
|
||||||
|
swigfaissJNI.OnDiskInvertedLists_lists_set(swigCPtr, this, SWIGTYPE_p_std__vectorT_faiss__OnDiskOneList_t.getCPtr(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
public SWIGTYPE_p_std__vectorT_faiss__OnDiskOneList_t getLists() {
|
||||||
|
long cPtr = swigfaissJNI.OnDiskInvertedLists_lists_get(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new SWIGTYPE_p_std__vectorT_faiss__OnDiskOneList_t(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
static public class Slot {
|
||||||
|
private transient long swigCPtr;
|
||||||
|
protected transient boolean swigCMemOwn;
|
||||||
|
|
||||||
|
protected Slot(long cPtr, boolean cMemoryOwn) {
|
||||||
|
swigCMemOwn = cMemoryOwn;
|
||||||
|
swigCPtr = cPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static long getCPtr(Slot obj) {
|
||||||
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected void finalize() {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void delete() {
|
||||||
|
if (swigCPtr != 0) {
|
||||||
|
if (swigCMemOwn) {
|
||||||
|
swigCMemOwn = false;
|
||||||
|
swigfaissJNI.delete_OnDiskInvertedLists_Slot(swigCPtr);
|
||||||
|
}
|
||||||
|
swigCPtr = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOffset(long value) {
|
||||||
|
swigfaissJNI.OnDiskInvertedLists_Slot_offset_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getOffset() {
|
||||||
|
return swigfaissJNI.OnDiskInvertedLists_Slot_offset_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCapacity(long value) {
|
||||||
|
swigfaissJNI.OnDiskInvertedLists_Slot_capacity_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getCapacity() {
|
||||||
|
return swigfaissJNI.OnDiskInvertedLists_Slot_capacity_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Slot(long offset, long capacity) {
|
||||||
|
this(swigfaissJNI.new_OnDiskInvertedLists_Slot__SWIG_0(offset, capacity), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Slot() {
|
||||||
|
this(swigfaissJNI.new_OnDiskInvertedLists_Slot__SWIG_1(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSlots(SWIGTYPE_p_std__listT_faiss__OnDiskInvertedLists__Slot_t value) {
|
||||||
|
swigfaissJNI.OnDiskInvertedLists_slots_set(swigCPtr, this, SWIGTYPE_p_std__listT_faiss__OnDiskInvertedLists__Slot_t.getCPtr(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
public SWIGTYPE_p_std__listT_faiss__OnDiskInvertedLists__Slot_t getSlots() {
|
||||||
|
long cPtr = swigfaissJNI.OnDiskInvertedLists_slots_get(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new SWIGTYPE_p_std__listT_faiss__OnDiskInvertedLists__Slot_t(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFilename(String value) {
|
||||||
|
swigfaissJNI.OnDiskInvertedLists_filename_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFilename() {
|
||||||
|
return swigfaissJNI.OnDiskInvertedLists_filename_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTotsize(long value) {
|
||||||
|
swigfaissJNI.OnDiskInvertedLists_totsize_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getTotsize() {
|
||||||
|
return swigfaissJNI.OnDiskInvertedLists_totsize_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPtr(SWIGTYPE_p_unsigned_char value) {
|
||||||
|
swigfaissJNI.OnDiskInvertedLists_ptr_set(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
public SWIGTYPE_p_unsigned_char getPtr() {
|
||||||
|
long cPtr = swigfaissJNI.OnDiskInvertedLists_ptr_get(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRead_only(boolean value) {
|
||||||
|
swigfaissJNI.OnDiskInvertedLists_read_only_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getRead_only() {
|
||||||
|
return swigfaissJNI.OnDiskInvertedLists_read_only_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public OnDiskInvertedLists(long nlist, long code_size, String filename) {
|
||||||
|
this(swigfaissJNI.new_OnDiskInvertedLists__SWIG_0(nlist, code_size, filename), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long list_size(long list_no) {
|
||||||
|
return swigfaissJNI.OnDiskInvertedLists_list_size(swigCPtr, this, list_no);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SWIGTYPE_p_unsigned_char get_codes(long list_no) {
|
||||||
|
long cPtr = swigfaissJNI.OnDiskInvertedLists_get_codes(swigCPtr, this, list_no);
|
||||||
|
return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public LongVector get_ids(long list_no) {
|
||||||
|
return new LongVector(swigfaissJNI.OnDiskInvertedLists_get_ids(swigCPtr, this, list_no), false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long add_entries(long list_no, long n_entry, LongVector ids, SWIGTYPE_p_unsigned_char code) {
|
||||||
|
return swigfaissJNI.OnDiskInvertedLists_add_entries(swigCPtr, this, list_no, n_entry, SWIGTYPE_p_long_long.getCPtr(ids.data()), ids, SWIGTYPE_p_unsigned_char.getCPtr(code));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void update_entries(long list_no, long offset, long n_entry, LongVector ids, SWIGTYPE_p_unsigned_char code) {
|
||||||
|
swigfaissJNI.OnDiskInvertedLists_update_entries(swigCPtr, this, list_no, offset, n_entry, SWIGTYPE_p_long_long.getCPtr(ids.data()), ids, SWIGTYPE_p_unsigned_char.getCPtr(code));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void resize(long list_no, long new_size) {
|
||||||
|
swigfaissJNI.OnDiskInvertedLists_resize(swigCPtr, this, list_no, new_size);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long merge_from(SWIGTYPE_p_p_faiss__InvertedLists ils, int n_il, boolean verbose) {
|
||||||
|
return swigfaissJNI.OnDiskInvertedLists_merge_from__SWIG_0(swigCPtr, this, SWIGTYPE_p_p_faiss__InvertedLists.getCPtr(ils), n_il, verbose);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long merge_from(SWIGTYPE_p_p_faiss__InvertedLists ils, int n_il) {
|
||||||
|
return swigfaissJNI.OnDiskInvertedLists_merge_from__SWIG_1(swigCPtr, this, SWIGTYPE_p_p_faiss__InvertedLists.getCPtr(ils), n_il);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long merge_from_1(InvertedLists il, boolean verbose) {
|
||||||
|
return swigfaissJNI.OnDiskInvertedLists_merge_from_1__SWIG_0(swigCPtr, this, InvertedLists.getCPtr(il), il, verbose);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long merge_from_1(InvertedLists il) {
|
||||||
|
return swigfaissJNI.OnDiskInvertedLists_merge_from_1__SWIG_1(swigCPtr, this, InvertedLists.getCPtr(il), il);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void crop_invlists(long l0, long l1) {
|
||||||
|
swigfaissJNI.OnDiskInvertedLists_crop_invlists(swigCPtr, this, l0, l1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void prefetch_lists(LongVector list_nos, int nlist) {
|
||||||
|
swigfaissJNI.OnDiskInvertedLists_prefetch_lists(swigCPtr, this, SWIGTYPE_p_long_long.getCPtr(list_nos.data()), list_nos, nlist);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLocks(SWIGTYPE_p_faiss__LockLevels value) {
|
||||||
|
swigfaissJNI.OnDiskInvertedLists_locks_set(swigCPtr, this, SWIGTYPE_p_faiss__LockLevels.getCPtr(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
public SWIGTYPE_p_faiss__LockLevels getLocks() {
|
||||||
|
long cPtr = swigfaissJNI.OnDiskInvertedLists_locks_get(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new SWIGTYPE_p_faiss__LockLevels(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPf(SWIGTYPE_p_faiss__OnDiskInvertedLists__OngoingPrefetch value) {
|
||||||
|
swigfaissJNI.OnDiskInvertedLists_pf_set(swigCPtr, this, SWIGTYPE_p_faiss__OnDiskInvertedLists__OngoingPrefetch.getCPtr(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
public SWIGTYPE_p_faiss__OnDiskInvertedLists__OngoingPrefetch getPf() {
|
||||||
|
long cPtr = swigfaissJNI.OnDiskInvertedLists_pf_get(swigCPtr, this);
|
||||||
|
return (cPtr == 0) ? null : new SWIGTYPE_p_faiss__OnDiskInvertedLists__OngoingPrefetch(cPtr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPrefetch_nthread(int value) {
|
||||||
|
swigfaissJNI.OnDiskInvertedLists_prefetch_nthread_set(swigCPtr, this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPrefetch_nthread() {
|
||||||
|
return swigfaissJNI.OnDiskInvertedLists_prefetch_nthread_get(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void do_mmap() {
|
||||||
|
swigfaissJNI.OnDiskInvertedLists_do_mmap(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void update_totsize(long new_totsize) {
|
||||||
|
swigfaissJNI.OnDiskInvertedLists_update_totsize(swigCPtr, this, new_totsize);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void resize_locked(long list_no, long new_size) {
|
||||||
|
swigfaissJNI.OnDiskInvertedLists_resize_locked(swigCPtr, this, list_no, new_size);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long allocate_slot(long capacity) {
|
||||||
|
return swigfaissJNI.OnDiskInvertedLists_allocate_slot(swigCPtr, this, capacity);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void free_slot(long offset, long capacity) {
|
||||||
|
swigfaissJNI.OnDiskInvertedLists_free_slot(swigCPtr, this, offset, capacity);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void set_all_lists_sizes(SWIGTYPE_p_unsigned_long sizes) {
|
||||||
|
swigfaissJNI.OnDiskInvertedLists_set_all_lists_sizes(swigCPtr, this, SWIGTYPE_p_unsigned_long.getCPtr(sizes));
|
||||||
|
}
|
||||||
|
|
||||||
|
public OnDiskInvertedLists() {
|
||||||
|
this(swigfaissJNI.new_OnDiskInvertedLists__SWIG_1(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue