001/* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, 013 * software distributed under the License is distributed on an 014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 015 * KIND, either express or implied. See the License for the 016 * specific language governing permissions and limitations 017 * under the License. 018 */ 019package org.apache.reef.examples.group.utils.math; 020 021 022import org.apache.reef.io.Tuple; 023 024/** 025 * Represents an immutable vector. 026 */ 027public interface ImmutableVector { 028 /** 029 * Access the value of the Vector at dimension i. 030 * 031 * @param i index 032 * @return the value at index i 033 */ 034 double get(int i); 035 036 /** 037 * The size (dimensionality) of the Vector. 038 * 039 * @return the size of the Vector. 040 */ 041 int size(); 042 043 /** 044 * Computes the inner product with another Vector. 045 * 046 * @param that 047 * @return the inner product between two Vectors. 048 */ 049 double dot(Vector that); 050 051 /** 052 * Computes the computeSum of all entries in the Vector. 053 * 054 * @return the computeSum of all entries in this Vector 055 */ 056 double sum(); 057 058 /** 059 * Computes the L2 norm of this Vector. 060 * 061 * @return the L2 norm of this Vector. 062 */ 063 double norm2(); 064 065 /** 066 * Computes the square of the L2 norm of this Vector. 067 * 068 * @return the square of the L2 norm of this Vector. 069 */ 070 double norm2Sqr(); 071 072 /** 073 * Computes the min of all entries in the Vector. 074 * 075 * @return the min of all entries in this Vector 076 */ 077 Tuple<Integer, Double> min(); 078}