⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 memoryresidentmatrix.java

📁 用java写的DTW程序组合
💻 JAVA
字号:
// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi 
// Source File Name:   MemoryResidentMatrix.java

package dtw;


// Referenced classes of package dtw:
//            CostMatrix, SearchWindow

class MemoryResidentMatrix
    implements CostMatrix
{

    private static final double OUT_OF_WINDOW_VALUE = (1.0D / 0.0D);
    private final SearchWindow window;
    private double cellValues[];
    private int colOffsets[];

    MemoryResidentMatrix(SearchWindow searchWindow)
    {
        window = searchWindow;
        cellValues = new double[window.size()];
        colOffsets = new int[window.maxI() + 1];
        int currentOffset = 0;
        for(int i = window.minI(); i <= window.maxI(); i++)
        {
            colOffsets[i] = currentOffset;
            currentOffset += (window.maxJforI(i) - window.minJforI(i)) + 1;
        }

    }

    public void put(int col, int row, double value)
    {
        if(row < window.minJforI(col) || row > window.maxJforI(col))
        {
            throw new InternalError("CostMatrix is filled in a cell (col=" + col + ", row=" + row + ") that is not in the " + "search window");
        } else
        {
            cellValues[(colOffsets[col] + row) - window.minJforI(col)] = value;
            return;
        }
    }

    public double get(int col, int row)
    {
        if(row < window.minJforI(col) || row > window.maxJforI(col))
            return (1.0D / 0.0D);
        else
            return cellValues[(colOffsets[col] + row) - window.minJforI(col)];
    }

    public int size()
    {
        return cellValues.length;
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -