text: /*
   *  Copyright 2002-2015 Barcelona Supercomputing Center (www.bsc.es)
   *
   *  Licensed under the Apache License, Version 2.0 (the "License");
   *  you may not use this file except in compliance with the License.
   *  You may obtain a copy of the License at
   *
   *      http://www.apache.org/licenses/LICENSE-2.0
   *
   *  Unless required by applicable law or agreed to in writing, software
   *  distributed under the License is distributed on an "AS IS" BASIS,
   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   *  See the License for the specific language governing permissions and
   *  limitations under the License.
   */
  
  #ifndef BLOCK_H
  #define BLOCK_H
  
  #include <vector>
  #include <boost/archive/text_iarchive.hpp>
  #include <boost/archive/text_oarchive.hpp>
  #include <boost/serialization/serialization.hpp>
  #include <boost/serialization/access.hpp>
  #include <boost/serialization/vector.hpp>
  
  using namespace std;
  using namespace boost;
  using namespace serialization;
  
  #define MAX 10
  
  class Block {
  
  public:
  	Block(){};
  
  	Block(int bSize);
  
  	void init(int bSize, double initVal);
  	
  	static Block create( int bSize, double initVal);
  
  	static void generate(Block *b, int bSize, double initVal);
  	
  	static void test1(int size, float *oa, int* ia, double* ioa, char* file);
  	
  	void test3 (int size, float* ia );
  
  	void multiply(Block *block1, Block *block2);
  
  	void print();
  
  	void result();
  
  	std::vector< std::vector< double > > data;
  
  private:
  	int M;
  
  	friend class::serialization::access;
  	template<class Archive>
  	void serialize(Archive & ar, const unsigned int version) {
  		ar & M;
  		if (Archive::is_loading::value){
  			data.clear();
  		}
  		ar & data;
  	}
  };
  
  #endif
  