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 021import java.io.Serializable; 022 023/** 024 * An interface for Linear Alebra Vectors. 025 */ 026public interface Vector extends ImmutableVector, Serializable { 027 028 /** 029 * Set dimension i of the Vector to value v. 030 * 031 * @param i the index 032 * @param v value 033 */ 034 void set(final int i, final double v); 035 036 /** 037 * Adds the Vector that to this one in place: this += that. 038 * 039 * @param that 040 */ 041 void add(final Vector that); 042 043 /** 044 * this += factor * that. 045 * 046 * @param factor 047 * @param that 048 */ 049 void multAdd(final double factor, final ImmutableVector that); 050 051 /** 052 * Scales this Vector: this *= factor. 053 * 054 * @param factor the scaling factor. 055 */ 056 void scale(final double factor); 057 058 059 /** 060 * Normalizes the Vector according to the L2 norm. 061 */ 062 void normalize(); 063 064 /** 065 * Create a new instance of the current type. 066 * with elements being zero 067 * 068 * @return zero vector of current dimensionality 069 */ 070 Vector newInstance(); 071 072}