@Override public <T extends Matrix64F> T copy() { return (T)new FixedMatrix2_64F(this); }
@Override public double get(int row, int col) { return unsafe_get(row,col); }
@Override public void set(int row, int col, double val) { unsafe_set(row,col,val); }
@Override public <T extends Matrix64F> T copy() { return (T)new FixedMatrix2_64F(this); }
@Override public void set(int row, int col, double val) { unsafe_set(row,col,val); }
@Override public double get(int row, int col) { return unsafe_get(row,col); }
/** * Extracts the row from the matrix a. * @param a Input matrix * @param row Which row is to be extracted * @param out output. Storage for the extracted row. If null then a new vector will be returned. * @return The extracted row. */ public static FixedMatrix2_64F extractRow( FixedMatrix2x2_64F a , int row , FixedMatrix2_64F out ) { if( out == null) out = new FixedMatrix2_64F(); switch( row ) { case 0: out.a1 = a.a11; out.a2 = a.a12; break; case 1: out.a1 = a.a21; out.a2 = a.a22; break; default: throw new IllegalArgumentException("Out of bounds row. row = "+row); } return out; }
/** * Extracts the column from the matrix a. * @param a Input matrix * @param column Which column is to be extracted * @param out output. Storage for the extracted column. If null then a new vector will be returned. * @return The extracted column. */ public static FixedMatrix2_64F extractColumn( FixedMatrix2x2_64F a , int column , FixedMatrix2_64F out ) { if( out == null) out = new FixedMatrix2_64F(); switch( column ) { case 0: out.a1 = a.a11; out.a2 = a.a21; break; case 1: out.a1 = a.a12; out.a2 = a.a22; break; default: throw new IllegalArgumentException("Out of bounds column. column = "+column); } return out; }
/** * Converts {@link DenseMatrix64F} into {@link FixedMatrix2_64F} * * @param input Input matrix. * @param output Output matrix. If null a new matrix will be declared. * @return Converted matrix. */ public static FixedMatrix2_64F convert( DenseMatrix64F input , FixedMatrix2_64F output ) { if( output == null) output = new FixedMatrix2_64F(); if( input.getNumRows() != 1 && input.getNumCols() != 1 ) throw new IllegalArgumentException("One row or column must have a length of 1 for it to be a vector"); int length = Math.max(input.getNumRows(),input.getNumCols()); if( length != 2 ) throw new IllegalArgumentException("Length of input vector is not 2. It is "+length); output.a1 = input.data[0]; output.a2 = input.data[1]; return output; }
/** * Converts {@link DenseMatrix64F} into {@link FixedMatrix2_64F} * * @param input Input matrix. * @param output Output matrix. If null a new matrix will be declared. * @return Converted matrix. */ public static FixedMatrix2_64F convert( DenseMatrix64F input , FixedMatrix2_64F output ) { if( output == null) output = new FixedMatrix2_64F(); if( input.getNumRows() != 1 && input.getNumCols() != 1 ) throw new IllegalArgumentException("One row or column must have a length of 1 for it to be a vector"); int length = Math.max(input.getNumRows(),input.getNumCols()); if( length != 2 ) throw new IllegalArgumentException("Length of input vector is not 2. It is "+length); output.a1 = input.data[0]; output.a2 = input.data[1]; return output; }