| 1 | /* |
| 2 | * MultiDimensionalScalingCore.java |
| 3 | * |
| 4 | * Copyright (c) 2002-2015 Alexei Drummond, Andrew Rambaut and Marc Suchard |
| 5 | * |
| 6 | * This file is part of BEAST. |
| 7 | * See the NOTICE file distributed with this work for additional |
| 8 | * information regarding copyright ownership and licensing. |
| 9 | * |
| 10 | * BEAST is free software; you can redistribute it and/or modify |
| 11 | * it under the terms of the GNU Lesser General Public License as |
| 12 | * published by the Free Software Foundation; either version 2 |
| 13 | * of the License, or (at your option) any later version. |
| 14 | * |
| 15 | * BEAST is distributed in the hope that it will be useful, |
| 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 18 | * GNU Lesser General Public License for more details. |
| 19 | * |
| 20 | * You should have received a copy of the GNU Lesser General Public |
| 21 | * License along with BEAST; if not, write to the |
| 22 | * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, |
| 23 | * Boston, MA 02110-1301 USA |
| 24 | */ |
| 25 | |
| 26 | package dr.inference.multidimensionalscaling; |
| 27 | |
| 28 | /** |
| 29 | * MultiDimensionalScalingCore - An interface describing the core likelihood functions. |
| 30 | * |
| 31 | * @author Andrew Rambaut |
| 32 | * @author Marc Suchard |
| 33 | * @version $Id$ |
| 34 | */ |
| 35 | |
| 36 | public interface MultiDimensionalScalingCore { |
| 37 | |
| 38 | @SuppressWarnings("all") |
| 39 | long USE_NATIVE_MDS = 1 << 0; // 1 |
| 40 | // 2 |
| 41 | @SuppressWarnings("unused") |
| 42 | long SINGLE_PRECISION = 1 << 2; // 4 |
| 43 | @SuppressWarnings("unused") |
| 44 | long MULTI_CORE = 1 << 3; // 8 |
| 45 | @SuppressWarnings("unused") |
| 46 | long OPENCL_VECTORIZATION = 1 << 4; // 16 |
| 47 | long LEFT_TRUNCATION = 1 << 5; // 32 |
| 48 | |
| 49 | /** |
| 50 | * initializes arrays. |
| 51 | */ |
| 52 | void initialize(int embeddingDimension, int locationCount, long flags); |
| 53 | |
| 54 | /** |
| 55 | * sets the observation data |
| 56 | */ |
| 57 | void setPairwiseData(double[] observations); |
| 58 | |
| 59 | /** |
| 60 | * |
| 61 | */ |
| 62 | void setParameters(double[] parameters); |
| 63 | |
| 64 | /** |
| 65 | * Updates the location of a single entity |
| 66 | */ |
| 67 | void updateLocation(int locationIndex, double[] location); |
| 68 | |
| 69 | /** |
| 70 | * Calculates the log likelihood of the data given the current locations. |
| 71 | */ |
| 72 | double calculateLogLikelihood(); |
| 73 | |
| 74 | /** |
| 75 | * Store current state |
| 76 | */ |
| 77 | void storeState(); |
| 78 | |
| 79 | /** |
| 80 | * Restore the stored state |
| 81 | */ |
| 82 | void restoreState(); |
| 83 | |
| 84 | /** |
| 85 | * Set all recalculate flags |
| 86 | */ |
| 87 | void makeDirty(); |
| 88 | |
| 89 | /** |
| 90 | * Accept the proposed state |
| 91 | */ |
| 92 | void acceptState(); |
| 93 | |
| 94 | /** |
| 95 | * Get gradient of MDS likelihood w.r.t. locations |
| 96 | */ |
| 97 | void getGradient(double[] location); |
| 98 | |
| 99 | /** |
| 100 | * Get pair-wise data |
| 101 | */ |
| 102 | @SuppressWarnings("unused") |
| 103 | double[] getPairwiseData(); |
| 104 | } |