Save the prebuilt index to disk, to be reloaded with load_prebuilt_raw() and friends.
It is expected that load_prebuilt_raw() should create an object that is "equivalent" to the object that was saved with save(). That is, any neighbor search results should be the same across the original and reloaded object. It is also expected that the relevant template parameters used in load_prebuilt_raw() should be the same as those in the original Prebuilt object.
An implementation of this method should create a <prefix>ALGORITHM file that contains the search algorithm's name. This should be an ASCII file with no newlines, where the algorithm name should follow the <library>::<algorithm> format, e.g., knncolle::Vptree. This will be used by load_prebuilt_raw() to determine the exact loader function to call. Other than the ALGORITHM file, each implementation may create any number of additional files of any format, as long as they start with prefix.
An implementation of this method is not required to use portable file formats. load_prebuilt_raw() is only expected to work on the same system (i.e., architecture, compiler, compilation settings) that was used for the save() call. Any additional portability is at the discretion of the implementation, e.g., it is common to assume IEEE floating-point and two's-complement integers.
An implementation of this method is not required to create files that are readable by different versions of the implementation. Thus, the files created by this method are generally unsuitable for archival storage. However, implementations are recommended to at least provide enough information to throw an exception if an incompatible version of load_prebuilt_raw() is used.
If a subclass does not implement this method, an error is thrown by default.
- Parameters
-
| prefix | Prefix of the file path(s) in which to save the index. All files created by this method should start with this prefix. Any directories required to write a file starting with prefix should already have been created. |