Example: Mathematical functions

/*
 * Expression Template Matrix Library
 *
 * Copyright (C) 2004 - 2004 Ricky Lung <mtlung@users.sourceforge.net>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 */

/*
 *  Demonstrate the use of available global functions
 */

#include <iostream>
#include "../include/exmat.h"

using namespace std;
using namespace exmat;

// Define some vector and matrix types

// A row vector of static size 3, with float as the element type
typedef Vec<DenseColVecCon<float, 3> > Vec3f;

int main()
{
    // dot product
    Vec3f v1("1 2 3"), v2("4 5 6");
    cout << "dot(v1, v2) = " << dot(v1, v2) << endl;

    // Vector squared norm ( |v|^2 )
    cout << "norm2(v1) = " << norm2(v1) << endl;

    // Vector norm ( |v| )
    cout << "norm(v1) = " << norm(v1) << endl;

    return 0;
}

Generated on Sat May 6 23:12:04 2006 for Exmat by  doxygen 1.4.6-NO