// Path: java_sentence_completion/src/sparse/Pair.java
// public class Pair<A, B> implements Entry<A, B> {
// 	public final A first;
// 	public final B second;
// 
// 	public Pair(A first, B second) {
// 		this.first = first;
// 		this.second = second;
// 	}
// 
// 	public int hashCode() {
// 		int hashFirst = first != null ? first.hashCode() : 0;
// 		int hashSecond = second != null ? second.hashCode() : 0;
// 
// 		return (hashFirst + hashSecond) * hashSecond + hashFirst;
// 	}
// 
// 	public boolean equals(Object other) {
// 		if (other instanceof Pair<?, ?>) {
// 			Pair<?, ?> otherPair = (Pair<?, ?>) other;
// 			return ((this.first == otherPair.first || (this.first != null
// 					&& otherPair.first != null && this.first
// 						.equals(otherPair.first))) && (this.second == otherPair.second || (this.second != null
// 					&& otherPair.second != null && this.second
// 						.equals(otherPair.second))));
// 		}
// 
// 		return false;
// 	}
// 
// 	public String toString() {
// 		return "(" + first + ", " + second + ")";
// 	}
// 
// 	@Override
// 	public A getKey() {
// 		return first;
// 	}
// 
// 	@Override
// 	public B getValue() {
// 		return second;
// 	}
// 
// 	/**
// 	 * Immutable
// 	 * 
// 	 * @throws UnsupportedOperationException
// 	 *             always
// 	 */
// 	@Override
// 	public B setValue(B value) throws UnsupportedOperationException {
// 		throw new UnsupportedOperationException("Immutable");
// 	}
// 
// }


import java.util.Map.Entry;
import java.util.Set;
import sparse.Pair;
	 *            column number
	 * @throws IndexOutOfBoundsException
	 *             if l or c is not in the matrix bounds
	 */
	protected void check_bounds(int l, int c) throws IndexOutOfBoundsException {
		// bounds
		if (l >= nlines || c >= ncols) {
			throw new IndexOutOfBoundsException(l + " >= " + nlines + " or "
					+ c + " >= " + ncols);
		}
		if (l < 0 || c < 0) {
			throw new IndexOutOfBoundsException("l (" + l + ") < 0 or c (" + c
					+ ") <0");
		}
	}

	/**
	 * Multiplies the matrix by the given vector
	 * 
	 * @param vec
	 *            non-null
	 * @return the result in a new vector
	 */
	public abstract DOK1Dfloat multiply(DOK1Dfloat vec);

	/**
	 * returns a set of the non-zero elements
	 * 
	 * @return the non-zero elements
	 */
// Path: java_sentence_completion/src/sparse/Pair.java
// public class Pair<A, B> implements Entry<A, B> {
// 	public final A first;
// 	public final B second;
// 
// 	public Pair(A first, B second) {
// 		this.first = first;
// 		this.second = second;
// 	}
// 
// 	public int hashCode() {
// 		int hashFirst = first != null ? first.hashCode() : 0;
// 		int hashSecond = second != null ? second.hashCode() : 0;
// 
// 		return (hashFirst + hashSecond) * hashSecond + hashFirst;
// 	}
// 
// 	public boolean equals(Object other) {
// 		if (other instanceof Pair<?, ?>) {
// 			Pair<?, ?> otherPair = (Pair<?, ?>) other;
// 			return ((this.first == otherPair.first || (this.first != null
// 					&& otherPair.first != null && this.first
// 						.equals(otherPair.first))) && (this.second == otherPair.second || (this.second != null
// 					&& otherPair.second != null && this.second
// 						.equals(otherPair.second))));
// 		}
// 
// 		return false;
// 	}
// 
// 	public String toString() {
// 		return "(" + first + ", " + second + ")";
// 	}
// 
// 	@Override
// 	public A getKey() {
// 		return first;
// 	}
// 
// 	@Override
// 	public B getValue() {
// 		return second;
// 	}
// 
// 	/**
// 	 * Immutable
// 	 * 
// 	 * @throws UnsupportedOperationException
// 	 *             always
// 	 */
// 	@Override
// 	public B setValue(B value) throws UnsupportedOperationException {
// 		throw new UnsupportedOperationException("Immutable");
// 	}
// 
// }


// Path: java_sentence_completion/src/sparse/float_/Matrix2Dfloat.java
import java.util.Map.Entry;
import java.util.Set;
import sparse.Pair;

	 *            column number
	 * @throws IndexOutOfBoundsException
	 *             if l or c is not in the matrix bounds
	 */
	protected void check_bounds(int l, int c) throws IndexOutOfBoundsException {
		// bounds
		if (l >= nlines || c >= ncols) {
			throw new IndexOutOfBoundsException(l + " >= " + nlines + " or "
					+ c + " >= " + ncols);
		}
		if (l < 0 || c < 0) {
			throw new IndexOutOfBoundsException("l (" + l + ") < 0 or c (" + c
					+ ") <0");
		}
	}

	/**
	 * Multiplies the matrix by the given vector
	 * 
	 * @param vec
	 *            non-null
	 * @return the result in a new vector
	 */
	public abstract DOK1Dfloat multiply(DOK1Dfloat vec);

	/**
	 * returns a set of the non-zero elements
	 * 
	 * @return the non-zero elements
	 */
	public abstract Set<Entry<Pair<Integer, Integer>, Float>> nz_elements();